@stdlib/strided-base-binary-addon-dispatch 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +5 -5
- package/dist/index.js +35 -6
- package/dist/index.js.map +3 -3
- package/lib/main.js +9 -1
- package/lib/ndarray.js +9 -1
- package/package.json +13 -12
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -349,7 +349,7 @@ See [LICENSE][stdlib-license].
|
|
|
349
349
|
|
|
350
350
|
## Copyright
|
|
351
351
|
|
|
352
|
-
Copyright © 2016-
|
|
352
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
353
353
|
|
|
354
354
|
</section>
|
|
355
355
|
|
|
@@ -362,8 +362,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
362
362
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/strided-base-binary-addon-dispatch.svg
|
|
363
363
|
[npm-url]: https://npmjs.org/package/@stdlib/strided-base-binary-addon-dispatch
|
|
364
364
|
|
|
365
|
-
[test-image]: https://github.com/stdlib-js/strided-base-binary-addon-dispatch/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
366
|
-
[test-url]: https://github.com/stdlib-js/strided-base-binary-addon-dispatch/actions/workflows/test.yml?query=branch:v0.
|
|
365
|
+
[test-image]: https://github.com/stdlib-js/strided-base-binary-addon-dispatch/actions/workflows/test.yml/badge.svg?branch=v0.3.1
|
|
366
|
+
[test-url]: https://github.com/stdlib-js/strided-base-binary-addon-dispatch/actions/workflows/test.yml?query=branch:v0.3.1
|
|
367
367
|
|
|
368
368
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/strided-base-binary-addon-dispatch/main.svg
|
|
369
369
|
[coverage-url]: https://codecov.io/github/stdlib-js/strided-base-binary-addon-dispatch?branch=main
|
|
@@ -375,8 +375,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
375
375
|
|
|
376
376
|
-->
|
|
377
377
|
|
|
378
|
-
[chat-image]: https://img.shields.io/
|
|
379
|
-
[chat-url]: https://
|
|
378
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
379
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
380
380
|
|
|
381
381
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
382
382
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";var J=function(m,l){return function(){return l||m((l={exports:{}}).exports,l),l.exports}};var _=J(function(y,W){"use strict";var K=require("@stdlib/assert-is-function"),L=require("@stdlib/assert-is-typed-array-like"),q=require("@stdlib/strided-base-dtype-resolve-enum"),b=require("@stdlib/strided-base-reinterpret-complex64"),B=require("@stdlib/strided-base-reinterpret-complex128"),F=require("@stdlib/strided-base-reinterpret-boolean"),Q=require("@stdlib/string-format"),P=q("complex64"),A=q("complex128"),M=q("bool");function z(m,l){if(!K(m))throw new TypeError(Q("invalid argument. First argument must be a function. Value: `%s`.",m));if(!K(l))throw new TypeError(Q("invalid argument. Second argument must be a function. Value: `%s`.",l));return C;function C(g,i,v,c,r,n,t,o,e,s){var u,w,a;if(!L(v)||!L(n)||!L(e))return l(g,i,v,c,r,n,t,o,e,s),e;if(i=q(i),r=q(r),o=q(o),i===null||r===null||o===null)throw new TypeError("invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.");return i===P?u=b(v,0):i===A?u=B(v,0):i===M?u=F(v,0):u=v,r===P?w=b(n,0):r===A?w=B(n,0):r===M?w=F(n,0):w=n,o===P?a=b(e,0):o===A?a=B(e,0):o===M?a=F(e,0):a=e,m(g,i,u,c,r,w,t,o,a,s),e}}W.exports=z});var N=J(function(rr,f){"use strict";var $=require("@stdlib/assert-is-function"),S=require("@stdlib/assert-is-typed-array-like"),x=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,h=require("@stdlib/strided-base-dtype-resolve-enum"),I=require("@stdlib/strided-base-reinterpret-complex64"),U=require("@stdlib/strided-base-reinterpret-complex128"),p=require("@stdlib/strided-base-reinterpret-boolean"),R=require("@stdlib/strided-base-offset-view"),j=require("@stdlib/strided-base-min-view-buffer-index"),V=require("@stdlib/string-format"),D=h("complex64"),G=h("complex128"),H=h("bool");function X(m,l){if(!$(m))throw new TypeError(V("invalid argument. First argument must be a function. Value: `%s`.",m));if(!$(l))throw new TypeError(V("invalid argument. Second argument must be a function. Value: `%s`.",l));return C;function C(g,i,v,c,r,n,t,o,e,s,u,w,a){var E,T,O;if(!S(v)||!S(t)||!S(u))return l(g,i,v,c,r,n,t,o,e,s,u,w,a),u;if(i=h(i),n=h(n),s=h(s),i===null||n===null||s===null)throw new TypeError("invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.");if(!x(r))throw new TypeError(V("invalid argument. First input array offset must be a nonnegative integer. Value: `%s`.",r));if(!x(e))throw new TypeError(V("invalid argument. Second input array offset must be a nonnegative integer. Value: `%s`.",e));if(!x(a))throw new TypeError(V("invalid argument. Output array offset must be a nonnegative integer. Value: `%s`.",a));return r=j(g,c,r),e=j(g,o,e),a=j(g,w,a),i===D?E=I(v,r):i===G?E=U(v,r):i===H?E=p(v,r):E=R(v,r),n===D?T=I(t,e):n===G?T=U(t,e):n===H?T=p(t,e):T=R(t,e),s===D?O=I(u,a):s===G?O=U(u,a):s===H?O=p(u,a):O=R(u,a),m(g,i,E,c,n,T,o,s,O,w),u}}f.exports=X});var Y=require("@stdlib/utils-define-nonenumerable-read-only-property"),k=_(),Z=N();Y(k,"ndarray",Z);module.exports=k;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2024 The Stdlib Authors.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @license Apache-2.0
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
23
|
+
*
|
|
24
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License.
|
|
26
|
+
* You may obtain a copy of the License at
|
|
27
|
+
*
|
|
28
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
+
*
|
|
30
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
31
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
32
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
33
|
+
* See the License for the specific language governing permissions and
|
|
34
|
+
* limitations under the License.
|
|
35
|
+
*/
|
|
7
36
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/ndarray.js", "../lib/index.js"],
|
|
4
|
-
"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/* eslint-disable max-len */\n\n'use strict';\n\n// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );\nvar resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );\nvar reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );\nvar reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar COMPLEX64 = resolve( 'complex64' );\nvar COMPLEX128 = resolve( 'complex128' );\n\n\n// MAIN //\n\n/**\n* Returns a function which dispatches to a native add-on applying a binary function to two input strided arrays.\n*\n* ## Notes\n*\n* - The returned function has the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideY**: `z` stride length.\n*\n* - The add-on function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type (enumeration constant).\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type (enumeration constant).\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type (enumeration constant).\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n*\n* - The fallback function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n*\n* @param {Function} addon - add-on interface\n* @param {Function} fallback - fallback function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @returns {Function} dispatch function\n*\n* @example\n* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Call into native add-on...\n* }\n*\n* function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Fallback JavaScript implementation...\n* }\n*\n* // Create a dispatch function:\n* var f = dispatch( addon, fallback );\n*\n* // ...\n*\n* // Invoke the dispatch function with strided array arguments:\n* f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 3, 4 ], 1, 'generic', [ 0, 0 ], 1 );\n*/\nfunction dispatch( addon, fallback ) {\n\tif ( !isFunction( addon ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', addon ) );\n\t}\n\tif ( !isFunction( fallback ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fallback ) );\n\t}\n\treturn dispatcher;\n\n\t/**\n\t* Dispatches to a native add-on.\n\t*\n\t* @private\n\t* @param {integer} N - number of indexed elements\n\t* @param {*} dtypeX - `x` data type\n\t* @param {Collection} x - input array\n\t* @param {integer} strideX - `x` stride length\n\t* @param {*} dtypeY - `y` data type\n\t* @param {Collection} y - input array\n\t* @param {integer} strideY - `y` stride length\n\t* @param {*} dtypeZ - `z` data type\n\t* @param {Collection} z - destination array\n\t* @param {integer} strideZ - `z` stride length\n\t* @throws {TypeError} unable to resolve a strided array function supporting the provided array argument data types\n\t* @returns {Collection} `z`\n\t*/\n\tfunction dispatcher( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n\t\tvar viewX;\n\t\tvar viewY;\n\t\tvar viewZ;\n\n\t\t// WARNING: we assume that, if we're provided something resembling a typed array, we're provided a typed array; however, this can lead to potential unintended errors as the native add-on may not work with non-typed array objects (e.g., generic arrays)...\n\t\tif (\n\t\t\t!isTypedArrayLike( x ) ||\n\t\t\t!isTypedArrayLike( y ) ||\n\t\t\t!isTypedArrayLike( z )\n\t\t) {\n\t\t\tfallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ );\n\t\t\treturn z;\n\t\t}\n\t\tdtypeX = resolve( dtypeX );\n\t\tdtypeY = resolve( dtypeY );\n\t\tdtypeZ = resolve( dtypeZ );\n\t\tif ( dtypeX === null || dtypeY === null || dtypeZ === null ) {\n\t\t\tthrow new TypeError( 'invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.' );\n\t\t}\n\t\tif ( dtypeX === COMPLEX64 ) {\n\t\t\tviewX = reinterpretComplex64( x, 0 );\n\t\t} else if ( dtypeX === COMPLEX128 ) {\n\t\t\tviewX = reinterpretComplex128( x, 0 );\n\t\t} else {\n\t\t\tviewX = x;\n\t\t}\n\t\tif ( dtypeY === COMPLEX64 ) {\n\t\t\tviewY = reinterpretComplex64( y, 0 );\n\t\t} else if ( dtypeY === COMPLEX128 ) {\n\t\t\tviewY = reinterpretComplex128( y, 0 );\n\t\t} else {\n\t\t\tviewY = y;\n\t\t}\n\t\tif ( dtypeZ === COMPLEX64 ) {\n\t\t\tviewZ = reinterpretComplex64( z, 0 );\n\t\t} else if ( dtypeZ === COMPLEX128 ) {\n\t\t\tviewZ = reinterpretComplex128( z, 0 );\n\t\t} else {\n\t\t\tviewZ = z;\n\t\t}\n\t\taddon( N, dtypeX, viewX, strideX, dtypeY, viewY, strideY, dtypeZ, viewZ, strideZ );\n\t\treturn z;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dispatch;\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/* eslint-disable max-len */\n\n'use strict';\n\n// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );\nvar reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );\nvar reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar offsetView = require( '@stdlib/strided-base-offset-view' );\nvar minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar COMPLEX64 = resolve( 'complex64' );\nvar COMPLEX128 = resolve( 'complex128' );\n\n\n// MAIN //\n\n/**\n* Returns a function which dispatches to a native add-on applying a binary function to two input strided arrays using alternative indexing semantics.\n*\n* ## Notes\n*\n* - The returned function has the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **offsetX**: starting `x` index.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **offsetY**: starting `y` index.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n* - **offsetZ**: starting `z` index.\n*\n* - The add-on function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type (enumeration constant).\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type (enumeration constant).\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type (enumeration constant).\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n*\n* - The fallback function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **offsetX**: starting `x` index.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **offsetY**: starting `y` index.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n* - **offsetZ**: starting `z` index.\n*\n* @param {Function} addon - add-on interface\n* @param {Function} fallback - fallback function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @returns {Function} dispatch function\n*\n* @example\n* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Call into native add-on...\n* }\n*\n* function fallback( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ ) {\n* // Fallback JavaScript implementation...\n* }\n*\n* // Create a dispatch function:\n* var f = dispatch( addon, fallback );\n*\n* // ...\n*\n* // Invoke the dispatch function with strided array arguments:\n* f( 2, 'generic', [ 1, 2 ], 1, 0, 'generic', [ 3, 4 ], 1, 0, 'generic', [ 0, 0 ], 1, 0 );\n*/\nfunction dispatch( addon, fallback ) {\n\tif ( !isFunction( addon ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', addon ) );\n\t}\n\tif ( !isFunction( fallback ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fallback ) );\n\t}\n\treturn dispatcher;\n\n\t/**\n\t* Dispatches to a native add-on.\n\t*\n\t* @private\n\t* @param {integer} N - number of indexed elements\n\t* @param {*} dtypeX - `x` data type\n\t* @param {Collection} x - input array\n\t* @param {integer} strideX - `x` stride length\n\t* @param {NonNegativeInteger} offsetX - starting `x` index\n\t* @param {*} dtypeY - `y` data type\n\t* @param {Collection} y - input array\n\t* @param {integer} strideY - `y` stride length\n\t* @param {NonNegativeInteger} offsetY - starting `y` index\n\t* @param {*} dtypeZ - `z` data type\n\t* @param {Collection} z - destination array\n\t* @param {integer} strideZ - `z` stride length\n\t* @param {NonNegativeInteger} offsetZ - starting `z` index\n\t* @throws {TypeError} fifth argument must be a nonnegative integer\n\t* @throws {TypeError} ninth argument must be a nonnegative integer\n\t* @throws {TypeError} thirteenth argument must be a nonnegative integer\n\t* @throws {TypeError} unable to resolve a strided array function supporting the provided array argument data types\n\t* @returns {Collection} `z`\n\t*/\n\tfunction dispatcher( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ ) { // eslint-disable-line max-params\n\t\tvar viewX;\n\t\tvar viewY;\n\t\tvar viewZ;\n\n\t\t// WARNING: we assume that, if we're provided something resembling a typed array, we're provided a typed array; however, this can lead to potential unintended errors as the native add-on may not work with non-typed array objects (e.g., generic arrays)...\n\t\tif (\n\t\t\t!isTypedArrayLike( x ) ||\n\t\t\t!isTypedArrayLike( y ) ||\n\t\t\t!isTypedArrayLike( z )\n\t\t) {\n\t\t\tfallback( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ );\n\t\t\treturn z;\n\t\t}\n\t\tdtypeX = resolve( dtypeX );\n\t\tdtypeY = resolve( dtypeY );\n\t\tdtypeZ = resolve( dtypeZ );\n\t\tif ( dtypeX === null || dtypeY === null || dtypeZ === null ) {\n\t\t\tthrow new TypeError( 'invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.' );\n\t\t}\n\t\tif ( !isNonNegativeInteger( offsetX ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First input array offset must be a nonnegative integer. Value: `%s`.', offsetX ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( offsetY ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second input array offset must be a nonnegative integer. Value: `%s`.', offsetY ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( offsetZ ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Output array offset must be a nonnegative integer. Value: `%s`.', offsetZ ) );\n\t\t}\n\t\toffsetX = minViewBufferIndex( N, strideX, offsetX );\n\t\toffsetY = minViewBufferIndex( N, strideY, offsetY );\n\t\toffsetZ = minViewBufferIndex( N, strideZ, offsetZ );\n\t\tif ( dtypeX === COMPLEX64 ) {\n\t\t\tviewX = reinterpretComplex64( x, offsetX );\n\t\t} else if ( dtypeX === COMPLEX128 ) {\n\t\t\tviewX = reinterpretComplex128( x, offsetX );\n\t\t} else {\n\t\t\tviewX = offsetView( x, offsetX );\n\t\t}\n\t\tif ( dtypeY === COMPLEX64 ) {\n\t\t\tviewY = reinterpretComplex64( y, offsetY );\n\t\t} else if ( dtypeY === COMPLEX128 ) {\n\t\t\tviewY = reinterpretComplex128( y, offsetY );\n\t\t} else {\n\t\t\tviewY = offsetView( y, offsetY );\n\t\t}\n\t\tif ( dtypeZ === COMPLEX64 ) {\n\t\t\tviewZ = reinterpretComplex64( z, offsetZ );\n\t\t} else if ( dtypeZ === COMPLEX128 ) {\n\t\t\tviewZ = reinterpretComplex128( z, offsetZ );\n\t\t} else {\n\t\t\tviewZ = offsetView( z, offsetZ );\n\t\t}\n\n\t\taddon( N, dtypeX, viewX, strideX, dtypeY, viewY, strideY, dtypeZ, viewZ, strideZ );\n\t\treturn z;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dispatch;\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* Dispatch to a native add-on applying a binary function to two input strided arrays.\n*\n* @module @stdlib/strided-base-binary-addon-dispatch\n*\n* @example\n* var dispatch = require( '@stdlib/strided-base-binary-addon-dispatch' );\n*\n* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Call into native add-on...\n* }\n*\n* function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Fallback JavaScript implementation...\n* }\n*\n* // Create a dispatch function:\n* var f = dispatch( addon, fallback );\n*\n* // ...\n*\n* // Invoke the dispatch function with strided array arguments:\n* f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 3, 4 ], 1, 'generic', [ 0, 0 ], 1 );\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"],
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAwBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAmB,QAAS,oCAAqC,EACjEC,EAAU,QAAS,yCAA0C,EAC7DC,EAAuB,QAAS,4CAA6C,EAC7EC,EAAwB,QAAS,6CAA8C,EAC/EC,EAAS,QAAS,uBAAwB,EAK1CC,
|
|
6
|
-
"names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "isTypedArrayLike", "resolve", "reinterpretComplex64", "reinterpretComplex128", "format", "COMPLEX64", "COMPLEX128", "dispatch", "addon", "fallback", "dispatcher", "N", "dtypeX", "x", "strideX", "dtypeY", "y", "strideY", "dtypeZ", "z", "strideZ", "viewX", "viewY", "viewZ", "require_ndarray", "__commonJSMin", "exports", "module", "isFunction", "isTypedArrayLike", "isNonNegativeInteger", "resolve", "reinterpretComplex64", "reinterpretComplex128", "offsetView", "minViewBufferIndex", "format", "COMPLEX64", "COMPLEX128", "dispatch", "addon", "fallback", "dispatcher", "N", "dtypeX", "x", "strideX", "offsetX", "dtypeY", "y", "strideY", "offsetY", "dtypeZ", "z", "strideZ", "offsetZ", "viewX", "viewY", "viewZ", "setReadOnly", "main", "ndarray"]
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 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/* eslint-disable max-len */\n\n'use strict';\n\n// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );\nvar resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );\nvar reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );\nvar reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar COMPLEX64 = resolve( 'complex64' );\nvar COMPLEX128 = resolve( 'complex128' );\nvar BOOLEAN = resolve( 'bool' );\n\n\n// MAIN //\n\n/**\n* Returns a function which dispatches to a native add-on applying a binary function to two input strided arrays.\n*\n* ## Notes\n*\n* - The returned function has the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideY**: `z` stride length.\n*\n* - The add-on function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type (enumeration constant).\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type (enumeration constant).\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type (enumeration constant).\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n*\n* - The fallback function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n*\n* @param {Function} addon - add-on interface\n* @param {Function} fallback - fallback function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @returns {Function} dispatch function\n*\n* @example\n* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Call into native add-on...\n* }\n*\n* function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Fallback JavaScript implementation...\n* }\n*\n* // Create a dispatch function:\n* var f = dispatch( addon, fallback );\n*\n* // ...\n*\n* // Invoke the dispatch function with strided array arguments:\n* f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 3, 4 ], 1, 'generic', [ 0, 0 ], 1 );\n*/\nfunction dispatch( addon, fallback ) {\n\tif ( !isFunction( addon ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', addon ) );\n\t}\n\tif ( !isFunction( fallback ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fallback ) );\n\t}\n\treturn dispatcher;\n\n\t/**\n\t* Dispatches to a native add-on.\n\t*\n\t* @private\n\t* @param {integer} N - number of indexed elements\n\t* @param {*} dtypeX - `x` data type\n\t* @param {Collection} x - input array\n\t* @param {integer} strideX - `x` stride length\n\t* @param {*} dtypeY - `y` data type\n\t* @param {Collection} y - input array\n\t* @param {integer} strideY - `y` stride length\n\t* @param {*} dtypeZ - `z` data type\n\t* @param {Collection} z - destination array\n\t* @param {integer} strideZ - `z` stride length\n\t* @throws {TypeError} unable to resolve a strided array function supporting the provided array argument data types\n\t* @returns {Collection} `z`\n\t*/\n\tfunction dispatcher( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n\t\tvar viewX;\n\t\tvar viewY;\n\t\tvar viewZ;\n\n\t\t// WARNING: we assume that, if we're provided something resembling a typed array, we're provided a typed array; however, this can lead to potential unintended errors as the native add-on may not work with non-typed array objects (e.g., generic arrays)...\n\t\tif (\n\t\t\t!isTypedArrayLike( x ) ||\n\t\t\t!isTypedArrayLike( y ) ||\n\t\t\t!isTypedArrayLike( z )\n\t\t) {\n\t\t\tfallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ );\n\t\t\treturn z;\n\t\t}\n\t\tdtypeX = resolve( dtypeX );\n\t\tdtypeY = resolve( dtypeY );\n\t\tdtypeZ = resolve( dtypeZ );\n\t\tif ( dtypeX === null || dtypeY === null || dtypeZ === null ) {\n\t\t\tthrow new TypeError( 'invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.' );\n\t\t}\n\t\tif ( dtypeX === COMPLEX64 ) {\n\t\t\tviewX = reinterpretComplex64( x, 0 );\n\t\t} else if ( dtypeX === COMPLEX128 ) {\n\t\t\tviewX = reinterpretComplex128( x, 0 );\n\t\t} else if ( dtypeX === BOOLEAN ) {\n\t\t\tviewX = reinterpretBoolean( x, 0 );\n\t\t} else {\n\t\t\tviewX = x;\n\t\t}\n\t\tif ( dtypeY === COMPLEX64 ) {\n\t\t\tviewY = reinterpretComplex64( y, 0 );\n\t\t} else if ( dtypeY === COMPLEX128 ) {\n\t\t\tviewY = reinterpretComplex128( y, 0 );\n\t\t} else if ( dtypeY === BOOLEAN ) {\n\t\t\tviewY = reinterpretBoolean( y, 0 );\n\t\t} else {\n\t\t\tviewY = y;\n\t\t}\n\t\tif ( dtypeZ === COMPLEX64 ) {\n\t\t\tviewZ = reinterpretComplex64( z, 0 );\n\t\t} else if ( dtypeZ === COMPLEX128 ) {\n\t\t\tviewZ = reinterpretComplex128( z, 0 );\n\t\t} else if ( dtypeZ === BOOLEAN ) {\n\t\t\tviewZ = reinterpretBoolean( z, 0 );\n\t\t} else {\n\t\t\tviewZ = z;\n\t\t}\n\t\taddon( N, dtypeX, viewX, strideX, dtypeY, viewY, strideY, dtypeZ, viewZ, strideZ );\n\t\treturn z;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dispatch;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 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/* eslint-disable max-len */\n\n'use strict';\n\n// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );\nvar reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );\nvar reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );\nvar reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' );\nvar offsetView = require( '@stdlib/strided-base-offset-view' );\nvar minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar COMPLEX64 = resolve( 'complex64' );\nvar COMPLEX128 = resolve( 'complex128' );\nvar BOOLEAN = resolve( 'bool' );\n\n\n// MAIN //\n\n/**\n* Returns a function which dispatches to a native add-on applying a binary function to two input strided arrays using alternative indexing semantics.\n*\n* ## Notes\n*\n* - The returned function has the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **offsetX**: starting `x` index.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **offsetY**: starting `y` index.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n* - **offsetZ**: starting `z` index.\n*\n* - The add-on function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type (enumeration constant).\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **dtypeY**: `y` data type (enumeration constant).\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **dtypeZ**: `z` data type (enumeration constant).\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n*\n* - The fallback function should have the following signature:\n*\n* ```text\n* f( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ )\n* ```\n*\n* where\n*\n* - **N**: number of indexed elements.\n* - **dtypeX**: `x` data type.\n* - **x**: input array.\n* - **strideX**: `x` stride length.\n* - **offsetX**: starting `x` index.\n* - **dtypeY**: `y` data type.\n* - **y**: input array.\n* - **strideY**: `y` stride length.\n* - **offsetY**: starting `y` index.\n* - **dtypeZ**: `z` data type.\n* - **z**: output array.\n* - **strideZ**: `z` stride length.\n* - **offsetZ**: starting `z` index.\n*\n* @param {Function} addon - add-on interface\n* @param {Function} fallback - fallback function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @returns {Function} dispatch function\n*\n* @example\n* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Call into native add-on...\n* }\n*\n* function fallback( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ ) {\n* // Fallback JavaScript implementation...\n* }\n*\n* // Create a dispatch function:\n* var f = dispatch( addon, fallback );\n*\n* // ...\n*\n* // Invoke the dispatch function with strided array arguments:\n* f( 2, 'generic', [ 1, 2 ], 1, 0, 'generic', [ 3, 4 ], 1, 0, 'generic', [ 0, 0 ], 1, 0 );\n*/\nfunction dispatch( addon, fallback ) {\n\tif ( !isFunction( addon ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', addon ) );\n\t}\n\tif ( !isFunction( fallback ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fallback ) );\n\t}\n\treturn dispatcher;\n\n\t/**\n\t* Dispatches to a native add-on.\n\t*\n\t* @private\n\t* @param {integer} N - number of indexed elements\n\t* @param {*} dtypeX - `x` data type\n\t* @param {Collection} x - input array\n\t* @param {integer} strideX - `x` stride length\n\t* @param {NonNegativeInteger} offsetX - starting `x` index\n\t* @param {*} dtypeY - `y` data type\n\t* @param {Collection} y - input array\n\t* @param {integer} strideY - `y` stride length\n\t* @param {NonNegativeInteger} offsetY - starting `y` index\n\t* @param {*} dtypeZ - `z` data type\n\t* @param {Collection} z - destination array\n\t* @param {integer} strideZ - `z` stride length\n\t* @param {NonNegativeInteger} offsetZ - starting `z` index\n\t* @throws {TypeError} fifth argument must be a nonnegative integer\n\t* @throws {TypeError} ninth argument must be a nonnegative integer\n\t* @throws {TypeError} thirteenth argument must be a nonnegative integer\n\t* @throws {TypeError} unable to resolve a strided array function supporting the provided array argument data types\n\t* @returns {Collection} `z`\n\t*/\n\tfunction dispatcher( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ ) { // eslint-disable-line max-params\n\t\tvar viewX;\n\t\tvar viewY;\n\t\tvar viewZ;\n\n\t\t// WARNING: we assume that, if we're provided something resembling a typed array, we're provided a typed array; however, this can lead to potential unintended errors as the native add-on may not work with non-typed array objects (e.g., generic arrays)...\n\t\tif (\n\t\t\t!isTypedArrayLike( x ) ||\n\t\t\t!isTypedArrayLike( y ) ||\n\t\t\t!isTypedArrayLike( z )\n\t\t) {\n\t\t\tfallback( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY, dtypeZ, z, strideZ, offsetZ );\n\t\t\treturn z;\n\t\t}\n\t\tdtypeX = resolve( dtypeX );\n\t\tdtypeY = resolve( dtypeY );\n\t\tdtypeZ = resolve( dtypeZ );\n\t\tif ( dtypeX === null || dtypeY === null || dtypeZ === null ) {\n\t\t\tthrow new TypeError( 'invalid arguments. Unable to resolve a strided array function supporting the provided array argument data types.' );\n\t\t}\n\t\tif ( !isNonNegativeInteger( offsetX ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First input array offset must be a nonnegative integer. Value: `%s`.', offsetX ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( offsetY ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second input array offset must be a nonnegative integer. Value: `%s`.', offsetY ) );\n\t\t}\n\t\tif ( !isNonNegativeInteger( offsetZ ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Output array offset must be a nonnegative integer. Value: `%s`.', offsetZ ) );\n\t\t}\n\t\toffsetX = minViewBufferIndex( N, strideX, offsetX );\n\t\toffsetY = minViewBufferIndex( N, strideY, offsetY );\n\t\toffsetZ = minViewBufferIndex( N, strideZ, offsetZ );\n\t\tif ( dtypeX === COMPLEX64 ) {\n\t\t\tviewX = reinterpretComplex64( x, offsetX );\n\t\t} else if ( dtypeX === COMPLEX128 ) {\n\t\t\tviewX = reinterpretComplex128( x, offsetX );\n\t\t} else if ( dtypeX === BOOLEAN ) {\n\t\t\tviewX = reinterpretBoolean( x, offsetX );\n\t\t} else {\n\t\t\tviewX = offsetView( x, offsetX );\n\t\t}\n\t\tif ( dtypeY === COMPLEX64 ) {\n\t\t\tviewY = reinterpretComplex64( y, offsetY );\n\t\t} else if ( dtypeY === COMPLEX128 ) {\n\t\t\tviewY = reinterpretComplex128( y, offsetY );\n\t\t} else if ( dtypeY === BOOLEAN ) {\n\t\t\tviewY = reinterpretBoolean( y, offsetY );\n\t\t} else {\n\t\t\tviewY = offsetView( y, offsetY );\n\t\t}\n\t\tif ( dtypeZ === COMPLEX64 ) {\n\t\t\tviewZ = reinterpretComplex64( z, offsetZ );\n\t\t} else if ( dtypeZ === COMPLEX128 ) {\n\t\t\tviewZ = reinterpretComplex128( z, offsetZ );\n\t\t} else if ( dtypeZ === BOOLEAN ) {\n\t\t\tviewZ = reinterpretBoolean( z, offsetZ );\n\t\t} else {\n\t\t\tviewZ = offsetView( z, offsetZ );\n\t\t}\n\n\t\taddon( N, dtypeX, viewX, strideX, dtypeY, viewY, strideY, dtypeZ, viewZ, strideZ );\n\t\treturn z;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dispatch;\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* Dispatch to a native add-on applying a binary function to two input strided arrays.\n*\n* @module @stdlib/strided-base-binary-addon-dispatch\n*\n* @example\n* var dispatch = require( '@stdlib/strided-base-binary-addon-dispatch' );\n*\n* function addon( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Call into native add-on...\n* }\n*\n* function fallback( N, dtypeX, x, strideX, dtypeY, y, strideY, dtypeZ, z, strideZ ) {\n* // Fallback JavaScript implementation...\n* }\n*\n* // Create a dispatch function:\n* var f = dispatch( addon, fallback );\n*\n* // ...\n*\n* // Invoke the dispatch function with strided array arguments:\n* f( 2, 'generic', [ 1, 2 ], 1, 'generic', [ 3, 4 ], 1, 'generic', [ 0, 0 ], 1 );\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar ndarray = require( './ndar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,EACtBmB,EAAQzB,EAAoBiB,EAAGE,CAAQ,EAEvCM,EAAQxB,EAAYgB,EAAGE,CAAQ,EAE3BC,IAAWhB,EACfsB,EAAQ5B,EAAsBuB,EAAGE,CAAQ,EAC9BH,IAAWf,EACtBqB,EAAQ3B,EAAuBsB,EAAGE,CAAQ,EAC/BH,IAAWd,EACtBoB,EAAQ1B,EAAoBqB,EAAGE,CAAQ,EAEvCG,EAAQzB,EAAYoB,EAAGE,CAAQ,EAGhCf,EAAOG,EAAGC,EAAQY,EAAOV,EAASE,EAAQS,EAAOP,EAASE,EAAQM,EAAOJ,CAAQ,EAC1ED,CACR,CACD,CAKA5B,EAAO,QAAUc,IC7LjB,IAAIoB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAU,IAKdF,EAAaC,EAAM,UAAWC,CAAQ,EAKtC,OAAO,QAAUD",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "isTypedArrayLike", "resolve", "reinterpretComplex64", "reinterpretComplex128", "reinterpretBoolean", "format", "COMPLEX64", "COMPLEX128", "BOOLEAN", "dispatch", "addon", "fallback", "dispatcher", "N", "dtypeX", "x", "strideX", "dtypeY", "y", "strideY", "dtypeZ", "z", "strideZ", "viewX", "viewY", "viewZ", "require_ndarray", "__commonJSMin", "exports", "module", "isFunction", "isTypedArrayLike", "isNonNegativeInteger", "resolve", "reinterpretComplex64", "reinterpretComplex128", "reinterpretBoolean", "offsetView", "minViewBufferIndex", "format", "COMPLEX64", "COMPLEX128", "BOOLEAN", "dispatch", "addon", "fallback", "dispatcher", "N", "dtypeX", "x", "strideX", "offsetX", "dtypeY", "y", "strideY", "offsetY", "dtypeZ", "z", "strideZ", "offsetZ", "viewX", "viewY", "viewZ", "setReadOnly", "main", "ndarray"]
|
|
7
7
|
}
|
package/lib/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license Apache-2.0
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2024 The Stdlib Authors.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -27,6 +27,7 @@ var isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );
|
|
|
27
27
|
var resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );
|
|
28
28
|
var reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );
|
|
29
29
|
var reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );
|
|
30
|
+
var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' );
|
|
30
31
|
var format = require( '@stdlib/string-format' );
|
|
31
32
|
|
|
32
33
|
|
|
@@ -34,6 +35,7 @@ var format = require( '@stdlib/string-format' );
|
|
|
34
35
|
|
|
35
36
|
var COMPLEX64 = resolve( 'complex64' );
|
|
36
37
|
var COMPLEX128 = resolve( 'complex128' );
|
|
38
|
+
var BOOLEAN = resolve( 'bool' );
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
// MAIN //
|
|
@@ -173,6 +175,8 @@ function dispatch( addon, fallback ) {
|
|
|
173
175
|
viewX = reinterpretComplex64( x, 0 );
|
|
174
176
|
} else if ( dtypeX === COMPLEX128 ) {
|
|
175
177
|
viewX = reinterpretComplex128( x, 0 );
|
|
178
|
+
} else if ( dtypeX === BOOLEAN ) {
|
|
179
|
+
viewX = reinterpretBoolean( x, 0 );
|
|
176
180
|
} else {
|
|
177
181
|
viewX = x;
|
|
178
182
|
}
|
|
@@ -180,6 +184,8 @@ function dispatch( addon, fallback ) {
|
|
|
180
184
|
viewY = reinterpretComplex64( y, 0 );
|
|
181
185
|
} else if ( dtypeY === COMPLEX128 ) {
|
|
182
186
|
viewY = reinterpretComplex128( y, 0 );
|
|
187
|
+
} else if ( dtypeY === BOOLEAN ) {
|
|
188
|
+
viewY = reinterpretBoolean( y, 0 );
|
|
183
189
|
} else {
|
|
184
190
|
viewY = y;
|
|
185
191
|
}
|
|
@@ -187,6 +193,8 @@ function dispatch( addon, fallback ) {
|
|
|
187
193
|
viewZ = reinterpretComplex64( z, 0 );
|
|
188
194
|
} else if ( dtypeZ === COMPLEX128 ) {
|
|
189
195
|
viewZ = reinterpretComplex128( z, 0 );
|
|
196
|
+
} else if ( dtypeZ === BOOLEAN ) {
|
|
197
|
+
viewZ = reinterpretBoolean( z, 0 );
|
|
190
198
|
} else {
|
|
191
199
|
viewZ = z;
|
|
192
200
|
}
|
package/lib/ndarray.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license Apache-2.0
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2024 The Stdlib Authors.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -28,6 +28,7 @@ var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).is
|
|
|
28
28
|
var resolve = require( '@stdlib/strided-base-dtype-resolve-enum' );
|
|
29
29
|
var reinterpretComplex64 = require( '@stdlib/strided-base-reinterpret-complex64' );
|
|
30
30
|
var reinterpretComplex128 = require( '@stdlib/strided-base-reinterpret-complex128' );
|
|
31
|
+
var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' );
|
|
31
32
|
var offsetView = require( '@stdlib/strided-base-offset-view' );
|
|
32
33
|
var minViewBufferIndex = require( '@stdlib/strided-base-min-view-buffer-index' );
|
|
33
34
|
var format = require( '@stdlib/string-format' );
|
|
@@ -37,6 +38,7 @@ var format = require( '@stdlib/string-format' );
|
|
|
37
38
|
|
|
38
39
|
var COMPLEX64 = resolve( 'complex64' );
|
|
39
40
|
var COMPLEX128 = resolve( 'complex128' );
|
|
41
|
+
var BOOLEAN = resolve( 'bool' );
|
|
40
42
|
|
|
41
43
|
|
|
42
44
|
// MAIN //
|
|
@@ -200,6 +202,8 @@ function dispatch( addon, fallback ) {
|
|
|
200
202
|
viewX = reinterpretComplex64( x, offsetX );
|
|
201
203
|
} else if ( dtypeX === COMPLEX128 ) {
|
|
202
204
|
viewX = reinterpretComplex128( x, offsetX );
|
|
205
|
+
} else if ( dtypeX === BOOLEAN ) {
|
|
206
|
+
viewX = reinterpretBoolean( x, offsetX );
|
|
203
207
|
} else {
|
|
204
208
|
viewX = offsetView( x, offsetX );
|
|
205
209
|
}
|
|
@@ -207,6 +211,8 @@ function dispatch( addon, fallback ) {
|
|
|
207
211
|
viewY = reinterpretComplex64( y, offsetY );
|
|
208
212
|
} else if ( dtypeY === COMPLEX128 ) {
|
|
209
213
|
viewY = reinterpretComplex128( y, offsetY );
|
|
214
|
+
} else if ( dtypeY === BOOLEAN ) {
|
|
215
|
+
viewY = reinterpretBoolean( y, offsetY );
|
|
210
216
|
} else {
|
|
211
217
|
viewY = offsetView( y, offsetY );
|
|
212
218
|
}
|
|
@@ -214,6 +220,8 @@ function dispatch( addon, fallback ) {
|
|
|
214
220
|
viewZ = reinterpretComplex64( z, offsetZ );
|
|
215
221
|
} else if ( dtypeZ === COMPLEX128 ) {
|
|
216
222
|
viewZ = reinterpretComplex128( z, offsetZ );
|
|
223
|
+
} else if ( dtypeZ === BOOLEAN ) {
|
|
224
|
+
viewZ = reinterpretBoolean( z, offsetZ );
|
|
217
225
|
} else {
|
|
218
226
|
viewZ = offsetView( z, offsetZ );
|
|
219
227
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/strided-base-binary-addon-dispatch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Dispatch to a native add-on applying a binary function to two input strided arrays.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -30,16 +30,18 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/assert-is-function": "^0.2.
|
|
34
|
-
"@stdlib/assert-is-nonnegative-integer": "^0.2.
|
|
35
|
-
"@stdlib/assert-is-typed-array-like": "^0.2.
|
|
36
|
-
"@stdlib/strided-base-dtype-resolve-enum": "^0.2.
|
|
37
|
-
"@stdlib/strided-base-min-view-buffer-index": "^0.
|
|
38
|
-
"@stdlib/strided-base-offset-view": "^0.2.
|
|
39
|
-
"@stdlib/strided-base-reinterpret-
|
|
40
|
-
"@stdlib/strided-base-reinterpret-
|
|
41
|
-
"@stdlib/
|
|
42
|
-
"@stdlib/
|
|
33
|
+
"@stdlib/assert-is-function": "^0.2.3",
|
|
34
|
+
"@stdlib/assert-is-nonnegative-integer": "^0.2.3",
|
|
35
|
+
"@stdlib/assert-is-typed-array-like": "^0.2.3",
|
|
36
|
+
"@stdlib/strided-base-dtype-resolve-enum": "^0.2.3",
|
|
37
|
+
"@stdlib/strided-base-min-view-buffer-index": "^0.3.1",
|
|
38
|
+
"@stdlib/strided-base-offset-view": "^0.2.3",
|
|
39
|
+
"@stdlib/strided-base-reinterpret-boolean": "^0.0.3",
|
|
40
|
+
"@stdlib/strided-base-reinterpret-complex128": "^0.2.3",
|
|
41
|
+
"@stdlib/strided-base-reinterpret-complex64": "^0.2.1",
|
|
42
|
+
"@stdlib/string-format": "^0.2.3",
|
|
43
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.3",
|
|
44
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.3"
|
|
43
45
|
},
|
|
44
46
|
"devDependencies": {},
|
|
45
47
|
"engines": {
|
|
@@ -68,7 +70,6 @@
|
|
|
68
70
|
"native",
|
|
69
71
|
"binary"
|
|
70
72
|
],
|
|
71
|
-
"__stdlib__": {},
|
|
72
73
|
"funding": {
|
|
73
74
|
"type": "opencollective",
|
|
74
75
|
"url": "https://opencollective.com/stdlib"
|