Skip to content
Closed
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
17 changes: 3 additions & 14 deletions lib/node_modules/@stdlib/ndarray/includes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,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, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
Expand All @@ -80,17 +79,13 @@ var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
var out = includes( x, 5.0, {
'dims': [ 1, 2 ]
});
// returns <ndarray>

var v = ndarray2array( out );
// returns [ false, false, true ]
// returns <ndarray>[ false, false, 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, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
Expand All @@ -101,10 +96,7 @@ var out = includes( x, 5.0, {
'dims': [ 1, 2 ],
'keepdims': true
});
// returns <ndarray>

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

#### includes.assign( x, searchElement, out\[, options] )
Expand Down Expand Up @@ -151,7 +143,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, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
Expand All @@ -161,6 +152,7 @@ var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
var y = empty( [ 3 ], {
'dtype': 'bool'
});
// returns <ndarray>[ false, false, true ]

// Perform reduction:
var out = includes.assign( x, 5.0, y, {
Expand All @@ -169,9 +161,6 @@ var out = includes.assign( x, 5.0, y, {

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

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

</section>
Expand Down
4 changes: 1 addition & 3 deletions lib/node_modules/@stdlib/ndarray/includes/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
> y.get()
true
> y = {{alias}}( x, 3.0, { 'keepdims': true } )
<ndarray>
> {{alias:@stdlib/ndarray/to-array}}( y )
[ [ true ] ]
<ndarray>[ [ true ] ]
> y.get( 0, 0 )
true

Expand Down
Loading