Skip to main content

Mut

Struct Mut 

Source
pub struct Mut<'a, T> { /* private fields */ }
Expand description

A Matrix/MatrixMut implementation that mutably references its data.

Implementations§

Source§

impl<'a, T> Mut<'a, T>

Source

pub fn try_from_data( data: &'a mut [T], nrows: usize, ncols: usize, ) -> Result<Self, TryFromError<&'a mut [T]>>

Try to construct directly from data.

Returns an error if Layout::new fails for nrows and ncols or data.len() is not equal to nrows * ncols.

Source

pub fn row_vector(data: &'a mut [T]) -> Self

Construct a row vector directly from data.

Source

pub fn column_vector(data: &'a mut [T]) -> Self

Construct a column vector directly from data.

Source

pub fn into_mut_slice(self) -> &'a mut [T]

Consume self and return the underlying data as a mutable slice.

Trait Implementations§

Source§

impl<'a, T: Debug> Debug for Mut<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Matrix for Mut<'_, T>

Source§

type Element = T

The type of the element stored in the matrix.
Source§

fn as_nonnull(&self) -> NonNull<T>

Return the base pointer for the matrix.
Source§

fn layout(&self) -> Layout<T>

Return the Layout for the matrix.
Source§

fn nrows(&self) -> usize

Return the number of rows in the matrix.
Source§

fn ncols(&self) -> usize

Return the number of columns in the matrix.
Source§

unsafe fn row_unchecked(&self, row: usize) -> &[Self::Element]

Returns the requested row without bounds checking. Read more
Source§

fn as_ptr(&self) -> *const Self::Element

Return a pointer to the base of the matrix.
Source§

fn as_slice(&self) -> &[Self::Element]

Return the underlying data as a slice.
Source§

fn row(&self, row: usize) -> &[Self::Element]

Return row row as a slice. Read more
Source§

fn get_row(&self, row: usize) -> Option<&[Self::Element]>

Return row row if row < self.nrows(). Otherwise, return None.
Source§

fn rows(&self) -> Rows<'_, Self::Element> ⓘ

Return a iterator over all rows in the matrix. Read more
Source§

unsafe fn element_unchecked(&self, row: usize, col: usize) -> &Self::Element

Returns a reference to an element without bounds checking. Read more
Source§

fn get_element(&self, row: usize, col: usize) -> Option<&Self::Element>

Return the value at the specified row and col. Read more
Source§

fn element(&self, row: usize, col: usize) -> &Self::Element

Return the value at the specified row and col. Read more
Source§

fn as_view(&self) -> Ref<'_, Self::Element>

Return a view over the matrix.
Source§

fn subview(&self, rows: Range<usize>) -> Option<Ref<'_, Self::Element>>

Return a view over the rows in rows, or None when the range is invalid.
Source§

fn window_iter(&self, batchsize: NonZeroUsize) -> Windows<'_, Self::Element> ⓘ

Return an iterator that divides the matrix into sub-matrices with (up to) batchsize rows with self.ncols() columns. Read more
Source§

fn to_rowmajor_owned(&self) -> Owned<Self::Element>
where Self::Element: Clone,

Return an Owned with the same shape as self and cloned contents.
Source§

fn try_map<F, R>(&self, f: F) -> Result<Owned<R>, LayoutError>
where F: FnMut(&Self::Element) -> R,

Create a new Matrix by applying the closure f to each element. Read more
Source§

fn map<F, R>(&self, f: F) -> Owned<R>
where F: FnMut(&Self::Element) -> R,

Create a new Matrix by applying the closure f to each element. Read more
Source§

fn transpose(&self) -> Owned<Self::Element>
where Self::Element: Clone,

Transpose the elements in self.
Source§

fn par_rows(&self) -> impl IndexedParallelIterator<Item = &[Self::Element]>
where Self::Element: Sync,

Return a parallel iterator over the rows of the matrix.
Source§

fn par_window_iter( &self, batchsize: usize, ) -> impl IndexedParallelIterator<Item = Ref<'_, Self::Element>>
where Self::Element: Sync,

Return a parallel iterator that divides the matrix into sub-matrices with (up to) batchsize rows with self.ncols() columns. Read more
Source§

impl<T> MatrixMut for Mut<'_, T>

Source§

fn as_nonnull_mut(&mut self) -> NonNull<T>

Return the base pointer for the matrix. Read more
Source§

unsafe fn row_unchecked_mut(&mut self, row: usize) -> &mut [Self::Element]

Returns the requested row without bounds checking. Read more
Source§

fn as_mut_ptr(&mut self) -> *mut Self::Element

Return a pointer to the base of the matrix.
Source§

fn as_mut_slice(&mut self) -> &mut [Self::Element]

Return the underlying data as a mutable slice.
Source§

fn row_mut(&mut self, row: usize) -> &mut [Self::Element]

Return row row as a mutable slice. Read more
Source§

fn get_row_mut(&mut self, row: usize) -> Option<&mut [Self::Element]>

Return row row if row < self.nrows(). Otherwise, return None.
Source§

fn rows_mut(&mut self) -> RowsMut<'_, Self::Element> ⓘ

Return a mutable iterator over all rows in the matrix. Read more
Source§

unsafe fn element_unchecked_mut( &mut self, row: usize, col: usize, ) -> &mut Self::Element

Returns a mutable reference to an element without bounds checking. Read more
Source§

fn get_element_mut( &mut self, row: usize, col: usize, ) -> Option<&mut Self::Element>

Return the value at the specified row and col. Read more
Source§

fn element_mut(&mut self, row: usize, col: usize) -> &mut Self::Element

Return the value at the specified row and col. Read more
Source§

fn as_view_mut(&mut self) -> Mut<'_, Self::Element>

Return a view over the matrix.
Source§

fn par_rows_mut( &mut self, ) -> impl IndexedParallelIterator<Item = &mut [Self::Element]>
where Self::Element: Send,

Return a parallel iterator over the rows of the matrix. Read more
Source§

fn par_window_iter_mut( &mut self, batchsize: usize, ) -> impl IndexedParallelIterator<Item = Mut<'_, Self::Element>>
where Self::Element: Send,

Return a parallel iterator that divides the matrix into mutable sub-matrices with (up to) batchsize rows with self.ncols() columns. Read more
Source§

impl<T> PartialEq for Mut<'_, T>
where T: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a, T> Reborrow<'a> for Mut<'_, T>

Source§

type Target = Ref<'a, T>

Source§

fn reborrow(&'a self) -> Self::Target

Borrow self into a generalized reference type and reborrow
Source§

impl<'a, T> ReborrowMut<'a> for Mut<'_, T>

Source§

type Target = Mut<'a, T>

Source§

fn reborrow_mut(&'a mut self) -> Self::Target

Mutably borrow self into a generalized reference type and reborrow.
Source§

impl<T> Send for Mut<'_, T>
where T: Send,

Source§

impl<T> Sync for Mut<'_, T>
where T: Sync,

Auto Trait Implementations§

§

impl<'a, T> !UnwindSafe for Mut<'a, T>

§

impl<'a, T> Freeze for Mut<'a, T>
where NonNull<T>: Freeze, Layout<T>: Freeze, PhantomData<&'a mut [T]>: Freeze,

§

impl<'a, T> RefUnwindSafe for Mut<'a, T>

§

impl<'a, T> Unpin for Mut<'a, T>
where NonNull<T>: Unpin, Layout<T>: Unpin, PhantomData<&'a mut [T]>: Unpin,

§

impl<'a, T> UnsafeUnpin for Mut<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsyncFriendly for T
where T: Send + Sync + 'static,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V