8000 Generalize ref-to-ref ops by akern40 · Pull Request #1468 · rust-ndarray/ndarray · GitHub
[go: up one dir, main page]

Skip to content

Generalize ref-to-ref ops #1468

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

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
99722fa
Adds an array reference type.
akern40 Oct 4, 2024
44079cc
Adds some documentation
akern40 Oct 4, 2024
3d32c08
Fixes some CI/CD issues
akern40 Oct 5, 2024
8bf86df
More CI/CD fixes
akern40 Oct 5, 2024
dda4b66
Last CI/CD fix?
akern40 Oct 5, 2024
3c75150
Switches to the "same-repr" approach to allow array views to still be…
akern40 Oct 6, 2024
28fea66
Changes back to Copy-capable ArrayBase and unchanged ArrayBase internals
akern40 Oct 6, 2024
3a180c1
Removes unused import
akern40 Oct 6, 2024
6b64678
Introduces LayoutRef and starts to move functionality from ArrayBase …
akern40 Oct 11, 2024
4c440a8
Working version of the conversion to reference types
akern40 Oct 13, 2024
c183903
Uses a new design with two reference types
akern40 Oct 13, 2024
476dac5
Satisfying CI/CD
akern40 Oct 13, 2024
68d6f53
Adds Index, equality, IntoIterator, and Hash traits, plus approximates
akern40 Oct 13, 2024
2fde998
Finishes conversions of all possible ArrayBase impls to ArrayRef
akern40 Oct 14, 2024
d63d26e
Satisfying CI/CD
akern40 Oct 14, 2024
b7281f5
Adds some aliases to avoid breaking changes, and adds an example of h…
akern40 Oct 14, 2024
663e2f9
Adds Borrow and ToOwned
akern40 Oct 14, 2024
5204f68
Tests that the *Assign operators work for slices via deref
akern40 Oct 14, 2024
6a3d131
Somehow missed a `use` for `ToOwned`
akern40 Oct 14, 2024
289130d
Implicitly use deref
akern40 Oct 14, 2024
db52eab
Adds documentation and aliases for `LayoutRef`
akern40 Oct 20, 2024
2b34bf8
Fixes doc links
akern40 Oct 20, 2024
a40307b
Adds formatting for ArrayRef
akern40 Oct 20, 2024
5adbb31
Change some examples over to ArrayRef
akern40 Oct 20, 2024
6e61e83
Adds missed #[repr(transparent)] for RawRef
akern40 Oct 20, 2024
0cd4334
Simplifies deref logic and avoids null check
akern40 Oct 20, 2024
f77ad96
Adds documentation to ArrayRef
akern40 Oct 20, 2024
3888399
Adds missing aliases to ArrayBase from RawRef and LayoutRef
akern40 Oct 21, 2024
0a3cad3
Adds a short snippet of documentation for `RawRef` and some top-level…
akern40 Oct 21, 2024
cbed837
Makes as_ref more explicit through methods on ArrayBase
akern40 Oct 26, 2024
945f70d
Restore remove_index to DataOwned
akern40 Oct 26, 2024
93dfb38
Fixes unused imports
akern40 Oct 26, 2024
1d5d6f4
Generalize ref-to-ref ops to work with arbitrary output types
akern40 Dec 23, 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
Prev Previous commit
Next Next commit
Restore remove_index to DataOwned
I think I accidentally moved this over to ArrayRef, but we're not sure it should still require DataOwned
  • Loading branch information
akern40 committed Oct 26, 2024
commit 945f70de8138e80cce290345edaabff9db0b21cd
10 changes: 9 additions & 1 deletion src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3102,7 +3102,13 @@ impl<A, D: Dimension> ArrayRef<A, D>
Zip::from(self.lanes_mut(axis)).map_collect(mapping)
}
}
}

impl<A, S, D> ArrayBase<S, D>
where
S: DataOwned<Elem = A> + DataMut,
D: Dimension,
{
/// Remove the `index`th elements along `axis` and shift down elements from higher indexes.
///
/// Note that this "removes" the elements by swapping them around to the end of the axis and
Expand All @@ -3115,7 +3121,6 @@ impl<A, D: Dimension> ArrayRef<A, D>
/// ***Panics*** if `axis` is out of bounds<br>
/// ***Panics*** if not `index < self.len_of(axis)`.
pub fn remove_index(&mut self, axis: Axis, index: usize)
// TODO: Check whether this needed to be DataOwned
{
assert!(index < self.len_of(axis), "index {} must be less than length of Axis({})",
index, axis.index());
Expand All @@ -3125,7 +3130,10 @@ impl<A, D: Dimension> ArrayRef<A, D>
// then slice the axis in place to cut out the removed final element
self.slice_axis_inplace(axis, Slice::new(0, Some(-1), 1));
}
}

impl<A, D: Dimension> ArrayRef<A, D>
{
/// Iterates over pairs of consecutive elements along the axis.
///
/// The first argument to the closure is 498A an element, and the second
Expand Down
Loading
0