Skip to content
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

[pull] master from rust-ndarray:master #1

Open
wants to merge 822 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
822 commits
Select commit Hold shift + click to select a range
c66d408
Merge pull request #1171 from aganders3/fix-ci
jturner314 Jul 30, 2022
739316e
Add MSRV to Cargo.toml (#1191)
jturner314 Jul 30, 2022
ff74996
fix(ci): lint with clippy
aganders3 Jun 16, 2022
cd6fc28
fix(clippy): remove unused lifetimes from trait impls
aganders3 Jun 16, 2022
45a1ded
fix(doctest): allow warning of unused #[macro_use] in itertools doctest
aganders3 Jun 16, 2022
a6c8bd2
fix(clippy): remove unnecessary derefs
jturner314 Jul 30, 2022
1d0212c
fix(clippy): remove unnecessary keyword in format
jturner314 Jul 30, 2022
dedb15f
Merge pull request #1190 from jturner314/cherry-pick-1171
jturner314 Jul 30, 2022
2f0b37b
Make ArrayBase::get_ptr(_mut) public to enable indexing into raw views.
adamreichold Jan 22, 2022
eb50663
Rename get_ptr_mut to get_mut_ptr to be more consistent with the as_m…
adamreichold Jan 23, 2022
853384a
Merge pull request #1151 from adamreichold/pub-get-ptr
jturner314 Jul 30, 2022
e080d62
Release version 0.15.6
jturner314 Jul 30, 2022
f8522cf
Merge branch '0.15.x'
jturner314 Jul 30, 2022
6b5e829
Update README.rst (#1199)
podusowski Aug 23, 2022
01f7182
Add NumPy examples combining slicing and assignment
jturner314 Sep 24, 2022
0740695
Improve example in doc for columns method (#1221)
gkobeaga Oct 12, 2022
a26a17e
Update README-quick-start.md
fumseckk Dec 17, 2022
2c0ae32
added stride support to windows
LazaroHurtado Dec 29, 2022
4cadbfd
fix(ci): Allow use of deprecated zip function from itertools.
adamreichold May 23, 2023
eea3bdd
fix(ci): Avoid the unmaintained action-rs actions.
adamreichold May 23, 2023
73545b7
fix(clippy): Make current version of Clippy happy.
adamreichold May 23, 2023
1688509
fix(ci): Pin dependencies to MSRV-compatible versions.
adamreichold May 23, 2023
b9c4f10
fix(ci): Integrate numeric tests into workspace to avoid confusing cr…
adamreichold May 24, 2023
4a868fb
Merge pull request #1286 from rust-ndarray/shipshape
adamreichold May 24, 2023
bad802d
Merge pull request #1210 from jturner314/numpy-example-fill-assign
May 27, 2023
d98cfb3
Add both approx features
nilgoyette Jun 2, 2023
9dc4247
Merge pull request #1289 from nilgoyette/readme_features
Jun 2, 2023
61d55cd
updated Window::new to use new_with_stride with unit stride
LazaroHurtado Jun 8, 2023
0449bae
formatted test file
LazaroHurtado Jun 9, 2023
a7680ad
Added select to numpy user docs
WillAyd Jun 9, 2023
7342ca8
Merge pull request #1294 from WillAyd/update-docs
Jun 9, 2023
c357f0d
updated windows method doc description to reference windows_with_stride
LazaroHurtado Jun 10, 2023
1b00771
refactored unit stride logic
LazaroHurtado Jun 10, 2023
c5bb8b6
Merge pull request #1249 from LazaroHurtado/windows_stride_feature
Jun 11, 2023
17a8d25
Merge pull request #1246 from Ph03nixStyle/master
Jun 15, 2023
5bcc73e
updated Windows base computations to be safer
LazaroHurtado Jun 17, 2023
9447328
Merge pull request #1297 from LazaroHurtado/fix/window_stride
Jun 18, 2023
8ec4d91
Fix comparison with NumPy of slicing with negative step
venkat0791 Aug 5, 2023
e21665f
Merge pull request #1319 from venkat0791/slicing_versus_numpy
Aug 6, 2023
40bb0b2
Make Clippy happy and fix MSRV build
adamreichold Aug 7, 2023
7330141
Fix new rustc lints to make the CI pass.
adamreichold Dec 2, 2023
8e72e33
Use PowerPC instead of MIPS for big endian cross tests as it is still…
adamreichold Dec 2, 2023
d3334a5
Update forcing dependency versions to fix MSRV build.
adamreichold Dec 2, 2023
2a5553f
Add common used functions.
KmolYuan Jul 13, 2021
ccb1f76
Chain the mapping.
KmolYuan Jul 13, 2021
bd69672
Change macro names.
KmolYuan Jul 23, 2021
1de7898
Simplify macros.
KmolYuan Aug 5, 2021
82af40d
Apply partial suggestions.
KmolYuan Oct 3, 2021
a796dc5
Apply most of the suggestions.
KmolYuan Dec 8, 2021
a982f0b
Revert cargo fmt.
KmolYuan Dec 8, 2021
fa57078
Improve clamp implementation
KmolYuan Nov 26, 2023
174ca76
Update README-quick-start.md
joelchen Dec 22, 2023
23d7cab
Fix MSRV build by pinning crossbeam crates.
adamreichold Dec 22, 2023
4374a9c
Use `clone_from()` in two places
ChayimFriedman2 Jan 7, 2024
05e854c
fix and improve doc-comments
johann-cm Jan 15, 2024
5b931a9
improve doc-comments
johann-cm Jan 15, 2024
81fae81
export Linspace and Logspace iterators
johann-cm Jan 15, 2024
8d91bc2
fix no-std build
johann-cm Jan 17, 2024
b53f418
fix(docs): minimum rust version mismatch in lib.rs
HoKim98 Jan 28, 2024
5981cce
ndarray_from_numpy example to code not pointed out to clippy
higumachan Feb 16, 2024
30bdfee
Fix nightly lints
bluss Feb 26, 2024
97ecc0d
dimension: Fix contig check for single element arrays
bluss Feb 26, 2024
9a16e3e
ci: Only run cross tests on master
bluss Mar 9, 2024
436b4c1
ci: Use checkout@v4
bluss Mar 9, 2024
8e55872
ci: Use merge queue
bluss Mar 9, 2024
77dd957
Merge pull request #1367 from rust-ndarray/ci
bluss Mar 9, 2024
fe3eb5a
ci: Setup so that most checks run in merge queue only
bluss Mar 9, 2024
909ec76
ci: Adopt conclusion job that summarizes ci status
bluss Mar 9, 2024
54b3ffb
Merge pull request #1368 from rust-ndarray/ci
bluss Mar 9, 2024
899db5c
iterators: Re-export IntoIter
bluss Mar 9, 2024
08bb5a9
ci: Cross tests - run numeric as release, use s390x
bluss Mar 9, 2024
8e41436
ci: Run regular tests in pr check
bluss Mar 9, 2024
fa195d8
Fix unsafe blocks in s![] macro
jturner314 Aug 13, 2022
58d60ee
Merge pull request #1369 from rust-ndarray/ci
bluss Mar 9, 2024
f124a16
Merge pull request #1196 from jturner314/fix-s-unsafe
bluss Mar 9, 2024
96a30b4
Merge pull request #1370 from rust-ndarray/into-iter
bluss Mar 9, 2024
31009f3
ci: Test using cargo-careful
bluss Mar 9, 2024
a70bf19
Fix Miri failure with -Zmiri-tag-raw-pointers
jturner314 Dec 20, 2021
6df86a3
Fix Miri errors for WindowsIter and ExactChunksIter/Mut
jturner314 Dec 24, 2021
0598508
Merge pull request #1371 from rust-ndarray/cargo-careful
bluss Mar 9, 2024
3a01497
Merge pull request #1138 from jturner314/fix-map_axis-miri
bluss Mar 9, 2024
f0f4849
Merge pull request #1142 from jturner314/fix-miri-iterators
bluss Mar 9, 2024
39f0bfa
derived Debug for Iter and IterMut
biskwikman Jan 29, 2024
2205612
removed commented code
biskwikman Jan 30, 2024
3ed2022
Merge pull request #1353 from biskwikman/iter-debug
bluss Mar 10, 2024
7b1df49
Add tests for overflow converting slices to views
jturner314 Dec 7, 2021
a68435d
Add missing checks when converting slices to views
jturner314 Dec 7, 2021
eb12613
Merge pull request #1131 from jturner314/fix-convert-to-view-check
bluss Mar 10, 2024
6034da4
Make Ix* functions const fn
jturner314 Dec 7, 2021
ea429b4
Make Dim::new and *ViewRepr::new const fns
jturner314 Dec 7, 2021
fa9fb4a
shape: Deprecate .reshape()
bluss Jan 15, 2021
0504347
shape: Remove usages of deprecated .reshape()
bluss May 4, 2021
7d61342
shape: Add .into_shape_clone()
bluss May 6, 2021
3f02ac2
shape: Convert format tests to use into_shape_clone
bluss May 6, 2021
8501d7b
shape: Deprecate into_shape, add into_shape_with_order
bluss Jul 25, 2023
e16dc45
shape: Use into_shape_with_order, not into_shape
bluss Aug 3, 2023
49f5870
shape: Replace reshape with into_shape_with_order in tests
bluss Mar 9, 2024
a5a4b98
shape: More explicit examples for to_shape and into_shape
bluss Mar 9, 2024
ee7f435
shape: Add test for into_shape_clone
bluss Mar 9, 2024
1fbe2e6
Update MSRV to 1.57
jturner314 Dec 7, 2021
0e461f0
Make aview* free functions be const fns
jturner314 Dec 7, 2021
cab158f
Remove redundant code
jturner314 Dec 7, 2021
d32248d
Apply examples changes from code review
bluss Mar 10, 2024
cd0a956
Merge pull request #1132 from jturner314/const-constructors
bluss Mar 10, 2024
ba8f45c
Merge pull request #1310 from rust-ndarray/better-into-shape
bluss Mar 10, 2024
d517bef
Add Zip::any
nilgoyette Nov 8, 2022
3492a9c
Merge pull request #1228 from nilgoyette/zip_any
bluss Mar 10, 2024
2033b76
implement `DoubleEndedIterator` for 1d lanes
Muthsera Nov 29, 2022
a90146a
Add docs to CI
jturner314 Feb 18, 2021
1e0102d
Merge pull request #1237 from Muthsera/rev
bluss Mar 10, 2024
20844f1
Add slice_axis_move method
jturner314 Sep 24, 2022
8d5eac1
Merge pull request #925 from jturner314/docs-in-ci
bluss Mar 10, 2024
c4db8e7
Merge pull request #1211 from jturner314/slice-axis-move
bluss Mar 10, 2024
2cb374a
Track-caller all the panics
xd009642 Apr 7, 2021
5465bc4
Merge pull request #975 from xd009642/feature/track-callers
bluss Mar 10, 2024
f700e19
rustfmt: Add rustfmt.toml
bluss Mar 12, 2024
f642c56
rustfmt: Add rustfmt check to CI
jturner314 Feb 18, 2021
c57115f
rustfmt: Add rustfmt::skip to macro with a problem
bluss Mar 12, 2024
d07f5f3
rustfmt: Apply new formatting to whole repo
bluss Mar 12, 2024
b417e93
Merge pull request #1375 from rust-ndarray/rustfmt2
bluss Mar 13, 2024
4690923
Add rustfmt commit to ignored revisions for git blame
lucascolley Mar 13, 2024
646de85
Add additional array -> array view conversions
bluss Dec 6, 2021
d37c0c8
Merge pull request #1130 from rust-ndarray/array-view-from
bluss Mar 14, 2024
330e915
tests: Use mold linker to speed up ci
bluss Mar 31, 2024
77332b1
Merge pull request #1378 from rust-ndarray/use-mold
bluss Mar 31, 2024
6d04ebd
Update into_raw_vec
jturner314 Apr 1, 2024
edfbe81
Add .into_raw_vec_with_offset() and deprecate .into_raw_vec()
bluss Apr 1, 2024
510d65b
Merge pull request #1379 from rust-ndarray/offset-to-first-2
bluss Apr 4, 2024
83dba02
Bumped approx's version number.
obsgolem Sep 2, 2021
ea62b5d
API: Remove approx-0_5 feature (replaced by approx feature)
bluss Apr 6, 2024
a4764ef
Merge pull request #1380 from rust-ndarray/approx-0.5
bluss Apr 6, 2024
a85c5b9
Use inline on spit_at and smaller methods
bluss Jul 1, 2023
6933dd8
Add reserve method for owned arrays
ssande7 Mar 9, 2023
aa077bf
Add benchmark for reserve()
ssande7 Mar 11, 2023
63062d3
Add convenience functions for reserving space for rows/columns in Array2
ssande7 Mar 11, 2023
a16707a
Add bounds checking and error documentation
ssande7 May 7, 2023
beb1439
Check for usize overflow of new capacity
ssande7 May 7, 2023
4b022eb
Make sure added capacity doesn't overflow usize::MAX
ssande7 May 7, 2023
8e030d1
Error on overflow when reserving
ssande7 Mar 17, 2024
f39e8d1
Merge pull request #1381 from rust-ndarray/inline
bluss Apr 6, 2024
25d2d04
reserve: Add test with inverted axis
bluss Apr 6, 2024
7cc7141
reserve: Update tests to use into_raw_vec_and_offset
bluss Apr 6, 2024
d664f3d
Merge pull request #1268 from ssande7/reserve
bluss Apr 6, 2024
d0ee87e
Fixed broke continuous integration badge
juhotuho10 Apr 14, 2024
f5d17e5
Merge pull request #1382 from juhotuho10/patch-1
adamreichold Apr 14, 2024
cddb2ee
Avoid legacy numeric constants.
adamreichold May 19, 2024
778ee68
Allow for rawpointer::PointerExt being unused as the inherent methods…
adamreichold May 19, 2024
bde682a
Merge pull request #1388 from rust-ndarray/ci-cd
adamreichold May 19, 2024
17a628e
Implements and tests `product_axis`.
akern40 May 18, 2024
e734ce8
Merge pull request #1387 from akern40/prod_impl
adamreichold May 19, 2024
654db57
Expands the `array!` macro.
akern40 May 20, 2024
98b1a33
Hopefully fixes fmt CI error
akern40 May 20, 2024
3986824
Adds `triu` and `tril` methods that mimic NumPy.
akern40 May 22, 2024
e2facb7
Actually fixes formatting
akern40 May 22, 2024
449ad0e
Uses alloc:: instead of std:: for vec! import
akern40 May 22, 2024
9e9c3f9
Uses initial check to clarify logic
akern40 May 25, 2024
84f0c80
Removes unecessary comment
akern40 May 25, 2024
72b0d09
Merge pull request #1386 from akern40/triangular
nilgoyette May 27, 2024
7538644
Fix styling of the BLAS integration heading.
adamreichold May 20, 2024
bd13f6b
Use the stable toolchain to run clippy
nilgoyette Jul 23, 2024
024dccb
Merge pull request #1400 from nilgoyette/clippy_stable
nilgoyette Jul 23, 2024
6cb2368
Merge pull request #1389 from akern40/array_macro
bluss Jul 23, 2024
5d37dfb
Fix clippy lints
bluss Jul 26, 2024
e86ebff
Add `is_unique` for `ArcArray` (#1399)
daniellga Jul 29, 2024
587a111
Increase MSRV to Rust 1.64.0
bluss Jul 29, 2024
77cc6c8
Bump itertools to 0.13
bluss Jul 29, 2024
3330cbf
Bump blas-src to 0.10
bluss Jul 29, 2024
99e3f31
Fix a few clippy lints
bluss Jul 29, 2024
a091a12
Merge pull request #1404 from rust-ndarray/msrv
bluss Aug 1, 2024
8a4d3a0
Organize the workspace of test crates a bit better
bluss Aug 1, 2024
f4e424a
extra-tests: Reduce matrix sizes in test
bluss Aug 1, 2024
ec0ffa6
Merge pull request #1405 from rust-ndarray/test-workspace
bluss Aug 1, 2024
71e359a
Update to use dep: for features
bluss Aug 1, 2024
f9258f2
Merge pull request #1406 from rust-ndarray/dep-features
bluss Aug 1, 2024
2aec819
Add AxisWindows
jonasBoss Jul 12, 2023
21fb817
add a test for zipping axis_windows with a 1d array
jonasBoss Aug 1, 2024
7dd3638
Made compatible with thumbv6m-none-eabi
BjornTheProgrammer Apr 25, 2024
0d3649e
Merge pull request #1384 from BjornTheProgrammer/master
bluss Aug 2, 2024
65c2a22
Organize dependencies with workspace = true (cont.)
bluss Aug 2, 2024
d51c3c4
Merge pull request #1407 from rust-ndarray/workspace-deps
bluss Aug 2, 2024
a7fbf38
Prepare changelog for 0.16.0
bluss Jul 24, 2024
a828db6
Update readme for 0.16
bluss Aug 2, 2024
874f6b4
Organize tests in workspace (cont.)
bluss Aug 2, 2024
7f93048
Simplify all-tests.sh
bluss Aug 2, 2024
9c14169
Merge pull request #1408 from rust-ndarray/simplify
bluss Aug 2, 2024
de604c9
Add flatten methods
barakugav Jul 9, 2024
a554300
Add `squeeze()` to dynamic arrays
barakugav Jul 3, 2024
91ecb92
Merge pull request #1397 from barakugav/flatten
bluss Aug 2, 2024
45009ff
Merge pull request #1396 from barakugav/squeeze
bluss Aug 2, 2024
be3aa20
Add A: Clone bound to into_shared
jturner314 Jun 5, 2021
9681aba
Implement DataOwned for CowRepr
jturner314 Jun 1, 2021
6fc3f24
Remove deprecated uninitialized and maybe_uninit
bluss Aug 2, 2024
ddc8271
Remove deprecated visit and genrows/gencolumns/_mut
bluss Aug 2, 2024
41090f3
Correct the deprecation since= versions for 0.16
bluss Aug 2, 2024
708de94
Remove deprecated Zip apply methods
bluss Aug 2, 2024
99766f6
ndarray-rand: Remove deprecated F32
bluss Aug 2, 2024
ca7d8bb
Remove deprecated AxisDescription methods
bluss Aug 2, 2024
2ed283a
Remove deprecated scalar_sum
bluss Aug 2, 2024
7dd3054
Remove deprecated stack_new_axis
bluss Aug 2, 2024
b5bbe0e
Remove deprecated (internal) _data_slice
bluss Aug 2, 2024
f163e14
Merge pull request #1305 from jonasBoss/axis_windows_dimension
bluss Aug 2, 2024
e29a524
Merge pull request #1028 from jturner314/cowrepr-dataowned
bluss Aug 2, 2024
e578d58
Merge pull request #1409 from rust-ndarray/remove-deprecated
bluss Aug 2, 2024
516a504
Allow aliasing in ArrayView::from_shape
bluss Aug 2, 2024
e9e8c9d
Merge pull request #1410 from rust-ndarray/aliasing-checks
bluss Aug 3, 2024
8cbc348
ci: Remove duplicated test in cargo-careful
bluss Aug 3, 2024
98c2f25
ci: Require nostd build
bluss Aug 3, 2024
3de33e4
ci: Require rustfmt check
bluss Aug 3, 2024
9873c0a
Merge pull request #1411 from rust-ndarray/ci
bluss Aug 3, 2024
b03953a
Check for aliasing in RawViewMut::from_shape_ptr
bluss Aug 3, 2024
825e80b
Update changelog for ndarray 0.16 and ndarray-rand 0.15
bluss Aug 3, 2024
b592995
Bump to ndarray 0.16 and ndarray-rand 0.15
bluss Aug 3, 2024
84fe611
Merge pull request #1414 from rust-ndarray/release-0.16
bluss Aug 3, 2024
a9605dc
Make iterators covariant in element type
bluss Aug 6, 2024
00e1546
Convert Baseiter to use NonNull throughout
bluss Aug 6, 2024
f7e4750
Merge pull request #1417 from rust-ndarray/baseiter-covariant
bluss Aug 6, 2024
7e5762b
ci: Run all checks as pull request tests
bluss Aug 8, 2024
6a8fb96
ci: Check for warnings in cargo doc
bluss Aug 8, 2024
2d258bc
Fix rustdoc warnings everywhere
bluss Aug 8, 2024
f07b2fe
Set doc, doctest = false for test crates
bluss Aug 8, 2024
005be01
Merge pull request #1420 from rust-ndarray/ci
bluss Aug 8, 2024
9f1b35d
blas-tests: Fix to use blas feature
bluss Aug 7, 2024
2ca801c
ndarray-gen: Add simple internal interface for building matrices
bluss Aug 7, 2024
27e347c
blas: Update layout logic for gemm
bluss Aug 7, 2024
01bb218
blas: Fix to skip array with too short stride
bluss Aug 7, 2024
56cac34
ci: Run ndarray tests with feature blas
bluss Aug 7, 2024
e65bd0d
tests: Refactor to use ArrayBuilder more places
bluss Aug 7, 2024
b2955cb
blas: Simplify layout logic for gemm
bluss Aug 8, 2024
844cfcb
blas: Test that matrix multiply calls BLAS
bluss Aug 8, 2024
f563af0
Merge pull request #1419 from rust-ndarray/blas-layout
bluss Aug 8, 2024
700b4dd
scripts: Fix off by one in makechangelog
bluss Aug 9, 2024
05789c1
Use resolver=2 in the workspace
bluss Aug 9, 2024
7226d39
blas: Run blas-mock-tests in cross compiler tests
bluss Aug 9, 2024
453eae3
blas: Refactor and simplify gemm call further
bluss Aug 9, 2024
0153a37
blas: Simplify control flow in matrix multiply
bluss Aug 9, 2024
876ad01
blas: test with more than one pattern in data
bluss Aug 9, 2024
1df6c32
Fix infinite recursion, overflow, and off-by-one error in triu/tril (…
akern40 Aug 11, 2024
33e2a58
Merge pull request #1421 from rust-ndarray/blas-simplify
bluss Aug 14, 2024
6f77377
0.16.1
bluss Aug 14, 2024
1304f9d
Fix uniqueness in last_mut()
bluss Aug 21, 2024
7843a3b
Adds vscode editor settings to gitignore
akern40 Aug 22, 2024
5dc62e6
Tweak documentation for into_raw_vec_and_offset (#1432)
benliepert Sep 6, 2024
c7ebd35
Removed typo
Drazhar Sep 16, 2024
fce6034
Add `diff` method as an equivalent to `numpy.diff` (#1437)
johann-cm Sep 26, 2024
f1153bf
Ignore Jetbrains IDE config folder
XXMA16 Oct 6, 2024
492b274
Fixes no_std + approx combination (#1448)
akern40 Oct 24, 2024
fd3ce5d
Adds Miri to CI/CD (#1446)
akern40 Oct 30, 2024
9c703ac
Fixing lifetime elisions and minor clippy complaints
akern40 Nov 30, 2024
4e61c87
Changing CI to account for BLAS requiring MSRV > 1.64
akern40 Nov 30, 2024
d5f32ec
Pin openblas to >=0.10.11 in order to fix blas-compatible MSRV to 0.7…
akern40 Dec 20, 2024
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
38 changes: 34 additions & 4 deletions src/impl_methods.rs
Original file line number Diff line number Diff line change
@@ -732,13 +732,26 @@ where
/// ```
pub fn get<I>(&self, index: I) -> Option<&A>
where
I: NdIndex<D>,
S: Data,
I: NdIndex<D>,
{
unsafe { self.get_ptr(index).map(|ptr| &*ptr) }
}

pub(crate) fn get_ptr<I>(&self, index: I) -> Option<*const A>
/// Return a raw pointer to the element at `index`, or return `None`
/// if the index is out of bounds.
///
/// ```
/// use ndarray::arr2;
///
/// let a = arr2(&[[1., 2.], [3., 4.]]);
///
/// let v = a.raw_view();
/// let p = a.get_ptr((0, 1)).unwrap();
///
/// assert_eq!(unsafe { *p }, 2.);
/// ```
pub fn get_ptr<I>(&self, index: I) -> Option<*const A>
where
I: NdIndex<D>,
{
@@ -755,10 +768,27 @@ where
S: DataMut,
I: NdIndex<D>,
{
unsafe { self.get_ptr_mut(index).map(|ptr| &mut *ptr) }
unsafe { self.get_mut_ptr(index).map(|ptr| &mut *ptr) }
}

pub(crate) fn get_ptr_mut<I>(&mut self, index: I) -> Option<*mut A>
/// Return a raw pointer to the element at `index`, or return `None`
/// if the index is out of bounds.
///
/// ```
/// use ndarray::arr2;
///
/// let mut a = arr2(&[[1., 2.], [3., 4.]]);
///
/// let v = a.raw_view_mut();
/// let p = a.get_mut_ptr((0, 1)).unwrap();
///
/// unsafe {
/// *p = 5.;
/// }
///
/// assert_eq!(a.get((0, 1)), Some(&5.));
/// ```
pub fn get_mut_ptr<I>(&mut self, index: I) -> Option<*mut A>
where
S: RawDataMut,
I: NdIndex<D>,
4 changes: 2 additions & 2 deletions src/impl_views/indexing.rs
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ where
fn index(mut self, index: I) -> &'a mut A {
debug_bounds_check!(self, index);
unsafe {
match self.get_ptr_mut(index) {
match self.get_mut_ptr(index) {
Some(ptr) => &mut *ptr,
None => array_out_of_bounds(),
}
@@ -182,7 +182,7 @@ where
fn get(mut self, index: I) -> Option<&'a mut A> {
debug_bounds_check!(self, index);
unsafe {
match self.get_ptr_mut(index) {
match self.get_mut_ptr(index) {
Some(ptr) => Some(&mut *ptr),
None => None,
}