The ndarray crate provides owned arrays and views for numeric and general elements in Rust. It emphasizes efficient operations, slicing, and optional BLAS acceleration.
Overview
ndarray is a Rust crate for n-dimensional arrays ranging from vectors and matrices to higher-rank data. ArrayBase underpins owned Array types and lightweight views, with slicing that supports steps and negative axis indices.
Higher-order methods and arithmetic on arrays are the preferred style for performance, alongside Zip and azip! for lock-step work across multiple arrays. Matrix multiplication is implemented efficiently in pure Rust and can delegate to BLAS when the optional feature is enabled and configured with a compatible backend.
Feature flags add standard-library integration, serde serialization, rayon parallel iterators, approx trait support, and threaded matrixmultiply. The crate can be used without std, and related ecosystem crates cover linear algebra, statistics, and random array generation.
Key features
- Generic n-dimensional arrays and views
- Flexible multidimensional slicing
- Zip and parallel rayon support
- Optional BLAS matrix multiply
- Serde serialization feature
- works without std feature flag
Use cases
- Numeric computing in Rust
- Matrix and tensor manipulations
- Scientific code needing array views