Skip to content

Further small changes for the 0.13.1 release #805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 0.13.1 (2020-04)
Version 0.13.1 (2020-04-21)
===========================

New features
Expand All @@ -14,7 +14,10 @@ New features
https://github.com/rust-ndarray/ndarray/pull/728
- `Dimension::Larger` now requires `RemoveAxis` by [@TheLortex]
https://github.com/rust-ndarray/ndarray/pull/792

- New methods for collecting Zip into an array by [@bluss]
https://github.com/rust-ndarray/ndarray/pull/797
- New `Array::maybe_uninit` and `.assume_init()` by [@bluss]
https://github.com/rust-ndarray/ndarray/pull/803

Enhancements
------------
Expand All @@ -25,6 +28,8 @@ Enhancements
https://github.com/rust-ndarray/ndarray/pull/754
- Implement `fold` for `IndicesIter` by [@jturner314]
https://github.com/rust-ndarray/ndarray/pull/733
- New Quick Start readme by [@lifuyang]
https://github.com/rust-ndarray/ndarray/pull/785

API changes
-----------
Expand All @@ -39,6 +44,9 @@ Other changes
- Improve blas version documentation by [@jturner314]
- Doc improvements by [@mockersf] https://github.com/rust-ndarray/ndarray/pull/751
- Doc and lint related improvements by [@viniciusd] https://github.com/rust-ndarray/ndarray/pull/750
- Minor fixes related to best practices for unsafe code by [@bluss]
https://github.com/rust-ndarray/ndarray/pull/799
https://github.com/rust-ndarray/ndarray/pull/802
- Release management by [@bluss]


Expand Down Expand Up @@ -944,3 +952,4 @@ Earlier releases
[@TheLortex]: https://github.com/TheLortex
[@mockersf]: https://github.com/mockersf
[@viniciusd]: https://github.com/viniciusd
[@lifuyang]: https://github.com/liufuyang
41 changes: 11 additions & 30 deletions src/impl_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,41 +474,20 @@ where
///
/// ### Safety
///
/// Accessing uninitalized values is undefined behaviour. You must
/// overwrite *all* the elements in the array after it is created; for
/// example using the methods `.fill()` or `.assign()`.
/// Accessing uninitalized 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.
///
/// The contents of the array is indeterminate before initialization and it
/// is an error to perform operations that use the previous values. For
/// example it would not be legal to use `a += 1.;` on such an array.
///
/// This constructor is limited to elements where `A: Copy` (no destructors)
/// to avoid users shooting themselves too hard in the foot; it is not
/// a problem to drop an array created with this method even before elements
/// are initialized. (Note that constructors `from_shape_vec` and
/// `from_shape_vec_unchecked` allow the user yet more control).
///
/// ### Examples
///
/// ```
/// use ndarray::{s, Array2};
///
/// // Example Task: Let's create a column shifted copy of a in b
///
/// fn shift_by_two(a: &Array2<f32>) -> Array2<f32> {
/// let mut b = unsafe { Array2::uninitialized(a.dim()) };
///
/// // two first columns in b are two last in a
/// // rest of columns in b are the initial columns in a
/// b.slice_mut(s![.., ..2]).assign(&a.slice(s![.., -2..]));
/// b.slice_mut(s![.., 2..]).assign(&a.slice(s![.., ..-2]));
///
/// // `b` is safe to use with all operations at this point
/// b
/// }
///
/// # shift_by_two(&Array2::zeros((8, 8)));
/// ```
/// to avoid users shooting themselves too hard in the foot.
///
/// (Also note that the constructors `from_shape_vec` and
/// `from_shape_vec_unchecked` allow the user yet more control, in the sense
/// that Arrays can be created from arbitrary vectors.)
pub unsafe fn uninitialized<Sh>(shape: Sh) -> Self
where
A: Copy,
Expand Down Expand Up @@ -554,7 +533,7 @@ where
/// use ndarray::Zip;
/// use ndarray::Axis;
///
/// // Example Task: Let's create a transposed copy of the input
/// // Example Task: Let's create a column shifted copy of the input
///
/// fn shift_by_two(a: &Array2<f32>) -> Array2<f32> {
/// // create an uninitialized array
Expand All @@ -574,6 +553,8 @@ where
///
/// use ndarray::{IntoNdProducer, AssignElem};
///
/// // This function clones elements from the first input to the second;
/// // the two producers must have the same shape
/// fn assign_to<'a, P1, P2, A>(from: P1, to: P2)
/// where P1: IntoNdProducer<Item = &'a A>,
/// P2: IntoNdProducer<Dim = P1::Dim>,
Expand Down