@stdlib/array-base-ternary3d 0.1.0 → 0.2.0
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 +8 -11
- package/SECURITY.md +5 -0
- package/dist/index.js.map +2 -2
- package/docs/types/index.d.ts +6 -7
- package/lib/index.js +1 -4
- package/lib/main.js +2 -5
- package/package.json +6 -4
- package/CITATION.cff +0 -30
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2024 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -64,12 +64,9 @@ var ternary3d = require( '@stdlib/array-base-ternary3d' );
|
|
|
64
64
|
Applies a ternary callback to elements in three three-dimensional nested input arrays and assigns results to elements in a three-dimensional nested output array.
|
|
65
65
|
|
|
66
66
|
```javascript
|
|
67
|
+
var add = require( '@stdlib/math-base-ops-add3' );
|
|
67
68
|
var zeros3d = require( '@stdlib/array-base-zeros3d' );
|
|
68
69
|
|
|
69
|
-
function add( x, y, z ) {
|
|
70
|
-
return x + y + z;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
70
|
var x = [ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ];
|
|
74
71
|
var out = zeros3d( [ 1, 2, 2 ] );
|
|
75
72
|
|
|
@@ -108,13 +105,10 @@ The function accepts the following arguments:
|
|
|
108
105
|
```javascript
|
|
109
106
|
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
|
|
110
107
|
var filled3dBy = require( '@stdlib/array-base-filled3d-by' );
|
|
108
|
+
var add = require( '@stdlib/math-base-ops-add3' );
|
|
111
109
|
var zeros3d = require( '@stdlib/array-base-zeros3d' );
|
|
112
110
|
var ternary3d = require( '@stdlib/array-base-ternary3d' );
|
|
113
111
|
|
|
114
|
-
function add( x, y, z ) {
|
|
115
|
-
return x + y + z;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
112
|
var shape = [ 3, 3, 3 ];
|
|
119
113
|
|
|
120
114
|
var x = filled3dBy( shape, discreteUniform( -100, 100 ) );
|
|
@@ -171,7 +165,7 @@ See [LICENSE][stdlib-license].
|
|
|
171
165
|
|
|
172
166
|
## Copyright
|
|
173
167
|
|
|
174
|
-
Copyright © 2016-
|
|
168
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
175
169
|
|
|
176
170
|
</section>
|
|
177
171
|
|
|
@@ -184,8 +178,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
184
178
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-ternary3d.svg
|
|
185
179
|
[npm-url]: https://npmjs.org/package/@stdlib/array-base-ternary3d
|
|
186
180
|
|
|
187
|
-
[test-image]: https://github.com/stdlib-js/array-base-ternary3d/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
188
|
-
[test-url]: https://github.com/stdlib-js/array-base-ternary3d/actions/workflows/test.yml?query=branch:v0.
|
|
181
|
+
[test-image]: https://github.com/stdlib-js/array-base-ternary3d/actions/workflows/test.yml/badge.svg?branch=v0.2.0
|
|
182
|
+
[test-url]: https://github.com/stdlib-js/array-base-ternary3d/actions/workflows/test.yml?query=branch:v0.2.0
|
|
189
183
|
|
|
190
184
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-ternary3d/main.svg
|
|
191
185
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-base-ternary3d?branch=main
|
|
@@ -208,8 +202,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
208
202
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
209
203
|
|
|
210
204
|
[deno-url]: https://github.com/stdlib-js/array-base-ternary3d/tree/deno
|
|
205
|
+
[deno-readme]: https://github.com/stdlib-js/array-base-ternary3d/blob/deno/README.md
|
|
211
206
|
[umd-url]: https://github.com/stdlib-js/array-base-ternary3d/tree/umd
|
|
207
|
+
[umd-readme]: https://github.com/stdlib-js/array-base-ternary3d/blob/umd/README.md
|
|
212
208
|
[esm-url]: https://github.com/stdlib-js/array-base-ternary3d/tree/esm
|
|
209
|
+
[esm-readme]: https://github.com/stdlib-js/array-base-ternary3d/blob/esm/README.md
|
|
213
210
|
[branches-url]: https://github.com/stdlib-js/array-base-ternary3d/blob/main/branches.md
|
|
214
211
|
|
|
215
212
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-base-ternary3d/main/LICENSE
|
package/SECURITY.md
ADDED
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// MAIN //\n\n/**\n* Applies a ternary callback to elements in three three-dimensional nested input arrays and assigns results to elements in a three-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject<Array<Collection
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,
|
|
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// MAIN //\n\n/**\n* Applies a ternary callback to elements in three three-dimensional nested input arrays and assigns results to elements in a three-dimensional nested output array.\n*\n* ## Notes\n*\n* - The function assumes that the input and output arrays have the same shape.\n*\n* @param {ArrayLikeObject<Array<Array<Collection>>>} arrays - array-like object containing three input nested arrays and one output nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {Callback} fcn - ternary callback\n* @returns {void}\n*\n* @example\n* var add = require( '@stdlib/math-base-ops-add3' );\n* var ones3d = require( '@stdlib/array-base-ones3d' );\n* var zeros3d = require( '@stdlib/array-base-zeros3d' );\n*\n* var shape = [ 1, 2, 2 ];\n*\n* var x = ones3d( shape );\n* var y = ones3d( shape );\n* var z = ones3d( shape );\n* var out = zeros3d( shape );\n*\n* ternary3d( [ x, y, z, out ], shape, add );\n*\n* console.log( out );\n* // => [ [ [ 3.0, 3.0 ], [ 3.0, 3.0 ] ] ]\n*/\nfunction ternary3d( arrays, shape, fcn ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar x0;\n\tvar y0;\n\tvar z0;\n\tvar w0;\n\tvar x1;\n\tvar y1;\n\tvar z1;\n\tvar w1;\n\tvar x;\n\tvar y;\n\tvar z;\n\tvar w;\n\n\tS0 = shape[ 2 ];\n\tS1 = shape[ 1 ];\n\tS2 = shape[ 0 ];\n\tif ( S0 <= 0 || S1 <= 0 || S2 <= 0 ) {\n\t\treturn;\n\t}\n\tx = arrays[ 0 ];\n\ty = arrays[ 1 ];\n\tz = arrays[ 2 ];\n\tw = arrays[ 3 ];\n\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\tx1 = x[ i2 ];\n\t\ty1 = y[ i2 ];\n\t\tz1 = z[ i2 ];\n\t\tw1 = w[ i2 ];\n\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\tx0 = x1[ i1 ];\n\t\t\ty0 = y1[ i1 ];\n\t\t\tz0 = z1[ i1 ];\n\t\t\tw0 = w1[ i1 ];\n\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\tw0[ i0 ] = fcn( x0[ i0 ], y0[ i0 ], z0[ i0 ] );\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = ternary3d;\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* Apply a ternary callback to elements in three three-dimensional nested input arrays and assign results to elements in a three-dimensional nested output array.\n*\n* @module @stdlib/array-base-ternary3d\n*\n* @example\n* var add = require( '@stdlib/math-base-ops-add3' );\n* var ones3d = require( '@stdlib/array-base-ones3d' );\n* var zeros3d = require( '@stdlib/array-base-zeros3d' );\n* var ternary3d = require( '@stdlib/array-base-ternary3d' );\n*\n* var shape = [ 1, 2, 2 ];\n*\n* var x = ones3d( shape );\n* var y = ones3d( shape );\n* var z = ones3d( shape );\n* var out = zeros3d( shape );\n*\n* ternary3d( [ x, y, z, out ], shape, add );\n*\n* console.log( out );\n* // => [ [ [ 3.0, 3.0 ], [ 3.0, 3.0 ] ] ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAmDA,SAASC,EAAWC,EAAQC,EAAOC,EAAM,CACxC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAKJ,GAHAjB,EAAKF,EAAO,CAAE,EACdG,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACT,EAAAE,GAAM,GAAKC,GAAM,GAAKC,GAAM,GAOjC,IAJAY,EAAIjB,EAAQ,CAAE,EACdkB,EAAIlB,EAAQ,CAAE,EACdmB,EAAInB,EAAQ,CAAE,EACdoB,EAAIpB,EAAQ,CAAE,EACRQ,EAAK,EAAGA,EAAKH,EAAIG,IAKtB,IAJAK,EAAKI,EAAGT,CAAG,EACXM,EAAKI,EAAGV,CAAG,EACXO,EAAKI,EAAGX,CAAG,EACXQ,EAAKI,EAAGZ,CAAG,EACLD,EAAK,EAAGA,EAAKH,EAAIG,IAKtB,IAJAE,EAAKI,EAAIN,CAAG,EACZG,EAAKI,EAAIP,CAAG,EACZI,EAAKI,EAAIR,CAAG,EACZK,EAAKI,EAAIT,CAAG,EACND,EAAK,EAAGA,EAAKH,EAAIG,IACtBM,EAAIN,CAAG,EAAIJ,EAAKO,EAAIH,CAAG,EAAGI,EAAIJ,CAAG,EAAGK,EAAIL,CAAG,CAAE,CAIjD,CAKAR,EAAO,QAAUC,ICvDjB,IAAIsB,EAAO,IAKX,OAAO,QAAUA",
|
|
6
6
|
"names": ["require_main", "__commonJSMin", "exports", "module", "ternary3d", "arrays", "shape", "fcn", "S0", "S1", "S2", "i0", "i1", "i2", "x0", "y0", "z0", "w0", "x1", "y1", "z1", "w1", "x", "y", "z", "w", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -26,7 +26,9 @@ import { Shape3D } from '@stdlib/types/ndarray';
|
|
|
26
26
|
/**
|
|
27
27
|
* Ternary callback.
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
29
|
+
* @param v1 - element from first input array
|
|
30
|
+
* @param v2 - element from second input array
|
|
31
|
+
* @param v3 - element from third input array
|
|
30
32
|
* @returns result
|
|
31
33
|
*/
|
|
32
34
|
type Ternary<T, U, V, W> = ( v1: T, v2: U, v3: V ) => W;
|
|
@@ -43,12 +45,9 @@ type Ternary<T, U, V, W> = ( v1: T, v2: U, v3: V ) => W;
|
|
|
43
45
|
* @param fcn - ternary callback
|
|
44
46
|
*
|
|
45
47
|
* @example
|
|
46
|
-
* var
|
|
47
|
-
* var
|
|
48
|
-
*
|
|
49
|
-
* function add( x, y, z ) {
|
|
50
|
-
* return x + y + z;
|
|
51
|
-
* }
|
|
48
|
+
* var add = require( '@stdlib/math-base-ops-add3' );
|
|
49
|
+
* var ones3d = require( '@stdlib/array-base-ones3d' );
|
|
50
|
+
* var zeros3d = require( '@stdlib/array-base-zeros3d' );
|
|
52
51
|
*
|
|
53
52
|
* var shape = [ 1, 2, 2 ];
|
|
54
53
|
*
|
package/lib/index.js
CHANGED
|
@@ -24,14 +24,11 @@
|
|
|
24
24
|
* @module @stdlib/array-base-ternary3d
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
|
+
* var add = require( '@stdlib/math-base-ops-add3' );
|
|
27
28
|
* var ones3d = require( '@stdlib/array-base-ones3d' );
|
|
28
29
|
* var zeros3d = require( '@stdlib/array-base-zeros3d' );
|
|
29
30
|
* var ternary3d = require( '@stdlib/array-base-ternary3d' );
|
|
30
31
|
*
|
|
31
|
-
* function add( x, y, z ) {
|
|
32
|
-
* return x + y + z;
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
32
|
* var shape = [ 1, 2, 2 ];
|
|
36
33
|
*
|
|
37
34
|
* var x = ones3d( shape );
|
package/lib/main.js
CHANGED
|
@@ -27,19 +27,16 @@
|
|
|
27
27
|
*
|
|
28
28
|
* - The function assumes that the input and output arrays have the same shape.
|
|
29
29
|
*
|
|
30
|
-
* @param {ArrayLikeObject<Array<Collection
|
|
30
|
+
* @param {ArrayLikeObject<Array<Array<Collection>>>} arrays - array-like object containing three input nested arrays and one output nested array
|
|
31
31
|
* @param {NonNegativeIntegerArray} shape - array shape
|
|
32
32
|
* @param {Callback} fcn - ternary callback
|
|
33
33
|
* @returns {void}
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
|
+
* var add = require( '@stdlib/math-base-ops-add3' );
|
|
36
37
|
* var ones3d = require( '@stdlib/array-base-ones3d' );
|
|
37
38
|
* var zeros3d = require( '@stdlib/array-base-zeros3d' );
|
|
38
39
|
*
|
|
39
|
-
* function add( x, y, z ) {
|
|
40
|
-
* return x + y + z;
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
40
|
* var shape = [ 1, 2, 2 ];
|
|
44
41
|
*
|
|
45
42
|
* var x = ones3d( shape );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-base-ternary3d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Apply a ternary callback to elements in three three-dimensional nested input arrays and assign results to elements in a three-dimensional nested output array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/types": "^0.1
|
|
40
|
+
"@stdlib/types": "^0.3.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@stdlib/array-base-filled3d-by": "^0.1.0",
|
|
44
44
|
"@stdlib/array-base-zeros3d": "^0.1.0",
|
|
45
|
-
"@stdlib/bench": "^0.1.0",
|
|
46
45
|
"@stdlib/math-base-assert-is-nan": "^0.1.1",
|
|
46
|
+
"@stdlib/math-base-ops-add3": "^0.1.0",
|
|
47
47
|
"@stdlib/math-base-special-floor": "^0.1.1",
|
|
48
48
|
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
49
49
|
"@stdlib/ndarray-base-numel": "^0.1.1",
|
|
@@ -51,7 +51,9 @@
|
|
|
51
51
|
"@stdlib/random-base-uniform": "^0.1.0",
|
|
52
52
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
53
53
|
"istanbul": "^0.4.1",
|
|
54
|
-
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
54
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
55
|
+
"@stdlib/bench-harness": "^0.2.0",
|
|
56
|
+
"@stdlib/bench": "^0.3.1"
|
|
55
57
|
},
|
|
56
58
|
"engines": {
|
|
57
59
|
"node": ">=0.10.0",
|
package/CITATION.cff
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
cff-version: 1.2.0
|
|
2
|
-
title: stdlib
|
|
3
|
-
message: >-
|
|
4
|
-
If you use this software, please cite it using the
|
|
5
|
-
metadata from this file.
|
|
6
|
-
|
|
7
|
-
type: software
|
|
8
|
-
|
|
9
|
-
authors:
|
|
10
|
-
- name: The Stdlib Authors
|
|
11
|
-
url: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
12
|
-
|
|
13
|
-
repository-code: https://github.com/stdlib-js/stdlib
|
|
14
|
-
url: https://stdlib.io
|
|
15
|
-
|
|
16
|
-
abstract: |
|
|
17
|
-
Standard library for JavaScript and Node.js.
|
|
18
|
-
|
|
19
|
-
keywords:
|
|
20
|
-
- JavaScript
|
|
21
|
-
- Node.js
|
|
22
|
-
- TypeScript
|
|
23
|
-
- standard library
|
|
24
|
-
- scientific computing
|
|
25
|
-
- numerical computing
|
|
26
|
-
- statistical computing
|
|
27
|
-
|
|
28
|
-
license: Apache-2.0 AND BSL-1.0
|
|
29
|
-
|
|
30
|
-
date-released: 2016
|