diff --git a/lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/README.md b/lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/README.md index 4b402dc14a7e..0e04cc9df986 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/README.md @@ -55,11 +55,11 @@ The function has the following parameters: - **N**: number of indexed elements. - **x**: input [`Float32Array`][@stdlib/array/float32]. -- **strideX**: index increment for `x`. +- **strideX**: stride length for `x`. - **out**: output [`Float64Array`][@stdlib/array/float64] whose first element is the sum and whose second element is the number of non-NaN elements. -- **strideOut**: index increment for `out`. +- **strideOut**: stride length for `out`. -The `N` and stride parameters determine which elements are accessed at runtime. For example, to compute the sum of every other element in `x`, +The `N` and stride parameters determine which elements are accessed at runtime. For example, to compute the sum of every other element: ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -92,7 +92,7 @@ var v = dsnannsumors( 4, x1, 2, out1, 1 ); #### dsnannsumors.ndarray( N, x, strideX, offsetX, out, strideOut, offsetOut ) -Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics. +Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result. ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -110,7 +110,7 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetOut**: starting index for `out`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to calculate the sum of every other value in `x` starting from the second value +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the sum of every other element starting from the second element: ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -171,6 +171,132 @@ console.log( out ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/dsnannsumors.h" +``` + +#### stdlib_strided_dsnannsumors( N, \*X, strideX, \*n ) + +Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using ordinary recursive summation with extended accumulation, and returning an extended precision result. + +```c +const float x[] = { 1.0f, -2.0f, 0.0/0.0, 2.0f }; +CBLAS_INT n = 0; + +double v = stdlib_strided_dsnannsumors( 4, x, 1, &n ); +// returns 1.0 +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] float*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **n**: `[out] CBLAS_INT*` number of non-NaN elements. + +```c +double stdlib_strided_dsnannsumors( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, CBLAS_INT *n ); +``` + +#### stdlib_strided_dsnannsumors_ndarray( N, \*X, strideX, offsetX, \*n ) + +Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result. + +```c +const float x[] = { 1.0f, -2.0f, 0.0/0.0, 2.0f }; +CBLAS_INT n = 0; + +double v = stdlib_strided_dsnannsumors_ndarray( 4, x, 1, 0, &n ); +// returns 1.0 +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] float*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **n**: `[out] CBLAS_INT*` number of non-NaN elements. + +```c +double stdlib_strided_dsnannsumors_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/dsnannsumors.h" +#include "stdlib/blas/base/shared.h" +#include + +int main( void ) { + // Create a strided array: + const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 0.0/0.0, 0.0/0.0 }; + + // Specify the number of elements: + const int N = 5; + + // Specify the stride length: + const int strideX = 2; + + // Initialize a variable for storing the number of non-NaN elements: + CBLAS_INT n = 0; + + // Compute the sum: + double v = stdlib_strided_dsnannsumors( N, x, strideX, &n ); + + // Print the result: + printf( "sum: %lf\n", v ); + printf( "n: %"CBLAS_IFMT"\n", n ); +} +``` + +
+ + + +
+ + +