@stdlib/ndarray-base-broadcast-arrays 0.2.1 → 0.2.3
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.map +1 -1
- package/docs/types/index.d.ts +1 -1
- package/lib/main.js +1 -1
- package/package.json +4 -5
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -190,7 +190,7 @@ See [LICENSE][stdlib-license].
|
|
|
190
190
|
|
|
191
191
|
## Copyright
|
|
192
192
|
|
|
193
|
-
Copyright © 2016-
|
|
193
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
194
194
|
|
|
195
195
|
</section>
|
|
196
196
|
|
|
@@ -203,8 +203,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
203
203
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-broadcast-arrays.svg
|
|
204
204
|
[npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-broadcast-arrays
|
|
205
205
|
|
|
206
|
-
[test-image]: https://github.com/stdlib-js/ndarray-base-broadcast-arrays/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
207
|
-
[test-url]: https://github.com/stdlib-js/ndarray-base-broadcast-arrays/actions/workflows/test.yml?query=branch:v0.2.
|
|
206
|
+
[test-image]: https://github.com/stdlib-js/ndarray-base-broadcast-arrays/actions/workflows/test.yml/badge.svg?branch=v0.2.3
|
|
207
|
+
[test-url]: https://github.com/stdlib-js/ndarray-base-broadcast-arrays/actions/workflows/test.yml?query=branch:v0.2.3
|
|
208
208
|
|
|
209
209
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-broadcast-arrays/main.svg
|
|
210
210
|
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-broadcast-arrays?branch=main
|
|
@@ -216,8 +216,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
216
216
|
|
|
217
217
|
-->
|
|
218
218
|
|
|
219
|
-
[chat-image]: https://img.shields.io/
|
|
220
|
-
[chat-url]: https://
|
|
219
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
220
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
221
221
|
|
|
222
222
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
223
223
|
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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 broadcastShapes = require( '@stdlib/ndarray-base-broadcast-shapes' );\nvar broadcastArray = require( '@stdlib/ndarray-base-broadcast-array' );\nvar getShape = require( '@stdlib/ndarray-base-shape' );\n\n\n// MAIN //\n\n/**\n* Broadcasts ndarrays to a common shape.\n*\n* ## Notes\n*\n* - The returned arrays are views on their respective underlying data buffers. The views are typically **not** contiguous. As more than one element of a returned view may refer to the same memory location, writing to a view may affect multiple elements. If you need to write to one of the returned arrays, copy the array before performing operations which may mutate elements.\n*\n* @param {ArrayLikeObject<ndarray>} arrays - list of input arrays\n* @throws {Error} input arrays must be broadcast compatible\n* @returns {Array<ndarray>} broadcasted arrays\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var zeros = require( '@stdlib/ndarray-zeros' );\n*\n* var x1 = array( [ [ 1, 2 ], [ 3, 4 ] ] );\n* // returns <ndarray>\n*\n* var shx = x1.shape;\n* // returns [ 2, 2 ]\n*\n* var y1 = zeros( [ 3, 2, 2 ] );\n* // returns <ndarray>\n*\n* var shy = y1.shape;\n* // returns [ 3, 2, 2 ]\n*\n* var out = broadcastArrays( [ x1, y1 ] );\n* // returns <ndarray
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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 broadcastShapes = require( '@stdlib/ndarray-base-broadcast-shapes' );\nvar broadcastArray = require( '@stdlib/ndarray-base-broadcast-array' );\nvar getShape = require( '@stdlib/ndarray-base-shape' );\n\n\n// MAIN //\n\n/**\n* Broadcasts ndarrays to a common shape.\n*\n* ## Notes\n*\n* - The returned arrays are views on their respective underlying data buffers. The views are typically **not** contiguous. As more than one element of a returned view may refer to the same memory location, writing to a view may affect multiple elements. If you need to write to one of the returned arrays, copy the array before performing operations which may mutate elements.\n*\n* @param {ArrayLikeObject<ndarray>} arrays - list of input arrays\n* @throws {Error} input arrays must be broadcast compatible\n* @returns {Array<ndarray>} broadcasted arrays\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var zeros = require( '@stdlib/ndarray-zeros' );\n*\n* var x1 = array( [ [ 1, 2 ], [ 3, 4 ] ] );\n* // returns <ndarray>\n*\n* var shx = x1.shape;\n* // returns [ 2, 2 ]\n*\n* var y1 = zeros( [ 3, 2, 2 ] );\n* // returns <ndarray>\n*\n* var shy = y1.shape;\n* // returns [ 3, 2, 2 ]\n*\n* var out = broadcastArrays( [ x1, y1 ] );\n* // returns [ <ndarray> , <ndarray> ]\n*\n* var x2 = out[ 0 ];\n* // returns <ndarray>\n*\n* var y2 = out[ 1 ];\n* // returns <ndarray>\n*\n* shx = x2.shape;\n* // returns [ 3, 2, 2 ]\n*\n* shy = y2.shape;\n* // returns [ 3, 2, 2 ]\n*\n* var v = x2.get( 0, 0, 0 );\n* // returns 1\n*\n* v = x2.get( 0, 0, 1 );\n* // returns 2\n*\n* v = x2.get( 1, 0, 0 );\n* // returns 1\n*\n* v = x2.get( 1, 1, 0 );\n* // returns 3\n*\n* v = x2.get( 2, 0, 0 );\n* // returns 1\n*\n* v = x2.get( 2, 1, 1 );\n* // returns 4\n*\n* @example\n* var zeros = require( '@stdlib/ndarray-zeros' );\n*\n* var x = zeros( [ 2, 2 ] );\n* // returns <ndarray>\n*\n* var y = zeros( [ 4, 2 ] );\n* // returns <ndarray>\n*\n* var out = broadcastArrays( [ x, y ] );\n* // throws <Error>\n*/\nfunction broadcastArrays( arrays ) {\n\tvar shapes;\n\tvar out;\n\tvar sh;\n\tvar N;\n\tvar i;\n\n\tN = arrays.length;\n\n\t// Resolve the list of shapes...\n\tshapes = [];\n\tfor ( i = 0; i < N; i++ ) {\n\t\tshapes.push( getShape( arrays[ i ], false ) );\n\t}\n\t// Broadcast the shapes to a common shape:\n\tsh = broadcastShapes( shapes );\n\tif ( sh === null ) {\n\t\tthrow new Error( 'invalid arguments. Input arrays must be broadcast compatible.' );\n\t}\n\t// Broadcast each array to the common shape...\n\tout = [];\n\tfor ( i = 0; i < N; i++ ) {\n\t\tout.push( broadcastArray( arrays[ i ], sh ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = broadcastArrays;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Broadcast ndarrays to a common shape.\n*\n* @module @stdlib/ndarray-base-broadcast-arrays\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var zeros = require( '@stdlib/ndarray-zeros' );\n* var broadcastArrays = require( '@stdlib/ndarray-base-broadcast-arrays' );\n*\n* var x1 = array( [ [ 1, 2 ], [ 3, 4 ] ] );\n* // returns <ndarray>\n*\n* var shx = x1.shape;\n* // returns [ 2, 2 ]\n*\n* var y1 = zeros( [ 3, 2, 2 ] );\n* // returns <ndarray>\n*\n* var shy = y1.shape;\n* // returns [ 3, 2, 2 ]\n*\n* var out = broadcastArrays( [ x1, y1 ] );\n* // returns [ <ndarray>, <ndarray> ]\n*\n* var x2 = out[ 0 ];\n* // returns <ndarray>\n*\n* var y2 = out[ 1 ];\n* // returns <ndarray>\n*\n* shx = x2.shape;\n* // returns [ 3, 2, 2 ]\n*\n* shy = y2.shape;\n* // returns [ 3, 2, 2 ]\n*\n* var v = x2.get( 0, 0, 0 );\n* // returns 1\n*\n* v = x2.get( 0, 0, 1 );\n* // returns 2\n*\n* v = x2.get( 1, 0, 0 );\n* // returns 1\n*\n* v = x2.get( 1, 1, 0 );\n* // returns 3\n*\n* v = x2.get( 2, 0, 0 );\n* // returns 1\n*\n* v = x2.get( 2, 1, 1 );\n* // returns 4\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
5
|
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAkB,QAAS,uCAAwC,EACnEC,EAAiB,QAAS,sCAAuC,EACjEC,EAAW,QAAS,4BAA6B,EA6ErD,SAASC,EAAiBC,EAAS,CAClC,IAAIC,EACAC,EACAC,EACAC,EACAC,EAMJ,IAJAD,EAAIJ,EAAO,OAGXC,EAAS,CAAC,EACJI,EAAI,EAAGA,EAAID,EAAGC,IACnBJ,EAAO,KAAMH,EAAUE,EAAQK,CAAE,EAAG,EAAM,CAAE,EAI7C,GADAF,EAAKP,EAAiBK,CAAO,EACxBE,IAAO,KACX,MAAM,IAAI,MAAO,+DAAgE,EAIlF,IADAD,EAAM,CAAC,EACDG,EAAI,EAAGA,EAAID,EAAGC,IACnBH,EAAI,KAAML,EAAgBG,EAAQK,CAAE,EAAGF,CAAG,CAAE,EAE7C,OAAOD,CACR,CAKAP,EAAO,QAAUI,ICrDjB,IAAIO,EAAO,IAKX,OAAO,QAAUA",
|
|
6
6
|
"names": ["require_main", "__commonJSMin", "exports", "module", "broadcastShapes", "broadcastArray", "getShape", "broadcastArrays", "arrays", "shapes", "out", "sh", "N", "i", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
package/lib/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/ndarray-base-broadcast-arrays",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Broadcast ndarrays to a common shape.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/ndarray-base-broadcast-array": "^0.2.
|
|
34
|
-
"@stdlib/ndarray-base-broadcast-shapes": "^0.2.
|
|
35
|
-
"@stdlib/ndarray-base-shape": "^0.2.
|
|
33
|
+
"@stdlib/ndarray-base-broadcast-array": "^0.2.3",
|
|
34
|
+
"@stdlib/ndarray-base-broadcast-shapes": "^0.2.3",
|
|
35
|
+
"@stdlib/ndarray-base-shape": "^0.2.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {},
|
|
38
38
|
"engines": {
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"utils",
|
|
67
67
|
"util"
|
|
68
68
|
],
|
|
69
|
-
"__stdlib__": {},
|
|
70
69
|
"funding": {
|
|
71
70
|
"type": "opencollective",
|
|
72
71
|
"url": "https://opencollective.com/stdlib"
|