From 8f3624cacff63c52db0af6e43b8dcf0ed4d5fd69 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Apr 2024 20:41:30 +0000 Subject: [PATCH] Auto-generated commit --- base/ddot/README.md | 2 +- base/dnrm2/README.md | 95 +++++++++++++++++++ base/dnrm2/include/stdlib/blas/base/dnrm2.h | 4 +- .../include/stdlib/blas/base/dnrm2_cblas.h | 4 +- base/dnrm2/manifest.json | 76 ++++++++++++--- base/dnrm2/src/dnrm2.c | 13 ++- base/dnrm2/src/dnrm2_cblas.c | 3 +- base/dnrm2/src/dnrm2_f.c | 3 +- 8 files changed, 176 insertions(+), 24 deletions(-) diff --git a/base/ddot/README.md b/base/ddot/README.md index 38e6d267b..cd0c3c490 100644 --- a/base/ddot/README.md +++ b/base/ddot/README.md @@ -205,7 +205,7 @@ console.log( out ); #### c_ddot( N, X, strideX, Y, strideY ) -Computes the sum of absolute values. +Computes the dot product of two double-precision floating-point vectors. ```c const double x[] = { 4.0, 2.0, -3.0, 5.0, -1.0 }; diff --git a/base/dnrm2/README.md b/base/dnrm2/README.md index f2ef7a448..0080d2020 100644 --- a/base/dnrm2/README.md +++ b/base/dnrm2/README.md @@ -160,6 +160,101 @@ console.log( out ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/dnrm2.h" +``` + +#### c_dnrm2( N, X, stride ) + +Computes the L2-norm of a double-precision floating-point vector. + +```c +const double x[] = { 1.0, -2.0, 2.0 }; + +double v = c_dnrm2( 3, x, 1 ); +// returns 3.0 +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] double*` input array. +- **stride**: `[in] CBLAS_INT` index increment for `X`. + +```c +double c_dnrm2( const CBLAS_INT N, const double *X, const CBLAS_INT stride ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/base/dnrm2.h" +#include + +int main( void ) { + // Create a strided array: + const double x[] = { 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 a stride: + const int strideX = 1; + + // Compute the L2-norm: + double l2 = c_dnrm2( N, x, strideX ); + + // Print the result: + printf( "L2-norm: %lf\n", l2 ); +} +``` + +
+ + + +
+ + +