ndarray
Library Featured
An n-dimensional array for general elements and for numerics. Lightweight array views and slicing; views support chunking and splitting.
- Downloads
- 13,748,379
- Dependents
- 2,888
- Stars
- 4,344
- Forks
- 394
- Contributors
- 115
- Commits
- 3,360
- Latest release
- 0.17.2 ·
About
The ndarray crate provides an n-dimensional container for general elements
and for numerics.
Please read the API documentation on docs.rs__
or take a look at the quickstart tutorial <./README-quick-start.md>_.
__ https://docs.rs/ndarray/
|build_status|_ |crates|_ |matrix-chat|_ |irc|_
.. |build_status| image:: https://github.com/rust-ndarray/ndarray/actions/workflows/ci.yaml/badge.svg :alt: CI build status .. _build_status: https://github.com/rust-ndarray/ndarray/actions
.. |crates| image:: https://img.shields.io/crates/v/ndarray.svg :alt: ndarray at crates.io .. _crates: https://crates.io/crates/ndarray
.. |matrix-chat| image:: https://img.shields.io/badge/Matrix-%23rust--sci%3Amatrix.org-lightgrey :alt: Matrix chat at #rust-sci:matrix.org .. _matrix-chat: https://matrix.to/#/#rust-sci:matrix.org
.. |irc| image:: https://img.shields.io/badge/IRC-%23rust--sci%20on%20OFTC-lightgrey :alt: IRC at #rust-sci on OFTC .. _irc: https://webchat.oftc.net/?channels=rust-sci
Read the full README
Highlights
- Generic 1, 2, ..., n-dimensional arrays
- Owned arrays and array views
- Slicing, also with arbitrary step size, and negative indices to mean elements from the end of the axis.
- Views and subviews of arrays; iterators that yield subviews.
Installation
From a shell in your project folder, run cargo add ndarray to add the latest version.
Status and Lookout
Still iterating on and evolving the crate
- The crate is continuously developing, and breaking changes are expected during evolution from version to version. We adopt the newest stable rust features if we need them.
Performance:
- Prefer higher order methods and arithmetic operations on arrays first, then iteration, and as a last priority using indexed algorithms.
- Efficient floating point matrix multiplication even for very large matrices; can optionally use BLAS to improve it further.
Crate Feature Flags
The following crate feature flags are available. They are configured in
your Cargo.toml.
stdRust standard library (enabled by default)
This crate can be used without the standard library by disabling the default
stdfeature. To do so, use this in yourCargo.toml:[dependencies] ndarray = { version = "0.x.y", default-features = false }
The
geomspacelinspacelogspacerangestdvarvar_axisandstd_axismethods are only available whenstdis enabled.
serde- Enables serialization support for serde 1.x
rayon- Enables parallel iterators, parallelized methods and
par_azip!. - Implies std
- Enables parallel iterators, parallelized methods and
approx- Implementations of traits from the [
approx] crate.
- Implementations of traits from the [
blas- Enable transparent BLAS support for matrix multiplication.
Uses
blas-srcfor pluggable backend, which needs to be configured separately (see below).
- Enable transparent BLAS support for matrix multiplication.
Uses
matrixmultiply-threading- Enable the
threadingfeature in the matrixmultiply package
- Enable the
portable-atomic-critical-section- Whether
portable-atomicshould usecritical-section
- Whether
How to enable BLAS integration
Blas integration is an optional add-on. Without BLAS, ndarray uses the
matrixmultiply crate for matrix multiplication for f64 and f32
arrays (and it's always enabled as a fallback since it supports matrices of
arbitrary strides in both dimensions).
Depend and link to blas-src directly to pick a blas provider. Ndarray
presently requires a blas provider that provides the cblas-sys interface. If
further feature selection is wanted or needed then you might need to depend directly on
the backend crate's source too. The backend version must be the one that
blas-src also depends on.
An example configuration using system openblas is shown below. Note that only end-user projects (not libraries) should select provider::
[dependencies]
ndarray = { version = "0.x.y", features = ["blas"] }
blas-src = { version = "0.10", features = ["openblas"] }
openblas-src = { version = "0.10", features = ["cblas", "system"] }
Using system-installed dependencies can save a long time building dependencies. An example configuration using (compiled) netlib is shown below anyway::
[dependencies]
ndarray = { version = "0.x.y", features = ["blas"] }
blas-src = { version = "0.10.0", default-features = false, features = ["netlib"] }
When this is done, your program must also link to blas_src by using it or
explicitly including it in your code::
extern crate blas_src;
The following versions have been verified to work together. For ndarray 0.15 or later,
there is no tight coupling to the blas-src version, so version selection is more flexible.
=========== ============ ================ ==============
ndarray blas-src openblas-src netlib-src
=========== ============ ================ ==============
0.16 0.10 0.10 0.8
0.15 0.8 0.10 0.8
0.15 0.7 0.9 0.8
0.14 0.6.1 0.9.0
0.13 0.2.0 0.6.0
=========== ============ ================ ==============
BLAS on MSRV
Although ndarray currently maintains an MSRV via rust-version, this is separate from the MSRV (either stated or real) of the various BLAS providers.
So, while ndarray may be compatible with older toolchains, the BLAS providers it depends on may not be.
Recent Changes
See RELEASES.md <./RELEASES.md>_.
License
Dual-licensed to be compatible with the Rust project.
Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- Optional
- Binds native code: cblas-sys (feature blas)
- Python bindings
- No Python binding crate found
- License
- Apache-2.0 OR MIT
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
An n-dimensional array for general elements and for numerics. Lightweight array views and slicing; views support chunking and splitting. |
13,748,379 downloads over 30 days | 2,888 | 4,344 | 0.17.2 | GPU support unknown | Binds native code: cblas-sys (feature blas) | Apache-2.0 OR MIT |
|
nalgebra Featured
General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices. |
6,251,820 downloads over 30 days | 2,119 | 4,810 | 0.35.0 | GPU support unknown | Binds native code: blas-sys, lapack-sys, defmt (feature defmt) | Apache-2.0 |
|
ndarray-stats Featured
Statistical routines for the n-dimensional array data structures provided by ndarray. |
592,313 downloads over 30 days | 115 | 239 | 0.7.0 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
basin Listed
Numerical optimization in pure Rust, with pluggable linear-algebra backends and WASM support. |
22,519 downloads over 30 days | 9 | 128 | 3.2.0 | GPU support unknown | Binds native code: blas-sys (feature nalgebra_latest-lapack), lapack-sys (feature nalgebra_latest-lapack) | Apache-2.0 OR MIT |
|
ndrustfft Listed
N-dimensional FFT, real-to-complex FFT and real-to-real DCT |
10,619 downloads over 30 days | 12 | 32 | 0.6.2 | GPU support unknown | No native code found | MIT |
|
numr Listed
The base for numerical code in Rust, in the role NumPy has in Python: n-dimensional tensors, linear algebra, FFT, statistics and autograd on CPU, CUDA and WebGPU. The backends use native kernels, with no cuBLAS, MKL or other vendor math library. |
1,673 downloads over 30 days | 7 | 59 | 0.15.2 | CUDA, WebGPU | Binds native code: ring (feature distributed) | Apache-2.0 |
Why FeaturedIt passes every Featured gate.
What it meets
- It has 881 active dependents and 645 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days.
- Active dependents are at 100% of their peak. Featured needs at least 50%.
- Docs are present. The release commit or a manifest ties the crate to the repository.
- No vulnerability advisory stays unpatched past the grace window. At least one version is neither a prerelease nor 0.0.x.
- The last activity is on 23 Oct 2026, 17 days ago. The rules expect an update within 1200 days. Dormancy rule
Exact rules: Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.17.2 base 300, doubled for 13748379 downloads per month, doubled for 881.25 active users: E = 1200 daysdormancy: last activity 2026-10-23, 17 days ago, E = 1200: activefeatured: featured: active_users 881.25, new_adopters 644.5, former_glory 1
Crates2 crates
- ndarray Primary
- ndarray-rand
Related projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days.
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption881 active dependents, 645 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 881.25 | crates.io database dump | Yes | |
| New dependents (365 days) | 644.5 | crates.io database dump | Yes | |
| Peak active dependents | 881.25 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 17 days ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2026-10-23 | GitHub repository | Yes | |
| Latest release | 2026-01-10 | crates.io database dump | Yes | |
| First release | 2015-12-20 | crates.io database dump | Yes | |
| Latest version | 0.17.2 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 518 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 100 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution92 releases, 13,748,379 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 92 | crates.io database dump | Yes | |
| Downloads over 30 days | 13748379 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository4,344 stars, 394 forks, 115 contributors, 3,360 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 4344 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 394 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 115 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 3360 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | Apache-2.0 OR MIT | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | Binds native code: cblas-sys (feature blas) | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 2888 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.