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 Jun 20, 2024
1 parent 3fa2b03 commit 3e4d535
Show file tree
Hide file tree
Showing 28 changed files with 5,011 additions and 153 deletions.
89 changes: 89 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@

##### Features

- [`fd71d8a`](https://github.com/stdlib-js/stdlib/commit/fd71d8a39d9dc53b0d941945d26178e2e079edbc) - add `place` to namespace
- [`20cd086`](https://github.com/stdlib-js/stdlib/commit/20cd0868236daf523fcd659d027e2277f7e1cb56) - add `mskput` to namespace
- [`2827035`](https://github.com/stdlib-js/stdlib/commit/2827035933c44ebb301a44200ff9cd5ad73e9ef0) - add `where` to namespace
- [`d626ffa`](https://github.com/stdlib-js/stdlib/commit/d626ffac9f0504be236c94afd4b920032272c8bf) - update namespace TypeScript declarations [(#2394)](https://github.com/stdlib-js/stdlib/pull/2394)
Expand Down Expand Up @@ -932,13 +933,37 @@ This release closes the following issue:

##### Features

- [`7c3729c`](https://github.com/stdlib-js/stdlib/commit/7c3729c19fdda77bfb15009ab4e52a4dfb59f73d) - add support for additional modes
- [`dc29f10`](https://github.com/stdlib-js/stdlib/commit/dc29f108e512a5ad2be34a7c3f539457648c1ee2) - add \"broadcasting\" mode to require broadcast compatibility
- [`e9bf843`](https://github.com/stdlib-js/stdlib/commit/e9bf843b45b204ca61eca213575aa4933026b09b) - add `array/base/mskput`

</section>

<!-- /.features -->

<section class="bug-fixes">

##### Bug Fixes

- [`2769ce9`](https://github.com/stdlib-js/stdlib/commit/2769ce9e876c2a6de5735ffdbc4c79b3d26347b6) - require broadcast compatibility

</section>

<!-- /.bug-fixes -->

<section class="breaking-changes">

##### BREAKING CHANGES

- [`7c3729c`](https://github.com/stdlib-js/stdlib/commit/7c3729c19fdda77bfb15009ab4e52a4dfb59f73d): add support for additional modes
- [`7c3729c`](https://github.com/stdlib-js/stdlib/commit/7c3729c19fdda77bfb15009ab4e52a4dfb59f73d): rename 'throw' mode to 'strict'

- To migrate, users should simply update 'throw' to 'strict'.

</section>

<!-- /.breaking-changes -->

</details>

</section>
Expand Down Expand Up @@ -989,6 +1014,52 @@ This release closes the following issue:

<!-- /.package -->

<section class="package" id="array-base-place-unreleased">

#### [@stdlib/array/base/place](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/place)

<details>

<section class="features">

##### Features

- [`fdb5d94`](https://github.com/stdlib-js/stdlib/commit/fdb5d94eee5fc019bc358d799025cb2b5966d820) - add support for additional modes
- [`e8a8a6e`](https://github.com/stdlib-js/stdlib/commit/e8a8a6e61d01e96272408449f48f411c691f3aa0) - add `array/base/place`

</section>

<!-- /.features -->

<section class="bug-fixes">

##### Bug Fixes

- [`d903fc9`](https://github.com/stdlib-js/stdlib/commit/d903fc907ddaacc144a97edaaed0f05abadc470c) - require broadcast compatibility

</section>

<!-- /.bug-fixes -->

<section class="breaking-changes">

##### BREAKING CHANGES

- [`fdb5d94`](https://github.com/stdlib-js/stdlib/commit/fdb5d94eee5fc019bc358d799025cb2b5966d820): add support for additional modes
- [`fdb5d94`](https://github.com/stdlib-js/stdlib/commit/fdb5d94eee5fc019bc358d799025cb2b5966d820): rename 'throw' mode to 'strict'

- To migrate, users should simply replace 'throw' with 'strict'.

</section>

<!-- /.breaking-changes -->

</details>

</section>

<!-- /.package -->

<section class="package" id="array-base-put-unreleased">

#### [@stdlib/array/base/put](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/put)
Expand Down Expand Up @@ -1974,6 +2045,16 @@ This release closes the following issue:

### BREAKING CHANGES

- [`fdb5d94`](https://github.com/stdlib-js/stdlib/commit/fdb5d94eee5fc019bc358d799025cb2b5966d820): add support for additional modes
- [`fdb5d94`](https://github.com/stdlib-js/stdlib/commit/fdb5d94eee5fc019bc358d799025cb2b5966d820): rename 'throw' mode to 'strict'

- To migrate, users should simply replace 'throw' with 'strict'.

- [`7c3729c`](https://github.com/stdlib-js/stdlib/commit/7c3729c19fdda77bfb15009ab4e52a4dfb59f73d): add support for additional modes
- [`7c3729c`](https://github.com/stdlib-js/stdlib/commit/7c3729c19fdda77bfb15009ab4e52a4dfb59f73d): rename 'throw' mode to 'strict'

- To migrate, users should simply update 'throw' to 'strict'.

- [`0adcae5`](https://github.com/stdlib-js/stdlib/commit/0adcae51386086e2ef5fb5d78402389cff776deb): update namespace TypeScript declarations
- [`0adcae5`](https://github.com/stdlib-js/stdlib/commit/0adcae51386086e2ef5fb5d78402389cff776deb): rename exported aliases

Expand Down Expand Up @@ -2033,6 +2114,14 @@ A total of 13 people contributed to this release. Thank you to the following con

<details>

- [`e57ccb2`](https://github.com/stdlib-js/stdlib/commit/e57ccb234687de4087aa12348d266ea448f3f241) - **refactor:** update boolean array indexing implementation and add tests _(by Athan Reines)_
- [`d903fc9`](https://github.com/stdlib-js/stdlib/commit/d903fc907ddaacc144a97edaaed0f05abadc470c) - **fix:** require broadcast compatibility _(by Athan Reines)_
- [`2769ce9`](https://github.com/stdlib-js/stdlib/commit/2769ce9e876c2a6de5735ffdbc4c79b3d26347b6) - **fix:** require broadcast compatibility _(by Athan Reines)_
- [`fdb5d94`](https://github.com/stdlib-js/stdlib/commit/fdb5d94eee5fc019bc358d799025cb2b5966d820) - **feat:** add support for additional modes _(by Athan Reines)_
- [`96f430f`](https://github.com/stdlib-js/stdlib/commit/96f430f4a1c3e3ded241118139d5359404963a99) - **test:** fix description and docs _(by Athan Reines)_
- [`7c3729c`](https://github.com/stdlib-js/stdlib/commit/7c3729c19fdda77bfb15009ab4e52a4dfb59f73d) - **feat:** add support for additional modes _(by Athan Reines)_
- [`fd71d8a`](https://github.com/stdlib-js/stdlib/commit/fd71d8a39d9dc53b0d941945d26178e2e079edbc) - **feat:** add `place` to namespace _(by Athan Reines)_
- [`e8a8a6e`](https://github.com/stdlib-js/stdlib/commit/e8a8a6e61d01e96272408449f48f411c691f3aa0) - **feat:** add `array/base/place` _(by Athan Reines)_
- [`566c39c`](https://github.com/stdlib-js/stdlib/commit/566c39c0a5d5b19360ae92db2b1f50d6e9bef067) - **test:** fix description _(by Athan Reines)_
- [`dc29f10`](https://github.com/stdlib-js/stdlib/commit/dc29f108e512a5ad2be34a7c3f539457648c1ee2) - **feat:** add \"broadcasting\" mode to require broadcast compatibility _(by Athan Reines)_
- [`20cd086`](https://github.com/stdlib-js/stdlib/commit/20cd0868236daf523fcd659d027e2277f7e1cb56) - **feat:** add `mskput` to namespace _(by Athan Reines)_
Expand Down
9 changes: 9 additions & 0 deletions base/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,15 @@ setReadOnly( ns, 'ones5d', require( './../../base/ones5d' ) );
*/
setReadOnly( ns, 'onesnd', require( './../../base/onesnd' ) );

/**
* @name place
* @memberof ns
* @readonly
* @type {Function}
* @see {@link module:@stdlib/array/base/place}
*/
setReadOnly( ns, 'place', require( './../../base/place' ) );

/**
* @name put
* @memberof ns
Expand Down
16 changes: 9 additions & 7 deletions base/mskput/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Replaces elements of an array with provided values according to a provided mask
```javascript
var x = [ 1, 2, 3, 4 ];

var out = mskput( x, [ 1, 0, 1, 0 ], [ 20, 40 ], 'throw' );
var out = mskput( x, [ 1, 0, 1, 0 ], [ 20, 40 ], 'strict' );
// returns [ 1, 20, 3, 40 ]

var bool = ( out === x );
Expand All @@ -49,27 +49,29 @@ The function supports the following parameters:
- **x**: input array.
- **mask**: mask array.
- **values**: values to set.
- **mode**: string specifying whether to raise an exception when the number of `values` is less than the number of falsy `mask` values.
- **mode**: string specifying behavior when the number of `values` does not equal the number of falsy `mask` values.

The function supports the following modes:

- `'throw'`: specifies that the function must raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
- `'strict'`: specifies that the function must raise an exception when the number of `values` does not **exactly** equal the number of falsy `mask` values.
- `'non_strict'`: specifies that the function must raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
- `'strict_broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the number of `values` does not **exactly** equal the number of falsy `mask` values.
- `'broadcast'`: specifies that the function must broadcast a single-element `values` array and otherwise raise an exception when the function is provided insufficient `values` to satisfy the `mask` array.
- `'repeat'`: specifies that the function must reuse provided `values` when replacing elements in `x` in order to satisfy the `mask` array.

When `mode` is equal to `'broadcast`', the function supports broadcasting a `values` array containing a single element against the number of falsy values in the `mask` array.
In broadcasting modes, the function supports broadcasting a `values` array containing a single element against the number of falsy values in the `mask` array.

```javascript
var x = [ 1, 2, 3, 4 ];

var out = mskput( x, [ 1, 0, 1, 0 ], [ 20 ], 'broadcast' );
var out = mskput( x, [ 1, 0, 1, 0 ], [ 20 ], 'strict_broadcast' );
// returns [ 1, 20, 3, 20 ]

var bool = ( out === x );
// returns true
```

When `mode` is equal to `repeat`, the function supports recycling elements in a `values` array to satisfy the number of falsy values in the `mask` array.
In repeat mode, the function supports recycling elements in a `values` array to satisfy the number of falsy values in the `mask` array.

```javascript
var x = [ 1, 2, 3, 4 ];
Expand Down Expand Up @@ -123,7 +125,7 @@ var values = filledBy( N, discreteUniform.factory( 1000, 2000 ) );
console.log( values );

// Update a random sample of elements in `x`:
var out = mskput( x, mask, values, 'throw' );
var out = mskput( x, mask, values, 'non_strict' );
console.log( out );
```

Expand Down
4 changes: 2 additions & 2 deletions base/mskput/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bench( pkg+'::no_broadcasting:len=100', function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = mskput( x, mask, x, 'throw' );
v = mskput( x, mask, x, 'strict' );
if ( typeof v !== 'object' ) {
b.fail( 'should return an array' );
}
Expand All @@ -65,7 +65,7 @@ bench( pkg+'::broadcasting:len=100', function benchmark( b ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = mskput( x, mask, [ i ], 'broadcast' );
v = mskput( x, mask, [ i ], 'strict_broadcast' );
if ( typeof v !== 'object' ) {
b.fail( 'should return an array' );
}
Expand Down
2 changes: 1 addition & 1 deletion base/mskput/benchmark/benchmark.length.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = mskput( x, mask, values[ i%values.length ], 'throw' );
v = mskput( x, mask, values[ i%values.length ], 'strict' );
if ( typeof v !== 'object' ) {
b.fail( 'should return an array' );
}
Expand Down
31 changes: 19 additions & 12 deletions base/mskput/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Replaces elements of an array with provided values according to a provided
mask array.

When the `mode` is `'broadcast'`, the function supports broadcasting a
`values` array containing a single element against the number of falsy
values in the `mask` array.
In broadcasting modes, the function supports broadcasting a values array
containing a single element against the number of falsy values in the mask
array.

When the `mode` is `'repeat'`, the function supports recycling elements in a
`values` array to satisfy the number of falsy values in the `mask` array.
In repeat mode, the function supports recycling elements in a values array
to satisfy the number of falsy values in the mask array.

The function mutates the input array.

Expand All @@ -26,12 +26,19 @@
Values to set.

mode: string
String specifying behavior when the number of values to set is less than
the number of falsy mask values. The function supports the following
modes:

- 'throw': specifies that the function must raise an exception when the
function is provided insufficient values to satisfy the mask array.
String specifying behavior when the number of values to set does not
equal the number of falsy mask values. The function supports the
following modes:

- 'strict': specifies that the function must raise an exception when the
number of values does not *exactly* equal the number of falsy mask
values.
- 'non_strict': specifies that the function must raise an exception when
the function is provided insufficient values to satisfy the mask array.
- 'strict_broadcast': specifies that the function must broadcast a
single-element values array and otherwise raise an exception when the
number of values does not **exactly** equal the number of falsy mask
values.
- 'broadcast': specifies that the function must broadcast a single-
element values array and otherwise raise an exception when the function
is provided insufficient values to satisfy the mask array.
Expand All @@ -46,7 +53,7 @@
Examples
--------
> var x = [ 1, 2, 3, 4 ];
> var out = {{alias}}( x, [ 1, 0, 1, 0 ], [ 20, 40 ], 'throw' )
> var out = {{alias}}( x, [ 1, 0, 1, 0 ], [ 20, 40 ], 'strict' )
[ 1, 20, 3, 40 ]
> var bool = ( out === x )
true
Expand Down
Loading

0 comments on commit 3e4d535

Please sign in to comment.