Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Aug 5, 2024

This PR contains the following updates:

Package Type Update Change
ndarray dependencies minor 0.15 -> 0.17

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

rust-ndarray/ndarray (ndarray)

v0.17.1

Compare Source

===========================
Version 0.17.1 provides a patch to fix the originally-unsound implementation of the new array reference types.

The reference types are now all unsized.
Practically speaking, this has one major implication: writing functions and traits that accept RawRef and LayoutRef will now need a + ?Sized bound to work ergonomically with ArrayRef.
For example, the release notes for 0.17.0 said

Reading / Writing Shape: LayoutRef<A, D>

LayoutRef lets functions view or modify shape/stride information without touching data.
This replaces verbose signatures like:

fn alter_view<S>(a: &mut ArrayBase<S, Ix1>)
where S: Data<Elem = f64>;

Use AsRef / AsMut for best compatibility:

fn alter_shape<T>(a: &mut T)
where T: AsMut<LayoutRef<f64>>;

However, these functions now need an additional bound to allow for callers to pass in &ArrayRef types:

fn alter_shape<T>(a: &mut T)
where T: AsMut<LayoutRef<f64>> + ?Sized; // Added bound here

A huge thank you to Sarah Quiñones (@​sarah-quinones) for catching the original unsound bug and helping to fix it.
She does truly excellent work with faer-rs; check it out!

v0.17.0

Compare Source

===========================
Version 0.17.0 introduces a new array reference type — the preferred way to write functions and extension traits in ndarray.
This release is fully backwards-compatible but represents a major usability improvement.
The first section of this changelog explains the change in detail.

It also includes numerous new methods, math functions, and internal improvements — all credited below.

A New Way to Write Functions

TL;DR

ndarray 0.17.0 adds new reference types for writing functions and traits that work seamlessly with owned arrays and views.

When writing functions that accept array arguments:

  • Use &ArrayRef<A, D> to read elements from any array.
  • Use &mut ArrayRef<A, D> to modify elements.
  • Use &T where T: AsRef<LayoutRef<A, D>> to inspect shape/stride only.
  • Use &mut T where T: AsMut<LayoutRef<A, D>> to modify shape/stride only.

All existing function signatures continue to work; these new types are fully opt-in.

Background

ndarray has multiple ways to write functions that take arrays (a problem captured well in issue #​1059).
For example:

fn sum(a: ArrayView1<f64>) -> f64;
fn sum(a: &ArrayView1<f64>) -> f64;
fn sum(a: &Array1<f64>) -> f64;

All of these work, but having several equivalent forms causes confusion.
The most general solution, writing generically over storage types:

fn sum<S>(a: &ArrayBase<S, Ix1>) -> f64
where S: Data<Elem = f64>;

is powerful but verbose and often hard to read.
Version 0.17.0 introduces a new, simpler pattern that expresses the same flexibility more clearly.

Solution

Three new reference types make it easier to write functions that accept any kind of array while clearly expressing what kind of access (data or layout) they need.

Reading / Writing Elements: ArrayRef<A, D>

ArrayRef is the Deref target of ArrayBase.
It behaves like &[T] for Vec<T>, giving access to elements and layout.
Mutability is expressed through the reference itself (& vs &mut), not through a trait bound or the type itself.
It is used as follows:

fn sum(a: &ArrayRef1<f64>) -> f64;
fn cumsum_mut(a: &mut ArrayRef1<f64>);

(ArrayRef1 is available from the prelude.)

Reading / Writing Shape: LayoutRef<A, D>

LayoutRef lets functions view or modify shape/stride information without touching data.
This replaces verbose signatures like:

fn alter_view<S>(a: &mut ArrayBase<S, Ix1>)
where S: Data<Elem = f64>;

Use AsRef / AsMut for best compatibility:

fn alter_shape<T>(a: &mut T)
where T: AsMut<LayoutRef<f64>>;

(Accepting a LayoutRef directly can cause unnecessary copies; see #​1440.)

Reading / Writing Unsafe Elements: RawRef<A, D>

RawRef augments RawArrayView and RawArrayViewMut for power users needing unsafe element access (e.g. uninitialized buffers).
Like LayoutRef, it is best used via AsRef / AsMut.

Added

Changed

  • remove_index can now be called on views, in addition to owned arrays by @​akern40

Removed

  • Removed the serde-1, test, and docs feature flags; by @​akern40 #​1479
    • Use approx,serde,rayon instead of docs.
    • Use serde instead of serde-1

Fixed

  • last_mut() now guarantees that the underlying data is uniquely held by @​bluss #​1429
  • ArrayView is now covariant over lifetime by @​akern40 #​1480, so that the following code now compiles
fn fn_cov<'a>(x: ArrayView1<'static, f64>) -> ArrayView1<'a, f64> {
    x
}

Documentation

  • Filled missing documentation and adds warn(missing_docs) by @​akern40
  • Fixed a typo in the documentation of select by @​Drazhar
  • Fixed a typo in the documentation of into_raw_vec_and_offset by @​benliepert
  • Documented Array::zeros with how to control the return type by @​akern40

Other

v0.16.1

Compare Source

===========================

v0.16.0

Compare Source

===========================

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


Configuration

📅 Schedule: Branch creation - "after 07:00 before 20:00 every weekday" in timezone Asia/Tokyo, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies label Aug 5, 2024
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 92ae664 to 793f347 Compare August 18, 2024 19:09
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 793f347 to ad46387 Compare August 25, 2024 18:15
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 3d1cc97 to 7988592 Compare September 8, 2024 18:23
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 7988592 to 00cdbad Compare September 15, 2024 19:54
@renovate
Copy link
Contributor Author

renovate bot commented Sep 22, 2024

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: Cargo.lock
Command failed: cargo update --config net.git-fetch-with-cli=true --manifest-path Cargo.toml --package ndarray@0.15.6 --precise 0.17.1
    Updating crates.io index
error: failed to select a version for the requirement `ndarray = ">=0.13, <0.16"`
candidate versions found which didn't match: 0.17.1
location searched: crates.io index
required by package `numpy v0.21.0`
    ... which satisfies dependency `numpy = "^0.21"` of package `mjai v0.2.1 (/tmp/renovate/repos/github/smly/mjai.app)`

@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 00cdbad to 9ca424b Compare September 22, 2024 18:52
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 7d1bf88 to 9a1f849 Compare October 6, 2024 18:59
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from d8d4ec3 to dd19f93 Compare October 20, 2024 18:09
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from bc15d4f to 282090a Compare October 27, 2024 18:36
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 8d92616 to 50c5279 Compare November 10, 2024 18:59
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from c868a2c to 566149c Compare November 24, 2024 18:32
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 566149c to 2fd738f Compare December 1, 2024 18:55
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 24dcb02 to 736de6d Compare December 15, 2024 18:51
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 360155b to 4f8b4bf Compare December 22, 2024 20:19
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 4f8b4bf to 8819784 Compare December 29, 2024 19:40
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 8819784 to df7e9d4 Compare January 5, 2025 19:56
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch 2 times, most recently from 8600268 to 7af85e5 Compare January 19, 2025 20:27
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 7af85e5 to d09c42a Compare January 26, 2025 21:02
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from d09c42a to 31cceed Compare February 22, 2025 10:38
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 31cceed to 8d06c4b Compare February 23, 2025 17:09
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 8d06c4b to f657162 Compare October 15, 2025 02:42
@renovate renovate bot changed the title fix(deps): update rust crate ndarray to 0.16 fix(deps): update rust crate ndarray to 0.17 Oct 15, 2025
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from f657162 to 0980bc9 Compare October 16, 2025 05:11
@renovate renovate bot changed the title fix(deps): update rust crate ndarray to 0.17 fix(deps): update rust crate ndarray to 0.16 Oct 16, 2025
@renovate renovate bot force-pushed the renovate/ndarray-0.x branch from 0980bc9 to 3386135 Compare November 3, 2025 01:58
@renovate renovate bot changed the title fix(deps): update rust crate ndarray to 0.16 fix(deps): update rust crate ndarray to 0.17 Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant