- Notifications
You must be signed in to change notification settings - Fork338
ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
License
Apache-2.0, Unknown licenses found
Licenses found
rust-ndarray/ndarray
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Thendarray
crate provides ann-dimensional container for general elementsand for numerics.
Please read theAPI documentation on docs.rsor take a look at thequickstart tutorial.
- Generic 1, 2, ...,n-dimensional arrays
- Owned arrays and array views
- Slicing, also with arbitrary step size, and negative indices to meanelements from the end of the axis.
- Views and subviews of arrays; iterators that yield subviews.
- Still iterating on and evolving the crate
- The crate is continuously developing, and breaking changes are expectedduring evolution from version to version. We adopt the newest stablerust 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 largematrices; can optionally use BLAS to improve it further.
The following crate feature flags are available. They are configured inyour Cargo.toml.
std
Rust standard library (enabled by default)
This crate can be used without the standard library by disabling thedefault std feature. To do so, use this in your Cargo.toml:
[dependencies]ndarray = { version = "0.x.y", default-features = false }
The geomspace linspace logspace range std var var_axis and std_axismethods are only available when std is 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 version 0.5 of the [approx] crate.
blas
- Enable transparent BLAS support for matrix multiplication.Uses
blas-src
for pluggable backend, which needs to be configuredseparately (see below).
- Enable transparent BLAS support for matrix multiplication.Uses
matrixmultiply-threading
- Enable the
threading
feature in the matrixmultiply package
- Enable the
portable-atomic-critical-section
- Whether
portable-atomic
should usecritical-section
- Whether
[dependencies]ndarray = "0.16.0"
Blas integration is an optional add-on. Without BLAS, ndarray uses thematrixmultiply
crate for matrix multiplication forf64
andf32
arrays (and it's always enabled as a fallback since it supports matrices ofarbitrary strides in both dimensions).
Depend and link toblas-src
directly to pick a blas provider. Ndarraypresently requires a blas provider that provides thecblas-sys
interface. Iffurther feature selection is wanted or needed then you might need to depend directly onthe backend crate's source too. The backend versionmust be the one thatblas-src
also depends on.
An example configuration using system openblas is shown below. Note that onlyend-user projects (not libraries) should select provider:
[dependencies]ndarray = { version = "0.16.0", 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.16.0", features = ["blas"] }blas-src = { version = "0.10.0", default-features = false, features = ["netlib"] }
When this is done, your program must also link toblas_src
by using it orexplicitly 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 theblas-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 |
Althoughndarray
currently maintains an MSRV of 1.64.0, this is separate from the MSRV (either stated or real) of the various BLAS providers.As of the time of writing,openblas
currently supports MSRV of 1.71.1.So, whilendarray
andopenblas-src
are compatible, they can only work together with toolchains 1.71.1 or above.
SeeRELEASES.md.
Dual-licensed to be compatible with the Rust project.
Licensed under the Apache License, Version 2.0http://www.apache.org/licenses/LICENSE-2.0 or the MIT licensehttp://opensource.org/licenses/MIT, at youroption. This file may not be copied, modified, or distributedexcept according to those terms.
About
ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
Topics
Resources
License
Apache-2.0, Unknown licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.