@stdlib/array-base-flatten5d 0.0.1 → 0.1.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/CITATION.cff +30 -0
- package/README.md +13 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +4 -8
- package/lib/assign.js +1 -1
- package/lib/main.js +1 -1
- package/package.json +9 -9
package/CITATION.cff
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
-->
|
|
20
20
|
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
21
32
|
# flatten5d
|
|
22
33
|
|
|
23
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -209,8 +220,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
209
220
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-flatten5d.svg
|
|
210
221
|
[npm-url]: https://npmjs.org/package/@stdlib/array-base-flatten5d
|
|
211
222
|
|
|
212
|
-
[test-image]: https://github.com/stdlib-js/array-base-flatten5d/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
213
|
-
[test-url]: https://github.com/stdlib-js/array-base-flatten5d/actions/workflows/test.yml?query=branch:v0.0
|
|
223
|
+
[test-image]: https://github.com/stdlib-js/array-base-flatten5d/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
224
|
+
[test-url]: https://github.com/stdlib-js/array-base-flatten5d/actions/workflows/test.yml?query=branch:v0.1.0
|
|
214
225
|
|
|
215
226
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-flatten5d/main.svg
|
|
216
227
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-base-flatten5d?branch=main
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var R=function(e,f){return function(){return f||e((f={exports:{}}).exports,f),f.exports}};var j=R(function(F,b){
|
|
2
|
+
function A(e,f,x){var u,l,q,S,s,c,o,i,r,a,v,t,n,d,g;if(l=f[4],q=f[3],S=f[2],s=f[1],c=f[0],u=[],x){for(o=0;o<l;o++)for(i=0;i<q;i++)for(r=0;r<S;r++)for(a=0;a<s;a++)for(v=0;v<c;v++)u.push(e[v][a][r][i][o]);return u}for(v=0;v<c;v++)for(g=e[v],a=0;a<s;a++)for(d=g[a],r=0;r<S;r++)for(n=d[r],i=0;i<q;i++)for(t=n[i],o=0;o<l;o++)u.push(t[o]);return u}b.exports=A
|
|
3
|
+
});var w=R(function(G,k){
|
|
4
|
+
function B(e,f,x,u,l,q){var S,s,c,o,i,r,a,v,t,n,d,g,y,O,m;if(S=f[4],s=f[3],c=f[2],o=f[1],i=f[0],m=q,x){for(r=0;r<S;r++)for(a=0;a<s;a++)for(v=0;v<c;v++)for(t=0;t<o;t++)for(n=0;n<i;n++)u[m]=e[n][t][v][a][r],m+=l;return u}for(n=0;n<i;n++)for(O=e[n],t=0;t<o;t++)for(y=O[t],v=0;v<c;v++)for(g=y[v],a=0;a<s;a++)for(d=g[a],r=0;r<S;r++)u[m]=d[r],m+=l;return u}k.exports=B
|
|
5
|
+
});var C=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),z=j(),D=w();C(z,"assign",D);module.exports=z;
|
|
6
|
+
/** @license Apache-2.0 */
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/main.js", "../lib/assign.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/* eslint-disable max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a five-dimensional nested array.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array<Array<Array<Array<Collection>>>>} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @returns {Array} flattened array\n*\n* @example\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], false );\n* // returns [ 1, 2, 3, 4 ]\n*\n* @example\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], true );\n* // returns [ 1, 3, 2, 4 ]\n*/\nfunction flatten5d( x, shape, colexicographic ) {\n\tvar out;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar a0;\n\tvar a1;\n\tvar a2;\n\tvar a3;\n\n\t// Extract loop variables:\n\tS0 = shape[ 4 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\n\t// Initialize an output array:\n\tout = [];\n\n\t// Iterate over the array dimensions...\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\t\tout.push( x[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ] ); // equivalent to storing in column-major (Fortran-style) order\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\ta3 = x[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\ta2 = a3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\ta1 = a2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\ta0 = a1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\tout.push( a0[ i0 ] ); // equivalent to storing in row-major (C-style) order\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = flatten5d;\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/* eslint-disable max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Flattens a five-dimensional nested array and assigns elements to a provided output array.\n*\n* ## Notes\n*\n* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).\n*\n* @param {Array<Array<Array<Array<Collection>>>>} x - input nested array\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], false, new Float64Array( 4 ), 1, 0 );\n* // returns <Float64Array>[ 1, 2, 3, 4 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], true, new Float64Array( 4 ), 1, 0 );\n* // returns <Float64Array>[ 1, 3, 2, 4 ]\n*/\nfunction flatten5d( x, shape, colexicographic, out, stride, offset ) {\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar a0;\n\tvar a1;\n\tvar a2;\n\tvar a3;\n\tvar io;\n\n\t// Extract loop variables:\n\tS0 = shape[ 4 ]; // for nested arrays, the last dimensions have the fastest changing indices\n\tS1 = shape[ 3 ];\n\tS2 = shape[ 2 ];\n\tS3 = shape[ 1 ];\n\tS4 = shape[ 0 ];\n\n\t// Iterate over the array dimensions...\n\tio = offset;\n\tif ( colexicographic ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\t\tout[ io ] = x[ i4 ][ i3 ][ i2 ][ i1 ][ i0 ]; // equivalent to storing in column-major (Fortran-style) order\n\t\t\t\t\t\t\tio += stride;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\ta3 = x[ i4 ];\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\ta2 = a3[ i3 ];\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\ta1 = a2[ i2 ];\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\ta0 = a1[ i1 ];\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\tout[ io ] = a0[ i0 ]; // equivalent to storing in row-major (C-style) order\n\t\t\t\t\t\tio += stride;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = flatten5d;\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* Flatten a five-dimensional nested array.\n*\n* @module @stdlib/array-base-flatten5d\n*\n* @example\n* var flatten5d = require( '@stdlib/array-base-flatten5d' );\n*\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], false );\n* // returns [ 1, 2, 3, 4 ]\n*\n* @example\n* var flatten5d = require( '@stdlib/array-base-flatten5d' );\n*\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], true );\n* // returns [ 1, 3, 2, 4 ]\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var flatten5d = require( '@stdlib/array-base-flatten5d' );\n*\n* var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];\n*\n* var out = new Float64Array( 4 );\n* var y = flatten5d.assign( x, [ 2, 1, 1, 1, 2 ], true, out, 1, 0 );\n* // returns <Float64Array>[ 1, 3, 2, 4 ]\n*\n* var bool = ( y === out );\n* // returns true\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAgDA,SAASC,EAAWC,EAAGC,EAAOC,EAAkB,CAC/C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAaJ,GAVAb,EAAKH,EAAO,CAAE,EACdI,EAAKJ,EAAO,CAAE,EACdK,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EAGdE,EAAM,CAAC,EAGFD,EAAkB,CACtB,IAAMO,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtBV,EAAI,KAAMH,EAAGa,CAAG,EAAGD,CAAG,EAAGD,CAAG,EAAGD,CAAG,EAAGD,CAAG,CAAE,EAM/C,OAAON,CACR,CACA,IAAMU,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKjB,EAAGa,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKC,EAAIL,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKC,EAAIL,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKC,EAAIL,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBN,EAAI,KAAMW,EAAIL,CAAG,CAAE,EAMxB,OAAON,CACR,CAKAL,EAAO,QAAUC,IC/GjB,IAAAmB,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAuDA,SAASC,EAAWC,EAAGC,EAAOC,EAAiBC,EAAKC,EAAQC,EAAS,CACpE,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAWJ,GARAd,EAAKL,EAAO,CAAE,EACdM,EAAKN,EAAO,CAAE,EACdO,EAAKP,EAAO,CAAE,EACdQ,EAAKR,EAAO,CAAE,EACdS,EAAKT,EAAO,CAAE,EAGdmB,EAAKf,EACAH,EAAkB,CACtB,IAAMS,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtB,IAAMC,EAAK,EAAGA,EAAKL,EAAIK,IACtBZ,EAAKiB,CAAG,EAAIpB,EAAGe,CAAG,EAAGD,CAAG,EAAGD,CAAG,EAAGD,CAAG,EAAGD,CAAG,EAC1CS,GAAMhB,EAMX,OAAOD,CACR,CACA,IAAMY,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKnB,EAAGe,CAAG,EACLD,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKC,EAAIL,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKC,EAAIL,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IAEtB,IADAI,EAAKC,EAAIL,CAAG,EACND,EAAK,EAAGA,EAAKL,EAAIK,IACtBR,EAAKiB,CAAG,EAAIJ,EAAIL,CAAG,EACnBS,GAAMhB,EAMX,OAAOD,CACR,CAKAL,EAAO,QAAUC,IC7DjB,IAAIsB,EAAc,QAAS,uDAAwD,EAC/EC,EAAO,IACPC,EAAS,IAKbF,EAAaC,EAAM,SAAUC,CAAO,EAKpC,OAAO,QAAUD",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "flatten5d", "x", "shape", "colexicographic", "out", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "a0", "a1", "a2", "a3", "require_assign", "__commonJSMin", "exports", "module", "flatten5d", "x", "shape", "colexicographic", "out", "stride", "offset", "S0", "S1", "S2", "S3", "S4", "i0", "i1", "i2", "i3", "i4", "a0", "a1", "a2", "a3", "io", "setReadOnly", "main", "assign"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -20,12 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import { Collection } from '@stdlib/types/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Five-dimensional nested array.
|
|
27
|
-
*/
|
|
28
|
-
type Array5D<T> = Array<Array<Array<Array<Collection<T>>>>>;
|
|
23
|
+
import { Collection, Array5D } from '@stdlib/types/array';
|
|
24
|
+
import { Shape5D } from '@stdlib/types/ndarray';
|
|
29
25
|
|
|
30
26
|
/**
|
|
31
27
|
* Interface describing `flatten5d`.
|
|
@@ -55,7 +51,7 @@ interface Flatten5d {
|
|
|
55
51
|
* var out = flatten5d( x, [ 2, 1, 1, 1, 2 ], true );
|
|
56
52
|
* // returns [ 1, 3, 2, 4 ]
|
|
57
53
|
*/
|
|
58
|
-
<T = unknown>( x: Array5D<T>, shape:
|
|
54
|
+
<T = unknown>( x: Array5D<T>, shape: Shape5D, colexicographic: boolean ): Array<T>;
|
|
59
55
|
|
|
60
56
|
/**
|
|
61
57
|
* Flattens a five-dimensional nested array and assigns elements to a provided output array.
|
|
@@ -88,7 +84,7 @@ interface Flatten5d {
|
|
|
88
84
|
* var out = flatten5d.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0 );
|
|
89
85
|
* // returns <Float64Array>[ 1, 3, 2, 4 ]
|
|
90
86
|
*/
|
|
91
|
-
assign<T = unknown, U = unknown>( x: Array5D<T>, shape:
|
|
87
|
+
assign<T = unknown, U = unknown>( x: Array5D<T>, shape: Shape5D, colexicographic: boolean, out: Collection<U>, stride: number, offset: number ): Collection<T | U>;
|
|
92
88
|
}
|
|
93
89
|
|
|
94
90
|
/**
|
package/lib/assign.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*
|
|
30
30
|
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
|
|
31
31
|
*
|
|
32
|
-
* @param {Array<Array<Collection
|
|
32
|
+
* @param {Array<Array<Array<Array<Collection>>>>} x - input nested array
|
|
33
33
|
* @param {NonNegativeIntegerArray} shape - array shape
|
|
34
34
|
* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order
|
|
35
35
|
* @param {Collection} out - output array
|
package/lib/main.js
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*
|
|
30
30
|
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
|
|
31
31
|
*
|
|
32
|
-
* @param {Array<Array<Collection
|
|
32
|
+
* @param {Array<Array<Array<Array<Collection>>>>} x - input nested array
|
|
33
33
|
* @param {NonNegativeIntegerArray} shape - array shape
|
|
34
34
|
* @param {boolean} colexicographic - specifies whether to flatten array values in colexicographic order
|
|
35
35
|
* @returns {Array} flattened array
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-base-flatten5d",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Flatten a five-dimensional nested array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/types": "^0.0
|
|
41
|
-
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.0
|
|
40
|
+
"@stdlib/types": "^0.1.0",
|
|
41
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@stdlib/array-base-filled": "^0.0.2",
|
|
45
|
-
"@stdlib/array-base-zero-to": "^0.0
|
|
46
|
-
"@stdlib/array-float64": "^0.0
|
|
47
|
-
"@stdlib/assert-has-own-property": "^0.0
|
|
48
|
-
"@stdlib/assert-is-array": "^0.0
|
|
49
|
-
"@stdlib/assert-is-float64array": "^0.0
|
|
50
|
-
"@stdlib/bench": "^0.0
|
|
45
|
+
"@stdlib/array-base-zero-to": "^0.1.0",
|
|
46
|
+
"@stdlib/array-float64": "^0.1.0",
|
|
47
|
+
"@stdlib/assert-has-own-property": "^0.1.0",
|
|
48
|
+
"@stdlib/assert-is-array": "^0.1.0",
|
|
49
|
+
"@stdlib/assert-is-float64array": "^0.1.0",
|
|
50
|
+
"@stdlib/bench": "^0.1.0",
|
|
51
51
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
52
52
|
"istanbul": "^0.4.1",
|
|
53
53
|
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|