diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e8bb568..7f66617c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -939,7 +939,6 @@ This release closes the following issue: ##### Features -- [`c04e29b`](https://github.com/stdlib-js/stdlib/commit/c04e29bf919dcc5f1368fecd977db696041ff8db) - add boolean dtype support to `array/base/mskfilter` [(#2450)](https://github.com/stdlib-js/stdlib/pull/2450) - [`d34ae78`](https://github.com/stdlib-js/stdlib/commit/d34ae789c63908f3edd1e7a746abd4cc60619b27) - add `assign` method @@ -2260,7 +2259,6 @@ A total of 13 people contributed to this release. Thank you to the following con
-- [`c04e29b`](https://github.com/stdlib-js/stdlib/commit/c04e29bf919dcc5f1368fecd977db696041ff8db) - **feat:** add boolean dtype support to `array/base/mskfilter` [(#2450)](https://github.com/stdlib-js/stdlib/pull/2450) _(by Jaysukh Makvana, Athan Reines)_ - [`760979b`](https://github.com/stdlib-js/stdlib/commit/760979b6efafb5c235daa718c17d7eb5cef82237) - **feat:** add boolean dtype support to `array/base/take` [(#2453)](https://github.com/stdlib-js/stdlib/pull/2453) _(by Jaysukh Makvana, Athan Reines)_ - [`c41435f`](https://github.com/stdlib-js/stdlib/commit/c41435fa51e75a6329d78b8e801590476ece06af) - **feat:** add boolean dtype support to `array/base/cuany` [(#2446)](https://github.com/stdlib-js/stdlib/pull/2446) _(by Jaysukh Makvana)_ - [`3c451db`](https://github.com/stdlib-js/stdlib/commit/3c451db98b94e5d89a2aaffca29c4ca93835605f) - **feat:** add boolean dtype support to `array/base/cuevery` [(#2447)](https://github.com/stdlib-js/stdlib/pull/2447) _(by Jaysukh Makvana)_ diff --git a/base/mskfilter/lib/assign.js b/base/mskfilter/lib/assign.js index e76d884b..e1952413 100644 --- a/base/mskfilter/lib/assign.js +++ b/base/mskfilter/lib/assign.js @@ -21,10 +21,8 @@ // MODULES // var isComplexDataType = require( './../../../base/assert/is-complex-floating-point-data-type' ); -var isBooleanDataType = require( './../../../base/assert/is-boolean-data-type' ); var arraylike2object = require( './../../../base/arraylike2object' ); var reinterpret = require( '@stdlib/strided/base/reinterpret-complex' ); -var reinterpretBoolean = require( '@stdlib/strided/base/reinterpret-boolean' ); // FUNCTIONS // @@ -165,48 +163,6 @@ function complex( x, mask, out, stride, offset ) { return out; } -/** -* Applies a mask to a boolean array and assigns unmasked values to elements in a boolean output array. -* -* @private -* @param {Collection} x - boolean input array view -* @param {Object} mask - mask array object -* @param {Collection} out - boolean output array view -* @param {integer} stride - output array stride -* @param {NonNegativeInteger} offset - output array offset -* @returns {Collection} output array view -* -* @example -* var Uint8Array = require( '@stdlib/array/uint8' ); -* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); -* -* var x = new Uint8Array( [ 1, 0, 0, 1 ] ); -* var mask = [ 0, 1, 0, 1 ]; -* -* var out = new Uint8Array( 4 ); -* -* var arr = boolean( x, arraylike2object( mask ), out, 1, 0 ); -* // returns [ 0, 1, 0, 0 ] -*/ -function boolean( x, mask, out, stride, offset ) { - var mdata; - var mget; - var io; - var i; - - mdata = mask.data; - mget = mask.accessors[ 0 ]; - - io = offset; - for ( i = 0; i < mdata.length; i++ ) { - if ( mget( mdata, i ) ) { - out[ io ] = x[ i ]; - io += stride; - } - } - return out; -} - // MAIN // @@ -244,7 +200,7 @@ function assign( x, mask, out, stride, offset ) { mo.accessorProtocol || oo.accessorProtocol ) { - // Note: we only explicitly support a limited set of dtype-to-dtype pairs, as this function should not be concerned with casting rules, etc. That is left to userland... + // Note: we only explicitly support complex-to-complex, as this function should not be concerned with casting rules, etc. That is left to userland... if ( isComplexDataType( xo.dtype ) && isComplexDataType( oo.dtype ) @@ -252,13 +208,6 @@ function assign( x, mask, out, stride, offset ) { complex( reinterpret( x, 0 ), mo, reinterpret( out, 0 ), stride, offset ); // eslint-disable-line max-len return out; } - if ( - isBooleanDataType( xo.dtype ) && - isBooleanDataType( oo.dtype ) - ) { - boolean( reinterpretBoolean( x, 0 ), mo, reinterpretBoolean( out, 0 ), stride, offset ); // eslint-disable-line max-len - return out; - } accessors( xo, mo, oo, stride, offset ); return out; } diff --git a/base/mskfilter/test/test.assign.js b/base/mskfilter/test/test.assign.js index 86b11dd9..e6f28b1b 100644 --- a/base/mskfilter/test/test.assign.js +++ b/base/mskfilter/test/test.assign.js @@ -22,11 +22,9 @@ var tape = require( 'tape' ); var Complex64Array = require( './../../../complex64' ); -var BooleanArray = require( './../../../bool' ); var toAccessorArray = require( './../../../base/to-accessor-array' ); var Int32Array = require( './../../../int32' ); var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' ); -var isSameBooleanArray = require( '@stdlib/assert/is-same-booleanarray' ); var zeros = require( './../../../zeros' ); var mskfilter = require( './../lib/assign.js' ); @@ -195,58 +193,6 @@ tape( 'the function filters array elements (complex typed array)', function test t.end(); }); -tape( 'the function filters array elements (boolean array)', function test( t ) { - var expected; - var actual; - var mask; - var out; - var x; - - x = new BooleanArray( [ true, false, false, true ] ); - - mask = [ 0, 1, 0, 1 ]; - out = new BooleanArray( 2 ); - actual = mskfilter( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 0 ]; - out = new BooleanArray( 0 ); - actual = mskfilter( x, mask, out, 1, 0 ); - expected = new BooleanArray( [] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 0, 0, 1 ]; - out = new BooleanArray( 1 ); - actual = mskfilter( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 1, 1, 1, 1 ]; - out = new BooleanArray( 4 ); - actual = mskfilter( x, mask, out, 1, 0 ); - expected = new BooleanArray( [ true, false, false, true ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - mask = [ 0, 1, 0, 1 ]; - out = new BooleanArray( 4 ); - actual = mskfilter( x, mask, out, -2, out.length-1 ); - expected = new BooleanArray( [ false, true, false, false ] ); - - t.strictEqual( actual, out, 'returns expected value' ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - - t.end(); -}); - tape( 'the function filters array elements (accessors)', function test( t ) { var expected; var actual; @@ -339,11 +285,5 @@ tape( 'the function returns leaves an output array unchanged if provided a secon actual = mskfilter( x, mask, out, 1, 0 ); t.strictEqual( isSameComplex64Array( actual, expected ), true, 'returns expected value' ); - x = new BooleanArray( [ true, false, false, true ] ); - out = new BooleanArray( [ false, false, false, false ] ); - expected = new BooleanArray( [ false, false, false, false ] ); - actual = mskfilter( x, mask, out, 1, 0 ); - t.strictEqual( isSameBooleanArray( actual, expected ), true, 'returns expected value' ); - t.end(); }); diff --git a/base/mskfilter/test/test.main.js b/base/mskfilter/test/test.main.js index ec7598e5..ed8aa704 100644 --- a/base/mskfilter/test/test.main.js +++ b/base/mskfilter/test/test.main.js @@ -22,7 +22,6 @@ var tape = require( 'tape' ); var Complex64Array = require( './../../../complex64' ); -var BooleanArray = require( './../../../bool' ); var isSameComplex64 = require( '@stdlib/assert/is-same-complex64' ); var isArray = require( '@stdlib/assert/is-array' ); var mskfilter = require( './../lib' ); @@ -92,18 +91,6 @@ tape( 'the function filters array elements (accessors)', function test( t ) { for ( i = 0; i < expected.length; i++ ) { t.strictEqual( isSameComplex64( actual[ i ], expected[ i ] ), true, 'returns expected value' ); } - - x = new BooleanArray( [ true, false, false, true ] ); - mask = [ 0, 1, 0, 1 ]; - actual = mskfilter( x, mask ); - expected = [ x.get( 1 ), x.get( 3 ) ]; - - t.strictEqual( isArray( actual ), true, 'returns expected value' ); - t.notEqual( actual, x, 'returns different reference' ); - for ( i = 0; i < expected.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); - } - t.end(); });