Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions lib/node_modules/@stdlib/utils/map-reduce-right/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ var mean = out / ctx.count;
```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );
var cceil = require( '@stdlib/math/base/special/cceil' );
var cceilf = require( '@stdlib/math/base/special/cceilf' );
var realf = require( '@stdlib/complex/float32/real' );
var imagf = require( '@stdlib/complex/float32/imag' );

Expand All @@ -150,14 +150,8 @@ var mean = out / ctx.count;

var x = new Complex64Array( [ 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5 ] );

var v = mapReduceRight( x, new Complex64( 0.0, 0.0 ), cceil, sum );
// returns <Complex64>

var re = realf( v );
// returns 20.0

var im = imagf( v );
// returns 24.0
var v = mapReduceRight( x, new Complex64( 0.0, 0.0 ), cceilf, sum );
// returns <Complex64>[ 20.0, 24.0 ]
```

- For [`ndarray`][@stdlib/ndarray/ctor]-like objects, the function performs a single-pass map-reduce operation over the entire input [`ndarray`][@stdlib/ndarray/ctor] (i.e., higher-order [`ndarray`][@stdlib/ndarray/ctor] dimensions are flattened to a single-dimension).
Expand Down
15 changes: 4 additions & 11 deletions lib/node_modules/@stdlib/utils/map-reduce-right/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@
* @example
* var Complex64Array = require( '@stdlib/array/complex64' );
* var Complex64 = require( '@stdlib/complex/float32/ctor' );
* var realf = require( '@stdlib/complex/float32/real' );
* var imagf = require( '@stdlib/complex/float32/imag' );
* var cceil = require( '@stdlib/math/base/special/cceil' );
* var cadd = require( '@stdlib/complex/float64/base/add' );
* var cceilf = require( '@stdlib/math/base/special/cceilf' );
* var cadd = require( '@stdlib/complex/float32/base/add' );
* var naryFunction = require( '@stdlib/utils/nary-function' );
*
* // Create a data buffer:
Expand Down Expand Up @@ -91,13 +89,8 @@
* x.ref = x;
*
* // Compute the sum:
* var v = mapReduceRight( x, new Complex64( 0.0, 0.0 ), naryFunction( cceil, 1 ), naryFunction( cadd, 2 ) );
*
* var re = realf( v );
* // returns 20.0
*
* var im = imagf( v );
* // returns 24.0
* var v = mapReduceRight( x, new Complex64( 0.0, 0.0 ), naryFunction( cceilf, 1 ), naryFunction( cadd, 2 ) );

Check warning on line 92 in lib/node_modules/@stdlib/utils/map-reduce-right/lib/ndarray.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "cadd"

Check warning on line 92 in lib/node_modules/@stdlib/utils/map-reduce-right/lib/ndarray.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unknown word: "cceilf"
* // returns <Complex64>[ 20.0, 24.0 ]
*/
function mapReduceRight( x, initial, mapper, reducer, thisArg ) {
var xbuf;
Expand Down
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/utils/map-reduce-right/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ var tape = require( 'tape' );
var noop = require( '@stdlib/utils/noop' );
var naryFunction = require( '@stdlib/utils/nary-function' );
var add = require( '@stdlib/number/float64/base/add' );
var cadd = require( '@stdlib/complex/float64/base/add' );
var cadd = require( '@stdlib/complex/float32/base/add' );
var abs = require( '@stdlib/math/base/special/abs' );
var cceil = require( '@stdlib/math/base/special/cceil' );
var cceilf = require( '@stdlib/math/base/special/cceilf' );
var Float64Array = require( '@stdlib/array/float64' );
var Complex64Array = require( '@stdlib/array/complex64' );
var array = require( '@stdlib/ndarray/array' );
Expand Down Expand Up @@ -239,7 +239,7 @@ tape( 'the function performs a map-reduce operation for each element in an array
var f1;
var f2;

f1 = naryFunction( cceil, 1 );
f1 = naryFunction( cceilf, 1 );
f2 = naryFunction( cadd, 2 );

arr = new Complex64Array( [ 1.5, 2.5, 3.5, 4.5, 5.5, 6.5 ] );
Expand Down