Gathering detailed insights and metrics for @stdlib/ndarray-base-vind2bind
Gathering detailed insights and metrics for @stdlib/ndarray-base-vind2bind
npm install @stdlib/ndarray-base-vind2bind
Typescript
Module System
Min. Node Version
Node Version
NPM Version
73.8
Supply Chain
95.3
Quality
83
Maintenance
100
Vulnerability
88
License
C (53.47%)
JavaScript (46.53%)
Total Downloads
101,963
Last Day
209
Last Week
1,264
Last Month
5,587
Last Year
57,630
1 Stars
66 Commits
3 Watching
5 Branches
11 Contributors
Minified
Minified + Gzipped
Latest Version
0.2.2
Package Id
@stdlib/ndarray-base-vind2bind@0.2.2
Unpacked Size
38.42 kB
Size
10.37 kB
File Count
14
NPM Version
8.19.4
Node Version
16.20.2
Publised On
27 Jul 2024
Cumulative downloads
Total Downloads
Last day
-26.9%
209
Compared to previous day
Last week
-15.5%
1,264
Compared to previous week
Last month
10.1%
5,587
Compared to previous month
Last year
132%
57,630
Compared to previous year
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.
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.
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.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Convert a linear index in an array view to a linear index in an underlying data buffer.
1npm install @stdlib/ndarray-base-vind2bind
1var vind2bind = require( '@stdlib/ndarray-base-vind2bind' );
Converts a linear index in an array view to a linear index in an underlying data buffer.
1var shape = [ 3, 3 ]; 2var order = 'row-major'; 3var strides = [ -3, 1 ]; 4var offset = 6; 5 6var idx = vind2bind( shape, strides, offset, order, 1, 'throw' ); 7// returns 7
The function supports the following modes:
0
(minimum linear index) or the maximum linear index.1var shape = [ 2, 2 ]; 2var order = 'row-major'; 3var strides = [ -2, 1 ]; 4var offset = 2; 5 6var idx = vind2bind( shape, strides, offset, order, -2, 'wrap' ); 7// returns 0 8 9idx = vind2bind( shape, strides, offset, order, 10, 'clamp' ); 10// returns 1
The order
parameter specifies whether an array is row-major
(C-style) or column-major
(Fortran-style).
1var shape = [ 2, 2 ]; 2var order = 'column-major'; 3var strides = [ 1, -2 ]; 4var offset = 2; 5 6var idx = vind2bind( shape, strides, offset, order, 2, 'throw' ); 7// returns 0
1var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); 2var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); 3var numel = require( '@stdlib/ndarray-base-numel' ); 4var randu = require( '@stdlib/random-base-randu' ); 5var vind2bind = require( '@stdlib/ndarray-base-vind2bind' ); 6 7// Specify array meta data: 8var shape = [ 3, 3, 3 ]; 9var order = 'row-major'; 10 11// Compute array meta data: 12var len = numel( shape ); 13var strides = shape2strides( shape, order ); 14 15// Randomly flip the sign of strides... 16var i; 17for ( i = 0; i < shape.length; i++ ) { 18 if ( randu() < 0.5 ) { 19 strides[ i ] *= -1; 20 } 21} 22 23// Compute the underlying data buffer index offset: 24var offset = strides2offset( shape, strides ); 25 26// Print array info: 27console.log( 'Dims: %s', shape.join( 'x' ) ); 28console.log( 'Strides: %s', strides.join( ',' ) ); 29console.log( 'Offset: %d', offset ); 30 31// For each view index, determine the corresponding index into an array's underlying data buffer... 32var ind; 33for ( i = 0; i < len; i++ ) { 34 ind = vind2bind( shape, strides, offset, order, i, 'throw' ); 35 console.log( 'view[%d] => buffer[%d]', i, ind ); 36}
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
See LICENSE.
Copyright © 2016-2024. The Stdlib Authors.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More