From f14cafa279a799e9e176bcb80b67765aeaeacd58 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Apr 2024 20:33:36 +0000 Subject: [PATCH] Auto-generated commit --- README.md | 100 ++++++++++++++++++++++++++ include/stdlib/blas/base/ddot.h | 4 +- include/stdlib/blas/base/ddot_cblas.h | 4 +- manifest.json | 58 +++++++++++---- package.json | 1 + src/ddot.c | 11 +-- src/ddot_cblas.c | 3 +- src/ddot_f.c | 3 +- 8 files changed, 162 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 71ded00..c70c190 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,106 @@ console.log( out ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/ddot.h" +``` + +#### c_ddot( N, X, strideX, Y, strideY ) + +Computes the sum of absolute values. + +```c +const double x[] = { 4.0, 2.0, -3.0, 5.0, -1.0 }; +const double y[] = { 2.0, 6.0, -1.0, -4.0, 8.0 }; + +double v = c_ddot( 5, x, 1, y, 1 ); +// returns -5.0 +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] double*` first input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **Y**: `[in] double*` second input array. +- **strideY**: `[in] CBLAS_INT` index increment for `Y`. + +```c +double c_ddot( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const double *Y, const CBLAS_INT strideY ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/ddot.h" +#include + +int main( void ) { + // Create strided arrays: + const double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 }; + const double y[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 }; + + // Specify the number of elements: + const int N = 8; + + // Specify strides: + const int strideX = 1; + const int strideY = -1; + + // Compute the dot product: + double d = c_ddot( N, x, strideX, y, strideY ); + + // Print the result: + printf( "dot product: %lf\n", d ); +} +``` + +
+ + + +
+ + +