diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 8c60edf..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-07-01T01:21:32.116Z diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c2e19..afe4f33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-07-01) +## Unreleased (2024-07-06)
@@ -12,7 +12,7 @@
-- [`a591e05`](https://github.com/stdlib-js/stdlib/commit/a591e052cf1b1515c267781b914c6a482e150425) - **test:** fix test configuration _(by Athan Reines)_ +- [`1600510`](https://github.com/stdlib-js/stdlib/commit/1600510d9214b9a33dc4dffa26762c78a1fa88e2) - **refactor:** reduce code duplication _(by Athan Reines)_
@@ -36,3 +36,65 @@ A total of 1 person contributed to this release. Thank you to this contributor: +
+ +## 0.2.1 (2024-02-22) + +
+ +### Features + +- [`ca91187`](https://github.com/stdlib-js/stdlib/commit/ca9118749c1e8f3ad1f722ef69e3dc602e57b6c7) - update minimum TypeScript version + +
+ + + +
+ +### BREAKING CHANGES + +- [`ca91187`](https://github.com/stdlib-js/stdlib/commit/ca9118749c1e8f3ad1f722ef69e3dc602e57b6c7): update minimum TypeScript version +- [`ca91187`](https://github.com/stdlib-js/stdlib/commit/ca9118749c1e8f3ad1f722ef69e3dc602e57b6c7): update minimum TypeScript version to 4.1 + + - To migrate, users should upgrade their TypeScript version to at least version 4.1. + +
+ + + +
+ +### Commits + +
+ +- [`dea49e0`](https://github.com/stdlib-js/stdlib/commit/dea49e03ab5571233e3da26835a6a6d3256d5737) - **docs:** use single quotes in require calls instead of backticks _(by Philipp Burckhardt)_ +- [`7db5611`](https://github.com/stdlib-js/stdlib/commit/7db56115b014aa41e4a3458629286ae3bd99c4e7) - **docs:** update links and fix headings _(by Athan Reines)_ +- [`f9c75ce`](https://github.com/stdlib-js/stdlib/commit/f9c75ce726ed4e5fade8622315bb98094dad8561) - **build:** remove tslint directives _(by Philipp Burckhardt)_ +- [`ca91187`](https://github.com/stdlib-js/stdlib/commit/ca9118749c1e8f3ad1f722ef69e3dc602e57b6c7) - **feat:** update minimum TypeScript version _(by Philipp Burckhardt)_ +- [`28e1c84`](https://github.com/stdlib-js/stdlib/commit/28e1c84390d88044883c9ef940a12f38d66ea3ef) - **docs:** resolve C lint errors _(by Athan Reines)_ + +
+ +
+ + + +
+ +### Contributors + +A total of 2 people contributed to this release. Thank you to the following contributors: + +- Athan Reines +- Philipp Burckhardt + +
+ + + +
+ + + diff --git a/dist/index.js b/dist/index.js index afe8ba3..850b88e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ -"use strict";var R=function(r,a){return function(){return a||r((a={exports:{}}).exports,a),a.exports}};var g=R(function(E,b){ -function w(r,a,u,c,t,l,m,o,s,p){var i,v,f,n,e;if(r<=0)return o;for(u<0?i=(1-r)*u:i=0,t<0?v=(1-r)*t:v=0,s<0?f=(1-r)*s:f=0,m<0?n=(1-r)*m:n=0,e=0;e [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*/\nfunction dmskmap2( N, x, strideX, y, strideY, mask, strideMask, z, strideZ, fcn ) { // eslint-disable-line max-len\n\tvar ix;\n\tvar iy;\n\tvar iz;\n\tvar im;\n\tvar i;\n\tif ( N <= 0 ) {\n\t\treturn z;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = (1-N) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = (1-N) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tif ( strideZ < 0 ) {\n\t\tiz = (1-N) * strideZ;\n\t} else {\n\t\tiz = 0;\n\t}\n\tif ( strideMask < 0 ) {\n\t\tim = (1-N) * strideMask;\n\t} else {\n\t\tim = 0;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tif ( mask[ im ] === 0 ) {\n\t\t\tz[ iz ] = fcn( x[ ix ], y[ iy ] );\n\t\t}\n\t\tix += strideX;\n\t\tiy += strideY;\n\t\tiz += strideZ;\n\t\tim += strideMask;\n\t}\n\treturn z;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dmskmap2;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a binary function to double-precision floating-point strided input arrays according to a strided mask array and assigns results to a double-precision floating-point strided output array.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Float64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Float64Array} y - input array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @param {Uint8Array} mask - mask array\n* @param {integer} strideMask - `mask` stride length\n* @param {NonNegativeInteger} offsetMask - starting `mask` index\n* @param {Float64Array} z - destination array\n* @param {integer} strideZ - `z` stride length\n* @param {NonNegativeInteger} offsetZ - starting `z` index\n* @param {Function} fcn - binary function to apply\n* @returns {Float64Array} `z`\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2( x.length, x, 1, 0, y, 1, 0, m, 1, 0, z, 1, 0, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*/\nfunction dmskmap2( N, x, strideX, offsetX, y, strideY, offsetY, mask, strideMask, offsetMask, z, strideZ, offsetZ, fcn ) { // eslint-disable-line max-len, max-params\n\tvar ix;\n\tvar iy;\n\tvar iz;\n\tvar im;\n\tvar i;\n\tif ( N <= 0 ) {\n\t\treturn z;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\tiz = offsetZ;\n\tim = offsetMask;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tif ( mask[ im ] === 0 ) {\n\t\t\tz[ iz ] = fcn( x[ ix ], y[ iy ] );\n\t\t}\n\t\tix += strideX;\n\t\tiy += strideY;\n\t\tiz += strideZ;\n\t\tim += strideMask;\n\t}\n\treturn z;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dmskmap2;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a binary function to double-precision floating-point strided input arrays according to a strided mask array and assign results to a double-precision floating-point strided output array.\n*\n* @module @stdlib/strided-base-dmskmap2\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var dmskmap2 = require( '@stdlib/strided-base-dmskmap2' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2( x.length, x, 1, y, 1, m, 1, z, 1, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var dmskmap2 = require( '@stdlib/strided-base-dmskmap2' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2.ndarray( x.length, x, 1, 0, y, 1, 0, m, 1, 0, z, 1, 0, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAoDA,SAASC,EAAUC,EAAGC,EAAGC,EAASC,EAAGC,EAASC,EAAMC,EAAYC,EAAGC,EAASC,EAAM,CACjF,IAAIC,EACAC,EACAC,EACAC,EACAC,EACJ,GAAKd,GAAK,EACT,OAAOO,EAsBR,IApBKL,EAAU,EACdQ,GAAM,EAAEV,GAAKE,EAEbQ,EAAK,EAEDN,EAAU,EACdO,GAAM,EAAEX,GAAKI,EAEbO,EAAK,EAEDH,EAAU,EACdI,GAAM,EAAEZ,GAAKQ,EAEbI,EAAK,EAEDN,EAAa,EACjBO,GAAM,EAAEb,GAAKM,EAEbO,EAAK,EAEAC,EAAI,EAAGA,EAAId,EAAGc,IACdT,EAAMQ,CAAG,IAAM,IACnBN,EAAGK,CAAG,EAAIH,EAAKR,EAAGS,CAAG,EAAGP,EAAGQ,CAAG,CAAE,GAEjCD,GAAMR,EACNS,GAAMP,EACNQ,GAAMJ,EACNK,GAAMP,EAEP,OAAOC,CACR,CAKAT,EAAO,QAAUC,IChGjB,IAAAgB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwDA,SAASC,EAAUC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAASC,EAAMC,EAAYC,EAAYC,EAAGC,EAASC,EAASC,EAAM,CACxH,IAAIC,EACAC,EACAC,EACAC,EACAC,EACJ,GAAKlB,GAAK,EACT,OAAOU,EAMR,IAJAI,EAAKX,EACLY,EAAKT,EACLU,EAAKJ,EACLK,EAAKR,EACCS,EAAI,EAAGA,EAAIlB,EAAGkB,IACdX,EAAMU,CAAG,IAAM,IACnBP,EAAGM,CAAG,EAAIH,EAAKZ,EAAGa,CAAG,EAAGV,EAAGW,CAAG,CAAE,GAEjCD,GAAMZ,EACNa,GAAMV,EACNW,GAAML,EACNM,GAAMT,EAEP,OAAOE,CACR,CAKAZ,EAAO,QAAUC,ICxBjB,IAAIoB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD", - "names": ["require_main", "__commonJSMin", "exports", "module", "dmskmap2", "N", "x", "strideX", "y", "strideY", "mask", "strideMask", "z", "strideZ", "fcn", "ix", "iy", "iz", "im", "i", "require_ndarray", "__commonJSMin", "exports", "module", "dmskmap2", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "mask", "strideMask", "offsetMask", "z", "strideZ", "offsetZ", "fcn", "ix", "iy", "iz", "im", "i", "setReadOnly", "main", "ndarray"] + "sources": ["../lib/ndarray.js", "../lib/main.js", "../lib/index.js"], + "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a binary function to double-precision floating-point strided input arrays according to a strided mask array and assigns results to a double-precision floating-point strided output array.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Float64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Float64Array} y - input array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @param {Uint8Array} mask - mask array\n* @param {integer} strideMask - `mask` stride length\n* @param {NonNegativeInteger} offsetMask - starting `mask` index\n* @param {Float64Array} z - destination array\n* @param {integer} strideZ - `z` stride length\n* @param {NonNegativeInteger} offsetZ - starting `z` index\n* @param {Function} fcn - binary function to apply\n* @returns {Float64Array} `z`\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2( x.length, x, 1, 0, y, 1, 0, m, 1, 0, z, 1, 0, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*/\nfunction dmskmap2( N, x, strideX, offsetX, y, strideY, offsetY, mask, strideMask, offsetMask, z, strideZ, offsetZ, fcn ) { // eslint-disable-line max-len, max-params\n\tvar ix;\n\tvar iy;\n\tvar iz;\n\tvar im;\n\tvar i;\n\tif ( N <= 0 ) {\n\t\treturn z;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\tiz = offsetZ;\n\tim = offsetMask;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tif ( mask[ im ] === 0 ) {\n\t\t\tz[ iz ] = fcn( x[ ix ], y[ iy ] );\n\t\t}\n\t\tix += strideX;\n\t\tiy += strideY;\n\t\tiz += strideZ;\n\t\tim += strideMask;\n\t}\n\treturn z;\n}\n\n\n// EXPORTS //\n\nmodule.exports = dmskmap2;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar stride2offset = require( '@stdlib/strided-base-stride2offset' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\n/**\n* Applies a binary function to double-precision floating-point strided input arrays and assigns results to a double-precision floating-point strided output array.\n*\n* @param {NonNegativeInteger} N - number of indexed elements\n* @param {Float64Array} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {Float64Array} y - input array\n* @param {integer} strideY - `y` stride length\n* @param {Uint8Array} mask - mask array\n* @param {integer} strideMask - `mask` stride length\n* @param {Float64Array} z - destination array\n* @param {integer} strideZ - `z` stride length\n* @param {Function} fcn - binary function to apply\n* @returns {Float64Array} `z`\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2( x.length, x, 1, y, 1, m, 1, z, 1, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*/\nfunction dmskmap2( N, x, strideX, y, strideY, mask, strideMask, z, strideZ, fcn ) { // eslint-disable-line max-len\n\treturn ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ), mask, strideMask, stride2offset( N, strideMask ), z, strideZ, stride2offset( N, strideZ ), fcn ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = dmskmap2;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Apply a binary function to double-precision floating-point strided input arrays according to a strided mask array and assign results to a double-precision floating-point strided output array.\n*\n* @module @stdlib/strided-base-dmskmap2\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var dmskmap2 = require( '@stdlib/strided-base-dmskmap2' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2( x.length, x, 1, y, 1, m, 1, z, 1, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var Uint8Array = require( '@stdlib/array-uint8' );\n* var add = require( '@stdlib/math-base-ops-add' );\n* var dmskmap2 = require( '@stdlib/strided-base-dmskmap2' );\n*\n* var x = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var y = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* var m = new Uint8Array( [ 0, 0, 1, 0, 0 ] );\n* var z = new Float64Array( x.length );\n*\n* dmskmap2.ndarray( x.length, x, 1, 0, y, 1, 0, m, 1, 0, z, 1, 0, add );\n*\n* console.log( z );\n* // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar ndarray = require( './ndarray.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'ndarray', ndarray );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwDA,SAASC,EAAUC,EAAGC,EAAGC,EAASC,EAASC,EAAGC,EAASC,EAASC,EAAMC,EAAYC,EAAYC,EAAGC,EAASC,EAASC,EAAM,CACxH,IAAIC,EACAC,EACAC,EACAC,EACAC,EACJ,GAAKlB,GAAK,EACT,OAAOU,EAMR,IAJAI,EAAKX,EACLY,EAAKT,EACLU,EAAKJ,EACLK,EAAKR,EACCS,EAAI,EAAGA,EAAIlB,EAAGkB,IACdX,EAAMU,CAAG,IAAM,IACnBP,EAAGM,CAAG,EAAIH,EAAKZ,EAAGa,CAAG,EAAGV,EAAGW,CAAG,CAAE,GAEjCD,GAAMZ,EACNa,GAAMV,EACNW,GAAML,EACNM,GAAMT,EAEP,OAAOE,CACR,CAKAZ,EAAO,QAAUC,ICpFjB,IAAAoB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAU,IAmCd,SAASC,EAAUC,EAAGC,EAAGC,EAASC,EAAGC,EAASC,EAAMC,EAAYC,EAAGC,EAASC,EAAM,CACjF,OAAOX,EAASE,EAAGC,EAAGC,EAASL,EAAeG,EAAGE,CAAQ,EAAGC,EAAGC,EAASP,EAAeG,EAAGI,CAAQ,EAAGC,EAAMC,EAAYT,EAAeG,EAAGM,CAAW,EAAGC,EAAGC,EAASX,EAAeG,EAAGQ,CAAQ,EAAGC,CAAI,CACrM,CAKAb,EAAO,QAAUG,ICLjB,IAAIW,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD", + "names": ["require_ndarray", "__commonJSMin", "exports", "module", "dmskmap2", "N", "x", "strideX", "offsetX", "y", "strideY", "offsetY", "mask", "strideMask", "offsetMask", "z", "strideZ", "offsetZ", "fcn", "ix", "iy", "iz", "im", "i", "require_main", "__commonJSMin", "exports", "module", "stride2offset", "ndarray", "dmskmap2", "N", "x", "strideX", "y", "strideY", "mask", "strideMask", "z", "strideZ", "fcn", "setReadOnly", "main", "ndarray"] } diff --git a/lib/main.js b/lib/main.js index 1d2050a..aa5ded7 100644 --- a/lib/main.js +++ b/lib/main.js @@ -18,6 +18,12 @@ 'use strict'; +// MODULES // + +var stride2offset = require( '@stdlib/strided-base-stride2offset' ); +var ndarray = require( './ndarray.js' ); + + // MAIN // /** @@ -51,44 +57,7 @@ * // => [ 2.0, 4.0, 0.0, 8.0, 10.0 ] */ function dmskmap2( N, x, strideX, y, strideY, mask, strideMask, z, strideZ, fcn ) { // eslint-disable-line max-len - var ix; - var iy; - var iz; - var im; - var i; - if ( N <= 0 ) { - return z; - } - if ( strideX < 0 ) { - ix = (1-N) * strideX; - } else { - ix = 0; - } - if ( strideY < 0 ) { - iy = (1-N) * strideY; - } else { - iy = 0; - } - if ( strideZ < 0 ) { - iz = (1-N) * strideZ; - } else { - iz = 0; - } - if ( strideMask < 0 ) { - im = (1-N) * strideMask; - } else { - im = 0; - } - for ( i = 0; i < N; i++ ) { - if ( mask[ im ] === 0 ) { - z[ iz ] = fcn( x[ ix ], y[ iy ] ); - } - ix += strideX; - iy += strideY; - iz += strideZ; - im += strideMask; - } - return z; + return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ), mask, strideMask, stride2offset( N, strideMask ), z, strideZ, stride2offset( N, strideZ ), fcn ); // eslint-disable-line max-len } diff --git a/manifest.json b/manifest.json index 890a937..1c20775 100644 --- a/manifest.json +++ b/manifest.json @@ -32,7 +32,9 @@ ], "libraries": [], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/strided-base-stride2offset" + ] } ] } diff --git a/package.json b/package.json index 9903e44..151eae2 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { + "@stdlib/strided-base-stride2offset": "github:stdlib-js/strided-base-stride2offset#main", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.1", "@stdlib/utils-library-manifest": "^0.2.1" }, diff --git a/src/main.c b/src/main.c index 2544fd1..9027517 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,7 @@ */ #include "stdlib/strided/base/dmskmap2.h" +#include "stdlib/strided/base/stride2offset.h" #include /** @@ -59,26 +60,10 @@ void stdlib_strided_dmskmap2( const int64_t N, const double *X, const int64_t st if ( N <= 0 ) { return; } - if ( strideX < 0 ) { - ix = (1-N) * strideX; - } else { - ix = 0; - } - if ( strideY < 0 ) { - iy = (1-N) * strideY; - } else { - iy = 0; - } - if ( strideZ < 0 ) { - iz = (1-N) * strideZ; - } else { - iz = 0; - } - if ( strideMask < 0 ) { - im = (1-N) * strideMask; - } else { - im = 0; - } + ix = stdlib_strided_stride2offset( N, strideX ); + iy = stdlib_strided_stride2offset( N, strideY ); + iz = stdlib_strided_stride2offset( N, strideZ ); + im = stdlib_strided_stride2offset( N, strideMask ); for ( i = 0; i < N; i++ ) { if ( Mask[ im ] == 0 ) { Z[ iz ] = fcn( X[ ix ], Y[ iy ] );