@stdlib/ndarray-base-bind2vind 0.0.2 → 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 CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2021 The Stdlib Authors.
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
 
@@ -181,6 +189,10 @@ This package is part of [stdlib][stdlib], a standard library for JavaScript and
181
189
 
182
190
  For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
183
191
 
192
+ #### Community
193
+
194
+ [![Chat][chat-image]][chat-url]
195
+
184
196
  ---
185
197
 
186
198
  ## License
@@ -190,7 +202,7 @@ See [LICENSE][stdlib-license].
190
202
 
191
203
  ## Copyright
192
204
 
193
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
205
+ Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].
194
206
 
195
207
  </section>
196
208
 
@@ -209,9 +221,23 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
209
221
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-bind2vind/main.svg
210
222
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-bind2vind?branch=main
211
223
 
212
- [dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-base-bind2vind
224
+ <!--
225
+
226
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-base-bind2vind.svg
213
227
  [dependencies-url]: https://david-dm.org/stdlib-js/ndarray-base-bind2vind/main
214
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
+
238
+ [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
239
+ [chat-url]: https://gitter.im/stdlib-js/stdlib/
240
+
215
241
  [stdlib]: https://github.com/stdlib-js/stdlib
216
242
 
217
243
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-bind2vind",
3
- "version": "0.0.2",
3
+ "version": "0.0.6",
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": {
@@ -18,7 +18,9 @@
18
18
  "benchmark": "./benchmark",
19
19
  "doc": "./docs",
20
20
  "example": "./examples",
21
+ "include": "./include",
21
22
  "lib": "./lib",
23
+ "src": "./src",
22
24
  "test": "./test"
23
25
  },
24
26
  "types": "./docs/types",
@@ -28,7 +30,7 @@
28
30
  "examples": "make examples",
29
31
  "benchmark": "make benchmark"
30
32
  },
31
- "homepage": "https://github.com/stdlib-js/stdlib",
33
+ "homepage": "https://stdlib.io",
32
34
  "repository": {
33
35
  "type": "git",
34
36
  "url": "git://github.com/stdlib-js/ndarray-base-bind2vind.git"
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 ) {
@@ -100,7 +96,7 @@ int64_t stdlib_ndarray_bind2vind( int64_t ndims, int64_t *shape, int64_t *stride
100
96
  idx -= k * s;
101
97
  k += shape[ i ] - 1;
102
98
  } else {
103
- k = idx / s; // truncates
99
+ k = idx / s; // cppcheck-suppress zerodivcond // truncates
104
100
  idx -= k * s;
105
101
  }
106
102
  ind += k * llabs( s );
@@ -115,7 +111,7 @@ int64_t stdlib_ndarray_bind2vind( int64_t ndims, int64_t *shape, int64_t *stride
115
111
  idx -= k * s;
116
112
  k += shape[ i ] - 1;
117
113
  } else {
118
- k = idx / s; // truncates
114
+ k = idx / s; // cppcheck-suppress zerodivcond // truncates
119
115
  idx -= k * s;
120
116
  }
121
117
  ind += k * llabs( s );
package/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- # CHANGELOG
2
-
3
- > Package changelog.
4
-
5
- See [GitHub Releases](https://github.com/stdlib-js/ndarray-base-bind2vind/releases) for the changelog.