diff --git a/lib/node_modules/@stdlib/blas/ext/base/cfill/README.md b/lib/node_modules/@stdlib/blas/ext/base/cfill/README.md index 374964e5d8c..32e80153b36 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/README.md @@ -30,7 +30,7 @@ limitations under the License. var cfill = require( '@stdlib/blas/ext/base/cfill' ); ``` -#### cfill( N, alpha, x, stride ) +#### cfill( N, alpha, x, strideX ) Fills a single-precision complex floating-point strided array `x` with a specified scalar constant `alpha`. @@ -63,7 +63,7 @@ The function has the following parameters: - **N**: number of indexed elements. - **alpha**: scalar constant. - **x**: input [`Complex64Array`][@stdlib/array/complex64]. -- **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 fill every other element @@ -143,7 +143,7 @@ im = imagf( y ); // returns 10.0 ``` -#### cfill.ndarray( N, alpha, x, stride, offset ) +#### cfill.ndarray( N, alpha, x, strideX, offsetX ) Fills a single-precision complex floating-point strided array `x` with a specified scalar constant `alpha` using alternative indexing semantics. @@ -173,9 +173,9 @@ var im = imagf( y ); 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 two 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 two elements of the strided array ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -240,16 +240,15 @@ im = imagf( y ); ```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var filledarrayBy = require( '@stdlib/array/filled-by' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Complex64Array = require( '@stdlib/array/complex64' ); var Complex64 = require( '@stdlib/complex/float32/ctor' ); var cfill = require( '@stdlib/blas/ext/base/cfill' ); -function rand() { - return new Complex64( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); -} - -var x = filledarrayBy( 10, 'complex64', rand ); +var xbuf = discreteUniform( 20, -100, 100, { + 'dtype': 'float32' +}); +var x = new Complex64Array( xbuf.buffer ); var alpha = new Complex64( 10.0, 10.0 ); cfill( x.length, alpha, x, 1 ); @@ -260,6 +259,131 @@ console.log( x.get( 0 ).toString() ); + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/cfill.h" +``` + +#### c_cfill( N, alpha, \*X, strideX ) + +Fills a single-precision floating-point strided array `X` with a specified scalar constant `alpha`. + +```c +float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; +const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f ); + +c_cfill( 2, alpha, (stdlib_complex64_t *)x, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] stdlib_complex64_t` scalar constant. +- **X**: `[out] stdlib_complex64_t*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. + +```c +void c_cfill( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX ); +``` + +#### c_cfill_ndarray( N, alpha, \*X, strideX, offsetX ) + +Fills a single-precision complex floating-point strided array `X` with a specified scalar constant `alpha` using alternative indexing semantics. + +```c +float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; +const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f ); + +c_cfill_ndarray( 4, alpha, (stdlib_complex64_t *x), 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] stlib_complex64_t` scalar constant. +- **X**: `[out] stdlib_complex64_t*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. + +```c +void c_cfill_ndarray( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex_64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/blas/ext/base/cfill.h" +#include "stdlib/complex/float32/ctor.h" +#include + +int main( void ) { + // Create a strided array of interleaved real and imaginary components: + float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; + + // Create a complex scalar: + const stdlib_complex64_t alpha = stdlib_complex64( 2.0f, 2.0f ); + + // Specify the number of indexed elements: + const int N = 4; + + // Specify a stride: + const int strideX = 1; + + // Fill the array: + c_cfill( N, alpha, (stdlib_complex_64_t *)x, strideX ); + + // Print the result: + for ( int i = 0; i < N; i++ ) { + printf( "x[ %i ] = %f + %fj\n", i, x[ i*2 ], x[ (i*2)+1 ] ); + } +} +``` + +
+ + + + + + +