From 2c8c5781ae40697318e7660d94473ccc730da8fb Mon Sep 17 00:00:00 2001 From: Frank Steffahn Date: Mon, 20 Dec 2021 02:17:59 +0100 Subject: [PATCH 1/4] Fix some typos (#1134) --- RELEASES.md | 6 +++--- examples/axis_ops.rs | 2 +- src/arraytraits.rs | 4 ++-- src/impl_1d.rs | 2 +- src/impl_2d.rs | 4 ++-- src/impl_constructors.rs | 10 +++++----- src/lib.rs | 2 +- src/linalg/impl_linalg.rs | 2 +- src/parallel/impl_par_methods.rs | 4 ++-- src/zip/mod.rs | 2 +- src/zip/ndproducer.rs | 2 +- tests/iterators.rs | 4 ++-- tests/windows.rs | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 99ec442ef..a4bd7e53a 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -366,7 +366,7 @@ API changes ----------- - New constructors `Array::from_iter` and `Array::from_vec` by [@bluss]. - No new functionality, just that these constructors are avaiable without trait + No new functionality, just that these constructors are available without trait imports. https://github.com/rust-ndarray/ndarray/pull/921 @@ -545,7 +545,7 @@ New features Enhancements ------------ -- Handle inhomogenous shape inputs better in Zip, in practice: guess better whether +- 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 @@ -978,7 +978,7 @@ Earlier releases - Add `Zip::indexed` - New methods `genrows/_mut, gencolumns/_mut, lanes/_mut` that - return iterable producers (producer means `Zip` compatibile). + return iterable producers (producer means `Zip` compatible). - New method `.windows()` by @Robbepop, returns an iterable producer - New function `general_mat_vec_mul` (with fast default and blas acceleration) - `Zip::apply` and `fold_while` now take `self` as the first argument diff --git a/examples/axis_ops.rs b/examples/axis_ops.rs index 98d2d3d7f..0b2c3dec8 100644 --- a/examples/axis_ops.rs +++ b/examples/axis_ops.rs @@ -11,7 +11,7 @@ use ndarray::prelude::*; /// make sure axes are in positive stride direction, and merge adjacent /// axes if possible. /// -/// This changes the logical order of the elments in the +/// This changes the logical order of the elements in the /// array, so that if we read them in row-major order after regularization, /// it corresponds to their order in memory. /// diff --git a/src/arraytraits.rs b/src/arraytraits.rs index a7f22c1f7..31d27b003 100644 --- a/src/arraytraits.rs +++ b/src/arraytraits.rs @@ -303,7 +303,7 @@ where pub const ARRAY_FORMAT_VERSION: u8 = 1u8; // use "raw" form instead of type aliases here so that they show up in docs -/// Implementation of `ArrayView::from(&S)` where `S` is a slice or slicable. +/// Implementation of `ArrayView::from(&S)` where `S` is a slice or sliceable. impl<'a, A, Slice: ?Sized> From<&'a Slice> for ArrayView<'a, A, Ix1> where Slice: AsRef<[A]>, @@ -335,7 +335,7 @@ where } } -/// Implementation of `ArrayViewMut::from(&mut S)` where `S` is a slice or slicable. +/// Implementation of `ArrayViewMut::from(&mut S)` where `S` is a slice or sliceable. impl<'a, A, Slice: ?Sized> From<&'a mut Slice> for ArrayViewMut<'a, A, Ix1> where Slice: AsMut<[A]>, diff --git a/src/impl_1d.rs b/src/impl_1d.rs index 74eaaad21..17f7729d6 100644 --- a/src/impl_1d.rs +++ b/src/impl_1d.rs @@ -42,7 +42,7 @@ where let mut dst = if let Some(dst) = lane_iter.next() { dst } else { return }; // Logically we do a circular swap here, all elements in a chain - // Using MaybeUninit to avoid unecessary writes in the safe swap solution + // Using MaybeUninit to avoid unnecessary writes in the safe swap solution // // for elt in lane_iter { // std::mem::swap(dst, elt); diff --git a/src/impl_2d.rs b/src/impl_2d.rs index 9af833103..6ef15c501 100644 --- a/src/impl_2d.rs +++ b/src/impl_2d.rs @@ -125,13 +125,13 @@ where /// Return true if the array is square, false otherwise. /// /// # Examples - /// Sqaure: + /// Square: /// ``` /// use ndarray::array; /// let array = array![[1., 2.], [3., 4.]]; /// assert!(array.is_square()); /// ``` - /// Not sqaure: + /// Not square: /// ``` /// use ndarray::array; /// let array = array![[1., 2., 5.], [3., 4., 6.]]; diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index df5e295c6..4a18ff832 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -540,7 +540,7 @@ where } - /// Create an array with uninitalized elements, shape `shape`. + /// Create an array with uninitialized elements, shape `shape`. /// /// The uninitialized elements of type `A` are represented by the type `MaybeUninit`, /// an easier way to handle uninit values correctly. @@ -598,7 +598,7 @@ where } } - /// Create an array with uninitalized elements, shape `shape`. + /// Create an array with uninitialized elements, shape `shape`. /// /// The uninitialized elements of type `A` are represented by the type `MaybeUninit`, /// an easier way to handle uninit values correctly. @@ -634,7 +634,7 @@ where #[deprecated(note = "This method is hard to use correctly. Use `uninit` instead.", since = "0.15.0")] - /// Create an array with uninitalized elements, shape `shape`. + /// Create an array with uninitialized elements, shape `shape`. /// /// Prefer to use [`uninit()`](ArrayBase::uninit) if possible, because it is /// easier to use correctly. @@ -643,7 +643,7 @@ where /// /// ### Safety /// - /// Accessing uninitalized values is undefined behaviour. You must overwrite *all* the elements + /// Accessing uninitialized values is undefined behaviour. You must overwrite *all* the elements /// in the array after it is created; for example using /// [`raw_view_mut`](ArrayBase::raw_view_mut) or other low-level element access. /// @@ -676,7 +676,7 @@ where S: DataOwned>, D: Dimension, { - /// Create an array with uninitalized elements, shape `shape`. + /// Create an array with uninitialized elements, shape `shape`. /// /// This method has been renamed to `uninit` #[deprecated(note = "Renamed to `uninit`", since = "0.15.0")] diff --git a/src/lib.rs b/src/lib.rs index a8ee9ee6d..915714fa4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -710,7 +710,7 @@ pub type Ixs = isize; /// The trait [`ScalarOperand`] marks types that can be used in arithmetic /// with arrays directly. For a scalar `K` the following combinations of operands /// are supported (scalar can be on either the left or right side, but -/// `ScalarOperand` docs has the detailed condtions). +/// `ScalarOperand` docs has the detailed conditions). /// /// - `&A @ K` or `K @ &A` which produces a new `Array` /// - `B @ K` or `K @ B` which consumes `B`, updates it with the result and returns it diff --git a/src/linalg/impl_linalg.rs b/src/linalg/impl_linalg.rs index d953dfdb4..52a15f44e 100644 --- a/src/linalg/impl_linalg.rs +++ b/src/linalg/impl_linalg.rs @@ -677,7 +677,7 @@ pub fn general_mat_vec_mul( /// General matrix-vector multiplication /// -/// Use a raw view for the destination vector, so that it can be uninitalized. +/// Use a raw view for the destination vector, so that it can be uninitialized. /// /// ## Safety /// diff --git a/src/parallel/impl_par_methods.rs b/src/parallel/impl_par_methods.rs index 381b86b52..ed0dcad7a 100644 --- a/src/parallel/impl_par_methods.rs +++ b/src/parallel/impl_par_methods.rs @@ -94,7 +94,7 @@ macro_rules! zip_impl { -> Array where R: Send { - let mut output = self.uninitalized_for_current_layout::(); + let mut output = self.uninitialized_for_current_layout::(); let total_len = output.len(); // Create a parallel iterator that produces chunks of the zip with the output @@ -191,7 +191,7 @@ macro_rules! zip_impl { /// Note that it is often more efficient to parallelize not per-element but rather /// based on larger chunks of an array like generalized rows and operating on each chunk /// using a sequential variant of the accumulation. - /// For example, sum each row sequentially and in parallel, taking advatange of locality + /// For example, sum each row sequentially and in parallel, taking advantage of locality /// and vectorization within each task, and then reduce their sums to the sum of the matrix. /// /// Also note that the splitting of the producer into multiple tasks is _not_ deterministic diff --git a/src/zip/mod.rs b/src/zip/mod.rs index a24adc2c1..a6cd0c1fe 100644 --- a/src/zip/mod.rs +++ b/src/zip/mod.rs @@ -426,7 +426,7 @@ where } #[cfg(feature = "rayon")] - pub(crate) fn uninitalized_for_current_layout(&self) -> Array, D> + pub(crate) fn uninitialized_for_current_layout(&self) -> Array, D> { let is_f = self.prefer_f(); Array::uninit(self.dimension.clone().set_f(is_f)) diff --git a/src/zip/ndproducer.rs b/src/zip/ndproducer.rs index 619fadcc3..0ec49f3ac 100644 --- a/src/zip/ndproducer.rs +++ b/src/zip/ndproducer.rs @@ -44,7 +44,7 @@ where /// Most `NdProducers` are *iterable* (implement `IntoIterator`) but not directly /// iterators. This separation is needed because the producer represents /// a multidimensional set of items, it can be split along a particular axis for -/// parallelization, and it has no fixed correspondance to a sequence. +/// parallelization, and it has no fixed correspondence to a sequence. /// /// The natural exception is one dimensional producers, like `AxisIter`, which /// implement `Iterator` directly diff --git a/tests/iterators.rs b/tests/iterators.rs index fb78c0ccc..d7f7c5823 100644 --- a/tests/iterators.rs +++ b/tests/iterators.rs @@ -532,8 +532,8 @@ fn axis_iter_mut_zip_partially_consumed_discontiguous() { fn axis_chunks_iter_corner_cases() { // examples provided by @bluss in PR #65 // these tests highlight corner cases of the axis_chunks_iter implementation - // and enable checking if no pointer offseting is out of bounds. However - // checking the absence of of out of bounds offseting cannot (?) be + // and enable checking if no pointer offsetting is out of bounds. However + // checking the absence of of out of bounds offsetting cannot (?) be // done automatically, so one has to launch this test in a debugger. let a = ArcArray::::linspace(0., 7., 8).reshape((8, 1)); let it = a.axis_chunks_iter(Axis(0), 4); diff --git a/tests/windows.rs b/tests/windows.rs index 664616f67..432be5e41 100644 --- a/tests/windows.rs +++ b/tests/windows.rs @@ -116,7 +116,7 @@ fn test_window_zip() { } } -/// Test verifies that non existant Axis results in panic +/// Test verifies that non existent Axis results in panic #[test] #[should_panic] fn axis_windows_outofbound() { From baf1846e6a0e6c959037bf11d41388164cfd04d1 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Wed, 2 Mar 2022 10:47:01 +0900 Subject: [PATCH 2/4] Allow macro ndarray::s! in no_std. (#1154) --- src/slice.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/slice.rs b/src/slice.rs index dd0d162e2..0146d6dba 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -842,14 +842,14 @@ macro_rules! s( } }; // empty call, i.e. `s![]` - (@parse ::std::marker::PhantomData::<$crate::Ix0>, ::std::marker::PhantomData::<$crate::Ix0>, []) => { + (@parse ::core::marker::PhantomData::<$crate::Ix0>, ::core::marker::PhantomData::<$crate::Ix0>, []) => { { #[allow(unsafe_code)] unsafe { $crate::SliceInfo::new_unchecked( [], - ::std::marker::PhantomData::<$crate::Ix0>, - ::std::marker::PhantomData::<$crate::Ix0>, + ::core::marker::PhantomData::<$crate::Ix0>, + ::core::marker::PhantomData::<$crate::Ix0>, ) } } @@ -858,18 +858,18 @@ macro_rules! s( (@parse $($t:tt)*) => { compile_error!("Invalid syntax in s![] call.") }; // convert range/index/new-axis into SliceInfoElem (@convert $r:expr) => { - <$crate::SliceInfoElem as ::std::convert::From<_>>::from($r) + <$crate::SliceInfoElem as ::core::convert::From<_>>::from($r) }; // convert range/index/new-axis and step into SliceInfoElem (@convert $r:expr, $s:expr) => { - <$crate::SliceInfoElem as ::std::convert::From<_>>::from( - <$crate::Slice as ::std::convert::From<_>>::from($r).step_by($s as isize) + <$crate::SliceInfoElem as ::core::convert::From<_>>::from( + <$crate::Slice as ::core::convert::From<_>>::from($r).step_by($s as isize) ) }; ($($t:tt)*) => { $crate::s![@parse - ::std::marker::PhantomData::<$crate::Ix0>, - ::std::marker::PhantomData::<$crate::Ix0>, + ::core::marker::PhantomData::<$crate::Ix0>, + ::core::marker::PhantomData::<$crate::Ix0>, [] $($t)* ] From e1ef4828222697cf9e576609d980bab254824eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hendrik=20Schr=C3=B6ter?= <16517898+Rikorose@users.noreply.github.com> Date: Wed, 18 May 2022 02:26:15 +0200 Subject: [PATCH 3/4] Add link to Slicing docs on libary documentation page (#1164) --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 915714fa4..07e5ed680 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,8 +40,8 @@ //! ## Highlights //! //! - Generic *n*-dimensional array -//! - Slicing, also with arbitrary step size, and negative indices to mean -//! elements from the end of the axis. +//! - [Slicing](ArrayBase#slicing), also with arbitrary step size, and negative +//! indices to mean elements from the end of the axis. //! - Views and subviews of arrays; iterators that yield subviews. //! - Higher order operations and arithmetic are performant //! - Array views can be used to slice and mutate any `[T]` data using From 7dc7891d6405f8bd32cba406df6e0084e2857dd7 Mon Sep 17 00:00:00 2001 From: Jim Turner Date: Sat, 30 Jul 2022 13:02:12 -0400 Subject: [PATCH 4/4] Release version 0.15.5 --- Cargo.toml | 2 +- RELEASES.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a9885f4a8..926ea064c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ndarray" -version = "0.15.4" +version = "0.15.5" edition = "2018" authors = [ "Ulrik Sverdrup \"bluss\"", diff --git a/RELEASES.md b/RELEASES.md index a4bd7e53a..209f4282e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,22 @@ +Version 0.15.5 (2022-07-30) +=========================== + +Enhancements +------------ + +- The `s!` macro now works in `no_std` environments, by [@makotokato]. + + https://github.com/rust-ndarray/ndarray/pull/1154 + +Other changes +------------- + +- Improve docs and fix typos, by [@steffahn] and [@Rikorose]. + + https://github.com/rust-ndarray/ndarray/pull/1134 + https://github.com/rust-ndarray/ndarray/pull/1164 + + Version 0.15.4 (2021-11-23) =========================== @@ -1562,14 +1581,17 @@ Earlier releases [@LeSeulArtichaut]: https://github.com/LeSeulArtichaut [@lifuyang]: https://github.com/liufuyang [@kdubovikov]: https://github.com/kdubovikov +[@makotokato]: https://github.com/makotokato [@max-sixty]: https://github.com/max-sixty [@mneumann]: https://github.com/mneumann [@mockersf]: https://github.com/mockersf [@nilgoyette]: https://github.com/nilgoyette [@nitsky]: https://github.com/nitsky +[@Rikorose]: https://github.com/Rikorose [@rth]: https://github.com/rth [@sebasv]: https://github.com/sebasv [@SparrowLii]: https://github.com/SparrowLii +[@steffahn]: https://github.com/steffahn [@stokhos]: https://github.com/stokhos [@termoshtt]: https://github.com/termoshtt [@TheLortex]: https://github.com/TheLortex