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
27 changes: 5 additions & 22 deletions lib/node_modules/@stdlib/ndarray/any/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ var x = array( [ [ [ -1.0, 0.0 ] ], [ [ -3.0, -4.0 ] ], [ [ 5.0, -6.0 ] ] ] );

// Perform reduction:
var out = any( x );
// returns <ndarray>

var v = out.get();
// returns true
// returns <ndarray>[ true ]
```

The function accepts the following arguments:
Expand All @@ -69,7 +66,6 @@ By default, the function performs a reduction over all elements in a provided [`

```javascript
var array = require( '@stdlib/ndarray/array' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );

// Create an input ndarray:
var x = array( [ [ [ -1.0, 0.0 ] ], [ [ -3.0, 0.0 ] ], [ [ 5.0, 0.0 ] ] ] );
Expand All @@ -79,17 +75,13 @@ var x = array( [ [ [ -1.0, 0.0 ] ], [ [ -3.0, 0.0 ] ], [ [ 5.0, 0.0 ] ] ] );
var out = any( x, {
'dims': [ 1, 2 ]
});
// returns <ndarray>

var v = ndarray2array( out );
// returns [ true, true, true ]
// returns <ndarray>[ true, true, true ]
```

By default, the function returns an [`ndarray`][@stdlib/ndarray/ctor] having a shape matching only the non-reduced dimensions of the input [`ndarray`][@stdlib/ndarray/ctor] (i.e., the reduced dimensions are dropped). To include the reduced dimensions as singleton dimensions in the output [`ndarray`][@stdlib/ndarray/ctor], set the `keepdims` option to `true`.

```javascript
var array = require( '@stdlib/ndarray/array' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );

// Create an input ndarray:
var x = array( [ [ [ -1.0, 0.0 ] ], [ [ -3.0, 0.0 ] ], [ [ 5.0, 0.0 ] ] ] );
Expand All @@ -100,10 +92,7 @@ var out = any( x, {
'dims': [ 1, 2 ],
'keepdims': true
});
// returns <ndarray>

var v = ndarray2array( out );
// returns [ [ [ true ] ], [ [ true ] ], [ [ true ] ] ]
// returns <ndarray>[ [ [ true ] ], [ [ true ] ], [ [ true ] ] ]
```

#### any.assign( x, out\[, options] )
Expand All @@ -125,13 +114,10 @@ var y = empty( [], {

// Perform reduction:
var out = any.assign( x, y );
// returns <ndarray>
// returns <ndarray>[ true ]

var bool = ( out === y );
// returns true

var v = y.get();
// returns true
```

The function accepts the following arguments:
Expand All @@ -149,7 +135,6 @@ By default, the function performs a reduction over all elements in a provided [`
```javascript
var array = require( '@stdlib/ndarray/array' );
var empty = require( '@stdlib/ndarray/empty' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );

// Create an input ndarray:
var x = array( [ [ [ -1.0, 0.0 ] ], [ [ -3.0, 0.0 ] ], [ [ 5.0, 0.0 ] ] ] );
Expand All @@ -164,12 +149,10 @@ var y = empty( [ 3 ], {
var out = any.assign( x, y, {
'dims': [ 1, 2 ]
});
// returns <ndarray>[ true, true, true ]

var bool = ( out === y );
// returns true

var v = ndarray2array( y );
// returns [ true, true, true ]
```

</section>
Expand Down
10 changes: 2 additions & 8 deletions lib/node_modules/@stdlib/ndarray/any/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@
> y.get()
true
> y = {{alias}}( x, { 'keepdims': true } )
<ndarray>
> {{alias:@stdlib/ndarray/to-array}}( y )
[ [ true ] ]
> y.get( 0, 0 )
true
<ndarray>[ [ true ] ]


{{alias}}.assign( x, y[, options] )
Expand Down Expand Up @@ -72,11 +68,9 @@
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 0.0 ], [ 0.0, 1.0 ] ] );
> var y = {{alias:@stdlib/ndarray/from-scalar}}( false );
> var out = {{alias}}.assign( x, y )
<ndarray>
<ndarray>[ true ]
> var bool = ( out === y )
true
> y.get()
true

See Also
--------
20 changes: 4 additions & 16 deletions lib/node_modules/@stdlib/ndarray/any/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ interface Any {
*
* // Perform reduction:
* var out = any( x );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
( x: ndarray, options?: Options ): boolndarray;

Expand Down Expand Up @@ -120,10 +117,7 @@ interface Any {
*
* // Perform reduction:
* var out = any.assign( x, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
assign<T extends ndarray>( x: ndarray, y: T, options?: BaseOptions ): T;
}
Expand Down Expand Up @@ -158,10 +152,7 @@ interface Any {
*
* // Perform reduction:
* var out = any( x );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -190,10 +181,7 @@ interface Any {
*
* // Perform reduction:
* var out = any.assign( x, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
declare var any: Any;

Expand Down
5 changes: 1 addition & 4 deletions lib/node_modules/@stdlib/ndarray/any/lib/assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ var validate = require( './validate.js' );
*
* // Perform reduction:
* var out = assign( x, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
function assign( x, y, options ) {
var opts;
Expand Down
10 changes: 2 additions & 8 deletions lib/node_modules/@stdlib/ndarray/any/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
*
* // Perform reduction:
* var out = any( x );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -78,10 +75,7 @@
*
* // Perform reduction:
* var out = any.assign( x, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/

// MODULES //
Expand Down
5 changes: 1 addition & 4 deletions lib/node_modules/@stdlib/ndarray/any/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ var validate = require( './validate.js' );
*
* // Perform reduction:
* var out = any( x );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
function any( x, options ) {
var opts;
Expand Down