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
28 changes: 5 additions & 23 deletions lib/node_modules/@stdlib/ndarray/some/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 ] ], [ [ 0.0, 6.0 ] ] ] );

// Perform reduction:
var out = some( x, 3 );
// returns <ndarray>

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

The function accepts the following arguments:
Expand All @@ -70,7 +67,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, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] );
Expand All @@ -82,17 +78,13 @@ var opts = {

// Perform reduction:
var out = some( x, 2, opts );
// returns <ndarray>

var v = ndarray2array( out );
// returns [ true, true ]
// returns <ndarray>[ 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, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] );
Expand All @@ -105,10 +97,7 @@ var opts = {

// Perform reduction:
var out = some( x, 2, opts );
// returns <ndarray>

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

#### some.assign( x, n, out\[, options] )
Expand All @@ -130,13 +119,10 @@ var y = empty( [], {

// Perform reduction:
var out = some.assign( x, 3, 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 @@ -155,7 +141,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, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] );
Expand All @@ -172,13 +157,10 @@ var opts = {

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

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

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

</section>
Expand Down
14 changes: 3 additions & 11 deletions lib/node_modules/@stdlib/ndarray/some/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@
--------
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 0 ], [ 3, 4 ] ] );
> var y = {{alias}}( x, 3 )
<ndarray>
> y.get()
true
<ndarray>[ true ]
> y = {{alias}}( x, 3, { 'keepdims': true } )
<ndarray>
> {{alias:@stdlib/ndarray/to-array}}( y )
[ [ true ] ]
> y.get( 0, 0 )
true
<ndarray>[ [ true ] ]


{{alias}}.assign( x, n, y[, options] )
Expand Down Expand Up @@ -82,11 +76,9 @@
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 0 ], [ 3, 4 ] ] );
> var y = {{alias:@stdlib/ndarray/from-scalar}}( false );
> var out = {{alias}}.assign( x, 3, y )
<ndarray>
<ndarray>[ true ]
> var bool = ( out === y )
true
> y.get()
true

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

Expand Down Expand Up @@ -124,10 +121,7 @@ interface Some {
*
* // Perform reduction:
* var out = some.assign( x, 3, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
assign<T extends ndarray>( x: InputArray<unknown>, n: integerndarray | number, y: T, options?: BaseOptions ): T;
}
Expand Down Expand Up @@ -161,10 +155,7 @@ interface Some {
*
* // Perform reduction:
* var out = some( x, 3 );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -193,10 +184,7 @@ interface Some {
*
* // Perform reduction:
* var out = some.assign( x, 3, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
declare var some: Some;

Expand Down
5 changes: 1 addition & 4 deletions lib/node_modules/@stdlib/ndarray/some/lib/assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
*
* // Perform reduction:
* var out = assign( x, 6, y );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
function assign( x, n, y, options ) {
var opts;
Expand Down
10 changes: 2 additions & 8 deletions lib/node_modules/@stdlib/ndarray/some/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
*
* // Perform reduction:
* var out = some( x, 6 );
* // 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 = some.assign( x, 6, 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/some/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
*
* // Perform reduction:
* var out = some( x, 3 );
* // returns <ndarray>
*
* var v = out.get();
* // returns true
* // returns <ndarray>[ true ]
*/
function some( x, n, options ) {
var opts;
Expand Down