PackageTrack
Sign in Get early access

ndarray-rand

Constructors for randomized arrays. `rand` integration for `ndarray`.

0.16.0 4.7M downloads/mo #4644 most downloaded on crates.io rust-ndarray/ndarray

What this package is like to depend on

Last release 9 months ago

04 Nov 2025

Ships unpredictably

gaps range from 2 weeks to 3.4 years

Some releases are documented

notes for 6 of 19 stable releases

Nothing withdrawn

no release was ever pulled

10 years old

19 releases · first in 2016

1 release in the last 12 months

see the full history below

Release timeline

19 releases · Mar 2016 to Nov 2025
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 19
  1. 0.16.0 04 Nov 2025
    Release notes

    This release of ndarray-rand adds compatibility for the new ArrayRef type in ndarray 0.17. It adds the the new RandomRefExt trait, providing sample_axis and sample_axis_using methods on ArrayRef.

    This release also bumps the requirements for rand to 0.9.0 and for rand_distr to 0.5.0.

    Open source →
    Release notes

    Version 0.16.0 (2024-08-03)

    Featured Changes

    • Better shape: Deprecate reshape, into_shape by @bluss #1310

      .into_shape() is now deprecated.
      Use .into_shape_with_order() or .to_shape() instead, which don't have into_shape's drawbacks.

    New Features and Improvements

    Tests, CI and Maintainer tasks

    Open source →
    Release notes

    Featured Changes

    • Better shape: Deprecate reshape, into_shape by @bluss #1310<br> .into_shape() is now deprecated. Use .into_shape_with_order() or .to_shape() instead, which don't have into_shape's drawbacks.

    New Features and Improvements

    Tests, CI and Maintainer tasks

    Open source →
  2. 0.15.0 03 Aug 2024
    Release notes

    New features

    • Support inserting new axes while slicing by [@jturner314]. This is an example:

      let view = arr.slice(s![.., -1, 2..;-1, NewAxis]);
      

      https://github.com/rust-ndarray/ndarray/pull/570

    • Support two-sided broadcasting in arithmetic operations with arrays by [@SparrowLii]

      This now allows, for example, addition of a 3 x 1 with a 1 x 3 array; the operands are in this case broadcast to 3 x 3 which is the shape of the result.

      Note that this means that a new trait bound is required in some places when mixing dimensionality types of arrays in arithmetic operations.

      https://github.com/rust-ndarray/ndarray/pull/898

    • Support for compiling ndarray as no_std (using core and alloc) by [@xd009642] and [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/861 <br> https://github.com/rust-ndarray/ndarray/pull/889

    • New methods .cell_view() and ArrayViewMut::into_cell_view that enable new ways of working with array elements as if they were in Cells - setting elements through shared views and broadcast views, by [@bluss].

      https://github.com/rust-ndarray/ndarray/pull/877

    • New methods slice_each_axis/_mut/_inplace that make it easier to slice a dynamic number of axes in some situations, by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/913

    • New method a.assign_to(b) with the inverse argument order compared to the existing b.assign(a) and some extra features like assigning into uninitialized arrays, By [@bluss].

      https://github.com/rust-ndarray/ndarray/pull/947

    • New methods .std() and .var() for standard deviation and variance by [@kdubovikov]

      https://github.com/rust-ndarray/ndarray/pull/790

    Enhancements

    • Ndarray can now correctly determine that arrays can be contiguous, even if they have negative strides, by [@SparrowLii]

      https://github.com/rust-ndarray/ndarray/pull/885 <br> https://github.com/rust-ndarray/ndarray/pull/948

    • Improvements to map_inplace by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/911

    • .into_dimensionality performance was improved for the IxDyn to IxDyn case by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/906

    • Improved performance for scalar + &array and &array + scalar operations by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/890

    API changes

    • New constructors Array::from_iter and Array::from_vec by [@bluss]. No new functionality, just that these constructors are available without trait imports.

      https://github.com/rust-ndarray/ndarray/pull/921

    • NdProducer::raw_dim is now a documented method by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/918

    • AxisDescription is now a struct with field names, not a tuple struct by [@jturner314]. Its accessor methods are now deprecated.

      https://github.com/rust-ndarray/ndarray/pull/915

    • Methods for array comparison abs_diff_eq and relative_eq are now exposed as inherent methods too (no trait import needed), still under the approx feature flag by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/946

    • Changes to the slicing-related types and macro by [@jturner314] and [@bluss]:

      • Remove the Dimension::SliceArg associated type, and add a new SliceArg trait for this purpose.
      • Change the return type of the s![] macro to an owned SliceInfo rather than a reference.
      • Replace the SliceOrIndex enum with SliceInfoElem, which has an additional NewAxis variant and does not have a step_by method.
      • Change the type parameters of SliceInfo in order to support the NewAxis functionality and remove some tricky unsafe code.
      • Mark the SliceInfo::new method as unsafe. The new implementations of TryFrom can be used as a safe alternative.
      • Remove the AsRef<SliceInfo<[SliceOrIndex], D>> for SliceInfo<T, D> implementation. Add the similar From<&'a SliceInfo<T, Din, Dout>> for SliceInfo<&'a [SliceInfoElem], Din, Dout> conversion as an alternative.
      • Change the expr ; step case in the s![] macro to error at compile time if an unsupported type for expr is used, instead of panicking at runtime.

      https://github.com/rust-ndarray/ndarray/pull/570 <br> https://github.com/rust-ndarray/ndarray/pull/940 <br> https://github.com/rust-ndarray/ndarray/pull/943 <br> https://github.com/rust-ndarray/ndarray/pull/945 <br>

    • Removed already deprecated methods by [@bluss]:

      • Remove deprecated .all_close() - use approx feature and methods like .abs_diff_eq instead
      • Mark .scalar_sum() as deprecated - use .sum() instead
      • Remove deprecated DataClone - use Data + RawDataClone instead
      • Remove deprecated ArrayView::into_slice - use to_slice() instead.

      https://github.com/rust-ndarray/ndarray/pull/874

    • Remove already deprecated methods: rows, cols (for row and column count; the new names are nrows and ncols) by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/872

    • Renamed Zip methods by [@bluss] and [@SparrowLii]:

      • apply -> for_each
      • apply_collect -> map_collect
      • apply_collect_into -> map_collect_into
      • (par_ prefixed methods renamed accordingly)

      https://github.com/rust-ndarray/ndarray/pull/894 <br> https://github.com/rust-ndarray/ndarray/pull/904 <br>

    • Deprecate Array::uninitialized and revamped its replacement by [@bluss]

      Please use new new Array::uninit which is based on MaybeUninit (renamed from Array::maybe_uninit, the old name is also deprecated).

      https://github.com/rust-ndarray/ndarray/pull/902 <br> https://github.com/rust-ndarray/ndarray/pull/876

    • Renamed methods (old names are now deprecated) by [@bluss] and [@jturner314]

      • genrows/_mut -> rows/_mut
      • gencolumns/_mut -> columns/_mut
      • stack_new_axis -> stack (the new name already existed)
      • visit -> for_each

      https://github.com/rust-ndarray/ndarray/pull/872 <br> https://github.com/rust-ndarray/ndarray/pull/937 <br> https://github.com/rust-ndarray/ndarray/pull/907 <br>

    • Updated matrixmultiply dependency to 0.3.0 by [@bluss] and adding new feature flag matrixmultiply-threading to enable its threading

      https://github.com/rust-ndarray/ndarray/pull/888 <br> https://github.com/rust-ndarray/ndarray/pull/938 <br>

    • Updated num-complex dependency to 0.4.0 by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/952

    Bug fixes

    • Fix Zip::indexed for the 0-dimensional case by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/862

    • Fix bug in layout computation that broke parallel collect to f-order array in some circumstances by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/900

    • Fix an unwanted panic in shape overflow checking by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/855

    • Mark the SliceInfo::new method as unsafe due to the requirement that indices.as_ref() always return the same value when called multiple times, by [@bluss] and [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/570

    Other changes

    • It was changed how we integrate with BLAS and blas-src. Users of BLAS need to read the README for the updated instructions. Ndarray itself no longer has public dependency on blas-src. Changes by [@bluss].

      https://github.com/rust-ndarray/ndarray/pull/891 <br> https://github.com/rust-ndarray/ndarray/pull/951

    • Various improvements to tests and CI by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/934 <br> https://github.com/rust-ndarray/ndarray/pull/924 <br>

    • The sort-axis.rs example file's implementation of sort was bugfixed and now has tests, by [@dam5h] and [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/916 <br> https://github.com/rust-ndarray/ndarray/pull/930

    • We now link to the #rust-sci room on matrix in the readme by [@jturner314]

      https://github.com/rust-ndarray/ndarray/pull/619

    • Internal cleanup with builder-like methods for creating arrays by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/908

    • Implementation fix of .swap(i, j) by [@bluss]

      https://github.com/rust-ndarray/ndarray/pull/903

    • Minimum supported Rust version (MSRV) is Rust 1.49.

      https://github.com/rust-ndarray/ndarray/pull/902

    • Minor improvements to docs by [@insideoutclub]

      https://github.com/rust-ndarray/ndarray/pull/887

    Open source →
  3. 0.14.0 27 Mar 2021
    Release notes

    New features

    • Zip::apply_collect and Zip::par_apply_collect now support all elements (not just Copy elements) by [@bluss] https://github.com/rust-ndarray/ndarray/pull/814
      https://github.com/rust-ndarray/ndarray/pull/817

    • New function stack by [@andrei-papou]
      https://github.com/rust-ndarray/ndarray/pull/844
      https://github.com/rust-ndarray/ndarray/pull/850

    Enhancements

    • Handle inhomogeneous shape inputs better in Zip, in practice: guess better whether to prefer c- or f-order for the inner loop by [@bluss] https://github.com/rust-ndarray/ndarray/pull/809

    • Improve code sharing in some commonly used code by [@bluss] https://github.com/rust-ndarray/ndarray/pull/819

    API changes

    • The old function stack has been renamed to concatenate. A new function stack with numpy-like semantics have taken its place. Old usages of stack should change to use concatenate.

      concatenate produces an array with the same number of axes as the inputs.
      stack produces an array that has one more axis than the inputs.

      This change was unfortunately done without a deprecation period, due to the long period between releases.

      https://github.com/rust-ndarray/ndarray/pull/844
      https://github.com/rust-ndarray/ndarray/pull/850

    • Enum ErrorKind is now properly non-exhaustive and has lost its old placeholder invalid variant. By [@Zuse64] https://github.com/rust-ndarray/ndarray/pull/848

    • Remove deprecated items:

      • RcArray (deprecated alias for ArcArray)
      • Removed subview_inplace use collapse_axis
      • Removed subview_mut use index_axis_mut
      • Removed into_subview use index_axis_move
      • Removed subview use index_axis
      • Removed slice_inplace use slice_collapse
    • Undeprecated remove_axis because its replacement is hard to find out on your own.

    • Update public external dependencies to new versions by [@Eijebong] and [@bluss]

      • num-complex 0.3
      • approx 0.4 (optional)
      • blas-src 0.6.1 and openblas-src 0.9.0 (optional)

      https://github.com/rust-ndarray/ndarray/pull/810
      https://github.com/rust-ndarray/ndarray/pull/851

    Other changes

    • Minor doc fixes by [@acj] https://github.com/rust-ndarray/ndarray/pull/834

    • Minor doc fixes by [@xd009642] https://github.com/rust-ndarray/ndarray/pull/847

    • The minimum required rust version is Rust 1.42.

    • Release management by [@bluss]

    Open source →
  4. 0.13.0 21 Dec 2020
    Release notes

    New features

    • ndarray-parallel is merged into ndarray. Use the rayon feature-flag to get access to parallel iterators and other parallelized methods. (#563 by [@bluss])
    • Add logspace and geomspace constructors (#617 by [@JP-Ellis])
    • Implement approx traits for ArrayBase. They can be enabled using the approx feature-flag. (#581 by [@jturner314])
    • Add mean method (#580 by [@LukeMathWalker])
    • Add Zip::all to check if all elements satisfy a predicate (#615 by [@mneumann])
    • Add RawArrayView and RawArrayViewMut types and RawData, RawDataMut, and RawDataClone traits (#496 by [@jturner314])
    • Add CowArray, Clone on write array (#632 by [@jturner314] and [@andrei-papou])
    • Add as_standard_layout to ArrayBase: it takes an array by reference and returns a CoWArray in standard layout (#616 by [@jturner314] and [@andrei-papou])
    • Add Array2::from_diag method to create 2D arrays from a diagonal (#673 by [@rth])
    • Add fold method to Zip (#684 by [@jturner314])
    • Add split_at method to AxisChunksIter/Mut (#691 by [@jturner314])
    • Implement parallel iteration for AxisChunksIter/Mut (#639 by [@nitsky])
    • Add into_scalar method to ArrayView0 and ArrayViewMut0 (#700 by [@LukeMathWalker])
    • Add accumulate_axis_inplace method to ArrayBase (#611 by [@jturner314] and [@bluss])
    • Add the array!, azip!, and s! macros to ndarray::prelude (#517 by [@jturner314])

    Enhancements

    • Improve performance for matrix multiplications when using the pure-Rust backend thanks to matrix-multiply:v0.2 (leverage SIMD instructions on x86-64 with runtime feature detection) (#556 by [@bluss])
    • Improve performance of fold for iterators (#574 by [@jturner314])
    • Improve performance of nth_back for iterators (#686 by [@jturner314])
    • Improve performance of iterators for 1-d arrays (#614 by [@andrei-papou])
    • Improve formatting for large arrays (#606 by [@andrei-papou] and [@LukeMathWalker], #633 and #707 by [@jturner314], and #713 by [@bluss])
    • Arithmetic operations between arrays with different element types are now allowed when there is a scalar equivalent (#588 by [@jturner314])
    • .map_axis/_mut won't panic on 0-length axis (#579 by [@andrei-papou])
    • Various documentation improvements (by [@jturner314], [@JP-Ellis], [@LukeMathWalker], [@bluss])

    API changes

    • The into_slice method on ArrayView is deprecated and renamed to to_slice (#646 by [@max-sixty])
    • RcArray is deprecated in favour of ArcArray (#560 by [@bluss])
    • into_slice is renamed to to_slice. into_slice is now deprecated (#646 by [@max-sixty])
    • from_vec is deprecated in favour of using the From to convert a Vec into an Array (#648 by [@max-sixty])
    • mean_axis returns Option<A> instead of A, to avoid panicking when invoked on a 0-length axis (#580 by [@LukeMathWalker])
    • Remove rustc-serialize feature-flag. serde is the recommended feature-flag for serialization (#557 by [@bluss])
    • rows/cols are renamed to nrows/ncols. rows/cols are now deprecated (#701 by [@bluss])
    • The usage of the azip! macro has changed to be more similar to for loops (#626 by [@jturner314])
    • For var_axis and std_axis, the constraints on ddof and the trait bounds on A have been made more strict (#515 by [@jturner314])
    • For mean_axis, the constraints on A have changed (#518 by [@jturner314])
    • DataClone is deprecated in favor of using Data + RawDataClone (#496 by [@jturner314])
    • The Dimension::Pattern associated type now has more trait bounds (#634 by [@termoshtt])
    • Axis::index() now takes self instead of &self (#642 by [@max-sixty])
    • The bounds on the implementation of Hash for Dim have changed (#642 by [@max-sixty])

    Bug fixes

    • Prevent overflow when computing strides in do_slice (#575 by [@jturner314])
    • Fix issue with BLAS matrix-vector multiplication for array with only 1 non-trivial dimension (#585 by [@sebasv])
    • Fix offset computation to avoid UB/panic when slicing in some edge cases (#636 by [@jturner314])
    • Fix issues with axis iterators (#669 by [@jturner314])
    • Fix handling of empty input to s! macro (#714 by [@bluss] and #715 by [@jturner314])

    Other changes

    • Various improvements to ndarray's CI pipeline (clippy, cargo fmt, etc. by [@max-sixty] and [@termoshtt])
    • Bump minimum required Rust version to 1.37.
    Open source →
  5. 0.12.0 29 Nov 2020
    Release notes
    • Add var_axis method for computing variance by @LukeMathWalker.
      • Add map_mut and map_axis_mut methods (mutable variants of map and map_axis) by @LukeMathWalker.
      • Add support for 128-bit integer scalars (i128 and u128).
      • Add support for slicing with inclusive ranges (start..=end and ..=end).
      • Relax constraint on closure from Fn to FnMut for mapv, mapv_into, map_inplace and mapv_inplace.
      • Implement TrustedIterator for IterMut.
      • Bump num-traits and num-complex to version 0.2.
      • Bump blas-src to version 0.2.
      • Bump minimum required Rust version to 1.27.
      • Additional contributors to this release: @ExpHP, @jturner314, @alexbool, @messense, @danmack, @nbro
    Open source →
  6. 0.11.0 23 Sep 2019
    Release notes

    Release announcement

    • Allow combined slicing and subviews in a single operation by @jturner314 and @bluss

      • Add support for individual indices (to indicate subviews) to the s![] macro, and change the return type to &SliceInfo<[SliceOrIndex; n], Do>.
      • Change the argument type of the slicing methods to correspond to the new s![] macro.
      • Replace the Si type with SliceOrIndex.
      • Add a new Slice type that is similar to the old Si type.
    • Add support for more index types (e.g. usize) to the s![] macro by @jturner314

    • Rename .islice() to .slice_inplace() by @jturner314

    • Rename .isubview() to .subview_inplace() by @jturner314

    • Add .slice_move(), .slice_axis(), .slice_axis_mut(), and .slice_axis_inplace() methods by @jturner314

    • Add Dimension::NDIM associated constant by @jturner314

    • Change trait bounds for arithmetic ops between an array (by value) and a reference to an array or array view (“array1 (op) &array2”); before, an ArrayViewMut was supported on the left hand side, now, the left hand side must not be a view. (#380) by @jturner314

    • Remove deprecated methods (.whole_chunks(), .whole_chunks_mut(), .sum(), and .mean(); replaced by .exact_chunks(), .exact_chunks_mut(), .sum_axis(), and .mean_axis(), respectively) by @bluss

    • Updated to the latest blas (optional) dependencies. See instructions in the README.

    • Minimum required Rust version is 1.22.

    Open source →
  7. 0.10.0 10 Sep 2019

    Nothing published for this version

  8. 0.9.0 19 Nov 2018

    Nothing published for this version

  9. 0.8.0 01 Sep 2018

    Nothing published for this version

  10. 0.7.0 29 Dec 2017

    Nothing published for this version

  11. 0.6.1 21 Sep 2017

    Nothing published for this version

  12. 0.6.0 17 Jul 2017

    Nothing published for this version

  13. 0.5.0 09 Apr 2017

    Nothing published for this version

  14. 0.4.0 02 Mar 2017

    Nothing published for this version

  15. 0.3.1 26 Nov 2016

    Nothing published for this version

  16. 0.3.0 21 Nov 2016

    Nothing published for this version

  17. 0.2.0 06 Jun 2016

    Nothing published for this version

  18. 0.1.1 17 Apr 2016

    Nothing published for this version

  19. 0.1.0 29 Mar 2016

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive