Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Dec 14, 2024
1 parent 928bb32 commit f14ca10
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ A total of 3 people contributed to this release. Thank you to the following cont

<details>

- [`3cd740e`](https://github.com/stdlib-js/stdlib/commit/3cd740ed3e550ee7411139fef930a96216cff5d9) - **docs:** add example _(by Athan Reines)_
- [`855b8c2`](https://github.com/stdlib-js/stdlib/commit/855b8c255abba003e9505aa3a80105a2e2b6b3a7) - **docs:** add example _(by Athan Reines)_
- [`47d03ca`](https://github.com/stdlib-js/stdlib/commit/47d03ca557edea6a39c8fa3cc3262ad85d04cd56) - **docs:** add example _(by Athan Reines)_
- [`cbc4d3f`](https://github.com/stdlib-js/stdlib/commit/cbc4d3f7514b7213cad4f9d2ca5d916e13eeffa5) - **feat:** add `reject` to namespace _(by Athan Reines)_
- [`43ccbfb`](https://github.com/stdlib-js/stdlib/commit/43ccbfbf9cd0ffcdd92fbe6ae0cc60db4f46ea6e) - **feat:** add `ndarray/reject` _(by Athan Reines)_
- [`1cc3e09`](https://github.com/stdlib-js/stdlib/commit/1cc3e095080947f8fdd61ea2217f9b3031b9f93b) - **docs:** fix annotation _(by Athan Reines)_
Expand Down
39 changes: 37 additions & 2 deletions filter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ var arr = ndarray2array( y );
The function accepts the following arguments:

- **x**: input [ndarray][@stdlib/ndarray/ctor].
- **options**: function options.
- **options**: function options _(optional)_.
- **predicate**: predicate function.
- **thisArg**: predicate function execution context.
- **thisArg**: predicate function execution context _(optional)_.

The function accepts the following options:

Expand Down Expand Up @@ -113,6 +113,41 @@ var arr = ndarray2array( y );
// returns [ 8.0, 9.0, 10.0 ]
```

To set the `predicate` function execution context, provide a `thisArg`.

<!-- eslint-disable no-invalid-this, max-len -->

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

function predicate( z ) {
this.count += 1;
return z > 6.0;
}

var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
var shape = [ 2, 3 ];
var strides = [ 6, 1 ];
var offset = 1;

var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
// returns <ndarray>

var ctx = {
'count': 0
};
var y = filter( x, predicate, ctx );
// returns <ndarray>

var arr = ndarray2array( y );
// returns [ 8.0, 9.0, 10.0 ]

var count = ctx.count;
// returns 6
```

The `predicate` function is provided the following arguments:

- **value**: current array element.
Expand Down
39 changes: 37 additions & 2 deletions map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ var arr = ndarray2array( y );
The function accepts the following arguments:

- **x**: input [ndarray][@stdlib/ndarray/ctor].
- **options**: function options.
- **options**: function options _(optional)_.
- **fcn**: callback to apply.
- **thisArg**: callback execution context.
- **thisArg**: callback execution context _(optional)_.

The function accepts the following options:

Expand Down Expand Up @@ -112,6 +112,41 @@ var arr = ndarray2array( y );
// returns [ [ 20.0, 30.0, 40.0 ], [ 80.0, 90.0, 100.0 ] ]
```

To set the callback function execution context, provide a `thisArg`.

<!-- eslint-disable no-invalid-this, max-len -->

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

function scale( z ) {
this.count += 1;
return z * 10.0;
}

var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
var shape = [ 2, 3 ];
var strides = [ 6, 1 ];
var offset = 1;

var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
// returns <ndarray>

var ctx = {
'count': 0
};
var y = map( x, scale, ctx );
// returns <ndarray>

var arr = ndarray2array( y );
// returns [ [ 20.0, 30.0, 40.0 ], [ 80.0, 90.0, 100.0 ] ]

var count = ctx.count;
// returns 6
```

The callback function is provided the following arguments:

- **value**: current array element.
Expand Down
39 changes: 37 additions & 2 deletions reject/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ var arr = ndarray2array( y );
The function accepts the following arguments:

- **x**: input [ndarray][@stdlib/ndarray/ctor].
- **options**: function options.
- **options**: function options _(optional)_.
- **predicate**: predicate function.
- **thisArg**: predicate function execution context.
- **thisArg**: predicate function execution context _(optional)_.

The function accepts the following options:

Expand Down Expand Up @@ -113,6 +113,41 @@ var arr = ndarray2array( y );
// returns [ 8.0, 9.0, 10.0 ]
```

To set the `predicate` function execution context, provide a `thisArg`.

<!-- eslint-disable no-invalid-this, max-len -->

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

function predicate( z ) {
this.count += 1;
return z <= 6.0;
}

var buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );
var shape = [ 2, 3 ];
var strides = [ 6, 1 ];
var offset = 1;

var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
// returns <ndarray>

var ctx = {
'count': 0
};
var y = reject( x, predicate, ctx );
// returns <ndarray>

var arr = ndarray2array( y );
// returns [ 8.0, 9.0, 10.0 ]

var count = ctx.count;
// returns 6
```

The `predicate` function is provided the following arguments:

- **value**: current array element.
Expand Down

0 comments on commit f14ca10

Please sign in to comment.