From b6074dbf0cb5b04bb0e8122da589f3bcd12a73d8 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 28 Sep 2024 23:40:23 +0500 Subject: [PATCH 1/8] feat: add C ndarray API and refactor --- .../@stdlib/blas/ext/base/cfill/README.md | 8 +- .../@stdlib/blas/ext/base/zfill/README.md | 152 ++++++++++++++++-- .../base/zfill/benchmark/c/benchmark.length.c | 53 +++++- .../@stdlib/blas/ext/base/zfill/docs/repl.txt | 10 +- .../blas/ext/base/zfill/docs/types/index.d.ts | 12 +- .../blas/ext/base/zfill/examples/c/example.c | 4 +- .../blas/ext/base/zfill/examples/index.js | 13 +- .../include/stdlib/blas/ext/base/zfill.h | 9 +- .../blas/ext/base/zfill/lib/ndarray.js | 14 +- .../blas/ext/base/zfill/lib/ndarray.native.js | 17 +- .../@stdlib/blas/ext/base/zfill/lib/zfill.js | 6 +- .../blas/ext/base/zfill/lib/zfill.native.js | 6 +- .../@stdlib/blas/ext/base/zfill/manifest.json | 9 +- .../@stdlib/blas/ext/base/zfill/src/addon.c | 23 ++- .../@stdlib/blas/ext/base/zfill/src/main.c | 38 +++-- 15 files changed, 293 insertions(+), 81 deletions(-) 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 e66274afa8a..c474bf9e78a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/README.md @@ -287,7 +287,7 @@ console.log( x.get( 0 ).toString() ); #### stdlib_strided_cfill( N, alpha, \*X, strideX ) -Fills a single-precision floating-point strided array `X` with a specified scalar constant `alpha`. +Fills a single-precision complex floating-point strided array `X` with a specified scalar constant `alpha`. ```c float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }; @@ -321,13 +321,13 @@ stdlib_strided_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. +- **alpha**: `[in] stdlib_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 stdlib_strided_cfill_ndarray( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex_64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +void stdlib_strided_cfill_ndarray( const CBLAS_INT N, const stdlib_complex64_t alpha, stdlib_complex64_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); ``` @@ -367,7 +367,7 @@ int main( void ) { const int strideX = 1; // Fill the array: - stdlib_strided_cfill( N, alpha, (stdlib_complex_64_t *)x, strideX ); + stdlib_strided_cfill( N, alpha, (stdlib_complex64_t *)x, strideX ); // Print the result: for ( int i = 0; i < N; i++ ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/README.md b/lib/node_modules/@stdlib/blas/ext/base/zfill/README.md index 86a9072bfb5..7cb181521d3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/README.md @@ -30,7 +30,7 @@ limitations under the License. var zfill = require( '@stdlib/blas/ext/base/zfill' ); ``` -#### zfill( N, alpha, x, stride ) +#### zfill( N, alpha, x, strideX ) Fills a double-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 [`Complex128Array`][@stdlib/array/complex128]. -- **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 = imag( y ); // returns 10.0 ``` -#### zfill.ndarray( N, alpha, x, stride, offset ) +#### zfill.ndarray( N, alpha, x, strideX, offsetX ) Fills a double-precision complex floating-point strided array `x` with a specified scalar constant `alpha` using alternative indexing semantics. @@ -173,9 +173,11 @@ var im = imag( 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 Float64Array = require( '@stdlib/array/float64' ); @@ -219,6 +221,8 @@ im = imag( y ); // returns 10.0 ``` + + @@ -240,16 +244,15 @@ im = imag( 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 Complex128 = require( '@stdlib/complex/float64/ctor' ); +var Complex128Array = require( '@stdlib/array/complex128' ); var zfill = require( '@stdlib/blas/ext/base/zfill' ); -function rand() { - return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) ); -} - -var x = filledarrayBy( 10, 'complex128', rand ); +var xbuf = discreteUniform( 20, -100, 100, { + 'dtype': 'float64' +}); +var x = new Complex128Array( xbuf.buffer ); var alpha = new Complex128( 10.0, 10.0 ); zfill( x.length, alpha, x, 1 ); @@ -260,6 +263,131 @@ console.log( x.get( 0 ).toString() ); + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/ext/base/zfill.h" +``` + +#### stdlib_strided_zfill( N, alpha, \*X, strideX ) + +Fills a double-precision complex floating-point strided array `X` with a specified scalar constant `alpha`. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; +const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); + +stdlib_strided_zfill( 2, alpha, (stdlib_complex128_t *)x, 1 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] stdlib_complex128_t` scalar constant. +- **X**: `[out] stdlib_complex128_t*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. + +```c +void stdlib_strided_zfill( const CBLAS_INT N, const stdlib_complex128_t alpha, stdlib_complex128_t *X, const CBLAS_INT strideX ); +``` + +#### stdlib_strided_zfill_ndarray( N, alpha, \*X, strideX, offsetX ) + +Fills a double-precision complex floating-point strided array `X` with a specified scalar constant `alpha` using alternative indexing semantics. + +```c +double x[] = { 1.0, 2.0, 3.0, 4.0 }; +const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); + +stdlib_strided_zfill_ndarray( 4, alpha, (stdlib_complex128_t *x), 1, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **alpha**: `[in] stdlib_complex128_t` scalar constant. +- **X**: `[out] stdlib_complex128_t*` input array. +- **strideX**: `[in] CBLAS_INT` index increment for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. + +```c +void stdlib_strided_zfill_ndarray( const CBLAS_INT N, const stdlib_complex128_t alpha, stdlib_complex128_t *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/complex/float64/ctor.h" +#include "stdlib/blas/ext/base/zfill.h" +#include + +int main() { + // Create a strided array of interleaved real and imaginary components: + double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; + + // Create a scalar constant: + const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 ); + + // Specify the number of elements: + const int N = 4; + + // Specify a stride: + const int strideX = 1; + + // Fill the array: + stdlib_strided_zfill( N, alpha, (stdlib_complex128_t *)x, strideX ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "x[ %i ] = %lf\n", i, x[ i ] ); + } +} +``` + +
+ + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js index 135b7a69c41..308fa5e7bb0 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js @@ -72,12 +72,10 @@ function zfill( N, alpha, x, strideX, offsetX ) { var ix; var m; var i; - var j; if ( N <= 0 ) { return x; } - ix = offsetX; // Decompose the constant into its real and imaginary components: re = real( alpha ); @@ -86,16 +84,19 @@ function zfill( N, alpha, x, strideX, offsetX ) { // Reinterpret the complex input array as a real-valued array: view = reinterpret( x, 0 ); - // Use loop unrolling if the stride is equal to `1`... - if ( strideX === 1 ) { + // Adjust the stride and offset according to real-valued array: + ix = offsetX * 2; + strideX *= 2; + + // Use loop unrolling if the stride is equal to `2`... + if ( strideX === 2 ) { m = N % M; // If we have a remainder, run a clean-up loop... if ( m > 0 ) { for ( i = 0; i < m; i++ ) { - j = ix * 2; - view[ j ] = re; - view[ j+1 ] = im; + view[ ix ] = re; + view[ ix+1 ] = im; ix += strideX; } } @@ -103,31 +104,29 @@ function zfill( N, alpha, x, strideX, offsetX ) { return x; } for ( i = m; i < N; i += M ) { - j = ix * 2; - view[ j ] = re; - view[ j+1 ] = im; - view[ j+2 ] = re; - view[ j+3 ] = im; - view[ j+4 ] = re; - view[ j+5 ] = im; - view[ j+6 ] = re; - view[ j+7 ] = im; - view[ j+8 ] = re; - view[ j+9 ] = im; - view[ j+10 ] = re; - view[ j+11 ] = im; - view[ j+12 ] = re; - view[ j+13 ] = im; - view[ j+14 ] = re; - view[ j+15 ] = im; - ix += M; + view[ ix ] = re; + view[ ix+1 ] = im; + view[ ix+2 ] = re; + view[ ix+3 ] = im; + view[ ix+4 ] = re; + view[ ix+5 ] = im; + view[ ix+6 ] = re; + view[ ix+7 ] = im; + view[ ix+8 ] = re; + view[ ix+9 ] = im; + view[ ix+10 ] = re; + view[ ix+11 ] = im; + view[ ix+12 ] = re; + view[ ix+13 ] = im; + view[ ix+14 ] = re; + view[ ix+15 ] = im; + ix += M*2; } return x; } for ( i = 0; i < N; i++ ) { - j = ix * 2; - view[ j ] = re; - view[ j+1 ] = im; + view[ ix ] = re; + view[ ix+1 ] = im; ix += strideX; } return x; diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/zfill/src/main.c index 05c58d8481b..2908e0f121c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/src/main.c @@ -51,6 +51,7 @@ void API_SUFFIX(stdlib_strided_zfill_ndarray)( const CBLAS_INT N, const stdlib_c if ( N <= 0 ) { return; } + ix = offsetX; // Use loop unrolling if the stride is equal to `1`... if ( strideX == 1 ) { @@ -59,25 +60,26 @@ void API_SUFFIX(stdlib_strided_zfill_ndarray)( const CBLAS_INT N, const stdlib_c // If we have a remainder, run a clean-up loop... if ( m > 0 ) { for ( i = 0; i < m; i++ ) { - X[ i ] = alpha; + X[ ix ] = alpha; + ix += strideX; } } if ( N < 8 ) { return; } for ( i = m; i < N; i += 8 ) { - X[ i ] = alpha; - X[ i+1 ] = alpha; - X[ i+2 ] = alpha; - X[ i+3 ] = alpha; - X[ i+4 ] = alpha; - X[ i+5 ] = alpha; - X[ i+6 ] = alpha; - X[ i+7 ] = alpha; + X[ ix ] = alpha; + X[ ix+1 ] = alpha; + X[ ix+2 ] = alpha; + X[ ix+3 ] = alpha; + X[ ix+4 ] = alpha; + X[ ix+5 ] = alpha; + X[ ix+6 ] = alpha; + X[ ix+7 ] = alpha; + ix += 8; } return; } - ix = offsetX; for ( i = 0; i < N; i++ ) { X[ ix ] = alpha; ix += strideX; From 336976d621903537def73f4ca06eac9d66a3f8fc Mon Sep 17 00:00:00 2001 From: headlessNode Date: Mon, 30 Sep 2024 13:20:05 +0500 Subject: [PATCH 5/8] fix: apply code review suggestions --- .../blas/ext/base/cfill/test/test.ndarray.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.js index 53d614825b8..8cfa5d7d0c2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.js @@ -167,23 +167,23 @@ tape( 'the function supports an offset parameter', function test( t ) { -2.0, 3.0, // 0 -4.0, // 0 - 6.0, - -8.0, - 10.0, // 1 - -12.0 // 1 + 6.0, // 1 + -8.0, // 1 + 10.0, + -12.0 ]); expected = new Complex64Array([ 1.0, -2.0, 5.0, // 0 -5.0, // 0 - 6.0, - -8.0, 5.0, // 1 - -5.0 // 1 + -5.0, // 1 + 10.0, + -12.0 ]); - cfill( 2, new Complex64( 5.0, -5.0 ), x, 2, 1 ); + cfill( 2, new Complex64( 5.0, -5.0 ), x, 1, 1 ); t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); t.end(); }); From 5c6ef0229e0ac6ff523e2a3c241b2ca4ac26226b Mon Sep 17 00:00:00 2001 From: headlessNode Date: Mon, 30 Sep 2024 13:48:50 +0500 Subject: [PATCH 6/8] feat: apply code review suggestions --- .../ext/base/cfill/test/test.ndarray.native.js | 16 ++++++++-------- .../blas/ext/base/dfill/test/test.ndarray.js | 16 ++++++++-------- .../ext/base/dfill/test/test.ndarray.native.js | 16 ++++++++-------- .../blas/ext/base/sfill/test/test.ndarray.js | 16 ++++++++-------- .../ext/base/sfill/test/test.ndarray.native.js | 16 ++++++++-------- .../blas/ext/base/zfill/test/test.ndarray.js | 16 ++++++++-------- .../ext/base/zfill/test/test.ndarray.native.js | 16 ++++++++-------- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.native.js index b6f4192b9bf..48261e15497 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/test/test.ndarray.native.js @@ -176,23 +176,23 @@ tape( 'the function supports an offset parameter', opts, function test( t ) { -2.0, 3.0, // 0 -4.0, // 0 - 6.0, - -8.0, - 10.0, // 1 - -12.0 // 1 + 6.0, // 1 + -8.0, // 1 + 10.0, + -12.0 ]); expected = new Complex64Array([ 1.0, -2.0, 5.0, // 0 -5.0, // 0 - 6.0, - -8.0, 5.0, // 1 - -5.0 // 1 + -5.0, // 1 + 10.0, + -12.0 ]); - cfill( 2, new Complex64( 5.0, -5.0 ), x, 2, 1 ); + cfill( 2, new Complex64( 5.0, -5.0 ), x, 1, 1 ); t.strictEqual( isSameComplex64Array( x, expected ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.js index dd34e93b373..f1dcd262dce 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.js @@ -157,21 +157,21 @@ tape( 'the function supports an offset parameter', function test( t ) { x = new Float64Array([ 1.0, 2.0, // 0 - 3.0, - 4.0, // 1 - 5.0, - 6.0 // 2 + 3.0, // 1 + 4.0, // 2 + 6.0, + 7.0 ]); expected = new Float64Array([ 1.0, 5.0, // 0 - 3.0, 5.0, // 1 - 5.0, - 5.0 // 2 + 5.0, // 2 + 6.0, + 7.0 ]); - dfill( 3, 5.0, x, 2, 1 ); + dfill( 3, 5.0, x, 1, 1 ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.native.js index 69806f4c8a4..843f6904a90 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dfill/test/test.ndarray.native.js @@ -166,21 +166,21 @@ tape( 'the function supports an offset parameter', opts, function test( t ) { x = new Float64Array([ 1.0, 2.0, // 0 - 3.0, - 4.0, // 1 - 5.0, - 6.0 // 2 + 3.0, // 1 + 4.0, // 2 + 6.0, + 7.0 ]); expected = new Float64Array([ 1.0, 5.0, // 0 - 3.0, 5.0, // 1 - 5.0, - 5.0 // 2 + 5.0, // 2 + 6.0, + 7.0 ]); - dfill( 3, 5.0, x, 2, 1 ); + dfill( 3, 5.0, x, 1, 1 ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.js index 60101678dc7..df3a549f4e2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.js @@ -157,21 +157,21 @@ tape( 'the function supports an offset parameter', function test( t ) { x = new Float32Array([ 1.0, 2.0, // 0 - 3.0, - 4.0, // 1 - 5.0, - 6.0 // 2 + 3.0, // 1 + 4.0, // 2 + 6.0, + 7.0 ]); expected = new Float32Array([ 1.0, 5.0, // 0 - 3.0, 5.0, // 1 - 5.0, - 5.0 // 2 + 5.0, // 2 + 6.0, + 7.0 ]); - sfill( 3, 5.0, x, 2, 1 ); + sfill( 3, 5.0, x, 1, 1 ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.native.js index 3f552668532..a4637594cb7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/sfill/test/test.ndarray.native.js @@ -166,21 +166,21 @@ tape( 'the function supports an offset parameter', opts, function test( t ) { x = new Float32Array([ 1.0, 2.0, // 0 - 3.0, - 4.0, // 1 - 5.0, - 6.0 // 2 + 3.0, // 1 + 4.0, // 2 + 6.0, + 7.0 ]); expected = new Float32Array([ 1.0, 5.0, // 0 - 3.0, 5.0, // 1 - 5.0, - 5.0 // 2 + 5.0, // 2 + 6.0, + 7.0 ]); - sfill( 3, 5.0, x, 2, 1 ); + sfill( 3, 5.0, x, 1, 1 ); t.deepEqual( x, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.js index b38c3e9fc66..6f40906edfb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.js @@ -167,23 +167,23 @@ tape( 'the function supports an offset parameter', function test( t ) { -2.0, 3.0, // 0 -4.0, // 0 - 6.0, - -8.0, - 10.0, // 1 - -12.0 // 1 + 6.0, // 1 + -8.0, // 1 + 10.0, + -12.0 ]); expected = new Complex128Array([ 1.0, -2.0, 5.0, // 0 -5.0, // 0 - 6.0, - -8.0, 5.0, // 1 - -5.0 // 1 + -5.0, // 1 + 10.0, + -12.0 ]); - zfill( 2, new Complex128( 5.0, -5.0 ), x, 2, 1 ); + zfill( 2, new Complex128( 5.0, -5.0 ), x, 1, 1 ); t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.native.js index 2de6683b73d..b70297d616f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/test/test.ndarray.native.js @@ -176,23 +176,23 @@ tape( 'the function supports an offset parameter', opts, function test( t ) { -2.0, 3.0, // 0 -4.0, // 0 - 6.0, - -8.0, - 10.0, // 1 - -12.0 // 1 + 6.0, // 1 + -8.0, // 1 + 10.0, + -12.0 ]); expected = new Complex128Array([ 1.0, -2.0, 5.0, // 0 -5.0, // 0 - 6.0, - -8.0, 5.0, // 1 - -5.0 // 1 + -5.0, // 1 + 10.0, + -12.0 ]); - zfill( 2, new Complex128( 5.0, -5.0 ), x, 2, 1 ); + zfill( 2, new Complex128( 5.0, -5.0 ), x, 1, 1 ); t.strictEqual( isSameComplex128Array( x, expected ), true, 'returns expected value' ); t.end(); }); From 6a153f0a6a36a443e00dbe021f32c6ad2acac955 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Tue, 1 Oct 2024 11:40:56 +0500 Subject: [PATCH 7/8] fix: apply code review suggestions --- lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js | 4 ++-- lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js index 67f1592965f..c821da5472d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js @@ -27,7 +27,7 @@ var imagf = require( '@stdlib/complex/float32/imag' ); // VARIABLES // -var M = 8; +var M = 16; // MAIN // @@ -120,7 +120,7 @@ function cfill( N, alpha, x, strideX, offsetX ) { view[ ix+13 ] = im; view[ ix+14 ] = re; view[ ix+15 ] = im; - ix += M*2; + ix += M; } return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js index 308fa5e7bb0..93b2f77f560 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js @@ -27,7 +27,7 @@ var imag = require( '@stdlib/complex/float64/imag' ); // VARIABLES // -var M = 8; +var M = 16; // MAIN // @@ -120,7 +120,7 @@ function zfill( N, alpha, x, strideX, offsetX ) { view[ ix+13 ] = im; view[ ix+14 ] = re; view[ ix+15 ] = im; - ix += M*2; + ix += M; } return x; } From fdc0f04a8b0cd213555492a6e448e190d5bf340b Mon Sep 17 00:00:00 2001 From: headlessNode Date: Tue, 1 Oct 2024 13:34:46 +0500 Subject: [PATCH 8/8] fix: apply code review suggestions --- lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js | 4 ++-- lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js index c821da5472d..8b36a9f6e56 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js @@ -27,7 +27,7 @@ var imagf = require( '@stdlib/complex/float32/imag' ); // VARIABLES // -var M = 16; +var M = 8; // MAIN // @@ -120,7 +120,7 @@ function cfill( N, alpha, x, strideX, offsetX ) { view[ ix+13 ] = im; view[ ix+14 ] = re; view[ ix+15 ] = im; - ix += M; + ix += M * 2; } return x; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js index 93b2f77f560..d33da443b86 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/zfill/lib/ndarray.js @@ -27,7 +27,7 @@ var imag = require( '@stdlib/complex/float64/imag' ); // VARIABLES // -var M = 16; +var M = 8; // MAIN // @@ -120,7 +120,7 @@ function zfill( N, alpha, x, strideX, offsetX ) { view[ ix+13 ] = im; view[ ix+14 ] = re; view[ ix+15 ] = im; - ix += M; + ix += M * 2; } return x; }