Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
Unknown
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

rust-ndarray/ndarray

Repository files navigation

ndarray

Thendarray crate provides ann-dimensional container for general elementsand for numerics.

Please read theAPI documentation on docs.rsor take a look at thequickstart tutorial.

CI build statusndarray at crates.ioMatrix chat at #rust-sci:matrix.orgIRC at #rust-sci on OFTC

Highlights

  • 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.

Status and Lookout

  • 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.

Crate Feature Flags

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 andpar_azip!.
    • Implies std
  • approx

    • Implementations of traits from version 0.5 of the [approx] crate.
  • blas

    • Enable transparent BLAS support for matrix multiplication.Usesblas-src for pluggable backend, which needs to be configuredseparately (see below).
  • matrixmultiply-threading

    • Enable thethreading feature in the matrixmultiply package
  • portable-atomic-critical-section

    • Whetherportable-atomic should usecritical-section

How to use with cargo

[dependencies]ndarray = "0.16.0"

How to enable BLAS integration

Blas integration is an optional add-on. Without BLAS, ndarray uses thematrixmultiply crate for matrix multiplication forf64 andf32arrays (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.

ndarrayblas-srcopenblas-srcnetlib-src
0.160.100.100.8
0.150.80.100.8
0.150.70.90.8
0.140.6.10.9.0 
0.130.2.00.6.0 

BLAS on MSRV

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.

Recent Changes

SeeRELEASES.md.

License

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

Apache-2.0
LICENSE-APACHE
Unknown
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp