diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/README.md b/lib/node_modules/@stdlib/blas/ext/base/scusum/README.md
index fc090f8e6bf8..deda4f366042 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/README.md
@@ -61,11 +61,11 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **sum**: initial sum.
- **x**: input [`Float32Array`][@stdlib/array/float32].
-- **strideX**: index increment for `x`.
+- **strideX**: stride length for `x`.
- **y**: output [`Float32Array`][@stdlib/array/float32].
-- **strideY**: index increment for `y`.
+- **strideY**: stride length for `y`.
-The `N` and `stride` parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element in the strided input array,
+The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element:
```javascript
var Float32Array = require( '@stdlib/array/float32' );
@@ -115,7 +115,7 @@ The function has the following additional parameters:
- **offsetX**: starting index for `x`.
- **offsetY**: starting index for `y`.
-While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, offsetX and offsetY parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative sum of every other value in the strided input array starting from the second value and to store in the last `N` elements of the strided output array starting from the last element
+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 cumulative sum of every other element in the strided input array starting from the second element and to store in the last `N` elements of the strided output array starting from the last element:
```javascript
var Float32Array = require( '@stdlib/array/float32' );
@@ -148,14 +148,17 @@ scusum.ndarray( 4, 0.0, x, 2, 1, y, -1, y.length-1 );
```javascript
-var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
-var Float32Array = require( '@stdlib/array/float32' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var scusum = require( '@stdlib/blas/ext/base/scusum' );
-var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
-var y = new Float32Array( x.length );
+var x = discreteUniform( 10, -100, 100, {
+ 'dtype': 'float32'
+});
console.log( x );
+
+var y = discreteUniform( 10, -100, 100, {
+ 'dtype': 'float32'
+});
console.log( y );
scusum( x.length, 0.0, x, 1, y, -1 );
@@ -166,6 +169,138 @@ console.log( y );
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/blas/ext/base/scusum.h"
+```
+
+#### stdlib_strided_scusum( N, sum, \*X, strideX, \*Y, strideY )
+
+Computes the cumulative sum of single-precision floating-point strided array elements.
+
+```c
+const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+
+stdlib_strided_scusum( 4, 0.0f, x, 1, y, 1 );
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **sum**: `[in] float` initial sum.
+- **X**: `[in] float*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+- **Y**: `[out] float*` output array.
+- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
+
+```c
+void stdlib_strided_scusum( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY );
+```
+
+
+
+#### stdlib_strided_scusum_ndarray( N, sum, \*X, strideX, offsetX, \*Y, strideY, offsetY )
+
+
+
+Computes the cumulative sum of single-precision floating-point strided array elements using alternative indexing semantics.
+
+```c
+const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
+float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+
+stdlib_strided_scusum_ndarray( 4, 0.0f, x, 1, 0, y, 1, 0 );
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **sum**: `[in] float` initial sum.
+- **X**: `[in] float*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
+- **Y**: `[out] float*` output array.
+- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
+- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
+
+```c
+void stdlib_strided_scusum_ndarray( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/blas/ext/base/scusum.h"
+#include
+
+int main( void ) {
+ // Create strided arrays:
+ const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
+ float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+
+ // Specify the number of elements:
+ const int N = 4;
+
+ // Specify stride lengths:
+ const int strideX = 2;
+ const int strideY = -2;
+
+ // Compute the cumulative sum:
+ stdlib_strided_scusum( N, 0.0f, x, strideX, y, strideY );
+
+ // Print the result:
+ for ( int i = 0; i < 8; i++ ) {
+ printf( "y[ %d ] = %f\n", i, y[ i ] );
+ }
+}
+```
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.js
index 69c251af827c..01e5462f87e4 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.js
@@ -21,9 +21,7 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var uniform = require( '@stdlib/random/base/uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
-var Float32Array = require( '@stdlib/array/float32' );
+var uniform = require( '@stdlib/random/array/uniform' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var pow = require( '@stdlib/math/base/special/pow' );
var pkg = require( './../package.json' ).name;
@@ -32,7 +30,9 @@ var scusum = require( './../lib/scusum.js' );
// VARIABLES //
-var rand = uniform( -10.0, 10.0 );
+var options = {
+ 'dtype': 'float32'
+};
// FUNCTIONS //
@@ -45,8 +45,8 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
- var x = filledarrayBy( len, 'float32', rand );
- var y = new Float32Array( len );
+ var x = uniform( len, -100, 100, options );
+ var y = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.native.js
index 942a4ddda88a..94876e968929 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.native.js
@@ -22,11 +22,9 @@
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
-var uniform = require( '@stdlib/random/base/uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
+var uniform = require( '@stdlib/random/array/uniform' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var pow = require( '@stdlib/math/base/special/pow' );
-var Float32Array = require( '@stdlib/array/float32' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;
@@ -37,7 +35,9 @@ var scusum = tryRequire( resolve( __dirname, './../lib/scusum.native.js' ) );
var opts = {
'skip': ( scusum instanceof Error )
};
-var rand = uniform( -10.0, 10.0 );
+var options = {
+ 'dtype': 'float32'
+};
// FUNCTIONS //
@@ -50,8 +50,8 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
- var x = filledarrayBy( len, 'float32', rand );
- var y = new Float32Array( len );
+ var x = uniform( len, -100, 100, options );
+ var y = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.js
index 00e014a1fe5e..7887fb8bf9f6 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.js
@@ -21,18 +21,18 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var uniform = require( '@stdlib/random/base/uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
+var uniform = require( '@stdlib/random/array/uniform' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var pow = require( '@stdlib/math/base/special/pow' );
-var Float32Array = require( '@stdlib/array/float32' );
var pkg = require( './../package.json' ).name;
var scusum = require( './../lib/ndarray.js' );
// VARIABLES //
-var rand = uniform( -10.0, 10.0 );
+var options = {
+ 'dtype': 'float32'
+};
// FUNCTIONS //
@@ -45,8 +45,8 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
- var x = filledarrayBy( len, 'float32', rand );
- var y = new Float32Array( len );
+ var x = uniform( len, -100, 100, options );
+ var y = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.native.js
index 0a920dce4110..98438aa8b2bf 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/benchmark.ndarray.native.js
@@ -22,11 +22,9 @@
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
-var uniform = require( '@stdlib/random/base/uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
+var uniform = require( '@stdlib/random/array/uniform' );
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var pow = require( '@stdlib/math/base/special/pow' );
-var Float32Array = require( '@stdlib/array/float32' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;
@@ -37,7 +35,9 @@ var scusum = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
var opts = {
'skip': ( scusum instanceof Error )
};
-var rand = uniform( -10.0, 10.0 );
+var options = {
+ 'dtype': 'float32'
+};
// FUNCTIONS //
@@ -50,8 +50,8 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
- var x = filledarrayBy( len, 'float32', rand );
- var y = new Float32Array( len );
+ var x = uniform( len, -100, 100, options );
+ var y = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/c/benchmark.length.c
index daae2fff79be..62ffb33c4416 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/benchmark/c/benchmark.length.c
@@ -94,7 +94,7 @@ static float rand_float( void ) {
* @param len array length
* @return elapsed time in seconds
*/
-static double benchmark( int iterations, int len ) {
+static double benchmark1( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
@@ -121,6 +121,40 @@ static double benchmark( int iterations, int len ) {
return elapsed;
}
+/**
+* Runs a benchmark.
+*
+* @param iterations number of iterations
+* @param len array length
+* @return elapsed time in seconds
+*/
+static double benchmark2( int iterations, int len ) {
+ double elapsed;
+ float x[ len ];
+ float y[ len ];
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
+ y[ i ] = 0.0f;
+ }
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ x[ 0 ] += 1.0f;
+ stdlib_strided_scusum_ndarray( len, 0.0f, x, 1, 0, y, 1, 0 );
+ if ( y[ 0 ] != y[ 0 ] ) {
+ printf( "should not return NaN\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( y[ len-1 ] != y[ len-1 ] ) {
+ printf( "should not return NaN\n" );
+ }
+ return elapsed;
+}
+
/**
* Main execution sequence.
*/
@@ -143,7 +177,18 @@ int main( void ) {
for ( j = 0; j < REPEATS; j++ ) {
count += 1;
printf( "# c::%s:len=%d\n", NAME, len );
- elapsed = benchmark( iter, len );
+ elapsed = benchmark1( iter, len );
+ print_results( iter, elapsed );
+ printf( "ok %d benchmark finished\n", count );
+ }
+ }
+ for ( i = MIN; i <= MAX; i++ ) {
+ len = pow( 10, i );
+ iter = ITERATIONS / pow( 10, i-1 );
+ for ( j = 0; j < REPEATS; j++ ) {
+ count += 1;
+ printf( "# c::%s:ndarray:len=%d\n", NAME, len );
+ elapsed = benchmark2( iter, len );
print_results( iter, elapsed );
printf( "ok %d benchmark finished\n", count );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/repl.txt
index d6e5e3124514..d30a2e0acfc2 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/repl.txt
@@ -3,8 +3,8 @@
Computes the cumulative sum of single-precision floating-point strided array
elements.
- The `N` and `stride` parameters determine which elements in the strided
- arrays are accessed at runtime.
+ The `N` and stride parameters determine which elements in the strided arrays
+ are accessed at runtime.
Indexing is relative to the first index. To introduce an offset, use a typed
array view.
@@ -23,13 +23,13 @@
Input array.
strideX: integer
- Index increment for `x`.
+ Stride length for `x`.
y: Float32Array
Output array.
strideY: integer
- Index increment for `y`.
+ Stride length for `y`.
Returns
-------
@@ -44,7 +44,7 @@
> {{alias}}( x.length, 0.0, x, 1, y, 1 )
[ 1.0, -1.0, 1.0 ]
- // Using `N` and `stride` parameters:
+ // Using `N` and stride parameters:
> x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
> y = new {{alias:@stdlib/array/float32}}( x.length );
> {{alias}}( 3, 0.0, x, 2, y, 2 )
@@ -66,8 +66,8 @@
elements using alternative indexing semantics.
While typed array views mandate a view offset based on the underlying
- buffer, the `offset` parameter supports indexing semantics based on a
- starting index.
+ buffer, the offset parameter supports indexing semantics based on starting
+ indices.
Parameters
----------
@@ -81,7 +81,7 @@
Input array.
strideX: integer
- Index increment for `x`.
+ Stride length for `x`.
offsetX: integer
Starting index for `x`.
@@ -90,7 +90,7 @@
Output array.
strideY: integer
- Index increment for `y`.
+ Stride length for `y`.
offsetY: integer
Starting index for `y`.
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/types/index.d.ts
index 22a74c53c2a8..72ac43f45abb 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/docs/types/index.d.ts
@@ -28,9 +28,9 @@ interface Routine {
* @param N - number of indexed elements
* @param sum - initial sum
* @param x - input array
- * @param strideX - `x` stride length
+ * @param strideX - stride length for `x`
* @param y - output array
- * @param strideY - `y` stride length
+ * @param strideY - stride length for `y`
* @returns output array
*
* @example
@@ -50,10 +50,10 @@ interface Routine {
* @param N - number of indexed elements
* @param sum - initial sum
* @param x - input array
- * @param strideX - `x` stride length
+ * @param strideX - stride length for `x`
* @param offsetX - starting index for `x`
* @param y - output array
- * @param strideY - `y` stride length
+ * @param strideY - stride length for `y`
* @param offsetY - starting index for `y`
* @returns output array
*
@@ -75,9 +75,9 @@ interface Routine {
* @param N - number of indexed elements
* @param sum - initial sum
* @param x - input array
-* @param strideX - `x` stride length
+* @param strideX - stride length for `x`
* @param y - output array
-* @param strideY - `y` stride length
+* @param strideY - stride length for `y`
* @returns output array
*
* @example
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/c/example.c
index 58a1d9c51297..f86a82bac261 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/c/example.c
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/c/example.c
@@ -17,27 +17,25 @@
*/
#include "stdlib/blas/ext/base/scusum.h"
-#include
#include
-#include
int main( void ) {
// Create strided arrays:
- const float x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
- float y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
+ const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
+ float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
// Specify the number of elements:
- const int64_t N = 4;
+ const int N = 4;
// Specify stride lengths:
- const int64_t strideX = 2;
- const int64_t strideY = -2;
+ const int strideX = 2;
+ const int strideY = -2;
// Compute the cumulative sum:
stdlib_strided_scusum( N, 0.0f, x, strideX, y, strideY );
// Print the result:
- for ( int64_t i = 0; i < 8; i++ ) {
- printf( "y[ %"PRId64" ] = %f\n", i, y[ i ] );
+ for ( int i = 0; i < 8; i++ ) {
+ printf( "y[ %d ] = %f\n", i, y[ i ] );
}
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/index.js
index 6a92d6ab1267..be336f4c7b9a 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/index.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/examples/index.js
@@ -18,15 +18,17 @@
'use strict';
-var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
-var Float32Array = require( '@stdlib/array/float32' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var scusum = require( './../lib' );
-var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
-var y = new Float32Array( x.length );
-
+var x = discreteUniform( 10, -100, 100, {
+ 'dtype': 'float32'
+});
console.log( x );
+
+var y = discreteUniform( 10, -100, 100, {
+ 'dtype': 'float32'
+});
console.log( y );
scusum( x.length, 0.0, x, 1, y, -1 );
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/include/stdlib/blas/ext/base/scusum.h b/lib/node_modules/@stdlib/blas/ext/base/scusum/include/stdlib/blas/ext/base/scusum.h
index d2ef9741f552..84b670480a7f 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/include/stdlib/blas/ext/base/scusum.h
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/include/stdlib/blas/ext/base/scusum.h
@@ -19,7 +19,7 @@
#ifndef STDLIB_BLAS_EXT_BASE_SCUSUM_H
#define STDLIB_BLAS_EXT_BASE_SCUSUM_H
-#include
+#include "stdlib/blas/base/shared.h"
/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
@@ -31,7 +31,12 @@ extern "C" {
/**
* Computes the cumulative sum of single-precision floating-point strided array elements.
*/
-void stdlib_strided_scusum( const int64_t N, const float sum, const float *X, const int64_t strideX, float *Y, const int64_t strideY );
+void API_SUFFIX(stdlib_strided_scusum)( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY );
+
+/**
+* Computes the cumulative sum of single-precision floating-point strided array elements using alternative indexing semantics.
+*/
+void API_SUFFIX(stdlib_strided_scusum_ndarray)( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.js
index fc8c631d22b0..40ae6ac83462 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.js
@@ -31,10 +31,10 @@ var scusumkbn = require( '@stdlib/blas/ext/base/scusumkbn' ).ndarray;
* @param {PositiveInteger} N - number of indexed elements
* @param {number} sum - initial sum
* @param {Float32Array} x - input array
-* @param {integer} strideX - `x` stride length
+* @param {integer} strideX - stride length for `x`
* @param {NonNegativeInteger} offsetX - starting index for `x`
* @param {Float32Array} y - output array
-* @param {integer} strideY - `y` stride length
+* @param {integer} strideY - stride length for `y`
* @param {NonNegativeInteger} offsetY - starting index for `y`
* @returns {Float32Array} output array
*
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.native.js
index 3f05e52ab35a..a24b7c6e0d2a 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/ndarray.native.js
@@ -20,9 +20,7 @@
// MODULES //
-var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' );
-var offsetView = require( '@stdlib/strided/base/offset-view' );
-var addon = require( './scusum.native.js' );
+var addon = require( './../src/addon.node' );
// MAIN //
@@ -33,10 +31,10 @@ var addon = require( './scusum.native.js' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} sum - initial sum
* @param {Float32Array} x - input array
-* @param {integer} strideX - `x` stride length
+* @param {integer} strideX - stride length for `x`
* @param {NonNegativeInteger} offsetX - starting index for `x`
* @param {Float32Array} y - output array
-* @param {integer} strideY - `y` stride length
+* @param {integer} strideY - stride length for `y`
* @param {NonNegativeInteger} offsetY - starting index for `y`
* @returns {Float32Array} output array
*
@@ -50,14 +48,7 @@ var addon = require( './scusum.native.js' );
* // returns [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ]
*/
function scusum( N, sum, x, strideX, offsetX, y, strideY, offsetY ) {
- var viewX;
- var viewY;
-
- offsetX = minViewBufferIndex( N, strideX, offsetX );
- viewX = offsetView( x, offsetX );
- offsetY = minViewBufferIndex( N, strideY, offsetY );
- viewY = offsetView( y, offsetY );
- addon( N, sum, viewX, strideX, viewY, strideY );
+ addon.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY );
return y;
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.js
index 6c0613927f8e..cf08e66e4147 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.js
@@ -31,9 +31,9 @@ var scusumkbn = require( '@stdlib/blas/ext/base/scusumkbn' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} sum - initial sum
* @param {Float32Array} x - input array
-* @param {integer} strideX - `x` stride length
+* @param {integer} strideX - stride length for `x`
* @param {Float32Array} y - output array
-* @param {integer} strideY - `y` stride length
+* @param {integer} strideY - stride length for `y`
* @returns {Float32Array} output array
*
* @example
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.native.js
index 96b9f767476f..70004245bd99 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/lib/scusum.native.js
@@ -31,9 +31,9 @@ var addon = require( './../src/addon.node' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} sum - initial sum
* @param {Float32Array} x - input array
-* @param {integer} strideX - `x` stride length
+* @param {integer} strideX - stride length for `x`
* @param {Float32Array} y - output array
-* @param {integer} strideY - `y` stride length
+* @param {integer} strideY - stride length for `y`
* @returns {Float32Array} output array
*
* @example
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/scusum/manifest.json
index 972622c09784..18744d15a7ad 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/manifest.json
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/manifest.json
@@ -28,14 +28,12 @@
{
"task": "build",
"src": [
- "./src/scusum.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/ext/base/scusumkbn",
@@ -43,39 +41,41 @@
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
"@stdlib/napi/argv-float",
- "@stdlib/napi/argv-strided-float32array"
+ "@stdlib/napi/argv-strided-float32array",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/blas/base/shared"
]
},
{
"task": "benchmark",
"src": [
- "./src/scusum.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
- "@stdlib/blas/ext/base/scusumkbn"
+ "@stdlib/blas/ext/base/scusumkbn",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/blas/base/shared"
]
},
{
"task": "examples",
"src": [
- "./src/scusum.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
- "@stdlib/blas/ext/base/scusumkbn"
+ "@stdlib/blas/ext/base/scusumkbn",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/blas/base/shared"
]
}
]
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/scusum/src/addon.c
index aa739dabff08..8eb8818a8325 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/src/addon.c
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/src/addon.c
@@ -17,13 +17,13 @@
*/
#include "stdlib/blas/ext/base/scusum.h"
+#include "stdlib/blas/base/shared.h"
#include "stdlib/napi/export.h"
#include "stdlib/napi/argv.h"
#include "stdlib/napi/argv_int64.h"
#include "stdlib/napi/argv_float.h"
#include "stdlib/napi/argv_strided_float32array.h"
#include
-#include
/**
* Receives JavaScript callback invocation data.
@@ -40,8 +40,29 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 4 );
- stdlib_strided_scusum( N, sum, X, strideX, Y, strideY );
+ API_SUFFIX(stdlib_strided_scusum)( N, sum, X, strideX, Y, strideY );
return NULL;
}
-STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
+/**
+* Receives JavaScript callback invocation data.
+*
+* @param env environment under which the function is invoked
+* @param info callback data
+* @return Node-API value
+*/
+static napi_value addon_method( napi_env env, napi_callback_info info ) {
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 8 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_FLOAT( env, sum, argv, 1 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
+ STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 6 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 7 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 5 );
+ API_SUFFIX(stdlib_strided_scusum_ndarray)( N, sum, X, strideX, offsetX, Y, strideY, offsetY );
+ return NULL;
+}
+
+STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method );
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/scusum/src/main.c
new file mode 100644
index 000000000000..7c3a208ebdc7
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/scusum/src/main.c
@@ -0,0 +1,54 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include "stdlib/blas/ext/base/scusum.h"
+#include "stdlib/blas/ext/base/scusumkbn.h"
+#include "stdlib/strided/base/stride2offset.h"
+#include "stdlib/blas/base/shared.h"
+
+/**
+* Computes the cumulative sum of single-precision floating-point strided array elements.
+*
+* @param N number of indexed elements
+* @param sum initial sum
+* @param X input array
+* @param strideX X stride length
+* @param Y output array
+* @param strideY Y stride length
+*/
+void API_SUFFIX(stdlib_strided_scusum)( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY ) {
+ const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
+ const CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY );
+ API_SUFFIX(stdlib_strided_scusum_ndarray)( N, sum, X, strideX, ox, Y, strideY, oy );
+}
+
+/**
+* Computes the cumulative sum of single-precision floating-point strided array elements using alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param sum initial sum
+* @param X input array
+* @param strideX stride length for X
+* @param offsetX starting index for X
+* @param Y output array
+* @param strideY stride length for Y
+* @param offsetY starting index for Y
+*/
+void API_SUFFIX(stdlib_strided_scusum_ndarray)( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) {
+ API_SUFFIX(stdlib_strided_scusumkbn_ndarray)( N, sum, X, strideX, offsetX, Y, strideY, offsetY );
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusum/src/scusum.c b/lib/node_modules/@stdlib/blas/ext/base/scusum/src/scusum.c
deleted file mode 100644
index f4822613f1ad..000000000000
--- a/lib/node_modules/@stdlib/blas/ext/base/scusum/src/scusum.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2020 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "stdlib/blas/ext/base/scusum.h"
-#include "stdlib/blas/ext/base/scusumkbn.h"
-#include
-
-/**
-* Computes the cumulative sum of single-precision floating-point strided array elements.
-*
-* @param N number of indexed elements
-* @param sum initial sum
-* @param X input array
-* @param strideX X stride length
-* @param Y output array
-* @param strideY Y stride length
-*/
-void stdlib_strided_scusum( const int64_t N, const float sum, const float *X, const int64_t strideX, float *Y, const int64_t strideY ) {
- stdlib_strided_scusumkbn( N, sum, X, strideX, Y, strideY );
-}