8000 Change ArrayBase.ptr to NonNull type by berquist · Pull Request #683 · rust-ndarray/ndarray · GitHub
[go: up one dir, main page]

Skip to content

Change ArrayBase.ptr to NonNull type #683

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 8 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master'
Bring in the latest changes and resolve conflicts (impl_views split)
  • Loading branch information
bluss committed Sep 8, 2019
commit 45eeb83d927d87c927704c565d6d76bcbf846e38
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sudo: required
dist: trusty
matrix:
include:
- rust: 1.32.0
- rust: 1.37.0
env:
- FEATURES='test docs'
- RUSTFLAGS='-D warnings'
Expand Down
775 changes: 3 additions & 772 deletions README.rst

Large diffs are not rendered by default.

798 changes: 798 additions & 0 deletions RELEASES.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions benches/iter.rs
8000
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@ fn iter_filter_sum_2d_stride_f32(bench: &mut Bencher) {
bench.iter(|| b.iter().filter(|&&x| x < 75.).sum::<f32>());
}

#[bench]
fn iter_rev_step_by_contiguous(bench: &mut Bencher) {
let a = Array::linspace(0., 1., 512);
bench.iter(|| {
a.iter().rev().step_by(2).for_each(|x| {
black_box(x);
})
});
}

#[bench]
fn iter_rev_step_by_discontiguous(bench: &mut Bencher) {
let mut a = Array::linspace(0., 1., 1024);
a.slice_axis_inplace(Axis(0), Slice::new(0, None, 2));
bench.iter(|| {
a.iter().rev().step_by(2).for_each(|x| {
black_box(x);
})
});
}

const ZIPSZ: usize = 10_000;

#[bench]
Expand Down
8 changes: 8 additions & 0 deletions blas-tests/tests/oper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ fn dot_product() {
assert_eq!(a.dot(&b), dot as i32);
}

#[test]
fn mat_vec_product_1d() {
let a = arr2(&[[1.], [2.]]);
let b = arr1(&[1., 2.]);
let ans = arr1(&[5.]);
assert_eq!(a.t().dot(&b), ans);
}

// test that we can dot product with a broadcast array
#[test]
fn dot_product_0() {
Expand Down
26 changes: 24 additions & 2 deletions src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ where
/// The last view may have less elements if `size` does not divide
/// the axis' dimension.
///
/// **Panics** if `axis` is out of bounds.
/// **Panics** if `axis` is out of bounds or if `size` is zero.
///
/// ```
/// use ndarray::Array;
Expand Down Expand Up @@ -1040,7 +1040,7 @@ where
///
/// Iterator element is `ArrayViewMut<A, D>`
///
/// **Panics** if `axis` is out of bounds.
/// **Panics** if `axis` is out of bounds or if `size` is zero.
pub fn axis_chunks_iter_mut(&mut self, axis: Axis, size: usize) -> AxisChunksIterMut<'_, A, D>
where
S: DataMut,
Expand Down Expand Up @@ -1121,6 +1121,28 @@ where
/// **Panics** if any dimension of `window_size` is zero.<br>
/// (**Panics** if `D` is `IxDyn` and `window_size` does not match the
/// number of array axes.)
///
/// This is an illustration of the 2×2 windows in a 3×4 array:
///
/// ```text
/// ──▶ Axis(1)
///
/// │ ┏━━━━━┳━━━━━┱─────┬─────┐ ┌─────┲━━━━━┳━━━━━┱─────┐ ┌─────┬─────┲━━━━━┳━━━━━┓
/// ▼ ┃ a₀₀ ┃ a₀₁ ┃ │ │ │ ┃ a₀₁ ┃ a₀₂ ┃ │ │ │ ┃ a₀₂ ┃ a₀₃ ┃
/// Axis(0) ┣━━━━━╋━━━━━╉─────┼─────┤ ├─────╊━━━━━╋━━━━━╉─────┤ ├─────┼─────╊━━━━━╋━━━━━┫
/// ┃ a₁₀ ┃ a₁₁ ┃ │ │ │ ┃ a₁₁ ┃ a₁₂ ┃ │ │ │ ┃ a₁₂ ┃ a₁₃ ┃
/// ┡━━━━━╇━━━━━╃─────┼─────┤ ├─────╄━━━━━╇━━━━━╃─────┤ ├─────┼─────╄━━━━━╇━━━━━┩
/// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
/// └─────┴─────┴─────┴─────┘ └─────┴─────┴─────┴─────┘ └─────┴─────┴─────┴─────┘
///
/// ┌─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┐
/// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
/// ┢━━━━━╈━━━━━╅─────┼─────┤ ├─────╆━━━━━╈━━━━━╅─────┤ ├─────┼─────╆━━━━━╈━━━━━┪
/// ┃ a₁₀ ┃ a₁₁ ┃ │ │ │ ┃ a₁₁ ┃ a₁₂ ┃ │ │ │ ┃ a₁₂ ┃ a₁₃ ┃
/// ┣━━━━━╋━━━━━╉─────┼─────┤ ├─────╊━━━━━╋━━━━━╉─────┤ ├─────┼─────╊━━━━━╋━━━━━┫
/// ┃ a₂₀ ┃ a₂₁ ┃ │ │ │ ┃ a₂₁ ┃ a₂₂ ┃ │ │ │ ┃ a₂₂ ┃ a₂₃ ┃
/// ┗━━━━━┻━━━━━┹─────┴─────┘ └─────┺━━━━━┻━━━━━┹─────┘ └─────┴─────┺━━━━━┻━━━━━┛
/// ```
pub fn windows<E>(&self, window_size: E) -> Windows<'_, A, D>
where
E: IntoDimension<Dim = D>,
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0