fix(deps): update rust crate ndarray to 0.17 #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.16->0.17Release Notes
rust-ndarray/ndarray (ndarray)
v0.17.1Compare 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
RawRefandLayoutRefwill now need a+ ?Sizedbound to work ergonomically withArrayRef.For example, the release notes for 0.17.0 said
However, these functions now need an additional bound to allow for callers to pass in
&ArrayReftypes: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.0Compare 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
ndarray0.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:
&ArrayRef<A, D>to read elements from any array.&mut ArrayRef<A, D>to modify elements.&T where T: AsRef<LayoutRef<A, D>>to inspect shape/stride only.&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:
All of these work, but having several equivalent forms causes confusion.
The most general solution, writing generically over storage types:
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>ArrayRefis theDereftarget ofArrayBase.It behaves like
&[T]forVec<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:
(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:
Use AsRef / AsMut for best compatibility:
(Accepting a
LayoutRefdirectly can cause unnecessary copies; see #1440.)Reading / Writing Unsafe Elements:
RawRef<A, D>RawRefaugmentsRawArrayViewandRawArrayViewMutfor power users needing unsafe element access (e.g. uninitialized buffers).Like
LayoutRef, it is best used viaAsRef/AsMut.Added
diffmethod for calculating the difference between elements by @johann-cm #1437partitionmethod for partially sorting an array by @NewBornRustacean #1498meshgridmethod for building regular grids of values by @akern40 #1477cumprodmethod for cumulative products by @NewBornRustacean #1491exp_m1,ln_1p,asin,acos,atan,sinh,cosh,tanh,asinh,acosh,atanh, andhypotaxis_windows_with_stridemethod for strided windows by @goertzenator #1460permute_axes) and reversing (reverse_axes) axes by @NewBornRustacean #1505into_*_iterfunctions as lifetime-preserving versions of into-iterator functionality by @akern40 #1510Changed
remove_indexcan now be called on views, in addition to owned arrays by @akern40Removed
serde-1,test, anddocsfeature flags; by @akern40 #1479approx,serde,rayoninstead ofdocs.serdeinstead ofserde-1Fixed
last_mut()now guarantees that the underlying data is uniquely held by @bluss #1429ArrayViewis now covariant over lifetime by @akern40 #1480, so that the following code now compilesDocumentation
selectby @Drazharinto_raw_vec_and_offsetby @benliepertArray::zeroswith how to control the return type by @akern40Other
no_stdby @akern40Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.