diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/lib/main.js b/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/lib/main.js
index 9f54ca98a843..fedde217d02e 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/lib/main.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/lib/main.js
@@ -81,88 +81,19 @@ function main( context ) {
break;
}
- /**
- * Sorts the variable declarations by name length.
- *
- * @private
- * @param {Object} a - input object
- * @param {Object} b - comparison object
- * @returns {number} number indicating sort order
- */
- function sortVars( a, b ) {
- if ( fun( a.name.length, b.name.length ) ) {
- return 1;
- }
- return -1;
- }
-
/**
* Reports the error message.
*
* @private
* @param {string} msg - error message
- * @param {ASTNode} node - node to fix
+ * @param {Object} loc - lines of code (object with `start` and `end` properties)
*/
- function report( msg, node ) {
+ function report( msg, loc ) {
context.report({
'node': null,
'message': msg,
- 'loc': node.loc,
- 'fix': fix
+ 'loc': loc
});
-
- /**
- * Fixes the lint error by reordering the variable declarations inside of the function.
- *
- * @private
- * @param {Function} fixer - ESLint fixer
- * @returns {(Object|null)} fix or null
- */
- function fix( fixer ) {
- var replacingText;
- var declarations;
- var startRange;
- var endRange;
- var source;
- var elem;
- var body;
- var i;
- var j;
-
- declarations = [];
- replacingText = '';
- body = node.body.body;
- source = context.getSourceCode();
-
- for ( i = 0; i < body.length; i++ ) {
- elem = body[ i ];
- if ( elem.type === 'VariableDeclaration' && elem.kind === 'var' ) {
- declarations.push({
- 'text': source.getText( elem ),
- 'name': elem.declarations[ 0 ].id.name,
- 'col': elem.loc.start.column
- });
- if ( declarations.length === 1 ) {
- startRange = elem.range[ 0 ] - elem.loc.start.column;
- }
- endRange = elem.range[ 1 ];
- }
- }
-
- declarations.sort( sortVars );
-
- for ( i = 0; i < declarations.length; i++ ) {
- for ( j = 0; j < declarations[ i ].col; j++ ) {
- replacingText += '\t';
- }
- replacingText += declarations[ i ].text;
- if ( i !== declarations.length -1 ) {
- replacingText += '\n';
- }
- }
-
- return fixer.replaceTextRange( [ startRange, endRange ], replacingText ); // eslint-disable-line max-len
- }
}
/**
@@ -186,7 +117,7 @@ function main( context ) {
if ( elem.type === 'VariableDeclaration' && elem.kind === 'var' ) {
name = elem.declarations[ 0 ].id.name;
if ( prevLength && !fun( name.length, prevLength ) ) {
- return report( 'Variable declarations inside of function are not ordered by length (in '+ order +' order)', node );
+ return report( 'Variable declarations inside of function are not ordered by length (in '+ order +' order)', node.loc );
}
prevLength = name.length;
}
@@ -204,11 +135,9 @@ function main( context ) {
rule = {
'meta': {
- 'type': 'layout',
'docs': {
'description': 'require variable declarations inside of functions to be ordered by length'
},
- 'fixable': 'code',
'schema': [
{
'order': [ 'increasing', 'decreasing' ]
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/test/fixtures/invalid.js
index bb09069ba350..6de001b4661e 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/test/fixtures/invalid.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/vars-order/test/fixtures/invalid.js
@@ -24,13 +24,13 @@ var test;
test = {
'code': [
'function fizzBuzz() {',
- ' var i;',
- ' var out;',
+ ' var i;',
+ ' var out;',
'',
- ' for ( i = 1; i <= 100; i++ ) {',
- ' out = ( i % 5 === 0 ) ? "Buzz" : ( i % 3 === 0 ) ? "Fizz" : i;',
- ' console.log( out );',
- ' }',
+ ' for ( i = 1; i <= 100; i++ ) {',
+ ' out = ( i % 5 === 0 ) ? "Buzz" : ( i % 3 === 0 ) ? "Fizz" : i;',
+ ' console.log( out );',
+ ' }',
'}'
].join( '\n' ),
'errors': [
@@ -38,27 +38,16 @@ test = {
'message': 'Variable declarations inside of function are not ordered by length (in decreasing order)',
'type': null
}
- ],
- 'output': [
- 'function fizzBuzz() {',
- ' var out;',
- ' var i;',
- '',
- ' for ( i = 1; i <= 100; i++ ) {',
- ' out = ( i % 5 === 0 ) ? "Buzz" : ( i % 3 === 0 ) ? "Fizz" : i;',
- ' console.log( out );',
- ' }',
- '}'
- ].join( '\n' )
+ ]
};
invalid.push( test );
test = {
'code': [
'function addFour( y ) {',
- ' var x = 4.0;',
- ' var out = x + y;',
- ' return out;',
+ ' var x = 4.0;',
+ ' var out = x + y;',
+ ' return out;',
'}'
].join( '\n' ),
'errors': [
@@ -66,14 +55,7 @@ test = {
'message': 'Variable declarations inside of function are not ordered by length (in decreasing order)',
'type': null
}
- ],
- 'output': [
- 'function addFour( y ) {',
- ' var out = x + y;',
- ' var x = 4.0;',
- ' return out;',
- '}'
- ].join( '\n' )
+ ]
};
invalid.push( test );
@@ -90,17 +72,17 @@ test = {
'* @returns {number} pseudorandom number',
'*/',
'function triangular( rand, a, b, c ) {',
- ' var x;',
- ' var fc;',
- ' var u;',
- ' fc = (c - a) / (b - a);',
- ' u = rand();',
- ' if ( u < fc ) {',
- ' x = (b - a) * (c - a);',
- ' return a + sqrt( x * u );',
- ' }',
- ' x = (b - a) * (b - c);',
- ' return b - sqrt( x * (1.0 - u) );',
+ ' var x;',
+ ' var fc;',
+ ' var u;',
+ ' fc = (c - a) / (b - a);',
+ ' u = rand();',
+ ' if ( u < fc ) {',
+ ' x = (b - a) * (c - a);',
+ ' return a + sqrt( x * u );',
+ ' }',
+ ' x = (b - a) * (b - c);',
+ ' return b - sqrt( x * (1.0 - u) );',
'}'
].join( '\n' ),
'errors': [
@@ -108,41 +90,16 @@ test = {
'message': 'Variable declarations inside of function are not ordered by length (in decreasing order)',
'type': null
}
- ],
- 'output': [
- '/**',
- '* Returns a pseudorandom number drawn from a triangular distribution with minimum support `a`, maximum support `b` and mode `c`.',
- '*',
- '* @private',
- '* @param {Function} rand - PRNG for generating uniformly distributed numbers',
- '* @param {number} a - minimum support',
- '* @param {number} b - maximum support',
- '* @param {number} c - mode',
- '* @returns {number} pseudorandom number',
- '*/',
- 'function triangular( rand, a, b, c ) {',
- ' var fc;',
- ' var x;',
- ' var u;',
- ' fc = (c - a) / (b - a);',
- ' u = rand();',
- ' if ( u < fc ) {',
- ' x = (b - a) * (c - a);',
- ' return a + sqrt( x * u );',
- ' }',
- ' x = (b - a) * (b - c);',
- ' return b - sqrt( x * (1.0 - u) );',
- '}'
- ].join( '\n' )
+ ]
};
invalid.push( test );
test = {
'code': [
'function addFour( y ) {',
- ' var x = 4.0;',
- ' var out = x + y;',
- ' return out;',
+ ' var x = 4.0;',
+ ' var out = x + y;',
+ ' return out;',
'}'
].join( '\n' ),
'options': [{
@@ -153,14 +110,7 @@ test = {
'message': 'Variable declarations inside of function are not ordered by length (in decreasing order)',
'type': null
}
- ],
- 'output': [
- 'function addFour( y ) {',
- ' var out = x + y;',
- ' var x = 4.0;',
- ' return out;',
- '}'
- ].join( '\n' )
+ ]
};
invalid.push( test );
@@ -177,17 +127,17 @@ test = {
'* @returns {number} pseudorandom number',
'*/',
'function triangular( rand, a, b, c ) {',
- ' var fc;',
- ' var x;',
- ' var u;',
- ' fc = (c - a) / (b - a);',
- ' u = rand();',
- ' if ( u < fc ) {',
- ' x = (b - a) * (c - a);',
- ' return a + sqrt( x * u );',
- ' }',
- ' x = (b - a) * (b - c);',
- ' return b - sqrt( x * (1.0 - u) );',
+ ' var fc;',
+ ' var x;',
+ ' var u;',
+ ' fc = (c - a) / (b - a);',
+ ' u = rand();',
+ ' if ( u < fc ) {',
+ ' x = (b - a) * (c - a);',
+ ' return a + sqrt( x * u );',
+ ' }',
+ ' x = (b - a) * (b - c);',
+ ' return b - sqrt( x * (1.0 - u) );',
'}'
].join( '\n' ),
'options': [{
@@ -198,115 +148,7 @@ test = {
'message': 'Variable declarations inside of function are not ordered by length (in increasing order)',
'type': null
}
- ],
- 'output': [
- '/**',
- '* Returns a pseudorandom number drawn from a triangular distribution with minimum support `a`, maximum support `b` and mode `c`.',
- '*',
- '* @private',
- '* @param {Function} rand - PRNG for generating uniformly distributed numbers',
- '* @param {number} a - minimum support',
- '* @param {number} b - maximum support',
- '* @param {number} c - mode',
- '* @returns {number} pseudorandom number',
- '*/',
- 'function triangular( rand, a, b, c ) {',
- ' var x;',
- ' var u;',
- ' var fc;',
- ' fc = (c - a) / (b - a);',
- ' u = rand();',
- ' if ( u < fc ) {',
- ' x = (b - a) * (c - a);',
- ' return a + sqrt( x * u );',
- ' }',
- ' x = (b - a) * (b - c);',
- ' return b - sqrt( x * (1.0 - u) );',
- '}'
- ].join( '\n' )
-};
-invalid.push( test );
-
-test = {
- 'code': [
- 'function outer() {',
- ' var xyz;',
- ' var x;',
- ' function inner() {',
- ' var a = 10;',
- ' var abc = 5;',
- ' var ab = 5;',
- ' return a + b + c;',
- ' }',
- ' xyz = inner() + x;',
- ' return xyz;',
- '}'
- ].join( '\n' ),
- 'errors': [
- {
- 'message': 'Variable declarations inside of function are not ordered by length (in decreasing order)',
- 'type': null
- }
- ],
- 'output': [
- 'function outer() {',
- ' var xyz;',
- ' var x;',
- ' function inner() {',
- ' var abc = 5;',
- ' var ab = 5;',
- ' var a = 10;',
- ' return a + b + c;',
- ' }',
- ' xyz = inner() + x;',
- ' return xyz;',
- '}'
- ].join( '\n' )
-};
-invalid.push( test );
-
-test = {
- 'code': [
- 'function outer() {',
- ' var xyz;',
- ' var x;',
- ' function inner() {',
- ' var abc = 5;',
- ' var ab = 5;',
- ' var a = 10;',
- ' return a + b + c;',
- ' }',
- ' xyz = inner() + x;',
- ' return xyz;',
- '}'
- ].join( '\n' ),
- 'options': [{
- 'order': 'increasing'
- }],
- 'errors': [
- {
- 'message': 'Variable declarations inside of function are not ordered by length (in increasing order)',
- 'type': null
- },
- {
- 'message': 'Variable declarations inside of function are not ordered by length (in increasing order)',
- 'type': null
- }
- ],
- 'output': [
- 'function outer() {',
- ' var x;',
- ' var xyz;',
- ' function inner() {',
- ' var a = 10;',
- ' var ab = 5;',
- ' var abc = 5;',
- ' return a + b + c;',
- ' }',
- ' xyz = inner() + x;',
- ' return xyz;',
- '}'
- ].join( '\n' )
+ ]
};
invalid.push( test );
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md b/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md
index c1824d76f4f2..d5c22579fd9b 100644
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md
+++ b/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md
@@ -451,66 +451,6 @@ var count = context.count;
// returns 3
```
-
-
-#### TypedArrayFE.prototype.filter( predicate\[, thisArg] )
-
-Returns a new array containing the elements of an array which pass a test implemented by a predicate function.
-
-```javascript
-function predicate( v ) {
- return ( v % 2 === 0 );
-}
-
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
-
-var out = arr.filter( predicate );
-// returns
-
-var len = out.length;
-// returns 2
-
-var v = out.get( 0 );
-// returns 2.0
-
-v = out.get( 1 );
-// return 4.0
-```
-
-The `predicate` function is provided three arguments:
-
-- **value**: current array element.
-- **index**: current array element index.
-- **arr**: the array on which this method was called.
-
-To set the function execution context, provide a `thisArg`.
-
-```javascript
-function predicate( v, i ) {
- this.count += 1;
- return ( v % 2 === 0 );
-}
-
-var context = {
- 'count': 0
-};
-
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
-
-var out = arr.filter( predicate, context );
-// returns
-
-var len = out.length;
-// returns 2
-
-var count = context.count;
-// returns 4
-```
-
#### TypedArrayFE.prototype.get( i )
@@ -575,38 +515,6 @@ var idx = arr.indexOf( 5.0 );
// returns -1
```
-
-
-#### TypedArrayFE.prototype.lastIndexOf( searchElement\[, fromIndex] )
-
-Returns the last index at which a given element can be found in the array.
-
-```javascript
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 2.0 ] );
-
-var idx = arr.lastIndexOf( 2.0 );
-// returns 4
-
-idx = arr.lastIndexOf( 2.0, 3 );
-// returns 1
-
-idx = arr.lastIndexOf( 2.0, -2 );
-// returns 1
-```
-
-If `searchElement` is not present in the array, the method returns `-1`.
-
-```javascript
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 2.0 ] );
-
-var idx = arr.lastIndexOf( 5.0 );
-// returns -1
-```
-
#### TypedArray.prototype.map( callbackFn\[, thisArg] )
@@ -668,99 +576,7 @@ var out = arr.map( fcn, context );
var count = context.count;
// returns 3;
```
-
-
-
-#### TypedArray.prototype.reduce( reducerFn\[, initialValue] )
-
-Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.
-
-```javascript
-function reducer( acc, v ) {
- return ( acc && v );
-}
-
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
-// returns
-
-var out = arr.reduce( reducer );
-// returns 0.0
-```
-
-The reducer function is provided four arguments:
-
-- **acc**: accumulated result.
-- **value**: current array element.
-- **index**: current array element index.
-- **arr**: the array on which this method was called.
-
-By default, the function initializes the accumulated result to the first element in the array and passes the second array element as `value` during the first invocation of the provided callback. To begin accumulation from a different starting value and pass in the first array element as `value` during the first invocation of the provided callback, provide an `initialValue` argument.
-
-```javascript
-function reducer( acc, v ) {
- if ( v ) {
- return acc + 1;
- }
- return acc;
-}
-
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
-// returns
-
-var out = arr.reduce( reducer, 0 );
-// returns 2
-```
-
-
-
-#### TypedArray.prototype.reduceRight( reducerFn\[, initialValue] )
-
-Applies a provided callback function to each element of the array, in reverse order, passing in the return value from the calculation on the following element and returning the accumulated result upon completion.
-
-```javascript
-function reducer( acc, v ) {
- return ( acc && v );
-}
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
-// returns
-
-var out = arr.reduceRight( reducer );
-// returns 0.0
-```
-
-The reducer function is provided four arguments:
-
-- **acc**: accumulated result.
-- **value**: current array element.
-- **index**: current array element index.
-- **arr**: the array on which this method was called.
-
-By default, the function initializes the accumulated result to the first element in the array and passes the second array element as `value` during the first invocation of the provided callback. To begin accumulation from a different starting value and pass in the first array element as `value` during the first invocation of the provided callback, provide an `initialValue` argument.
-
-```javascript
-function reducer( acc, v ) {
- if ( v ) {
- return acc + 1;
- }
- return acc;
-}
-
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
-
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 0.0, 1.0 ] );
-// returns
-
-var out = arr.reduceRight( reducer, 0 );
-// returns 2
-```
-
#### TypedArrayFE.prototype.set( arr\[, offset] )
@@ -863,11 +679,11 @@ var count = context.count;
// returns 3
```
-
+
-#### TypedArrayFE.prototype.toString()
+#### TypedArray.prototype.toReversed()
-Serializes an array as a string.
+Returns a new typed array containing the elements in reversed order.
```javascript
var Float64ArrayFE = fixedEndianFactory( 'float64' );
@@ -875,37 +691,33 @@ var Float64ArrayFE = fixedEndianFactory( 'float64' );
var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] );
// returns
-var str = arr.toString();
-// returns '1,2,3'
-```
-
-
-
-#### TypedArrayFE.prototype.join( \[separator] )
+var out = arr.toReversed();
+// returns
-Serializes the array elements into a string, with elements separated by the specified `separator`. If no `separator` is provided, a comma (`,`) is used as the default.
+var v = out.get( 0 );
+// returns 3.0
-```javascript
-var Float64ArrayFE = fixedEndianFactory( 'float64' );
+v = out.get( 1 );
+// returns 2.0
-var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] );
+v = out.get( 2 );
+// returns 1.0
+```
-var str = arr.join();
-// returns '1,2,3'
+
-str = arr.join( ' - ' );
-// returns '1 - 2 - 3'
-```
+#### TypedArrayFE.prototype.toString()
-If the provided `separator` is not a string, it is coerced to a string.
+Serializes an array as a string.
```javascript
var Float64ArrayFE = fixedEndianFactory( 'float64' );
var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] );
+// returns
-var str = arr.join( 0 );
-// returns '10203'
+var str = arr.toString();
+// returns '1,2,3'
```
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.filter.length.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.filter.length.js
deleted file mode 100644
index c98adfb62652..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.filter.length.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var pow = require( '@stdlib/math/base/special/pow' );
-var zeroTo = require( '@stdlib/array/zero-to' );
-var pkg = require( './../package.json' ).name;
-var factory = require( './../lib' );
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// FUNCTIONS //
-
-/**
-* Predicate function.
-*
-* @private
-* @param {number} value - array element
-* @param {NonNegativeInteger} idx - array element index
-* @param {TypedArray} arr - array instance
-* @returns {boolean} boolean indicating whether a value passes a test
-*/
-function predicate( value ) {
- return value % 2 === 0;
-}
-
-/**
-* Creates a benchmark function.
-*
-* @private
-* @param {PositiveInteger} len - array length
-* @returns {Function} benchmark function
-*/
-function createBenchmark( len ) {
- var arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) );
- return benchmark;
-
- /**
- * Benchmark function.
- *
- * @private
- * @param {Benchmark} b - benchmark instance
- */
- function benchmark( b ) {
- var out;
- var i;
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- out = arr.filter( predicate );
- if ( typeof out !== 'object' ) {
- b.fail( 'should return an object' );
- }
- }
- b.toc();
- if ( !( out instanceof Float64ArrayFE ) ) {
- b.fail( 'should return a typed array' );
- }
- b.pass( 'benchmark finished' );
- b.end();
- }
-}
-
-
-// MAIN //
-
-/**
-* Main execution sequence.
-*
-* @private
-*/
-function main() {
- var len;
- var min;
- var max;
- var f;
- var i;
-
- min = 1; // 10^min
- max = 6; // 10^max
-
- for ( i = min; i <= max; i++ ) {
- len = pow( 10, i );
- f = createBenchmark( len );
- bench( pkg+':filter:len='+len, f );
- }
-}
-
-main();
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.join.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.join.js
deleted file mode 100644
index 8defd362df4d..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.join.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var factory = require( './../lib' );
-var pkg = require( './../package.json' ).name;
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// MAIN //
-
-bench( pkg+':join', function benchmark( b ) {
- var out;
- var arr;
- var i;
-
- arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- out = arr.join();
- if ( typeof out !== 'string' ) {
- b.fail( 'should return a string' );
- }
- }
- b.toc();
- if ( typeof out !== 'string' ) {
- b.fail( 'should return a string' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.last-index-of.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.last-index-of.js
deleted file mode 100644
index 695e73fb3623..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.last-index-of.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
-var factory = require( './../lib' );
-var pkg = require( './../package.json' ).name;
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// MAIN //
-
-bench( pkg+':lastIndexOf', function benchmark( b ) {
- var arr;
- var idx;
- var i;
-
- arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- idx = arr.lastIndexOf( 5.0, arr.length - 1 );
- if ( typeof idx !== 'number' ) {
- b.fail( 'should return an integer' );
- }
- }
- b.toc();
- if ( !isInteger( idx ) ) {
- b.fail( 'should return an integer' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.last-index-of.length.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.last-index-of.length.js
deleted file mode 100644
index a3d40f511d24..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.last-index-of.length.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var pow = require( '@stdlib/math/base/special/pow' );
-var zeroTo = require( '@stdlib/array/zero-to' );
-var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
-var factory = require( './../lib' );
-var pkg = require( './../package.json' ).name;
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// FUNCTIONS //
-
-/**
-* Creates a benchmark function.
-*
-* @private
-* @param {PositiveInteger} len - array length
-* @returns {Function} benchmark function
-*/
-function createBenchmark( len ) {
- var arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) );
- return benchmark;
-
- /**
- * Benchmark function.
- *
- * @private
- * @param {Benchmark} b - benchmark instance
- */
- function benchmark( b ) {
- var idx;
- var v;
- var i;
-
- v = len - 1;
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- idx = arr.lastIndexOf( v );
- if ( typeof idx !== 'number' ) {
- b.fail( 'should return an integer' );
- }
- }
- b.toc();
- if ( !isInteger( idx ) ) {
- b.fail( 'should return an integer' );
- }
- b.pass( 'benchmark finished' );
- b.end();
- }
-}
-
-
-// MAIN //
-
-/**
-* Main execution sequence.
-*
-* @private
-*/
-function main() {
- var len;
- var min;
- var max;
- var f;
- var i;
-
- min = 1; // 10^min
- max = 6; // 10^max
-
- for ( i = min; i <= max; i++ ) {
- len = pow( 10, i );
- f = createBenchmark( len );
- bench( pkg+':lastIndexOf:len='+len, f );
- }
-}
-
-main();
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce.js
deleted file mode 100644
index 9ad7fe329f45..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
-var pkg = require( './../package.json' ).name;
-var factory = require( './../lib' );
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// FUNCTIONS //
-
-/**
-* Reducer function.
-*
-* @private
-* @param {integer} acc - accumulated value
-* @param {number} value - current array element
-* @param {integer} index - current array index
-* @returns {integer} accumulated value
-*/
-function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
-}
-
-
-// MAIN //
-
-bench( pkg+':reduce', function benchmark( b ) {
- var out;
- var arr;
- var i;
-
- arr = new Float64ArrayFE( 'little-endian', [ 1.0, 0.0, 0.0, 1.0 ] );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- out = arr.reduce( reducer, 0 );
- if ( typeof out !== 'number' ) {
- b.fail( 'should return a number' );
- }
- }
- b.toc();
- if ( !isInteger( out ) ) {
- b.fail( 'should return an integer' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce.length.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce.length.js
deleted file mode 100644
index 0bd1ac04164a..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce.length.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var pow = require( '@stdlib/math/base/special/pow' );
-var zeroTo = require( '@stdlib/array/zero-to' );
-var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
-var pkg = require( './../package.json' ).name;
-var factory = require( './../lib' );
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// FUNCTIONS //
-
-/**
-* Reducer function.
-*
-* @private
-* @param {integer} acc - accumulated value
-* @param {number} value - current array element
-* @param {integer} index - current array index
-* @returns {integer} accumulated value
-*/
-function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
-}
-
-/**
-* Creates a benchmark function.
-*
-* @private
-* @param {PositiveInteger} len - array length
-* @returns {Function} benchmark function
-*/
-function createBenchmark( len ) {
- var arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) );
- return benchmark;
-
- /**
- * Benchmark function.
- *
- * @private
- * @param {Benchmark} b - benchmark instance
- */
- function benchmark( b ) {
- var out;
- var i;
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- out = arr.reduce( reducer );
- if ( typeof out !== 'number' ) {
- b.fail( 'should return a number' );
- }
- }
- b.toc();
- if ( !isInteger( out ) ) {
- b.fail( 'should return an integer' );
- }
- b.pass( 'benchmark finished' );
- b.end();
- }
-}
-
-
-// MAIN //
-
-/**
-* Main execution sequence.
-*
-* @private
-*/
-function main() {
- var len;
- var min;
- var max;
- var f;
- var i;
-
- min = 1; // 10^min
- max = 6; // 10^max
-
- for ( i = min; i <= max; i++ ) {
- len = pow( 10, i );
- f = createBenchmark( len );
- bench( pkg+':reduce:len='+len, f );
- }
-}
-
-main();
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce_right.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce_right.js
deleted file mode 100644
index 8507bd66c843..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce_right.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
-var pkg = require( './../package.json' ).name;
-var factory = require( './../lib' );
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// FUNCTIONS //
-
-/**
-* Reducer function.
-*
-* @private
-* @param {integer} acc - accumulated value
-* @param {number} value - current array element
-* @param {integer} index - current array index
-* @returns {integer} accumulated value
-*/
-function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
-}
-
-
-// MAIN //
-
-bench( pkg+':reduceRight', function benchmark( b ) {
- var out;
- var arr;
- var i;
-
- arr = new Float64ArrayFE( 'little-endian', [ 1.0, 0.0, 0.0, 1.0 ] );
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- out = arr.reduceRight( reducer, 0 );
- if ( typeof out !== 'number' ) {
- b.fail( 'should return a number' );
- }
- }
- b.toc();
- if ( !isInteger( out ) ) {
- b.fail( 'should return an integer' );
- }
- b.pass( 'benchmark finished' );
- b.end();
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce_right.length.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce_right.length.js
deleted file mode 100644
index a93d9b4cf6ca..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.reduce_right.length.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var bench = require( '@stdlib/bench' );
-var pow = require( '@stdlib/math/base/special/pow' );
-var zeroTo = require( '@stdlib/array/zero-to' );
-var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
-var pkg = require( './../package.json' ).name;
-var factory = require( './../lib' );
-
-
-// VARIABLES //
-
-var Float64ArrayFE = factory( 'float64' );
-
-
-// FUNCTIONS //
-
-/**
-* Reducer function.
-*
-* @private
-* @param {integer} acc - accumulated value
-* @param {number} value - current array element
-* @param {integer} index - current array index
-* @returns {integer} accumulated value
-*/
-function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
-}
-
-/**
-* Creates a benchmark function.
-*
-* @private
-* @param {PositiveInteger} len - array length
-* @returns {Function} benchmark function
-*/
-function createBenchmark( len ) {
- var arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) );
- return benchmark;
-
- /**
- * Benchmark function.
- *
- * @private
- * @param {Benchmark} b - benchmark instance
- */
- function benchmark( b ) {
- var out;
- var i;
-
- b.tic();
- for ( i = 0; i < b.iterations; i++ ) {
- out = arr.reduceRight( reducer );
- if ( typeof out !== 'number' ) {
- b.fail( 'should return a number' );
- }
- }
- b.toc();
- if ( !isInteger( out ) ) {
- b.fail( 'should return an integer' );
- }
- b.pass( 'benchmark finished' );
- b.end();
- }
-}
-
-
-// MAIN //
-
-/**
-* Main execution sequence.
-*
-* @private
-*/
-function main() {
- var len;
- var min;
- var max;
- var f;
- var i;
-
- min = 1; // 10^min
- max = 6; // 10^max
-
- for ( i = min; i <= max; i++ ) {
- len = pow( 10, i );
- f = createBenchmark( len );
- bench( pkg+':reduceRight:len='+len, f );
- }
-}
-
-main();
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.filter.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.to_reversed.js
similarity index 83%
rename from lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.filter.js
rename to lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.to_reversed.js
index 1cee20ed4b58..be982f0d5718 100644
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.filter.js
+++ b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.to_reversed.js
@@ -32,7 +32,7 @@ var Float64ArrayFE = factory( 'float64' );
// MAIN //
-bench( pkg+':filter', function benchmark( b ) {
+bench( pkg+':toReversed', function benchmark( b ) {
var out;
var arr;
var i;
@@ -41,19 +41,15 @@ bench( pkg+':filter', function benchmark( b ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- out = arr.filter( predicate );
+ out = arr.toReversed();
if ( typeof out !== 'object' ) {
b.fail( 'should return an object' );
}
}
b.toc();
- if ( !( out instanceof Float64ArrayFE ) ) {
- b.fail( 'should return a typed array' );
+ if ( !( out instanceof Float64ArrayFE) ) {
+ b.fail( 'should return a Typed Array' );
}
b.pass( 'benchmark finished' );
b.end();
-
- function predicate( v ) {
- return v % 2 === 0;
- }
});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.join.length.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.to_reversed.length.js
similarity index 87%
rename from lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.join.length.js
rename to lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.to_reversed.length.js
index 683f2a3bc169..caf0b0681a66 100644
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.join.length.js
+++ b/lib/node_modules/@stdlib/array/fixed-endian-factory/benchmark/benchmark.to_reversed.length.js
@@ -21,10 +21,10 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var pow = require( '@stdlib/math/base/special/pow' );
var zeroTo = require( '@stdlib/array/zero-to' );
-var factory = require( './../lib' );
+var pow = require( '@stdlib/math/base/special/pow' );
var pkg = require( './../package.json' ).name;
+var factory = require( './../lib' );
// VARIABLES //
@@ -43,6 +43,7 @@ var Float64ArrayFE = factory( 'float64' );
*/
function createBenchmark( len ) {
var arr;
+
arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) );
return benchmark;
@@ -58,14 +59,14 @@ function createBenchmark( len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- out = arr.join( '/' );
- if ( typeof out !== 'string' ) {
- b.fail( 'should return a string' );
+ out = arr.toReversed();
+ if ( typeof out !== 'object' ) {
+ b.fail( 'should return an object' );
}
}
b.toc();
- if ( typeof out !== 'string' ) {
- b.fail( 'should return a string' );
+ if ( !( out instanceof Float64ArrayFE ) ) {
+ b.fail( 'should return a Complex64Array' );
}
b.pass( 'benchmark finished' );
b.end();
@@ -93,7 +94,7 @@ function main() {
for ( i = min; i <= max; i++ ) {
len = pow( 10, i );
f = createBenchmark( len );
- bench( pkg+':join:len='+len, f );
+ bench( pkg+':toReversed:len='+len, f );
}
}
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/lib/main.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/lib/main.js
index a8dbe8ea235b..cb3efe04b9af 100644
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/lib/main.js
+++ b/lib/node_modules/@stdlib/array/fixed-endian-factory/lib/main.js
@@ -804,6 +804,56 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli
return out;
});
+ /**
+ * Returns a new typed array containing the elements in reversed order.
+ *
+ * @name toReversed
+ * @memberof TypedArray.prototype
+ * @type {Function}
+ * @throws {TypeError} `this` is not a typed array
+ * @returns {TypedArray} reversed array
+ *
+ * @example
+ * var Float64ArrayFE = factory( 'float64' );
+ *
+ * var arr = new Float64ArrayFE( 'little-endian', [1.0, 2.0, 3.0] );
+ *
+ * var out = arr.toReversed();
+ * // returns
+ *
+ * var v = out.get( 0 );
+ * // returns 1.0
+ *
+ * v = out.get( 1 );
+ * // returns 2.0
+ *
+ * v = out.get( 2 );
+ * // returns 3.0
+ */
+ setReadOnly( TypedArray.prototype, 'toReversed', function toReversed() {
+ var obuf;
+ var out;
+ var len;
+ var buf;
+ var i;
+ var v;
+
+ if ( !isTypedArray( this ) ) {
+ throw new TypeError( 'invalid invocation. `this` is not a typed array.' );
+ }
+
+ len = this._length;
+ out = new this.constructor( flag2byteOrder( this._isLE ), len );
+ buf = this._buffer;
+ obuf = out._buffer; // eslint-disable-line no-underscore-dangle
+ for ( i = 0; i < len; i++ ) {
+ v = buf[ GETTER ]( ( ( len - 1 ) * BYTES_PER_ELEMENT ) - ( i * BYTES_PER_ELEMENT ), this._isLE );
+ obuf[ SETTER ]( i * BYTES_PER_ELEMENT, v, this._isLE );
+ }
+
+ return out;
+ });
+
/**
* Applies a provided callback function to each element of the array, in order, passing in the return value from the calculation on the preceding element and returning the accumulated result upon completion.
*
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.filter.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.filter.js
deleted file mode 100644
index 5f3c14ac0eb1..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.filter.js
+++ /dev/null
@@ -1,225 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var tape = require( 'tape' );
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-var isFunction = require( '@stdlib/assert/is-function' );
-var factory = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof factory, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'the function returns a function', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( isFunction( ctor ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'attached to the prototype of the returned function is an `filter` method', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( hasOwnProp( ctor.prototype, 'filter' ), true, 'returns expected value' );
- t.strictEqual( isFunction( ctor.prototype.filter ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
-
- values = [
- '5',
- 5,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- [],
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.filter.call( value, predicate );
- };
- }
- function predicate( v ) {
- return v < 0;
- }
-});
-
-tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
-
- values = [
- '5',
- 3.14,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- []
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.filter( value );
- };
- }
-});
-
-tape( 'the method returns an empty array if operating on an empty array', function test( t ) {
- var ctor;
- var arr;
- var out;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian' );
- out = arr.filter( predicate );
-
- t.strictEqual( out.length, 0, 'returns expected value' );
- t.end();
-
- function predicate( v ) {
- return v > 0.0;
- }
-});
-
-tape( 'the method returns a new boolean array containing only those elements which satisfy a test condition', function test( t ) {
- var expected;
- var actual;
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ -1.0, -2.0, 3.0, 4.0 ] );
- expected = new ctor( 'little-endian', [ 3.0, 4.0 ] );
- actual = arr.filter( predicate );
-
- t.strictEqual( actual instanceof ctor, true, 'returns expected value' );
- t.strictEqual( actual.length, expected.length, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function predicate( v ) {
- return v > 0;
- }
-});
-
-tape( 'the method copies all elements to a new array if all elements satisfy a test condition', function test( t ) {
- var expected;
- var actual;
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
- expected = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
- actual = arr.filter( predicate );
-
- t.strictEqual( actual instanceof ctor, true, 'returns expected value' );
- t.notEqual( actual, arr, 'returns a new instance' );
- t.strictEqual( actual.length, expected.length, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function predicate( v ) {
- return v === v;
- }
-});
-
-tape( 'the method returns an empty array if no elements satisfy a test condition', function test( t ) {
- var expected;
- var actual;
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
- expected = new ctor( 'little-endian' );
- actual = arr.filter( predicate );
-
- t.strictEqual( actual instanceof ctor, true, 'returns expected value' );
- t.notEqual( actual, arr, 'returns a new instance' );
- t.strictEqual( actual.length, expected.length, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function predicate( v ) {
- return v !== v;
- }
-});
-
-tape( 'the method supports providing an execution context', function test( t ) {
- var expected;
- var actual;
- var ctor;
- var arr;
- var ctx;
-
- ctx = {
- 'count': 0
- };
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
- expected = new ctor( 'little-endian', [ 2.0, 4.0 ] );
- actual = arr.filter( predicate, ctx );
-
- t.strictEqual( actual instanceof ctor, true, 'returns expected value' );
- t.strictEqual( actual.length, expected.length, 'returns expected value' );
- t.deepEqual( actual, expected, 'returns expected value' );
- t.strictEqual( ctx.count, 4, 'returns expected value' );
- t.end();
-
- function predicate( v ) {
- this.count += 1; // eslint-disable-line no-invalid-this
- return ( v % 2 === 0 );
- }
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.join.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.join.js
deleted file mode 100644
index d98a86d01da9..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.join.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var tape = require( 'tape' );
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-var isFunction = require( '@stdlib/assert/is-function' );
-var factory = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof factory, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'attached to the prototype of the returned function is a `join` method', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( hasOwnProp( ctor.prototype, 'join' ), true, 'has property' );
- t.strictEqual( isFunction( ctor.prototype.join ), true, 'has method' );
- t.end();
-});
-
-tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', 5 );
-
- values = [
- '5',
- 5,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- [],
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided ' + values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.join.call( value );
- };
- }
-});
-
-tape( 'the method returns an empty string if invoked on an empty array', function test( t ) {
- var ctor;
- var str;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [] );
-
- str = arr.join();
- t.strictEqual( str, '', 'returns expected value' );
- t.end();
-});
-
-tape( 'the method returns a string representation of a typed array with elements separated by a separator', function test( t ) {
- var expected;
- var ctor;
- var str;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
- expected = '1@2@3@4';
-
- str = arr.join( '@' );
-
- t.strictEqual( str, expected, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method returns a string representation of a typed array with elements separated by a separator (single element)', function test( t ) {
- var expected;
- var ctor;
- var str;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0 ] );
- expected = '1';
-
- str = arr.join();
-
- t.strictEqual( str, expected, 'returns expected value' );
-
- arr = new ctor( 'little-endian', [ 2.0 ] );
- expected = '2';
-
- str = arr.join( ';' );
-
- t.strictEqual( str, expected, 'returns expected value' );
- t.end();
-});
-
-tape( 'if the method is invoked without a separator argument, the method returns a string representation of a typed array with elements separated by a comma', function test( t ) {
- var expected;
- var ctor;
- var str;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
- expected = '1,2,3,4';
-
- str = arr.join();
-
- t.strictEqual( str, expected, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method coerces non-string separators to strings', function test( t ) {
- var expected;
- var ctor;
- var str;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0 ] );
-
- expected = '1true2true3';
- str = arr.join( true );
- t.strictEqual( str, expected, 'returns expected value' );
-
- expected = '1null2null3';
- str = arr.join( null );
- t.strictEqual( str, expected, 'returns expected value' );
-
- expected = '1[object Object]2[object Object]3';
- str = arr.join( {} );
- t.strictEqual( str, expected, 'returns expected value' );
-
- t.end();
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.last-index-of.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.last-index-of.js
deleted file mode 100644
index 8333bb8402a0..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.last-index-of.js
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var tape = require( 'tape' );
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-var isFunction = require( '@stdlib/assert/is-function' );
-var factory = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof factory, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'the function returns a function', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( isFunction( ctor ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'attached to the prototype of the returned function is a `lastIndexOf` method', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( hasOwnProp( ctor.prototype, 'lastIndexOf' ), true, 'returns expected value' );
- t.strictEqual( isFunction( ctor.prototype.lastIndexOf ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', 5 );
-
- values = [
- '5',
- 5,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- [],
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.lastIndexOf.call( value, 0 );
- };
- }
-});
-
-tape( 'the method throws an error if provided a second argument which is not an integer', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
-
- values = [
- '5',
- 3.14,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- [],
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.lastIndexOf( 1.0, value );
- };
- }
-});
-
-tape( 'the method returns `-1` if provided a second argument which resolves to an index less than zero', function test( t ) {
- var ctor;
- var arr;
- var v;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
-
- v = arr.lastIndexOf( 1.0, -10 );
- t.strictEqual( v, -1, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method returns `-1` if operating on an empty array', function test( t ) {
- var ctor;
- var arr;
- var v;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [] );
-
- v = arr.lastIndexOf( 1.0 );
- t.strictEqual( v, -1, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the method returns `-1` if a search element is not found', function test( t ) {
- var ctor;
- var arr;
- var v;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
-
- v = arr.lastIndexOf( 10.0 );
- t.strictEqual( v, -1, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the method returns the index of the last match if an element is found', function test( t ) {
- var ctor;
- var arr;
- var v;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 2.0 ] );
-
- v = arr.lastIndexOf( 2.0 );
- t.strictEqual( v, 4, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the method supports specifying a starting search index', function test( t ) {
- var ctor;
- var arr;
- var v;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 2.0 ] );
-
- v = arr.lastIndexOf( 2.0, 4 );
- t.strictEqual( v, 4, 'returns expected value' );
-
- v = arr.lastIndexOf( 2.0, 1 );
- t.strictEqual( v, 1, 'returns expected value' );
-
- v = arr.lastIndexOf( 1.0, 0 );
- t.strictEqual( v, 0, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'the method supports specifying a starting search index (negative)', function test( t ) {
- var ctor;
- var arr;
- var v;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 2.0 ] );
-
- v = arr.lastIndexOf( 2.0, -1 );
- t.strictEqual( v, 4, 'returns expected value' );
-
- v = arr.lastIndexOf( 1.0, -3 );
- t.strictEqual( v, 0, 'returns expected value' );
-
- t.end();
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reduce.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reduce.js
deleted file mode 100644
index 7611a1748c63..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reduce.js
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var tape = require( 'tape' );
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-var isFunction = require( '@stdlib/assert/is-function' );
-var factory = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof factory, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'the function returns a function', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( isFunction( ctor ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'attached to the prototype of the returned function is a `reduce` method', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( hasOwnProp( ctor.prototype, 'reduce' ), true, 'returns expected value' );
- t.strictEqual( isFunction( ctor.prototype.reduce ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
-
- values = [
- '5',
- 5,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- [],
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.reduce.call( value, reducer );
- };
- }
-
- function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
- }
-});
-
-tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
-
- values = [
- '5',
- 3.14,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- []
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.reduce( value );
- };
- }
-});
-
-tape( 'the method throws an error if not provided an initial value when operating on an empty array', function test( t ) {
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian' );
- t.throws( foo, Error, 'throws an error' );
- t.end();
-
- function foo() {
- arr.reduce( reducer );
- }
-
- function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
- }
-});
-
-tape( 'the method uses the first element of the array as the initial value when an initial value is not provided', function test( t ) {
- var valueArray;
- var accArray;
- var expected;
- var actual;
- var ctor;
- var arr;
- var ind;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 0.0, 1.0, 0.0 ] );
- accArray = [ 1.0, 0.0, 0.0 ];
- valueArray = [ 0.0, 1.0, 0.0 ];
- expected = 0.0;
- actual = arr.reduce( reducer );
-
- t.strictEqual( actual, expected, 'returns expected value' );
-
- t.end();
-
- function reducer( acc, value, index ) {
- ind = index-1;
- t.strictEqual( acc, accArray[ ind ], 'returns expected value' );
- t.strictEqual( value, valueArray[ ind ], 'returns expected value' );
- return ( acc && value );
- }
-});
-
-tape( 'the method supports providing an initial value as the second argument', function test( t ) {
- var valueArray;
- var accArray;
- var expected;
- var actual;
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 0.0, 0.0, 1.0 ] );
- accArray = [ 0.0, 1.0, 1.0, 1.0 ];
- valueArray = [ 1.0, 0.0, 0.0, 1.0 ];
- expected = 2;
- actual = arr.reduce( reducer, 0 );
-
- t.strictEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function reducer( acc, value, index ) {
- t.strictEqual( acc, accArray[ index ], 'returns expected value' );
- t.strictEqual( value, valueArray[ index ], 'returns expected value' );
- if ( value ) {
- return acc + 1;
- }
- return acc;
- }
-});
-
-tape( 'the method returns the accumulated result', function test( t ) {
- var expected;
- var actual;
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 0.0, 1.0, 1.0 ] );
- expected = 0.0;
- actual = arr.reduce( reducer );
-
- t.strictEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function reducer( acc, value ) {
- return ( acc && value );
- }
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reduce_right.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reduce_right.js
deleted file mode 100644
index 79221a54aade..000000000000
--- a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.reduce_right.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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.
-*/
-
-'use strict';
-
-// MODULES //
-
-var tape = require( 'tape' );
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-var isFunction = require( '@stdlib/assert/is-function' );
-var factory = require( './../lib' );
-
-
-// TESTS //
-
-tape( 'main export is a function', function test( t ) {
- t.ok( true, __filename );
- t.strictEqual( typeof factory, 'function', 'main export is a function' );
- t.end();
-});
-
-tape( 'the function returns a function', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( isFunction( ctor ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'attached to the prototype of the returned function is a `reduceRight` method', function test( t ) {
- var ctor = factory( 'float64' );
- t.strictEqual( hasOwnProp( ctor.prototype, 'reduceRight' ), true, 'returns expected value' );
- t.strictEqual( isFunction( ctor.prototype.reduceRight ), true, 'returns expected value' );
- t.end();
-});
-
-tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );
-
- values = [
- '5',
- 5,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- [],
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.reduceRight.call( value, reducer );
- };
- }
-
- function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
- }
-});
-
-tape( 'the method throws an error if provided a first argument which is not a function', function test( t ) {
- var values;
- var ctor;
- var arr;
- var i;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
-
- values = [
- '5',
- 3.14,
- NaN,
- true,
- false,
- null,
- void 0,
- {},
- []
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- return arr.reduceRight( value );
- };
- }
-});
-
-tape( 'the method throws an error if not provided an initial value when operating on an empty array', function test( t ) {
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian' );
- t.throws( foo, Error, 'throws an error' );
- t.end();
-
- function foo() {
- arr.reduceRight( reducer );
- }
-
- function reducer( acc, value ) {
- if ( value ) {
- return acc + 1;
- }
- return acc;
- }
-});
-
-tape( 'the method uses the first element of the array as the initial value when an initial value is not provided', function test( t ) {
- var valueArray;
- var accArray;
- var expected;
- var actual;
- var ctor;
- var arr;
- var ind;
- var len;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 0.0, 1.0, 0.0 ] );
- len = arr.length;
- accArray = [ 0.0, 0.0, 0.0 ];
- valueArray = [ 1.0, 0.0, 1.0 ];
- expected = 0.0;
- actual = arr.reduceRight( reducer );
-
- t.strictEqual( actual, expected, 'returns expected value' );
-
- t.end();
-
- function reducer( acc, value, index ) {
- ind = ( len - index - 2 );
- t.strictEqual( acc, accArray[ ind ], 'returns expected value' );
- t.strictEqual( value, valueArray[ ind ], 'returns expected value' );
- return ( acc && value );
- }
-});
-
-tape( 'the method supports providing an initial value as the second argument', function test( t ) {
- var valueArray;
- var accArray;
- var expected;
- var actual;
- var ctor;
- var arr;
- var ind;
- var len;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 0.0, 0.0, 1.0 ] );
- len = arr.length;
- accArray = [ 0.0, 1.0, 1.0, 1.0 ];
- valueArray = [ 1.0, 0.0, 0.0, 1.0 ];
- expected = 2;
- actual = arr.reduceRight( reducer, 0 );
-
- t.strictEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function reducer( acc, value, index ) {
- ind = ( len - index - 1 );
- t.strictEqual( acc, accArray[ ind ], 'returns expected value' );
- t.strictEqual( value, valueArray[ ind ], 'returns expected value' );
- if ( value ) {
- return acc + 1;
- }
- return acc;
- }
-});
-
-tape( 'the method returns the accumulated result', function test( t ) {
- var expected;
- var actual;
- var ctor;
- var arr;
-
- ctor = factory( 'float64' );
- arr = new ctor( 'little-endian', [ 1.0, 0.0, 1.0, 1.0 ] );
- expected = 0.0;
- actual = arr.reduceRight( reducer );
-
- t.strictEqual( actual, expected, 'returns expected value' );
- t.end();
-
- function reducer( acc, value ) {
- return ( acc && value );
- }
-});
diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.to_reversed.js b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.to_reversed.js
new file mode 100644
index 000000000000..cace666e255e
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/fixed-endian-factory/test/test.to_reversed.js
@@ -0,0 +1,120 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var isFunction = require( '@stdlib/assert/is-function' );
+var instanceOf = require( '@stdlib/assert/instance-of' );
+var factory = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof factory, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'attached to the prototype of the main export is a `toReversed` method', function test( t ) {
+ var ctor = factory( 'float64' );
+ t.strictEqual( hasOwnProp( ctor.prototype, 'toReversed' ), true, 'returns expected value' );
+ t.strictEqual( isFunction( ctor.prototype.toReversed ), true, 'returns expected value' );
+ t.end();
+});
+
+tape( 'the method throws an error if invoked with a `this` context which is not a typed array instance', function test( t ) {
+ var values;
+ var ctor;
+ var arr;
+ var i;
+
+ ctor = factory( 'float64' );
+ arr = new ctor( 'little-endian', 5 );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ {},
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] );
+ }
+
+ function badValue( value ) {
+ return function badValue() {
+ return arr.toReversed.call( value );
+ };
+ }
+ t.end();
+});
+
+tape( 'the method returns an empty array if operating on an empty typed array', function test( t ) {
+ var ctor;
+ var arr;
+ var out;
+
+ ctor = factory( 'float64' );
+ arr = new ctor( 'little-endian' );
+ out = arr.toReversed();
+
+ t.strictEqual(out.length, 0, 'returns expected value');
+ t.end();
+});
+
+tape( 'the method returns a new typed array containing elements in reverse order', function test( t ) {
+ var expected;
+ var ctor;
+ var arr;
+ var out;
+
+ ctor = factory( 'float64' );
+ arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] );
+ expected = new ctor( 'little-endian', [ 4.0, 3.0, 2.0, 1.0 ] );
+ out = arr.toReversed();
+
+ t.strictEqual( instanceOf( out, ctor ), true, 'returns expected value' );
+ t.notEqual( out, arr, 'returns a new instance' );
+ t.deepEqual( out, expected, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected length' );
+ t.end();
+});
+
+tape( 'the method does not change the array length', function test( t ) {
+ var ctor;
+ var arr;
+ var out;
+
+ ctor = factory( 'float64' );
+ arr = new ctor( 'little-endian', 10 );
+ out = arr.toReversed();
+
+ t.strictEqual( out.length, 10, 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/README.md b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/README.md
index 099e037756ed..0409c0431cc4 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/README.md
@@ -36,7 +36,7 @@ limitations under the License.
var ssumpw = require( '@stdlib/blas/ext/base/ssumpw' );
```
-#### ssumpw( N, x, strideX )
+#### ssumpw( N, x, stride )
Computes the sum of single-precision floating-point strided array elements using pairwise summation.
@@ -44,8 +44,9 @@ Computes the sum of single-precision floating-point strided array elements using
var Float32Array = require( '@stdlib/array/float32' );
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+var N = x.length;
-var v = ssumpw( x.length, x, 1 );
+var v = ssumpw( N, x, 1 );
// returns 1.0
```
@@ -53,9 +54,9 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **x**: input [`Float32Array`][@stdlib/array/float32].
-- **strideX**: stride length for `x`.
+- **stride**: index increment for `x`.
-The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element:
+The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in `x`,
```javascript
var Float32Array = require( '@stdlib/array/float32' );
@@ -80,7 +81,7 @@ var v = ssumpw( 4, x1, 2 );
// returns 5.0
```
-#### ssumpw.ndarray( N, x, strideX, offsetX )
+#### ssumpw.ndarray( N, x, stride, offset )
Computes the sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
@@ -88,16 +89,17 @@ Computes the sum of single-precision floating-point strided array elements using
var Float32Array = require( '@stdlib/array/float32' );
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+var N = x.length;
-var v = ssumpw.ndarray( x.length, x, 1, 0 );
+var v = ssumpw.ndarray( N, x, 1, 0 );
// returns 1.0
```
The function has the following additional parameters:
-- **offsetX**: starting index for `x`.
+- **offset**: starting index for `x`.
-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 calculate the sum of every other element starting from the second element:
+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 calculate the sum of every other value in `x` starting from the second value
```javascript
var Float32Array = require( '@stdlib/array/float32' );
@@ -145,123 +147,6 @@ console.log( v );
-
-
-* * *
-
-
-
-## C APIs
-
-
-
-
-
-
-
-
-
-
-
-### Usage
-
-```c
-#include "stdlib/blas/ext/base/ssumpw.h"
-```
-
-#### stdlib_strided_ssumpw( N, \*X, strideX )
-
-Computes the sum of single-precision floating-point strided array elements using pairwise summation.
-
-```c
-const float x[] = { 1.0f, -2.0f, 2.0f };
-
-double v = stdlib_strided_ssumpw( 3, x, 1 );
-// returns 1.0
-```
-
-The function accepts the following arguments:
-
-- **N**: `[in] CBLAS_INT` number of indexed elements.
-- **X**: `[in] float*` input array.
-- **strideX**: `[in] CBLAS_INT` stride length for `X`.
-
-```c
-double stdlib_strided_ssumpw( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
-```
-
-#### stdlib_strided_ssumpw_ndarray( N, \*X, strideX, offsetX )
-
-Computes the sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
-
-```c
-const float x[] = { 1.0f, -2.0f, 2.0f };
-
-double v = stdlib_strided_ssumpw_ndarray( 3, x, 1, 0 );
-// returns 1.0
-```
-
-The function accepts the following arguments:
-
-- **N**: `[in] CBLAS_INT` number of indexed elements.
-- **X**: `[in] float*` input array.
-- **strideX**: `[in] CBLAS_INT` stride length for `X`.
-- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
-
-```c
-double stdlib_strided_ssumpw_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
-```
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-### Examples
-
-```c
-#include "stdlib/blas/ext/base/ssumpw.h"
-#include
-
-int main( void ) {
- // Create a strided array:
- const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
-
- // Specify the number of elements:
- const int N = 4;
-
- // Specify the stride length:
- const int strideX = 2;
-
- // Compute the sum:
- float v = stdlib_strided_ssumpw( N, x, strideX );
-
- // Print the result:
- printf( "sum: %f\n", v );
-}
-```
-
-
-
-
-
-
-
-
-
* * *
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/benchmark/c/benchmark.length.c
index 43deee0705a7..b16f3996f92e 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/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 benchmark1( int iterations, int len ) {
+static double benchmark( int iterations, int len ) {
double elapsed;
float x[ len ];
float v;
@@ -107,7 +107,6 @@ static double benchmark1( int iterations, int len ) {
v = 0.0f;
t = tic();
for ( i = 0; i < iterations; i++ ) {
- // cppcheck-suppress uninitvar
v = stdlib_strided_ssumpw( len, x, 1 );
if ( v != v ) {
printf( "should not return NaN\n" );
@@ -121,40 +120,6 @@ static double benchmark1( 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 ];
- double v;
- double t;
- int i;
-
- for ( i = 0; i < len; i++ ) {
- x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
- }
- v = 0.0f;
- t = tic();
- for ( i = 0; i < iterations; i++ ) {
- // cppcheck-suppress uninitvar
- v = stdlib_strided_ssumpw_ndarray( len, x, 1, 0 );
- if ( v != v ) {
- printf( "should not return NaN\n" );
- break;
- }
- }
- elapsed = tic() - t;
- if ( v != v ) {
- printf( "should not return NaN\n" );
- }
- return elapsed;
-}
-
/**
* Main execution sequence.
*/
@@ -177,18 +142,7 @@ int main( void ) {
for ( j = 0; j < REPEATS; j++ ) {
count += 1;
printf( "# c::%s:len=%d\n", NAME, 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 );
+ elapsed = benchmark( iter, len );
print_results( iter, elapsed );
printf( "ok %d benchmark finished\n", count );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/repl.txt
index 7a9163d7aed9..124979eb58c8 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/repl.txt
@@ -1,10 +1,10 @@
-{{alias}}( N, x, strideX )
+{{alias}}( N, x, stride )
Computes the sum of single-precision floating-point strided array elements
using pairwise summation.
- The `N` and stride parameters determine which elements in the strided array
- are accessed at runtime.
+ The `N` and `stride` parameters determine which elements in the strided
+ array are accessed at runtime.
Indexing is relative to the first index. To introduce an offset, use a typed
array view.
@@ -19,8 +19,8 @@
x: Float32Array
Input array.
- strideX: integer
- Stride length.
+ stride: integer
+ Index increment.
Returns
-------
@@ -34,7 +34,7 @@
> {{alias}}( x.length, x, 1 )
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 ] );
> {{alias}}( 3, x, 2 )
1.0
@@ -46,12 +46,12 @@
-1.0
-{{alias}}.ndarray( N, x, strideX, offsetX )
+{{alias}}.ndarray( N, x, stride, offset )
Computes the sum of single-precision floating-point strided array elements
using pairwise summation and 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
+ buffer, the `offset` parameter supports indexing semantics based on a
starting index.
Parameters
@@ -62,10 +62,10 @@
x: Float32Array
Input array.
- strideX: integer
- Stride length.
+ stride: integer
+ Index increment.
- offsetX: integer
+ offset: integer
Starting index.
Returns
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/types/index.d.ts
index e902e3055afa..02c827ce1925 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/docs/types/index.d.ts
@@ -27,7 +27,7 @@ interface Routine {
*
* @param N - number of indexed elements
* @param x - input array
- * @param strideX - stride length
+ * @param stride - stride length
* @returns sum
*
* @example
@@ -38,15 +38,15 @@ interface Routine {
* var v = ssumpw( x.length, x, 1 );
* // returns 1.0
*/
- ( N: number, x: Float32Array, strideX: number ): number;
+ ( N: number, x: Float32Array, stride: number ): number;
/**
* Computes the sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
*
* @param N - number of indexed elements
* @param x - input array
- * @param strideX - stride length
- * @param offsetX - starting index
+ * @param stride - stride length
+ * @param offset - starting index
* @returns sum
*
* @example
@@ -57,7 +57,7 @@ interface Routine {
* var v = ssumpw.ndarray( x.length, x, 1, 0 );
* // returns 1.0
*/
- ndarray( N: number, x: Float32Array, strideX: number, offsetX: number ): number;
+ ndarray( N: number, x: Float32Array, stride: number, offset: number ): number;
}
/**
@@ -65,7 +65,7 @@ interface Routine {
*
* @param N - number of indexed elements
* @param x - input array
-* @param strideX - stride length
+* @param stride - stride length
* @returns sum
*
* @example
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/examples/c/example.c b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/examples/c/example.c
index 47874abf1740..60e6e6fad586 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/examples/c/example.c
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/examples/c/example.c
@@ -17,20 +17,21 @@
*/
#include "stdlib/blas/ext/base/ssumpw.h"
+#include
#include
int main( void ) {
// Create a strided array:
- const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
+ const float x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
// Specify the number of elements:
- const int N = 4;
+ const int64_t N = 4;
// Specify the stride length:
- const int strideX = 2;
+ const int64_t stride = 2;
// Compute the sum:
- float v = stdlib_strided_ssumpw( N, x, strideX );
+ float v = stdlib_strided_ssumpw( N, x, stride );
// Print the result:
printf( "sum: %f\n", v );
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/include/stdlib/blas/ext/base/ssumpw.h b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/include/stdlib/blas/ext/base/ssumpw.h
index 3f44488af3da..9f6f0c4a599f 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/include/stdlib/blas/ext/base/ssumpw.h
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/include/stdlib/blas/ext/base/ssumpw.h
@@ -19,7 +19,7 @@
#ifndef STDLIB_BLAS_EXT_BASE_SSUMPW_H
#define STDLIB_BLAS_EXT_BASE_SSUMPW_H
-#include "stdlib/blas/base/shared.h"
+#include
/*
* 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,12 +31,7 @@ extern "C" {
/**
* Computes the sum of single-precision floating-point strided array elements using pairwise summation.
*/
-double API_SUFFIX(stdlib_strided_ssumpw)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
-
-/**
-* Computes the sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
-*/
-double API_SUFFIX(stdlib_strided_ssumpw_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
+float stdlib_strided_ssumpw( const int64_t N, const float *X, const int64_t stride );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/index.js
index fb578cab4308..1fff659ec3b6 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/index.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/index.js
@@ -28,8 +28,9 @@
* var ssumpw = require( '@stdlib/blas/ext/base/ssumpw' );
*
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
*
-* var v = ssumpw( x.length, x, 1 );
+* var v = ssumpw( N, x, 1 );
* // returns 1.0
*
* @example
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.js
index d73d98f00de9..8626313fcd9a 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.js
@@ -22,7 +22,6 @@
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var floor = require( '@stdlib/math/base/special/floor' );
-var isnan = require( '@stdlib/math/base/assert/is-nan' );
// VARIABLES //
@@ -46,8 +45,8 @@ var BLOCKSIZE = 128;
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} strideX - stride length
-* @param {NonNegativeInteger} offsetX - starting index
+* @param {integer} stride - stride length
+* @param {NonNegativeInteger} offset - starting index
* @returns {number} sum
*
* @example
@@ -58,7 +57,7 @@ var BLOCKSIZE = 128;
* var v = ssumpw( 4, x, 2, 1 );
* // returns 5.0
*/
-function ssumpw( N, x, strideX, offsetX ) {
+function ssumpw( N, x, stride, offset ) {
var ix;
var s0;
var s1;
@@ -76,45 +75,42 @@ function ssumpw( N, x, strideX, offsetX ) {
if ( N <= 0 ) {
return 0.0;
}
- ix = offsetX;
- if ( strideX === 0 ) {
- if ( isnan( x[ ix ] ) ) {
- return 0.0;
- }
- return N * x[ ix ];
+ if ( N === 1 || stride === 0 ) {
+ return x[ offset ];
}
+ ix = offset;
if ( N < 8 ) {
// Use simple summation...
s = 0.0;
for ( i = 0; i < N; i++ ) {
s = float64ToFloat32( s + x[ ix ] );
- ix += strideX;
+ ix += stride;
}
return s;
}
if ( N <= BLOCKSIZE ) {
// Sum a block with 8 accumulators (by loop unrolling, we lower the effective blocksize to 16)...
s0 = x[ ix ];
- s1 = x[ ix+strideX ];
- s2 = x[ ix+(2*strideX) ];
- s3 = x[ ix+(3*strideX) ];
- s4 = x[ ix+(4*strideX) ];
- s5 = x[ ix+(5*strideX) ];
- s6 = x[ ix+(6*strideX) ];
- s7 = x[ ix+(7*strideX) ];
- ix += 8 * strideX;
+ s1 = x[ ix+stride ];
+ s2 = x[ ix+(2*stride) ];
+ s3 = x[ ix+(3*stride) ];
+ s4 = x[ ix+(4*stride) ];
+ s5 = x[ ix+(5*stride) ];
+ s6 = x[ ix+(6*stride) ];
+ s7 = x[ ix+(7*stride) ];
+ ix += 8 * stride;
M = N % 8;
for ( i = 8; i < N-M; i += 8 ) {
s0 = float64ToFloat32( s0 + x[ ix ] );
- s1 = float64ToFloat32( s1 + x[ ix+strideX ] );
- s2 = float64ToFloat32( s2 + x[ ix+(2*strideX) ] );
- s3 = float64ToFloat32( s3 + x[ ix+(3*strideX) ] );
- s4 = float64ToFloat32( s4 + x[ ix+(4*strideX) ] );
- s5 = float64ToFloat32( s5 + x[ ix+(5*strideX) ] );
- s6 = float64ToFloat32( s6 + x[ ix+(6*strideX) ] );
- s7 = float64ToFloat32( s7 + x[ ix+(7*strideX) ] );
- ix += 8 * strideX;
+ s1 = float64ToFloat32( s1 + x[ ix+stride ] );
+ s2 = float64ToFloat32( s2 + x[ ix+(2*stride) ] );
+ s3 = float64ToFloat32( s3 + x[ ix+(3*stride) ] );
+ s4 = float64ToFloat32( s4 + x[ ix+(4*stride) ] );
+ s5 = float64ToFloat32( s5 + x[ ix+(5*stride) ] );
+ s6 = float64ToFloat32( s6 + x[ ix+(6*stride) ] );
+ s7 = float64ToFloat32( s7 + x[ ix+(7*stride) ] );
+ ix += 8 * stride;
}
// Pairwise sum the accumulators:
s = float64ToFloat32( float64ToFloat32( float64ToFloat32(s0+s1) + float64ToFloat32(s2+s3) ) + float64ToFloat32( float64ToFloat32(s4+s5) + float64ToFloat32(s6+s7) ) ); // eslint-disable-line max-len
@@ -122,14 +118,14 @@ function ssumpw( N, x, strideX, offsetX ) {
// Clean-up loop...
for ( i; i < N; i++ ) {
s = float64ToFloat32( s + x[ ix ] );
- ix += strideX;
+ ix += stride;
}
return s;
}
// Recurse by dividing by two, but avoiding non-multiples of unroll factor...
n = floor( N/2 );
n -= n % 8;
- return float64ToFloat32( ssumpw( n, x, strideX, ix ) + ssumpw( N-n, x, strideX, ix+(n*strideX) ) ); // eslint-disable-line max-len
+ return float64ToFloat32( ssumpw( n, x, stride, ix ) + ssumpw( N-n, x, stride, ix+(n*stride) ) ); // eslint-disable-line max-len
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.native.js
index f206e28dec82..e6bfcf630720 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ndarray.native.js
@@ -20,7 +20,9 @@
// MODULES //
-var addon = require( './../src/addon.node' );
+var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' );
+var offsetView = require( '@stdlib/strided/base/offset-view' );
+var addon = require( './ssumpw.native.js' );
// MAIN //
@@ -30,8 +32,8 @@ var addon = require( './../src/addon.node' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} strideX - stride length
-* @param {NonNegativeInteger} offsetX - starting index
+* @param {integer} stride - stride length
+* @param {NonNegativeInteger} offset - starting index
* @returns {number} sum
*
* @example
@@ -42,8 +44,11 @@ var addon = require( './../src/addon.node' );
* var v = ssumpw( 4, x, 2, 1 );
* // returns 5.0
*/
-function ssumpw( N, x, strideX, offsetX ) {
- return addon.ndarray( N, x, strideX, offsetX );
+function ssumpw( N, x, stride, offset ) {
+ var view;
+ offset = minViewBufferIndex( N, stride, offset );
+ view = offsetView( x, offset );
+ return addon( N, view, stride );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.js
index bf5308c132be..50eefb89e3c7 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.js
@@ -20,8 +20,8 @@
// MODULES //
-var stride2offset = require( '@stdlib/strided/base/stride2offset' );
-var ndarray = require( './ndarray.js' );
+var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
+var sum = require( './ndarray.js' );
// MAIN //
@@ -39,19 +39,44 @@ var ndarray = require( './ndarray.js' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} strideX - stride length
+* @param {integer} stride - stride length
* @returns {number} sum
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
*
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
*
-* var v = ssumpw( x.length, x, 1 );
+* var v = ssumpw( N, x, 1 );
* // returns 1.0
*/
-function ssumpw( N, x, strideX ) {
- return ndarray( N, x, strideX, stride2offset( N, strideX ) );
+function ssumpw( N, x, stride ) {
+ var ix;
+ var s;
+ var i;
+
+ if ( N <= 0 ) {
+ return 0.0;
+ }
+ if ( N === 1 || stride === 0 ) {
+ return x[ 0 ];
+ }
+ if ( stride < 0 ) {
+ ix = (1-N) * stride;
+ } else {
+ ix = 0;
+ }
+ if ( N < 8 ) {
+ // Use simple summation...
+ s = 0.0;
+ for ( i = 0; i < N; i++ ) {
+ s = float64ToFloat32( s + x[ ix ] );
+ ix += stride;
+ }
+ return s;
+ }
+ return sum( N, x, stride, ix );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.native.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.native.js
index 88fdadc0cefe..e52820181c60 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/lib/ssumpw.native.js
@@ -30,19 +30,20 @@ var addon = require( './../src/addon.node' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} strideX - stride length
+* @param {integer} stride - stride length
* @returns {number} sum
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
*
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
+* var N = x.length;
*
-* var v = ssumpw( x.length, x, 1 );
+* var v = ssumpw( N, x, 1 );
* // returns 1.0
*/
-function ssumpw( N, x, strideX ) {
- return addon( N, x, strideX );
+function ssumpw( N, x, stride ) {
+ return addon( N, x, stride );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/manifest.json
index 2e4581f2d856..92cb2fbd64fb 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/manifest.json
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/manifest.json
@@ -28,55 +28,49 @@
{
"task": "build",
"src": [
- "./src/main.c"
+ "./src/ssumpw.c"
],
"include": [
"./include"
],
- "libraries": [],
+ "libraries": [
+ "-lm"
+ ],
"libpath": [],
"dependencies": [
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
- "@stdlib/napi/argv-strided-float32array",
- "@stdlib/napi/create-double",
- "@stdlib/math/base/assert/is-nanf",
- "@stdlib/blas/base/shared",
- "@stdlib/strided/base/stride2offset"
+ "@stdlib/napi/argv-strided-float32array"
]
},
{
"task": "benchmark",
"src": [
- "./src/main.c"
+ "./src/ssumpw.c"
],
"include": [
"./include"
],
- "libraries": [],
+ "libraries": [
+ "-lm"
+ ],
"libpath": [],
- "dependencies": [
- "@stdlib/math/base/assert/is-nanf",
- "@stdlib/blas/base/shared",
- "@stdlib/strided/base/stride2offset"
- ]
+ "dependencies": []
},
{
"task": "examples",
"src": [
- "./src/main.c"
+ "./src/ssumpw.c"
],
"include": [
"./include"
],
- "libraries": [],
+ "libraries": [
+ "-lm"
+ ],
"libpath": [],
- "dependencies": [
- "@stdlib/math/base/assert/is-nanf",
- "@stdlib/blas/base/shared",
- "@stdlib/strided/base/stride2offset"
- ]
+ "dependencies": []
}
]
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/addon.c
index e0868a246b27..48352d37510f 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/addon.c
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/addon.c
@@ -17,13 +17,12 @@
*/
#include "stdlib/blas/ext/base/ssumpw.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_strided_float32array.h"
-#include "stdlib/napi/create_double.h"
#include
+#include
/**
* Receives JavaScript callback invocation data.
@@ -35,27 +34,14 @@
static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV( env, info, argv, argc, 3 );
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
- STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
- STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
- STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_ssumpw)( N, X, strideX ), v )
- return v;
-}
+ STDLIB_NAPI_ARGV_INT64( env, stride, argv, 2 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, stride, argv, 1 );
+
+ napi_value v;
+ napi_status status = napi_create_double( env, (double)stdlib_strided_ssumpw( N, X, stride ), &v );
+ assert( status == napi_ok );
-/**
-* 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, 4 );
- STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
- STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
- STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
- STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
- STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_ssumpw_ndarray)( N, X, strideX, offsetX ), v )
return v;
}
-STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method );
+STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/main.c
deleted file mode 100644
index 910cc7a804d2..000000000000
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/main.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2024 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/ssumpw.h"
-#include "stdlib/math/base/assert/is_nanf.h"
-#include "stdlib/blas/base/shared.h"
-#include "stdlib/strided/base/stride2offset.h"
-
-/**
-* Computes the sum of single-precision floating-point strided array elements using pairwise summation.
-*
-* ## Method
-*
-* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
-*
-* ## References
-*
-* - Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
-*
-* @param N number of indexed elements
-* @param X input array
-* @param strideX stride length
-* @return output value
-*/
-double API_SUFFIX(stdlib_strided_ssumpw)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX ) {
- CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
- API_SUFFIX(stdlib_strided_ssumpw_ndarray)( N, X, strideX, ox );
-}
-
-/**
-* Computes the sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
-*
-* ## Method
-*
-* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
-*
-* ## References
-*
-* - Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
-*
-* @param N number of indexed elements
-* @param X input array
-* @param strideX stride length
-* @param offsetX starting index
-* @return output value
-*/
-double API_SUFFIX(stdlib_strided_ssumpw_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
- CBLAS_INT ix;
- CBLAS_INT M;
- CBLAS_INT n;
- CBLAS_INT i;
- double sum;
- double s0;
- double s1;
- double s2;
- double s3;
- double s4;
- double s5;
- double s6;
- double s7;
-
- if ( N <= 0 ) {
- return 0.0f;
- }
- ix = offsetX;
- if ( strideX == 0 ) {
- if ( stdlib_base_is_nanf( X[ ix ] ) ) {
- return 0.0f;
- }
- return N * X[ ix ];
- }
- if ( N < 8 ) {
- // Use simple summation...
- sum = 0.0f;
- for ( i = 0; i < N; i++ ) {
- sum += X[ ix ];
- ix += strideX;
- }
- return sum;
- }
- // Blocksize for pairwise summation: 128 (NOTE: decreasing the blocksize decreases rounding error as more pairs are summed, but also decreases performance. Because the inner loop is unrolled eight times, the blocksize is effectively `16`.)
- if ( N <= 128 ) {
- // Sum a block with 8 accumulators (by loop unrolling, we lower the effective blocksize to 16)...
- s0 = X[ ix ];
- s1 = X[ ix+strideX ];
- s2 = X[ ix+(2*strideX) ];
- s3 = X[ ix+(3*strideX) ];
- s4 = X[ ix+(4*strideX) ];
- s5 = X[ ix+(5*strideX) ];
- s6 = X[ ix+(6*strideX) ];
- s7 = X[ ix+(7*strideX) ];
- ix += 8 * strideX;
-
- M = N % 8;
- for ( i = 8; i < N-M; i += 8 ) {
- s0 += X[ ix ];
- s1 += X[ ix+strideX ];
- s2 += X[ ix+(2*strideX) ];
- s3 += X[ ix+(3*strideX) ];
- s4 += X[ ix+(4*strideX) ];
- s5 += X[ ix+(5*strideX) ];
- s6 += X[ ix+(6*strideX) ];
- s7 += X[ ix+(7*strideX) ];
- ix += 8 * strideX;
- }
- // Pairwise sum the accumulators:
- sum = ( (s0+s1) + (s2+s3) ) + ( (s4+s5) + (s6+s7) );
-
- // Clean-up loop...
- for (; i < N; i++ ) {
- sum += X[ ix ];
- ix += strideX;
- }
- return sum;
- }
- // Recurse by dividing by two, but avoiding non-multiples of unroll factor...
- n = N / 2;
- n -= n % 8;
- return stdlib_strided_ssumpw_ndarray( n, X, strideX, ix ) + stdlib_strided_ssumpw_ndarray( N-n, X, strideX, ix+(n*strideX) );
-}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/ssumpw.c b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/ssumpw.c
new file mode 100644
index 000000000000..0fcdb8965649
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/src/ssumpw.c
@@ -0,0 +1,121 @@
+/**
+* @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/ssumpw.h"
+#include
+
+/**
+* Computes the sum of single-precision floating-point strided array elements using pairwise summation.
+*
+* ## Method
+*
+* - This implementation uses pairwise summation, which accrues rounding error `O(log2 N)` instead of `O(N)`. The recursion depth is also `O(log2 N)`.
+*
+* ## References
+*
+* - Higham, Nicholas J. 1993. "The Accuracy of Floating Point Summation." _SIAM Journal on Scientific Computing_ 14 (4): 783–99. doi:[10.1137/0914050](https://doi.org/10.1137/0914050).
+*
+* @param N number of indexed elements
+* @param X input array
+* @param stride stride length
+* @return output value
+*/
+float stdlib_strided_ssumpw( const int64_t N, const float *X, const int64_t stride ) {
+ float *xp1;
+ float *xp2;
+ int64_t ix;
+ int64_t M;
+ int64_t n;
+ int64_t i;
+ float sum;
+ float s0;
+ float s1;
+ float s2;
+ float s3;
+ float s4;
+ float s5;
+ float s6;
+ float s7;
+
+ if ( N <= 0 ) {
+ return 0.0f;
+ }
+ if ( N == 1 || stride == 0 ) {
+ return X[ 0 ];
+ }
+ if ( stride < 0 ) {
+ ix = (1-N) * stride;
+ } else {
+ ix = 0;
+ }
+ if ( N < 8 ) {
+ // Use simple summation...
+ sum = 0.0f;
+ for ( i = 0; i < N; i++ ) {
+ sum += X[ ix ];
+ ix += stride;
+ }
+ return sum;
+ }
+ // Blocksize for pairwise summation: 128 (NOTE: decreasing the blocksize decreases rounding error as more pairs are summed, but also decreases performance. Because the inner loop is unrolled eight times, the blocksize is effectively `16`.)
+ if ( N <= 128 ) {
+ // Sum a block with 8 accumulators (by loop unrolling, we lower the effective blocksize to 16)...
+ s0 = X[ ix ];
+ s1 = X[ ix+stride ];
+ s2 = X[ ix+(2*stride) ];
+ s3 = X[ ix+(3*stride) ];
+ s4 = X[ ix+(4*stride) ];
+ s5 = X[ ix+(5*stride) ];
+ s6 = X[ ix+(6*stride) ];
+ s7 = X[ ix+(7*stride) ];
+ ix += 8 * stride;
+
+ M = N % 8;
+ for ( i = 8; i < N-M; i += 8 ) {
+ s0 += X[ ix ];
+ s1 += X[ ix+stride ];
+ s2 += X[ ix+(2*stride) ];
+ s3 += X[ ix+(3*stride) ];
+ s4 += X[ ix+(4*stride) ];
+ s5 += X[ ix+(5*stride) ];
+ s6 += X[ ix+(6*stride) ];
+ s7 += X[ ix+(7*stride) ];
+ ix += 8 * stride;
+ }
+ // Pairwise sum the accumulators:
+ sum = ((s0+s1) + (s2+s3)) + ((s4+s5) + (s6+s7));
+
+ // Clean-up loop...
+ for (; i < N; i++ ) {
+ sum += X[ ix ];
+ ix += stride;
+ }
+ return sum;
+ }
+ // Recurse by dividing by two, but avoiding non-multiples of unroll factor...
+ n = N / 2;
+ n -= n % 8;
+ if ( stride < 0 ) {
+ xp1 = (float *)X + ( (n-N)*stride );
+ xp2 = (float *)X;
+ } else {
+ xp1 = (float *)X;
+ xp2 = (float *)X + ( n*stride );
+ }
+ return stdlib_strided_ssumpw( n, xp1, stride ) + stdlib_strided_ssumpw( N-n, xp2, stride );
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.js
index 7f66952466c4..e9c183089d57 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.js
@@ -156,26 +156,14 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
t.end();
});
-tape( 'if provided a `stride` parameter equal to `0`, the function returns the sum of the first element repeated N times', function test( t ) {
+tape( 'if provided a `stride` parameter equal to `0`, the function returns the first indexed element', function test( t ) {
var x;
var v;
x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
v = ssumpw( x.length, x, 0, 0 );
- t.strictEqual( v, 5.0, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns 0.0', function test( t ) {
- var x;
- var v;
-
- x = new Float32Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
-
- v = ssumpw( x.length, x, 0, 0 );
- t.strictEqual( v, 0.0, 'returns expected value' );
+ t.strictEqual( v, 1.0, 'returns expected value' );
t.end();
});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.native.js
index 32adc1f11529..99493e472db6 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ndarray.native.js
@@ -165,26 +165,14 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
t.end();
});
-tape( 'if provided a `stride` parameter equal to `0`, the function returns the sum of the first element repeated N times', opts, function test( t ) {
+tape( 'if provided a `stride` parameter equal to `0`, the function returns the first indexed element', opts, function test( t ) {
var x;
var v;
x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
v = ssumpw( x.length, x, 0, 0 );
- t.strictEqual( v, 5.0, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns 0.0', opts, function test( t ) {
- var x;
- var v;
-
- x = new Float32Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
-
- v = ssumpw( x.length, x, 0, 0 );
- t.strictEqual( v, 0.0, 'returns expected value' );
+ t.strictEqual( v, 1.0, 'returns expected value' );
t.end();
});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.js
index 0eb782742a30..ea6438f6a75a 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.js
@@ -156,26 +156,14 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
t.end();
});
-tape( 'if provided a `stride` parameter equal to `0`, the function returns the sum of the first element repeated N times', function test( t ) {
+tape( 'if provided a `stride` parameter equal to `0`, the function returns the first element', function test( t ) {
var x;
var v;
x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
v = ssumpw( x.length, x, 0 );
- t.strictEqual( v, 5.0, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns 0.0', function test( t ) {
- var x;
- var v;
-
- x = new Float32Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
-
- v = ssumpw( x.length, x, 0 );
- t.strictEqual( v, 0.0, 'returns expected value' );
+ t.strictEqual( v, 1.0, 'returns expected value' );
t.end();
});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.native.js b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.native.js
index 182dba95473b..f8c3bac2d293 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.native.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/ssumpw/test/test.ssumpw.native.js
@@ -247,26 +247,14 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
t.end();
});
-tape( 'if provided a `stride` parameter equal to `0`, the function returns the sum of the first element repeated N times', opts, function test( t ) {
+tape( 'if provided a `stride` parameter equal to `0`, the function returns the first element', opts, function test( t ) {
var x;
var v;
x = new Float32Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
v = ssumpw( x.length, x, 0 );
- t.strictEqual( v, 5.0, 'returns expected value' );
-
- t.end();
-});
-
-tape( 'if provided a `stride` parameter equal to `0` and the first element is `NaN`, the function returns 0.0', opts, function test( t ) {
- var x;
- var v;
-
- x = new Float32Array( [ NaN, -2.0, -4.0, 5.0, 3.0 ] );
-
- v = ssumpw( x.length, x, 0 );
- t.strictEqual( v, 0.0, 'returns expected value' );
+ t.strictEqual( v, 1.0, 'returns expected value' );
t.end();
});