@stdlib/ndarray-base-bind2vind 0.0.5 → 0.0.6
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 +21 -2
- package/lib/main.js +0 -4
- package/package.json +1 -1
- package/src/main.c +0 -4
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2022 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ limitations under the License.
|
|
|
20
20
|
|
|
21
21
|
# bind2vind
|
|
22
22
|
|
|
23
|
-
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
|
|
23
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
24
24
|
|
|
25
25
|
> Convert a linear index in an underlying data buffer to a linear index in an array view.
|
|
26
26
|
|
|
@@ -168,6 +168,14 @@ for ( i = 0; i < len; i++ ) {
|
|
|
168
168
|
|
|
169
169
|
<!-- /.references -->
|
|
170
170
|
|
|
171
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
172
|
+
|
|
173
|
+
<section class="related">
|
|
174
|
+
|
|
175
|
+
</section>
|
|
176
|
+
|
|
177
|
+
<!-- /.related -->
|
|
178
|
+
|
|
171
179
|
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
172
180
|
|
|
173
181
|
|
|
@@ -194,7 +202,7 @@ See [LICENSE][stdlib-license].
|
|
|
194
202
|
|
|
195
203
|
## Copyright
|
|
196
204
|
|
|
197
|
-
Copyright © 2016-
|
|
205
|
+
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
198
206
|
|
|
199
207
|
</section>
|
|
200
208
|
|
|
@@ -213,9 +221,20 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
213
221
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-bind2vind/main.svg
|
|
214
222
|
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-bind2vind?branch=main
|
|
215
223
|
|
|
224
|
+
<!--
|
|
225
|
+
|
|
216
226
|
[dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-base-bind2vind.svg
|
|
217
227
|
[dependencies-url]: https://david-dm.org/stdlib-js/ndarray-base-bind2vind/main
|
|
218
228
|
|
|
229
|
+
-->
|
|
230
|
+
|
|
231
|
+
[umd]: https://github.com/umdjs/umd
|
|
232
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
233
|
+
|
|
234
|
+
[deno-url]: https://github.com/stdlib-js/ndarray-base-bind2vind/tree/deno
|
|
235
|
+
[umd-url]: https://github.com/stdlib-js/ndarray-base-bind2vind/tree/umd
|
|
236
|
+
[esm-url]: https://github.com/stdlib-js/ndarray-base-bind2vind/tree/esm
|
|
237
|
+
|
|
219
238
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
220
239
|
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
221
240
|
|
package/lib/main.js
CHANGED
|
@@ -85,10 +85,6 @@ function bind2vind( shape, strides, offset, order, idx, mode ) {
|
|
|
85
85
|
} else if ( idx < 0 || idx >= len ) {
|
|
86
86
|
throw new RangeError( 'invalid argument. Linear index must not exceed array dimensions. Number of array elements: ' + len + '. Value: `' + idx + '`.' );
|
|
87
87
|
}
|
|
88
|
-
// Trivial case where the offset into the underlying data buffer is 0...
|
|
89
|
-
if ( offset === 0 ) {
|
|
90
|
-
return idx;
|
|
91
|
-
}
|
|
92
88
|
// 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)...
|
|
93
89
|
ind = 0;
|
|
94
90
|
if ( order === 'column-major' ) {
|
package/package.json
CHANGED
package/src/main.c
CHANGED
|
@@ -86,10 +86,6 @@ int64_t stdlib_ndarray_bind2vind( int64_t ndims, int64_t *shape, int64_t *stride
|
|
|
86
86
|
} else if ( idx < 0 || idx >= len ) {
|
|
87
87
|
return -1;
|
|
88
88
|
}
|
|
89
|
-
// Trivial case where the offset into the underlying data buffer is 0...
|
|
90
|
-
if ( offset == 0 ) {
|
|
91
|
-
return idx;
|
|
92
|
-
}
|
|
93
89
|
// 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)...
|
|
94
90
|
ind = 0;
|
|
95
91
|
if ( order == STDLIB_NDARRAY_COLUMN_MAJOR ) {
|