Skip to content

Commit ef7f36a

Browse files
authored
Merge pull request #805 from rust-ndarray/prepare-0.13.1
Further small changes for the 0.13.1 release
2 parents 2113b7a + 1f6d249 commit ef7f36a

File tree

2 files changed

+22
-32
lines changed

2 files changed

+22
-32
lines changed

RELEASES.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 0.13.1 (2020-04)
1+
Version 0.13.1 (2020-04-21)
22
===========================
33

44
New features
@@ -14,7 +14,10 @@ New features
1414
https://github.com/rust-ndarray/ndarray/pull/728
1515
- `Dimension::Larger` now requires `RemoveAxis` by [@TheLortex]
1616
https://github.com/rust-ndarray/ndarray/pull/792
17-
17+
- New methods for collecting Zip into an array by [@bluss]
18+
https://github.com/rust-ndarray/ndarray/pull/797
19+
- New `Array::maybe_uninit` and `.assume_init()` by [@bluss]
20+
https://github.com/rust-ndarray/ndarray/pull/803
1821

1922
Enhancements
2023
------------
@@ -25,6 +28,8 @@ Enhancements
2528
https://github.com/rust-ndarray/ndarray/pull/754
2629
- Implement `fold` for `IndicesIter` by [@jturner314]
2730
https://github.com/rust-ndarray/ndarray/pull/733
31+
- New Quick Start readme by [@lifuyang]
32+
https://github.com/rust-ndarray/ndarray/pull/785
2833

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

4452

@@ -944,3 +952,4 @@ Earlier releases
944952
[@TheLortex]: https://github.com/TheLortex
945953
[@mockersf]: https://github.com/mockersf
946954
[@viniciusd]: https://github.com/viniciusd
955+
[@lifuyang]: https://github.com/liufuyang

src/impl_constructors.rs

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -474,41 +474,20 @@ where
474474
///
475475
/// ### Safety
476476
///
477-
/// Accessing uninitalized values is undefined behaviour. You must
478-
/// overwrite *all* the elements in the array after it is created; for
479-
/// example using the methods `.fill()` or `.assign()`.
477+
/// Accessing uninitalized values is undefined behaviour. You must overwrite *all* the elements
478+
/// in the array after it is created; for example using
479+
/// [`raw_view_mut`](ArrayBase::raw_view_mut) or other low-level element access.
480480
///
481481
/// The contents of the array is indeterminate before initialization and it
482482
/// is an error to perform operations that use the previous values. For
483483
/// example it would not be legal to use `a += 1.;` on such an array.
484484
///
485485
/// This constructor is limited to elements where `A: Copy` (no destructors)
486-
/// to avoid users shooting themselves too hard in the foot; it is not
487-
/// a problem to drop an array created with this method even before elements
488-
/// are initialized. (Note that constructors `from_shape_vec` and
489-
/// `from_shape_vec_unchecked` allow the user yet more control).
490-
///
491-
/// ### Examples
492-
///
493-
/// ```
494-
/// use ndarray::{s, Array2};
495-
///
496-
/// // Example Task: Let's create a column shifted copy of a in b
497-
///
498-
/// fn shift_by_two(a: &Array2<f32>) -> Array2<f32> {
499-
/// let mut b = unsafe { Array2::uninitialized(a.dim()) };
500-
///
501-
/// // two first columns in b are two last in a
502-
/// // rest of columns in b are the initial columns in a
503-
/// b.slice_mut(s![.., ..2]).assign(&a.slice(s![.., -2..]));
504-
/// b.slice_mut(s![.., 2..]).assign(&a.slice(s![.., ..-2]));
505-
///
506-
/// // `b` is safe to use with all operations at this point
507-
/// b
508-
/// }
509-
///
510-
/// # shift_by_two(&Array2::zeros((8, 8)));
511-
/// ```
486+
/// to avoid users shooting themselves too hard in the foot.
487+
///
488+
/// (Also note that the constructors `from_shape_vec` and
489+
/// `from_shape_vec_unchecked` allow the user yet more control, in the sense
490+
/// that Arrays can be created from arbitrary vectors.)
512491
pub unsafe fn uninitialized<Sh>(shape: Sh) -> Self
513492
where
514493
A: Copy,
@@ -554,7 +533,7 @@ where
554533
/// use ndarray::Zip;
555534
/// use ndarray::Axis;
556535
///
557-
/// // Example Task: Let's create a transposed copy of the input
536+
/// // Example Task: Let's create a column shifted copy of the input
558537
///
559538
/// fn shift_by_two(a: &Array2<f32>) -> Array2<f32> {
560539
/// // create an uninitialized array
@@ -574,6 +553,8 @@ where
574553
///
575554
/// use ndarray::{IntoNdProducer, AssignElem};
576555
///
556+
/// // This function clones elements from the first input to the second;
557+
/// // the two producers must have the same shape
577558
/// fn assign_to<'a, P1, P2, A>(from: P1, to: P2)
578559
/// where P1: IntoNdProducer<Item = &'a A>,
579560
/// P2: IntoNdProducer<Dim = P1::Dim>,

0 commit comments

Comments
 (0)