pub struct OwnedMatrix<T, A: Allocator = Global> { /* private fields */ }Expand description
A matrix that owns its elements.
To pass it to algorithms, use the .data() and .data_mut() functions.
§Example
#![feature(allocator_api)]
let mut A = OwnedMatrix::identity(2, 2, StaticRing::<i32>::RING);
let mut B = OwnedMatrix::identity(2, 2, StaticRing::<i32>::RING);
let mut C = OwnedMatrix::identity(2, 2, StaticRing::<i32>::RING);
StaticRing::<i32>::RING.get_ring().solve_right(A.data_mut(), B.data_mut(), C.data_mut(), Global).assert_solved();Implementations§
Source§impl<T> OwnedMatrix<T>
impl<T> OwnedMatrix<T>
Source§impl<T, A: Allocator> OwnedMatrix<T, A>
impl<T, A: Allocator> OwnedMatrix<T, A>
pub fn new(data: Vec<T, A>, col_count: usize) -> Self
Sourcepub fn from_fn_in<F>(
row_count: usize,
col_count: usize,
f: F,
allocator: A,
) -> Self
pub fn from_fn_in<F>( row_count: usize, col_count: usize, f: F, allocator: A, ) -> Self
§Availability
This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
pub fn data<'a>(&'a self) -> Submatrix<'a, AsFirstElement<T>, T>
pub fn data_mut<'a>(&'a mut self) -> SubmatrixMut<'a, AsFirstElement<T>, T>
pub fn at(&self, i: usize, j: usize) -> &T
pub fn at_mut(&mut self, i: usize, j: usize) -> &mut T
pub fn row_count(&self) -> usize
pub fn col_count(&self) -> usize
Sourcepub fn zero_in<R: RingStore>(
row_count: usize,
col_count: usize,
ring: R,
allocator: A,
) -> Self
pub fn zero_in<R: RingStore>( row_count: usize, col_count: usize, ring: R, allocator: A, ) -> Self
§Availability
This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Sourcepub fn identity_in<R: RingStore>(
row_count: usize,
col_count: usize,
ring: R,
allocator: A,
) -> Self
pub fn identity_in<R: RingStore>( row_count: usize, col_count: usize, ring: R, allocator: A, ) -> Self
§Availability
This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Sourcepub fn clone_matrix<R: RingStore>(&self, ring: R) -> Self
pub fn clone_matrix<R: RingStore>(&self, ring: R) -> Self
§Availability
This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Sourcepub fn set_row_count<F>(&mut self, new_count: usize, new_entries: F)where
F: FnMut() -> T,
pub fn set_row_count<F>(&mut self, new_count: usize, new_entries: F)where
F: FnMut() -> T,
§Availability
This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Trait Implementations§
Auto Trait Implementations§
impl<T, A> Freeze for OwnedMatrix<T, A>where
A: Freeze,
impl<T, A> RefUnwindSafe for OwnedMatrix<T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Send for OwnedMatrix<T, A>
impl<T, A> Sync for OwnedMatrix<T, A>
impl<T, A> Unpin for OwnedMatrix<T, A>
impl<T, A> UnwindSafe for OwnedMatrix<T, A>where
A: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more