@stdlib/ndarray-base-bind2vind 0.2.2 → 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 CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2024 The Stdlib Authors.
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md CHANGED
@@ -214,7 +214,7 @@ See [LICENSE][stdlib-license].
214
214
 
215
215
  ## Copyright
216
216
 
217
- Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
217
+ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
218
218
 
219
219
  </section>
220
220
 
@@ -227,8 +227,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
227
227
  [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-bind2vind.svg
228
228
  [npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-bind2vind
229
229
 
230
- [test-image]: https://github.com/stdlib-js/ndarray-base-bind2vind/actions/workflows/test.yml/badge.svg?branch=v0.2.2
231
- [test-url]: https://github.com/stdlib-js/ndarray-base-bind2vind/actions/workflows/test.yml?query=branch:v0.2.2
230
+ [test-image]: https://github.com/stdlib-js/ndarray-base-bind2vind/actions/workflows/test.yml/badge.svg?branch=v0.2.3
231
+ [test-url]: https://github.com/stdlib-js/ndarray-base-bind2vind/actions/workflows/test.yml?query=branch:v0.2.3
232
232
 
233
233
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-bind2vind/main.svg
234
234
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-bind2vind?branch=main
@@ -240,8 +240,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
240
240
 
241
241
  -->
242
242
 
243
- [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
244
- [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
243
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
244
+ [chat-url]: https://stdlib.zulipchat.com
245
245
 
246
246
  [stdlib]: https://github.com/stdlib-js/stdlib
247
247
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var q=function(u,t){return function(){return t||u((t={exports:{}}).exports,t),t.exports}};var c=q(function(p,i){
2
- var g=require('@stdlib/error-tools-fmtprodmsg/dist'),o=require('@stdlib/math-base-special-trunc/dist'),m=require('@stdlib/math-base-special-abs/dist');function w(u,t,j,b,r,v){var l,e,s,f,n,a;for(l=u.length,e=1,a=0;a<l;a++)e*=u[a];if(v==="clamp")r<0?r=0:r>=e&&(r=e-1);else if(v==="wrap")r<0?(r+=e,r<0&&(r%=e,r!==0&&(r+=e))):r>=e&&(r-=e,r>=e&&(r%=e));else if(v==="normalize"&&r<0&&(r+=e),r<0||r>=e)throw new RangeError(g('0i35E',e,r));if(s=0,b==="column-major"){for(a=l-1;a>=0;a--)n=t[a],n<0?(f=o(r/n),r-=f*n,f+=u[a]-1):(f=o(r/n),r-=f*n),s+=f*m(n);return s}for(a=0;a<l;a++)n=t[a],n<0?(f=o(r/n),r-=f*n,f+=u[a]-1):(f=o(r/n),r-=f*n),s+=f*m(n);return s}i.exports=w
3
- });var y=c();module.exports=y;
1
+ "use strict";var b=function(u,t){return function(){return t||u((t={exports:{}}).exports,t),t.exports}};var c=b(function(z,m){
2
+ var g=require('@stdlib/ndarray-base-assert-is-column-major-string/dist'),o=require('@stdlib/math-base-special-trunc/dist'),i=require('@stdlib/math-base-special-abs/dist'),w=require('@stdlib/error-tools-fmtprodmsg/dist');function y(u,t,k,q,r,v){var l,e,s,f,n,a;for(l=u.length,e=1,a=0;a<l;a++)e*=u[a];if(v==="clamp")r<0?r=0:r>=e&&(r=e-1);else if(v==="wrap")r<0?(r+=e,r<0&&(r%=e,r!==0&&(r+=e))):r>=e&&(r-=e,r>=e&&(r%=e));else if(v==="normalize"&&r<0&&(r+=e),r<0||r>=e)throw new RangeError(w('0i35E',e,r));if(s=0,g(q)){for(a=l-1;a>=0;a--)n=t[a],n<0?(f=o(r/n),r-=f*n,f+=u[a]-1):(f=o(r/n),r-=f*n),s+=f*i(n);return s}for(a=0;a<l;a++)n=t[a],n<0?(f=o(r/n),r-=f*n,f+=u[a]-1):(f=o(r/n),r-=f*n),s+=f*i(n);return s}m.exports=y
3
+ });var j=c();module.exports=j;
4
4
  /** @license Apache-2.0 */
5
5
  //# 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/index.js"],
4
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 format = require( '@stdlib/string-format' );\nvar trunc = require( '@stdlib/math-base-special-trunc' );\nvar abs = require( '@stdlib/math-base-special-abs' );\n\n\n// MAIN //\n\n/**\n* Converts a linear index in an underlying data buffer to a linear index in an array view.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - location of the first indexed value **based** on the stride array\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {integer} idx - linear index in an underlying data buffer\n* @param {string} mode - specifies how to handle a linear index which exceeds array dimensions\n* @throws {RangeError} linear index must not exceed array dimensions\n* @returns {NonNegativeInteger} linear index in an array view\n*\n* @example\n* var shape = [ 3, 3 ];\n* var strides = [ -3, 1 ];\n* var offset = 6;\n* var order = 'row-major';\n* var mode = 'throw';\n*\n* var ind = bind2vind( shape, strides, offset, order, 7, mode );\n* // returns 1\n*/\nfunction bind2vind( shape, strides, offset, order, idx, mode ) {\n\tvar ndims;\n\tvar len;\n\tvar ind;\n\tvar k;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tlen = 1;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tlen *= shape[ i ];\n\t}\n\tif ( mode === 'clamp' ) {\n\t\tif ( idx < 0 ) {\n\t\t\tidx = 0;\n\t\t} else if ( idx >= len ) {\n\t\t\tidx = len - 1;\n\t\t}\n\t} else if ( mode === 'wrap' ) {\n\t\tif ( idx < 0 ) {\n\t\t\tidx += len; // slight optimization to avoid modulo arithmetic when |idx| <= len\n\t\t\tif ( idx < 0 ) {\n\t\t\t\tidx %= len;\n\t\t\t\tif ( idx !== 0 ) {\n\t\t\t\t\tidx += len;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( idx >= len ) {\n\t\t\tidx -= len; // slight optimization to avoid modulo arithmetic when len < idx <= 2*len\n\t\t\tif ( idx >= len ) {\n\t\t\t\tidx %= len;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ( mode === 'normalize' && idx < 0 ) {\n\t\t\tidx += len;\n\t\t}\n\t\tif ( idx < 0 || idx >= len ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.', len, idx ) );\n\t\t}\n\t}\n\t// The approach which follows is to resolve a buffer index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the array view (i.e., where all strides are positive and offset is 0)...\n\tind = 0;\n\tif ( order === 'column-major' ) {\n\t\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\t\ts = strides[ i ];\n\t\t\tif ( s < 0 ) {\n\t\t\t\tk = trunc( idx/s );\n\t\t\t\tidx -= k * s;\n\t\t\t\tk += shape[ i ] - 1;\n\t\t\t} else {\n\t\t\t\tk = trunc( idx/s );\n\t\t\t\tidx -= k * s;\n\t\t\t}\n\t\t\tind += k * abs( s );\n\t\t}\n\t\treturn ind;\n\t}\n\t// Case: row-major\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\ts = strides[ i ];\n\t\tif ( s < 0 ) {\n\t\t\tk = trunc( idx/s );\n\t\t\tidx -= k * s;\n\t\t\tk += shape[ i ] - 1;\n\t\t} else {\n\t\t\tk = trunc( idx/s );\n\t\t\tidx -= k * s;\n\t\t}\n\t\tind += k * abs( s );\n\t}\n\treturn ind;\n}\n\n\n// EXPORTS //\n\nmodule.exports = bind2vind;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Convert a linear index in an underlying data buffer to a linear index in an array view.\n*\n* @module @stdlib/ndarray-base-bind2vind\n*\n* @example\n* var bind2vind = require( '@stdlib/ndarray-base-bind2vind' );\n*\n* var shape = [ 3, 3 ];\n* var strides = [ -3, 1 ];\n* var offset = 6;\n* var order = 'row-major';\n* var mode = 'throw';\n*\n* var ind = bind2vind( shape, strides, offset, order, 7, mode );\n* // returns 1\n*/\n\n// MODULES //\n\nvar bind2vind = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = bind2vind;\n"],
5
- "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EA2BnD,SAASC,EAAWC,EAAOC,EAASC,EAAQC,EAAOC,EAAKC,EAAO,CAC9D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,IAFAL,EAAQN,EAAM,OACdO,EAAM,EACAI,EAAI,EAAGA,EAAIL,EAAOK,IACvBJ,GAAOP,EAAOW,CAAE,EAEjB,GAAKN,IAAS,QACRD,EAAM,EACVA,EAAM,EACKA,GAAOG,IAClBH,EAAMG,EAAM,WAEFF,IAAS,OACfD,EAAM,GACVA,GAAOG,EACFH,EAAM,IACVA,GAAOG,EACFH,IAAQ,IACZA,GAAOG,KAGEH,GAAOG,IAClBH,GAAOG,EACFH,GAAOG,IACXH,GAAOG,YAIJF,IAAS,aAAeD,EAAM,IAClCA,GAAOG,GAEHH,EAAM,GAAKA,GAAOG,EACtB,MAAM,IAAI,WAAYX,EAAQ,gHAAiHW,EAAKH,CAAI,CAAE,EAK5J,GADAI,EAAM,EACDL,IAAU,eAAiB,CAC/B,IAAMQ,EAAIL,EAAM,EAAGK,GAAK,EAAGA,IAC1BD,EAAIT,EAASU,CAAE,EACVD,EAAI,GACRD,EAAIZ,EAAOO,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,EACXD,GAAKT,EAAOW,CAAE,EAAI,IAElBF,EAAIZ,EAAOO,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,GAEZF,GAAOC,EAAIX,EAAKY,CAAE,EAEnB,OAAOF,CACR,CAEA,IAAMG,EAAI,EAAGA,EAAIL,EAAOK,IACvBD,EAAIT,EAASU,CAAE,EACVD,EAAI,GACRD,EAAIZ,EAAOO,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,EACXD,GAAKT,EAAOW,CAAE,EAAI,IAElBF,EAAIZ,EAAOO,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,GAEZF,GAAOC,EAAIX,EAAKY,CAAE,EAEnB,OAAOF,CACR,CAKAb,EAAO,QAAUI,ICzFjB,IAAIa,EAAY,IAKhB,OAAO,QAAUA",
6
- "names": ["require_main", "__commonJSMin", "exports", "module", "format", "trunc", "abs", "bind2vind", "shape", "strides", "offset", "order", "idx", "mode", "ndims", "len", "ind", "k", "s", "i", "bind2vind"]
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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 isColumnMajor = require( '@stdlib/ndarray-base-assert-is-column-major-string' );\nvar trunc = require( '@stdlib/math-base-special-trunc' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Converts a linear index in an underlying data buffer to a linear index in an array view.\n*\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {IntegerArray} strides - stride array\n* @param {NonNegativeInteger} offset - location of the first indexed value **based** on the stride array\n* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)\n* @param {integer} idx - linear index in an underlying data buffer\n* @param {string} mode - specifies how to handle a linear index which exceeds array dimensions\n* @throws {RangeError} linear index must not exceed array dimensions\n* @returns {NonNegativeInteger} linear index in an array view\n*\n* @example\n* var shape = [ 3, 3 ];\n* var strides = [ -3, 1 ];\n* var offset = 6;\n* var order = 'row-major';\n* var mode = 'throw';\n*\n* var ind = bind2vind( shape, strides, offset, order, 7, mode );\n* // returns 1\n*/\nfunction bind2vind( shape, strides, offset, order, idx, mode ) {\n\tvar ndims;\n\tvar len;\n\tvar ind;\n\tvar k;\n\tvar s;\n\tvar i;\n\n\tndims = shape.length;\n\tlen = 1;\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\tlen *= shape[ i ];\n\t}\n\tif ( mode === 'clamp' ) {\n\t\tif ( idx < 0 ) {\n\t\t\tidx = 0;\n\t\t} else if ( idx >= len ) {\n\t\t\tidx = len - 1;\n\t\t}\n\t} else if ( mode === 'wrap' ) {\n\t\tif ( idx < 0 ) {\n\t\t\tidx += len; // slight optimization to avoid modulo arithmetic when |idx| <= len\n\t\t\tif ( idx < 0 ) {\n\t\t\t\tidx %= len;\n\t\t\t\tif ( idx !== 0 ) {\n\t\t\t\t\tidx += len;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( idx >= len ) {\n\t\t\tidx -= len; // slight optimization to avoid modulo arithmetic when len < idx <= 2*len\n\t\t\tif ( idx >= len ) {\n\t\t\t\tidx %= len;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ( mode === 'normalize' && idx < 0 ) {\n\t\t\tidx += len;\n\t\t}\n\t\tif ( idx < 0 || idx >= len ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Linear index must not exceed array dimensions. Number of array elements: `%u`. Value: `%d`.', len, idx ) );\n\t\t}\n\t}\n\t// The approach which follows is to resolve a buffer index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the array view (i.e., where all strides are positive and offset is 0)...\n\tind = 0;\n\tif ( isColumnMajor( order ) ) {\n\t\tfor ( i = ndims-1; i >= 0; i-- ) {\n\t\t\ts = strides[ i ];\n\t\t\tif ( s < 0 ) {\n\t\t\t\tk = trunc( idx/s );\n\t\t\t\tidx -= k * s;\n\t\t\t\tk += shape[ i ] - 1;\n\t\t\t} else {\n\t\t\t\tk = trunc( idx/s );\n\t\t\t\tidx -= k * s;\n\t\t\t}\n\t\t\tind += k * abs( s );\n\t\t}\n\t\treturn ind;\n\t}\n\t// Case: row-major\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\ts = strides[ i ];\n\t\tif ( s < 0 ) {\n\t\t\tk = trunc( idx/s );\n\t\t\tidx -= k * s;\n\t\t\tk += shape[ i ] - 1;\n\t\t} else {\n\t\t\tk = trunc( idx/s );\n\t\t\tidx -= k * s;\n\t\t}\n\t\tind += k * abs( s );\n\t}\n\treturn ind;\n}\n\n\n// EXPORTS //\n\nmodule.exports = bind2vind;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Convert a linear index in an underlying data buffer to a linear index in an array view.\n*\n* @module @stdlib/ndarray-base-bind2vind\n*\n* @example\n* var bind2vind = require( '@stdlib/ndarray-base-bind2vind' );\n*\n* var shape = [ 3, 3 ];\n* var strides = [ -3, 1 ];\n* var offset = 6;\n* var order = 'row-major';\n* var mode = 'throw';\n*\n* var ind = bind2vind( shape, strides, offset, order, 7, mode );\n* // returns 1\n*/\n\n// MODULES //\n\nvar bind2vind = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = bind2vind;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oDAAqD,EAC9EC,EAAQ,QAAS,iCAAkC,EACnDC,EAAM,QAAS,+BAAgC,EAC/CC,EAAS,QAAS,uBAAwB,EA2B9C,SAASC,EAAWC,EAAOC,EAASC,EAAQC,EAAOC,EAAKC,EAAO,CAC9D,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EAIJ,IAFAL,EAAQN,EAAM,OACdO,EAAM,EACAI,EAAI,EAAGA,EAAIL,EAAOK,IACvBJ,GAAOP,EAAOW,CAAE,EAEjB,GAAKN,IAAS,QACRD,EAAM,EACVA,EAAM,EACKA,GAAOG,IAClBH,EAAMG,EAAM,WAEFF,IAAS,OACfD,EAAM,GACVA,GAAOG,EACFH,EAAM,IACVA,GAAOG,EACFH,IAAQ,IACZA,GAAOG,KAGEH,GAAOG,IAClBH,GAAOG,EACFH,GAAOG,IACXH,GAAOG,YAIJF,IAAS,aAAeD,EAAM,IAClCA,GAAOG,GAEHH,EAAM,GAAKA,GAAOG,EACtB,MAAM,IAAI,WAAYT,EAAQ,gHAAiHS,EAAKH,CAAI,CAAE,EAK5J,GADAI,EAAM,EACDb,EAAeQ,CAAM,EAAI,CAC7B,IAAMQ,EAAIL,EAAM,EAAGK,GAAK,EAAGA,IAC1BD,EAAIT,EAASU,CAAE,EACVD,EAAI,GACRD,EAAIb,EAAOQ,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,EACXD,GAAKT,EAAOW,CAAE,EAAI,IAElBF,EAAIb,EAAOQ,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,GAEZF,GAAOC,EAAIZ,EAAKa,CAAE,EAEnB,OAAOF,CACR,CAEA,IAAMG,EAAI,EAAGA,EAAIL,EAAOK,IACvBD,EAAIT,EAASU,CAAE,EACVD,EAAI,GACRD,EAAIb,EAAOQ,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,EACXD,GAAKT,EAAOW,CAAE,EAAI,IAElBF,EAAIb,EAAOQ,EAAIM,CAAE,EACjBN,GAAOK,EAAIC,GAEZF,GAAOC,EAAIZ,EAAKa,CAAE,EAEnB,OAAOF,CACR,CAKAd,EAAO,QAAUK,IC1FjB,IAAIa,EAAY,IAKhB,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "isColumnMajor", "trunc", "abs", "format", "bind2vind", "shape", "strides", "offset", "order", "idx", "mode", "ndims", "len", "ind", "k", "s", "i", "bind2vind"]
7
7
  }
package/lib/main.js CHANGED
@@ -20,9 +20,10 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var format = require( '@stdlib/string-format' );
23
+ var isColumnMajor = require( '@stdlib/ndarray-base-assert-is-column-major-string' );
24
24
  var trunc = require( '@stdlib/math-base-special-trunc' );
25
25
  var abs = require( '@stdlib/math-base-special-abs' );
26
+ var format = require( '@stdlib/string-format' );
26
27
 
27
28
 
28
29
  // MAIN //
@@ -93,7 +94,7 @@ function bind2vind( shape, strides, offset, order, idx, mode ) {
93
94
  }
94
95
  // The approach which follows is to resolve a buffer index to its subscripts and then plug the subscripts into the standard formula for computing the linear index in the array view (i.e., where all strides are positive and offset is 0)...
95
96
  ind = 0;
96
- if ( order === 'column-major' ) {
97
+ if ( isColumnMajor( order ) ) {
97
98
  for ( i = ndims-1; i >= 0; i-- ) {
98
99
  s = strides[ i ];
99
100
  if ( s < 0 ) {
package/manifest.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
- "options": {},
3
- "fields": [
4
- {
5
- "field": "src",
6
- "resolve": true,
7
- "relative": true
8
- },
9
- {
10
- "field": "include",
11
- "resolve": true,
12
- "relative": true
13
- },
14
- {
15
- "field": "libraries",
16
- "resolve": false,
17
- "relative": false
18
- },
19
- {
20
- "field": "libpath",
21
- "resolve": true,
22
- "relative": false
23
- }
24
- ],
25
- "confs": [
26
- {
27
- "src": [
28
- "./src/main.c"
29
- ],
30
- "include": [
31
- "./include"
32
- ],
33
- "libraries": [],
34
- "libpath": [],
35
- "dependencies": [
36
- "@stdlib/ndarray-index-modes",
37
- "@stdlib/ndarray-orders"
38
- ]
39
- }
40
- ]
2
+ "options": {},
3
+ "fields": [
4
+ {
5
+ "field": "src",
6
+ "resolve": true,
7
+ "relative": true
8
+ },
9
+ {
10
+ "field": "include",
11
+ "resolve": true,
12
+ "relative": true
13
+ },
14
+ {
15
+ "field": "libraries",
16
+ "resolve": false,
17
+ "relative": false
18
+ },
19
+ {
20
+ "field": "libpath",
21
+ "resolve": true,
22
+ "relative": false
23
+ }
24
+ ],
25
+ "confs": [
26
+ {
27
+ "src": [
28
+ "./src/main.c"
29
+ ],
30
+ "include": [
31
+ "./include"
32
+ ],
33
+ "libraries": [],
34
+ "libpath": [],
35
+ "dependencies": [
36
+ "@stdlib/ndarray-index-modes",
37
+ "@stdlib/ndarray-orders"
38
+ ]
39
+ }
40
+ ]
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-bind2vind",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Convert a linear index in an underlying data buffer to a linear index in an array view.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -32,11 +32,12 @@
32
32
  "url": "https://github.com/stdlib-js/stdlib/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@stdlib/math-base-special-abs": "^0.2.1",
36
- "@stdlib/math-base-special-trunc": "^0.2.1",
37
- "@stdlib/ndarray-index-modes": "^0.2.2",
35
+ "@stdlib/math-base-special-abs": "^0.2.2",
36
+ "@stdlib/math-base-special-trunc": "^0.2.3",
37
+ "@stdlib/ndarray-base-assert-is-column-major-string": "^0.1.0",
38
+ "@stdlib/ndarray-index-modes": "^0.2.3",
38
39
  "@stdlib/ndarray-orders": "^0.2.2",
39
- "@stdlib/string-format": "^0.2.2",
40
+ "@stdlib/string-format": "^0.2.3",
40
41
  "@stdlib/error-tools-fmtprodmsg": "^0.2.2"
41
42
  },
42
43
  "devDependencies": {},
@@ -76,7 +77,6 @@
76
77
  "idx",
77
78
  "strided"
78
79
  ],
79
- "__stdlib__": {},
80
80
  "funding": {
81
81
  "type": "opencollective",
82
82
  "url": "https://opencollective.com/stdlib"