diff --git a/lib/node_modules/@stdlib/blas/ext/base/dapx/README.md b/lib/node_modules/@stdlib/blas/ext/base/dapx/README.md index 1aadc282dbc..70e7012cabc 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dapx/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dapx/README.md @@ -30,9 +30,9 @@ limitations under the License. var dapx = require( '@stdlib/blas/ext/base/dapx' ); ``` -#### dapx( N, alpha, x, stride ) +#### dapx( N, alpha, x, strideX ) -Adds a constant `alpha` to each element in a double-precision floating-point strided array. +Adds a scalar constant `alpha` to each element in a double-precision floating-point strided array. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -48,9 +48,9 @@ The function has the following parameters: - **N**: number of indexed elements. - **alpha**: scalar constant. - **x**: input [`Float64Array`][@stdlib/array/float64]. -- **stride**: index increment. +- **strideX**: index increment. -The `N` and `stride` parameters determine which elements in the strided array are accessed at runtime. For example, to add a constant to every other element +The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to add a constant to every other element ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -77,9 +77,9 @@ dapx( 3, 5.0, x1, 2 ); // x0 => [ 1.0, 3.0, 3.0, 1.0, 5.0, -1.0 ] ``` -#### dapx.ndarray( N, alpha, x, stride, offset ) +#### dapx.ndarray( N, alpha, x, strideX, offsetX ) -Adds a constant `alpha` to each element in a double-precision floating-point strided array using alternative indexing semantics. +Adds a scalar constant `alpha` to each element in a double-precision floating-point strided array using alternative indexing semantics. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -92,9 +92,9 @@ dapx.ndarray( x.length, 5.0, x, 1, 0 ); The function has the following additional parameters: -- **offset**: starting index. +- **offsetX**: starting index. -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 access only the last three elements of the strided array +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 access only the last three elements of the strided array ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -126,11 +126,12 @@ dapx.ndarray( 3, 5.0, x, 1, x.length-3 ); ```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; -var filledarrayBy = require( '@stdlib/array/filled-by' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var dapx = require( '@stdlib/blas/ext/base/dapx' ); -var x = filledarrayBy( 10, 'float64', discreteUniform( -100, 100 ) ); +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'float64' +}); console.log( x ); dapx( x.length, 5.0, x, 1 ); @@ -141,6 +142,126 @@ console.log( x ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/dapx.h" +``` + +#### c_dapx( N, alpha, \*X, strideX ) + +Adds a scalar constant `alpha` to each element in a double-precision floating-point strided array. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; + +c_dapx( 4, 5.0, x, 1 ); + +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] double` scalar constant. +- **X**: `[inout] double*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. + +```c +void c_dapx( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX ); +``` + +#### c_dapx_ndarray( N, alpha, \*X, strideX, offsetX ) + +Adds a scalar constant `alpha` to each element in a double-precision floating-point strided array `X` using alternative indexing semantics. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; + +c_dapx_ndarray( 4, 5.0, x, 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] double` scalar constant. +- **X**: `[inout] double*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. + +```c +void c_dapx_ndarray( const CBLAS_INT N, const double alpha, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/dapx.h" +#include + +int main( void ) { + // Create a strided array: + double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 }; + + // Specify the number of indexed elements: + const int N = 8; + + // Specify a stride: + const int strideX = 1; + + // Fill the array: + c_dapx( N, 5.0, x, strideX ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + } +} +``` + +
+ + + +
+ + +