From 9f550afd4f6ce8d0ecf7e5f5917ff78a690c6c13 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 11 Aug 2024 09:51:54 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 1 + dist/index.js.map | 2 +- lib/main.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index deeed94..66f15e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@
+- [`7a4424b`](https://github.com/stdlib-js/stdlib/commit/7a4424bd81e212e9c7534520213b696c0c64c644) - **docs:** fix comment _(by Athan Reines)_ - [`fd9a5c2`](https://github.com/stdlib-js/stdlib/commit/fd9a5c2e29508ab5b393e2273ddb7463be6affb3) - **feat:** add `ndarray/iter/subarrays` _(by Athan Reines)_
diff --git a/dist/index.js.map b/dist/index.js.map index 8b91337..a3f0291 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../lib/main.js", "../lib/index.js"], - "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'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isReadOnly = require( '@stdlib/ndarray-base-assert-is-read-only' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar iteratorSymbol = require( '@stdlib/symbol-iterator' );\nvar zeros = require( '@stdlib/array-base-zeros' );\nvar getShape = require( '@stdlib/ndarray-shape' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar slice = require( '@stdlib/ndarray-base-slice' );\nvar nextCartesianIndex = require( '@stdlib/ndarray-base-next-cartesian-index' ).assign;\nvar args2multislice = require( '@stdlib/slice-base-args2multislice' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates over each subarray in a stack of subarrays.\n*\n* @param {ndarray} x - input value\n* @param {PositiveInteger} ndims - number of dimensions to stack\n* @param {Options} [options] - function options\n* @param {boolean} [options.readonly=true] - boolean indicating whether returned views should be read-only\n* @throws {TypeError} first argument must be an ndarray\n* @throws {TypeError} first argument must have at least `ndims+1` dimensions\n* @throws {TypeError} second argument must be a positive integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {Error} cannot write to a read-only array\n* @returns {Iterator} iterator\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var ndarray2array = require( '@stdlib/ndarray-to-array' );\n*\n* var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ] );\n* // returns \n*\n* var iter = nditerSubarrays( x, 2 );\n*\n* var v = iter.next().value;\n* // returns \n*\n* var arr = ndarray2array( v );\n* // returns [ [ 1, 2 ], [ 3, 4 ] ]\n*\n* v = iter.next().value;\n* // returns \n*\n* arr = ndarray2array( v );\n* // returns [ [ 5, 6 ], [ 7, 8 ] ]\n*\n* // ...\n*/\nfunction nditerSubarrays( x, ndims ) {\n\tvar options;\n\tvar shape;\n\tvar opts;\n\tvar iter;\n\tvar FLG;\n\tvar idx;\n\tvar dim;\n\tvar S;\n\tvar M;\n\tvar N;\n\tvar i;\n\n\tif ( !isndarrayLike( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );\n\t}\n\tif ( !isPositiveInteger( ndims ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', ndims ) );\n\t}\n\topts = {\n\t\t'writable': false\n\t};\n\tif ( arguments.length > 2 ) {\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\tif ( hasOwnProp( options, 'readonly' ) ) {\n\t\t\tif ( !isBoolean( options.readonly ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', options.readonly ) );\n\t\t\t}\n\t\t\topts.writable = !options.readonly;\n\t\t\tif ( opts.writable && isReadOnly( x ) ) {\n\t\t\t\tthrow new Error( format( 'invalid option. Cannot write to read-only array.' ) );\n\t\t\t}\n\t\t}\n\t}\n\t// Retrieve input array meta data:\n\tshape = getShape( x );\n\tM = shape.length;\n\n\t// Ensure that the input array has sufficient dimensions...\n\tif ( M <= ndims ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ndarray having at least %d dimensions.', ndims+1 ) );\n\t}\n\t// Check whether the input array is empty...\n\tN = numel( shape );\n\tif ( N === 0 ) {\n\t\tFLG = true;\n\t}\n\t// Compute the number of subarrays across all stacks of subarrays:\n\tdim = M - ndims - 1;\n\tfor ( i = dim+1; i < M; i++ ) {\n\t\tN /= shape[ i ];\n\t}\n\tS = shape[ dim ];\n\n\t// Initialize an index array for generating slices:\n\tidx = zeros( M );\n\n\t// Set the last `ndims` elements to `null` to indicate that we want a full \"slice\" for the last `ndims` dimensions:\n\tfor ( i = dim+1; i < M; i++ ) {\n\t\tidx[ i ] = null;\n\t}\n\t// Initialize a counter:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\tvar s;\n\t\tvar j;\n\n\t\ti += 1;\n\t\tif ( FLG || i >= N ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\t// Create a multi-slice for the current view:\n\t\ts = args2multislice( idx );\n\n\t\t// Update the index array:\n\t\tj = ( idx[ dim ] + 1 ) % S;\n\t\tidx[ dim ] = j;\n\t\tif ( j === 0 ) {\n\t\t\t// If we've iterated over all the matrices in the current stack, move on to the next set of matrices:\n\t\t\tidx = nextCartesianIndex( shape, 'row-major', idx, dim-1, idx );\n\t\t}\n\t\t// Return the next slice:\n\t\treturn {\n\t\t\t'value': slice( x, s, true, opts.writable ),\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn nditerSubarrays( x, ndims, opts );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = nditerSubarrays;\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'use strict';\n\n/**\n* Create an iterator which iterates over each subarray in a stack of subarrays.\n*\n* @module @stdlib/ndarray-iter-subarrays\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var ndarray2array = require( '@stdlib/ndarray-to-array' );\n* var nditerSubarrays = require( '@stdlib/ndarray-iter-subarrays' );\n*\n* var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ] );\n* // returns \n*\n* var iter = nditerSubarrays( x, 2 );\n*\n* var v = iter.next().value;\n* // returns \n*\n* var arr = ndarray2array( v );\n* // returns [ [ 1, 2 ], [ 3, 4 ] ]\n*\n* v = iter.next().value;\n* // returns \n*\n* arr = ndarray2array( v );\n* // returns [ [ 5, 6 ], [ 7, 8 ] ]\n*\n* // ...\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], + "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'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;\nvar isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isReadOnly = require( '@stdlib/ndarray-base-assert-is-read-only' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar iteratorSymbol = require( '@stdlib/symbol-iterator' );\nvar zeros = require( '@stdlib/array-base-zeros' );\nvar getShape = require( '@stdlib/ndarray-shape' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar slice = require( '@stdlib/ndarray-base-slice' );\nvar nextCartesianIndex = require( '@stdlib/ndarray-base-next-cartesian-index' ).assign;\nvar args2multislice = require( '@stdlib/slice-base-args2multislice' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates over each subarray in a stack of subarrays.\n*\n* @param {ndarray} x - input value\n* @param {PositiveInteger} ndims - number of dimensions to stack\n* @param {Options} [options] - function options\n* @param {boolean} [options.readonly=true] - boolean indicating whether returned views should be read-only\n* @throws {TypeError} first argument must be an ndarray\n* @throws {TypeError} first argument must have at least `ndims+1` dimensions\n* @throws {TypeError} second argument must be a positive integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {Error} cannot write to a read-only array\n* @returns {Iterator} iterator\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var ndarray2array = require( '@stdlib/ndarray-to-array' );\n*\n* var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ] );\n* // returns \n*\n* var iter = nditerSubarrays( x, 2 );\n*\n* var v = iter.next().value;\n* // returns \n*\n* var arr = ndarray2array( v );\n* // returns [ [ 1, 2 ], [ 3, 4 ] ]\n*\n* v = iter.next().value;\n* // returns \n*\n* arr = ndarray2array( v );\n* // returns [ [ 5, 6 ], [ 7, 8 ] ]\n*\n* // ...\n*/\nfunction nditerSubarrays( x, ndims ) {\n\tvar options;\n\tvar shape;\n\tvar opts;\n\tvar iter;\n\tvar FLG;\n\tvar idx;\n\tvar dim;\n\tvar S;\n\tvar M;\n\tvar N;\n\tvar i;\n\n\tif ( !isndarrayLike( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );\n\t}\n\tif ( !isPositiveInteger( ndims ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a positive integer. Value: `%s`.', ndims ) );\n\t}\n\topts = {\n\t\t'writable': false\n\t};\n\tif ( arguments.length > 2 ) {\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\tif ( hasOwnProp( options, 'readonly' ) ) {\n\t\t\tif ( !isBoolean( options.readonly ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', options.readonly ) );\n\t\t\t}\n\t\t\topts.writable = !options.readonly;\n\t\t\tif ( opts.writable && isReadOnly( x ) ) {\n\t\t\t\tthrow new Error( format( 'invalid option. Cannot write to read-only array.' ) );\n\t\t\t}\n\t\t}\n\t}\n\t// Retrieve input array meta data:\n\tshape = getShape( x );\n\tM = shape.length;\n\n\t// Ensure that the input array has sufficient dimensions...\n\tif ( M <= ndims ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an ndarray having at least %d dimensions.', ndims+1 ) );\n\t}\n\t// Check whether the input array is empty...\n\tN = numel( shape );\n\tif ( N === 0 ) {\n\t\tFLG = true;\n\t}\n\t// Compute the number of subarrays across all stacks of subarrays:\n\tdim = M - ndims - 1;\n\tfor ( i = dim+1; i < M; i++ ) {\n\t\tN /= shape[ i ];\n\t}\n\tS = shape[ dim ];\n\n\t// Initialize an index array for generating slices:\n\tidx = zeros( M );\n\n\t// Set the last `ndims` elements to `null` to indicate that we want a full \"slice\" for the last `ndims` dimensions:\n\tfor ( i = dim+1; i < M; i++ ) {\n\t\tidx[ i ] = null;\n\t}\n\t// Initialize a counter:\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, factory );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next() {\n\t\tvar s;\n\t\tvar j;\n\n\t\ti += 1;\n\t\tif ( FLG || i >= N ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\t// Create a multi-slice for the current view:\n\t\ts = args2multislice( idx );\n\n\t\t// Update the index array:\n\t\tj = ( idx[ dim ] + 1 ) % S;\n\t\tidx[ dim ] = j;\n\t\tif ( j === 0 ) {\n\t\t\t// If we've iterated over all the subarrays in the current stack, move on to the next set of subarrays:\n\t\t\tidx = nextCartesianIndex( shape, 'row-major', idx, dim-1, idx );\n\t\t}\n\t\t// Return the next slice:\n\t\treturn {\n\t\t\t'value': slice( x, s, true, opts.writable ),\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\treturn nditerSubarrays( x, ndims, opts );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = nditerSubarrays;\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'use strict';\n\n/**\n* Create an iterator which iterates over each subarray in a stack of subarrays.\n*\n* @module @stdlib/ndarray-iter-subarrays\n*\n* @example\n* var array = require( '@stdlib/ndarray-array' );\n* var ndarray2array = require( '@stdlib/ndarray-to-array' );\n* var nditerSubarrays = require( '@stdlib/ndarray-iter-subarrays' );\n*\n* var x = array( [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ] );\n* // returns \n*\n* var iter = nditerSubarrays( x, 2 );\n*\n* var v = iter.next().value;\n* // returns \n*\n* var arr = ndarray2array( v );\n* // returns [ [ 1, 2 ], [ 3, 4 ] ]\n*\n* v = iter.next().value;\n* // returns \n*\n* arr = ndarray2array( v );\n* // returns [ [ 5, 6 ], [ 7, 8 ] ]\n*\n* // ...\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], "mappings": "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", "names": ["require_main", "__commonJSMin", "exports", "module", "setReadOnly", "isPlainObject", "isBoolean", "isPositiveInteger", "isndarrayLike", "isReadOnly", "hasOwnProp", "iteratorSymbol", "zeros", "getShape", "numel", "slice", "nextCartesianIndex", "args2multislice", "format", "nditerSubarrays", "x", "ndims", "options", "shape", "opts", "iter", "FLG", "idx", "dim", "S", "M", "N", "i", "next", "end", "factory", "s", "j", "value", "main"] } diff --git a/lib/main.js b/lib/main.js index 42dd053..edf7ee2 100644 --- a/lib/main.js +++ b/lib/main.js @@ -178,7 +178,7 @@ function nditerSubarrays( x, ndims ) { j = ( idx[ dim ] + 1 ) % S; idx[ dim ] = j; if ( j === 0 ) { - // If we've iterated over all the matrices in the current stack, move on to the next set of matrices: + // If we've iterated over all the subarrays in the current stack, move on to the next set of subarrays: idx = nextCartesianIndex( shape, 'row-major', idx, dim-1, idx ); } // Return the next slice: