@stdlib/ndarray

Multidimensional arrays.

https://github.com/stdlib-js/ndarray

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary

Keywords

array buffer data javascript matrix multidimensional namespace ndarray node node-js nodejs ns stdlib structures tensor typed typed-array types vector
Last synced: 4 months ago · JSON representation ·

Repository

Multidimensional arrays.

Basic Info
Statistics
  • Stars: 14
  • Watchers: 4
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Topics
array buffer data javascript matrix multidimensional namespace ndarray node node-js nodejs ns stdlib structures tensor typed typed-array types vector
Created over 4 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

About stdlib...

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!

ndarray

NPM version Build Status Coverage Status <!-- dependencies -->

Multidimensional arrays.

## Installation ```bash npm install @stdlib/ndarray ``` Alternatively, - To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]). - If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions). - For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]). The [branches.md][branches-url] 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.
## Usage ```javascript var ns = require( '@stdlib/ndarray' ); ``` #### ns ndarray namespace. ```javascript var o = ns; // returns {...} ``` The namespace exports the following functions to create multidimensional arrays:
- [`array( [buffer,] [options] )`][@stdlib/ndarray/array]: create a multidimensional array. - [`ndarray( dtype, buffer, shape, strides, offset, order[, options] )`][@stdlib/ndarray/ctor]: multidimensional array constructor.
The namespace contains the following sub-namespaces:
- [`base`][@stdlib/ndarray/base]: base ndarray. - [`iter`][@stdlib/ndarray/iter]: multidimensional array iterators.
In addition, the namespace contains the following multidimensional array utility functions:
- [`at( x[, ...indices] )`][@stdlib/ndarray/at]: return an `ndarray` element. - [`broadcastArray( x, shape )`][@stdlib/ndarray/broadcast-array]: broadcast an ndarray to a specified shape. - [`broadcastArrays( ...arrays )`][@stdlib/ndarray/broadcast-arrays]: broadcast ndarrays to a common shape. - [`castingModes()`][@stdlib/ndarray/casting-modes]: list of ndarray casting modes. - [`countFalsy( x[, options] )`][@stdlib/ndarray/count-falsy]: count the number of falsy elements along one or more `ndarray` dimensions. - [`countIf( x[, options], predicate[, thisArg] )`][@stdlib/ndarray/count-if]: count the number of truthy elements along one or more `ndarray` dimensions. - [`countTruthy( x[, options] )`][@stdlib/ndarray/count-truthy]: count the number of truthy elements along one or more `ndarray` dimensions. - [`dataBuffer( x )`][@stdlib/ndarray/data-buffer]: return the underlying data buffer of a provided ndarray. - [`defaults()`][@stdlib/ndarray/defaults]: default ndarray settings. - [`dispatch( fcns, types, data, nargs, nin, nout )`][@stdlib/ndarray/dispatch]: create an ndarray function interface which performs multiple dispatch. - [`dtype( x )`][@stdlib/ndarray/dtype]: return the data type of a provided ndarray. - [`dtypes( [kind] )`][@stdlib/ndarray/dtypes]: list of ndarray data types. - [`emptyLike( x[, options] )`][@stdlib/ndarray/empty-like]: create an uninitialized ndarray having the same shape and data type as a provided ndarray. - [`empty( shape[, options] )`][@stdlib/ndarray/empty]: create an uninitialized ndarray having a specified shape and data type. - [`every( x[, options] )`][@stdlib/ndarray/every]: test whether every element along one or more `ndarray` dimensions is truthy. - [`FancyArray( dtype, buffer, shape, strides, offset, order[, options] )`][@stdlib/ndarray/fancy]: fancy multidimensional array constructor. - [`fillBy( x, fcn[, thisArg] )`][@stdlib/ndarray/fill-by]: fill an input ndarray according to a callback function. - [`fill( x, value )`][@stdlib/ndarray/fill]: fill an input `ndarray` with a specified value. - [`filterMap( x[, options], fcn[, thisArg] )`][@stdlib/ndarray/filter-map]: filter and map elements in an input ndarray to elements in a new output ndarray according to a callback function. - [`filter( x[, options], predicate[, thisArg] )`][@stdlib/ndarray/filter]: return a shallow copy of an ndarray containing only those elements which pass a test implemented by a predicate function. - [`flag( x, name )`][@stdlib/ndarray/flag]: return a specified flag for a provided ndarray. - [`flags( x )`][@stdlib/ndarray/flags]: return the flags of a provided ndarray. - [`forEach( x, fcn[, thisArg] )`][@stdlib/ndarray/for-each]: invoke a callback function once for each ndarray element. - [`scalar2ndarray( value[, options] )`][@stdlib/ndarray/from-scalar]: convert a scalar value to a zero-dimensional ndarray. - [`includes( x, searchElement[, options] )`][@stdlib/ndarray/includes]: test whether an `ndarray` contains a specified value along one or more dimensions. - [`ind2sub( shape, idx[, options] )`][@stdlib/ndarray/ind2sub]: convert a linear index to an array of subscripts. - [`indexModes()`][@stdlib/ndarray/index-modes]: list of ndarray index modes. - [`ndindex( x[, options] )`][@stdlib/ndarray/index]: ndarray index constructor. - [`inputCastingPolicies()`][@stdlib/ndarray/input-casting-policies]: list of input ndarray casting policies. - [`map( x[, options], fcn[, thisArg] )`][@stdlib/ndarray/map]: apply a callback function to elements in an input ndarray and assign results to elements in a new output ndarray. - [`maybeBroadcastArray( x, shape )`][@stdlib/ndarray/maybe-broadcast-array]: broadcast an ndarray to a specified shape if and only if the specified shape differs from the provided ndarray's shape. - [`maybeBroadcastArrays( arrays )`][@stdlib/ndarray/maybe-broadcast-arrays]: broadcast ndarrays to a common shape. - [`minDataType( value )`][@stdlib/ndarray/min-dtype]: determine the minimum ndarray data type of the closest "kind" necessary for storing a provided scalar value. - [`mostlySafeCasts( [dtype] )`][@stdlib/ndarray/mostly-safe-casts]: 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] )`][@stdlib/ndarray/ndarraylike2ndarray]: convert an ndarray-like object to an `ndarray`. - [`ndims( x )`][@stdlib/ndarray/ndims]: return the number of ndarray dimensions. - [`nextDataType( [dtype] )`][@stdlib/ndarray/next-dtype]: return the next larger ndarray data type of the same kind. - [`numelDimension( x, dim )`][@stdlib/ndarray/numel-dimension]: return the size (i.e., number of elements) of a specified dimension for a provided ndarray. - [`numel( x )`][@stdlib/ndarray/numel]: return the number of elements in an ndarray. - [`offset( x )`][@stdlib/ndarray/offset]: return the index offset specifying the underlying buffer index of the first iterated ndarray element. - [`order( x )`][@stdlib/ndarray/order]: return the layout order of a provided ndarray. - [`orders()`][@stdlib/ndarray/orders]: list of ndarray orders. - [`outputDataTypePolicies()`][@stdlib/ndarray/output-dtype-policies]: list of output ndarray data type policies. - [`promotionRules( [dtype1, dtype2] )`][@stdlib/ndarray/promotion-rules]: return the ndarray data type with the smallest size and closest "kind" to which ndarray data types can be **safely** cast. - [`reject( x[, options], predicate[, thisArg] )`][@stdlib/ndarray/reject]: return a shallow copy of an ndarray containing only those elements which fail a test implemented by a predicate function. - [`safeCasts( [dtype] )`][@stdlib/ndarray/safe-casts]: return a list of ndarray data types to which a provided ndarray data type can be safely cast. - [`sameKindCasts( [dtype] )`][@stdlib/ndarray/same-kind-casts]: 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 )`][@stdlib/ndarray/shape]: return the shape of a provided ndarray. - [`sliceAssign( x, y, ...s[, options] )`][@stdlib/ndarray/slice-assign]: assign element values from a broadcasted input `ndarray` to corresponding elements in an output `ndarray` view. - [`sliceDimensionFrom( x, dim, start[, options] )`][@stdlib/ndarray/slice-dimension-from]: return a read-only shifted view of an input `ndarray` along a specified dimension. - [`sliceDimensionTo( x, dim, stop[, options] )`][@stdlib/ndarray/slice-dimension-to]: return a read-only truncated view of an input `ndarray` along a specified dimension. - [`sliceDimension( x, dim, slice[, options] )`][@stdlib/ndarray/slice-dimension]: return a read-only view of an input `ndarray` when sliced along a specified dimension. - [`sliceFrom( x, ...start[, options] )`][@stdlib/ndarray/slice-from]: return a read-only shifted view of an input ndarray. - [`sliceTo( x, ...stop[, options] )`][@stdlib/ndarray/slice-to]: return a read-only truncated view of an input ndarray. - [`slice( x, ...s[, options] )`][@stdlib/ndarray/slice]: return a read-only view of an input `ndarray`. - [`someBy( x, n[, options], predicate[, thisArg] )`][@stdlib/ndarray/some-by]: test whether at least `n` elements along one or more `ndarray` dimensions pass a test implemented by a predicate function. - [`stride( x, dim )`][@stdlib/ndarray/stride]: return the stride along a specified dimension for a provided ndarray. - [`strides( x )`][@stdlib/ndarray/strides]: return the strides of a provided ndarray. - [`sub2ind( shape, ...subscripts[, options] )`][@stdlib/ndarray/sub2ind]: convert subscripts to a linear index. - [`ndarray2array( x )`][@stdlib/ndarray/to-array]: convert an ndarray to a generic array. - [`ndarray2fancy( x[, options] )`][@stdlib/ndarray/to-fancy]: convert an ndarray to an object supporting fancy indexing. - [`ndarray2json( x )`][@stdlib/ndarray/to-json]: serialize an ndarray as a JSON object. - [`vector`][@stdlib/ndarray/vector]: vector constructors and associated utilities. - [`zerosLike( x[, options] )`][@stdlib/ndarray/zeros-like]: create a zero-filled ndarray having the same shape and data type as a provided ndarray. - [`zeros( shape[, options] )`][@stdlib/ndarray/zeros]: create a zero-filled ndarray having a specified shape and data type.
## Examples ```javascript var objectKeys = require( '@stdlib/utils/keys' ); var ns = require( '@stdlib/ndarray' ); console.log( objectKeys( ns ) ); ```
* * * ## Notice This package is part of [stdlib][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][stdlib], see the main project [repository][stdlib]. #### Community [![Chat][chat-image]][chat-url] --- ## License See [LICENSE][stdlib-license]. ## Copyright Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].

Owner

  • Name: stdlib
  • Login: stdlib-js
  • Kind: organization

Standard library for JavaScript.

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Watch event: 4
  • Push event: 1,147
  • Create event: 7
Last Year
  • Watch event: 4
  • Push event: 1,147
  • Create event: 7

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 626
  • Total Committers: 1
  • Avg Commits per committer: 626.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 279
  • Committers: 1
  • Avg Commits per committer: 279.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
stdlib-bot n****y@s****o 626
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 88,781 last-month
  • Total docker downloads: 481,210,190
  • Total dependent packages: 18
  • Total dependent repositories: 266
  • Total versions: 22
  • Total maintainers: 4
npmjs.org: @stdlib/ndarray

Multidimensional arrays.

  • Homepage: https://stdlib.io
  • License: Apache-2.0
  • Latest release: 0.3.3
    published about 1 year ago
  • Versions: 22
  • Dependent Packages: 18
  • Dependent Repositories: 266
  • Downloads: 88,781 Last month
  • Docker Downloads: 481,210,190
Rankings
Docker downloads count: 0.1%
Downloads: 0.6%
Dependent repos count: 1.0%
Dependent packages count: 1.3%
Average: 4.3%
Forks count: 9.8%
Stargazers count: 13.1%
Funding
  • type: opencollective
  • url: https://opencollective.com/stdlib
Last synced: 4 months ago

Dependencies

base/ind2sub/benchmark/julia/REQUIRE julia
  • BenchmarkTools 0.5.0
  • julia 1.5
base/sub2ind/benchmark/julia/REQUIRE julia
  • BenchmarkTools 0.5.0
  • julia 1.5
ctor/benchmark/julia/REQUIRE julia
  • BenchmarkTools 0.5.0
  • julia 1.5
ind2sub/benchmark/julia/REQUIRE julia
  • BenchmarkTools 0.5.0
  • julia 1.5
sub2ind/benchmark/julia/REQUIRE julia
  • BenchmarkTools 0.5.0
  • julia 1.5
package.json npm
  • @stdlib/bench github:stdlib-js/bench development
  • @stdlib/random github:stdlib-js/random development
  • istanbul ^0.4.1 development
  • proxyquire ^2.0.0 development
  • tap-spec 5.x.x development
  • tape git+https://github.com/kgryte/tape.git#fix/globby development
  • @stdlib/array github:stdlib-js/array#main
  • @stdlib/assert github:stdlib-js/assert#main
  • @stdlib/bigint github:stdlib-js/bigint#main
  • @stdlib/boolean github:stdlib-js/boolean#main
  • @stdlib/buffer github:stdlib-js/buffer#main
  • @stdlib/complex github:stdlib-js/complex#main
  • @stdlib/constants github:stdlib-js/constants#main
  • @stdlib/math github:stdlib-js/math#main
  • @stdlib/number github:stdlib-js/number#main
  • @stdlib/strided github:stdlib-js/strided#main
  • @stdlib/string github:stdlib-js/string#main
  • @stdlib/types github:stdlib-js/types#main
  • @stdlib/utils github:stdlib-js/utils#main
.github/workflows/benchmark.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/cancel.yml actions
  • styfle/cancel-workflow-action 0.11.0 composite
.github/workflows/close_pull_requests.yml actions
  • superbrothers/close-pull-request v3 composite
.github/workflows/examples.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/npm_downloads.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3 composite
  • distributhor/workflow-webhook v3 composite
.github/workflows/productionize.yml actions
  • act10ns/slack v2 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • stdlib-js/bundle-action main composite
  • stdlib-js/transform-errors-action main composite
.github/workflows/publish.yml actions
  • JS-DevTools/npm-publish v2 composite
  • act10ns/slack v2 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • styfle/cancel-workflow-action 0.11.0 composite
.github/workflows/test.yml actions
  • act10ns/slack v2 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/test_bundles.yml actions
  • act10ns/slack v2 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • denoland/setup-deno v1 composite
.github/workflows/test_coverage.yml actions
  • act10ns/slack v2 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • codecov/codecov-action v3 composite
  • distributhor/workflow-webhook v3 composite
.github/workflows/test_install.yml actions
  • act10ns/slack v2 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
array/package.json npm
base/assert/is-allowed-data-type-cast/package.json npm
base/assert/is-buffer-length-compatible/package.json npm
base/assert/is-buffer-length-compatible-shape/package.json npm
base/assert/is-casting-mode/package.json npm
base/assert/is-column-major/package.json npm
base/assert/is-column-major-contiguous/package.json npm
base/assert/is-complex-floating-point-data-type/package.json npm
base/assert/is-contiguous/package.json npm
base/assert/is-data-type/package.json npm
base/assert/is-floating-point-data-type/package.json npm
base/assert/is-index-mode/package.json npm
base/assert/is-integer-data-type/package.json npm
base/assert/is-numeric-data-type/package.json npm
base/assert/is-order/package.json npm
base/assert/is-read-only/package.json npm
base/assert/is-real-data-type/package.json npm
base/assert/is-real-floating-point-data-type/package.json npm
base/assert/is-row-major/package.json npm
base/assert/is-row-major-contiguous/package.json npm
base/assert/is-safe-data-type-cast/package.json npm
base/assert/is-same-kind-data-type-cast/package.json npm
base/assert/is-signed-integer-data-type/package.json npm
base/assert/is-single-segment-compatible/package.json npm
base/assert/is-unsigned-integer-data-type/package.json npm
base/assert/package.json npm
base/binary-loop-interchange-order/package.json npm
base/binary-tiling-block-size/package.json npm
base/bind2vind/package.json npm
base/broadcast-array/package.json npm
base/broadcast-scalar/package.json npm
base/broadcast-shapes/package.json npm
base/buffer/package.json npm
base/buffer-ctors/package.json npm
base/buffer-dtype/package.json npm
base/buffer-dtype-enum/package.json npm
base/bytes-per-element/package.json npm
base/char2dtype/package.json npm
base/clamp-index/package.json npm
base/ctor/package.json npm
base/dtype-char/package.json npm
base/dtype-desc/package.json npm
base/dtype-enum2str/package.json npm
base/dtype-resolve-enum/package.json npm
base/dtype-resolve-str/package.json npm
base/dtype-str2enum/package.json npm
base/dtype2c/package.json npm
base/dtypes2signatures/package.json npm
base/empty/package.json npm
base/empty-like/package.json npm
base/expand-dimensions/package.json npm
base/from-scalar/package.json npm
base/function-object/package.json npm
base/ind/package.json npm
base/ind2sub/package.json npm
base/iteration-order/package.json npm
base/max-view-buffer-index/package.json npm
base/maybe-broadcast-array/package.json npm
base/meta-data-props/package.json npm
base/min-view-buffer-index/package.json npm
base/minmax-view-buffer-index/package.json npm
base/napi/addon-arguments/package.json npm
base/napi/dtype-string-to-dtype/package.json npm
base/napi/package.json npm
base/napi/typedarray-type-to-dtype/package.json npm
base/napi/unary/package.json npm
base/ndarraylike2object/package.json npm
base/nonsingleton-dimensions/package.json npm
base/nullary/package.json npm
base/nullary-loop-interchange-order/package.json npm
base/nullary-tiling-block-size/package.json npm
base/numel/package.json npm
base/output-policy-enum2str/package.json npm
base/output-policy-resolve-enum/package.json npm
base/output-policy-resolve-str/package.json npm
base/output-policy-str2enum/package.json npm
base/package.json npm
base/prepend-singleton-dimensions/package.json npm
base/remove-singleton-dimensions/package.json npm
base/serialize-meta-data/package.json npm
base/shape2strides/package.json npm
base/singleton-dimensions/package.json npm
base/slice/package.json npm