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/cfill/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/cfill/lib/ndarray.js
index e15a4f4b9d2..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
@@ -72,12 +72,10 @@ function cfill( 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 = realf( alpha );
@@ -86,16 +84,19 @@ function cfill( 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 cfill( 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/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();
});
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/README.md b/lib/node_modules/@stdlib/blas/ext/base/zfill/README.md
index 86a9072bfb5..e7f65435105 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,9 @@ 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' );
@@ -240,16 +240,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 +259,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 ] );
+ }
+}
+```
+
+
+
+
+
+
+
+
+