Gathering detailed insights and metrics for @stdlib/ndarray
Gathering detailed insights and metrics for @stdlib/ndarray
Gathering detailed insights and metrics for @stdlib/ndarray
Gathering detailed insights and metrics for @stdlib/ndarray
npm install @stdlib/ndarray
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
10 Stars
423 Commits
3 Forks
5 Watching
5 Branches
10 Contributors
Updated on 21 Nov 2024
C (66.73%)
JavaScript (31.14%)
TypeScript (2.08%)
Python (0.05%)
Cumulative downloads
Total Downloads
Last day
10.7%
2,341
Compared to previous day
Last week
-21.7%
11,902
Compared to previous week
Last month
5.5%
76,608
Compared to previous month
Last year
19.8%
1,447,238
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!
Multidimensional arrays.
1npm install @stdlib/ndarray
Alternatively,
script
tag without installation and bundlers, use the ES Module available on the esm
branch (see README).deno
branch (see README for usage intructions).umd
branch (see README).The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.
To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
1var ns = require( '@stdlib/ndarray' );
ndarray namespace.
1var o = ns; 2// returns {...}
The namespace exports the following functions to create multidimensional arrays:
array( [buffer,] [options] )
: create a multidimensional array.ndarray( dtype, buffer, shape, strides, offset, order[, options] )
: multidimensional array constructor.The namespace contains the following sub-namespaces:
In addition, the namespace contains the following multidimensional array utility functions:
at( x[, ...indices] )
: return an ndarray
element.broadcastArray( x, shape )
: broadcast an ndarray to a specified shape.broadcastArrays( ...arrays )
: broadcast ndarrays to a common shape.castingModes()
: list of ndarray casting modes.dataBuffer( x )
: return the underlying data buffer of a provided ndarray.defaults()
: default ndarray settings.dispatch( fcns, types, data, nargs, nin, nout )
: create an ndarray function interface which performs multiple dispatch.dtype( x )
: return the data type of a provided ndarray.dtypes( [kind] )
: list of ndarray data types.emptyLike( x[, options] )
: create an uninitialized ndarray having the same shape and data type as a provided ndarray.empty( shape[, options] )
: create an uninitialized ndarray having a specified shape and data type.FancyArray( dtype, buffer, shape, strides, offset, order[, options] )
: fancy multidimensional array constructor.flag( x, name )
: return a specified flag for a provided ndarray.flags( x )
: return the flags of a provided ndarray.scalar2ndarray( value[, options] )
: convert a scalar value to a zero-dimensional ndarray.ind2sub( shape, idx[, options] )
: convert a linear index to an array of subscripts.indexModes()
: list of ndarray index modes.maybeBroadcastArray( x, shape )
: broadcast an ndarray to a specified shape if and only if the specified shape differs from the provided ndarray's shape.maybeBroadcastArrays( arrays )
: broadcast ndarrays to a common shape.minDataType( value )
: determine the minimum ndarray data type of the closest "kind" necessary for storing a provided scalar value.mostlySafeCasts( [dtype] )
: return a list of ndarray data types to which a provided ndarray data type can be safely cast and, for floating-point data types, can be downcast.ndarraylike2ndarray( x[, options] )
: convert an ndarray-like object to an ndarray
.ndims( x )
: return the number of ndarray dimensions.nextDataType( [dtype] )
: return the next larger ndarray data type of the same kind.numelDimension( x, dim )
: return the size (i.e., number of elements) of a specified dimension for a provided ndarray.numel( x )
: return the number of elements in an ndarray.offset( x )
: return the index offset specifying the underlying buffer index of the first iterated ndarray element.order( x )
: return the layout order of a provided ndarray.orders()
: list of ndarray orders.outputDataTypePolicies()
: list of output ndarray data type policies.promotionRules( [dtype1, dtype2] )
: return the ndarray data type with the smallest size and closest "kind" to which ndarray data types can be safely cast.safeCasts( [dtype] )
: return a list of ndarray data types to which a provided ndarray data type can be safely cast.sameKindCasts( [dtype] )
: return a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind".shape( x )
: return the shape of a provided ndarray.sliceAssign( x, y, ...s[, options] )
: assign element values from a broadcasted input ndarray
to corresponding elements in an output ndarray
view.sliceDimensionFrom( x, dim, start[, options] )
: return a read-only shifted view of an input ndarray
along a specified dimension.sliceDimensionTo( x, dim, stop[, options] )
: return a read-only truncated view of an input ndarray
along a specified dimension.sliceDimension( x, dim, slice[, options] )
: return a read-only view of an input ndarray
when sliced along a specified dimension.sliceFrom( x, ...start[, options] )
: return a read-only shifted view of an input ndarray.sliceTo( x, ...stop[, options] )
: return a read-only truncated view of an input ndarray.slice( x, ...s[, options] )
: return a read-only view of an input ndarray
.stride( x, dim )
: return the stride along a specified dimension for a provided ndarray.strides( x )
: return the strides of a provided ndarray.sub2ind( shape, ...subscripts[, options] )
: convert subscripts to a linear index.ndarray2array( x )
: convert an ndarray to a generic array.zerosLike( x[, options] )
: create a zero-filled ndarray having the same shape and data type as a provided ndarray.zeros( shape[, options] )
: create a zero-filled ndarray having a specified shape and data type.1var objectKeys = require( '@stdlib/utils/keys' ); 2var ns = require( '@stdlib/ndarray' ); 3 4console.log( objectKeys( ns ) );
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 dangerous workflow patterns detected
Reason
21 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
no binaries found in the repo
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
no effort to earn an OpenSSF best practices badge detected
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
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
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