MatMut

Type Alias MatMut 

Source
pub type MatMut<'a, T, Rows = usize, Cols = usize, RStride = isize, CStride = isize> = Mat<Mut<'a, T, Rows, Cols, RStride, CStride>>;
Expand description

mutable view over a matrix, similar to a mutable reference to a 2d strided slice

§note

unlike a slice, the data pointed to by MatMut<'_, T> is allowed to be partially or fully uninitialized under certain conditions. In this case, care must be taken to not perform any operations that read the uninitialized values, either directly or indirectly through any of the numerical library routines, unless it is explicitly permitted

§move semantics

since MatMut mutably borrows data, it cannot be Copy. this means that if we pass a MatMut to a function that takes it by value, or use a method that consumes self like MatMut::transpose_mut, this renders the original variable unusable

use faer::{Mat, MatMut};

fn takes_matmut(view: MatMut<'_, f64>) {}

let mut matrix = Mat::new();
let view = matrix.as_mut();

takes_matmut(view); // `view` is moved (passed by value)
takes_matmut(view); // this fails to compile since `view` was moved

the way to get around it is to use the reborrow::ReborrowMut trait, which allows us to mutably borrow a MatMut to obtain another MatMut for the lifetime of the borrow. it’s also similarly possible to immutably borrow a MatMut to obtain a MatRef for the lifetime of the borrow, using reborrow::Reborrow

use faer::{Mat, MatMut, MatRef};
use reborrow::*;

fn takes_matmut(view: MatMut<'_, f64>) {}
fn takes_matref(view: MatRef<'_, f64>) {}

let mut matrix = Mat::new();
let mut view = matrix.as_mut();

takes_matmut(view.rb_mut());
takes_matmut(view.rb_mut());
takes_matref(view.rb());
// view is still usable here

Aliased Type§

#[repr(transparent)]
pub struct MatMut<'a, T, Rows = usize, Cols = usize, RStride = isize, CStride = isize>(pub Mut<'a, T, Rows, Cols, RStride, CStride>);

Tuple Fields§

§0: Mut<'a, T, Rows, Cols, RStride, CStride>

Implementations§

Source§

impl<'a, T> MatMut<'a, T>

Source

pub fn from_row_major_array_mut<const ROWS: usize, const COLS: usize>( array: &'a mut [[T; COLS]; ROWS], ) -> Self

equivalent to MatMut::from_row_major_slice_mut(array.as_flattened_mut(), ROWS, COLS)

Source

pub fn from_column_major_array_mut<const ROWS: usize, const COLS: usize>( array: &'a mut [[T; ROWS]; COLS], ) -> Self

equivalent to MatMut::from_column_major_slice_mut(array.as_flattened_mut(), ROWS, COLS)

Source§

impl<'a, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> MatMut<'a, T, Rows, Cols, RStride, CStride>

Source

pub const unsafe fn from_raw_parts_mut( ptr: *mut T, nrows: Rows, ncols: Cols, row_stride: RStride, col_stride: CStride, ) -> Self

creates a MatMut from a pointer to the matrix data, dimensions, and strides

the row (resp. column) stride is the offset from the memory address of a given matrix element at index (row: i, col: j), to the memory address of the matrix element at index (row: i + 1, col: 0) (resp. (row: 0, col: i + 1)). this offset is specified in number of elements, not in bytes

§safety

the behavior is undefined if any of the following conditions are violated:

  • for each matrix unit, the entire memory region addressed by the matrix must be contained within a single allocation, accessible in its entirety by the corresponding pointer in ptr
  • for each matrix unit, the corresponding pointer must be non null and properly aligned, even for a zero-sized matrix.
  • the values accessible by the matrix must be initialized at some point before they are read, or references to them are formed
  • no aliasing (including self aliasing) is allowed. in other words, none of the elements accessible by any matrix unit may be accessed for reads or writes by any other means for the duration of the lifetime 'a. no two elements within a single matrix unit may point to the same address (such a thing can be achieved with a zero stride, for example), and no two matrix units may point to the same address
§example
use faer::{MatMut, mat};

// row major matrix with 2 rows, 3 columns, with a column at the end that we want to skip.
// the row stride is the pointer offset from the address of 1.0 to the address of 4.0,
// which is 4
// the column stride is the pointer offset from the address of 1.0 to the address of 2.0,
// which is 1
let mut data = [[1.0, 2.0, 3.0, f64::NAN], [4.0, 5.0, 6.0, f64::NAN]];
let mut matrix =
	unsafe { MatMut::from_raw_parts_mut(data.as_mut_ptr() as *mut f64, 2, 3, 4, 1) };

let expected = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
assert_eq!(expected.as_ref(), matrix);
Source

pub fn as_ptr(&self) -> *const T

returns a pointer to the matrix data

Source

pub fn nrows(&self) -> Rows

returns the number of rows of the matrix

Source

pub fn ncols(&self) -> Cols

returns the number of columns of the matrix

Source

pub fn shape(&self) -> (Rows, Cols)

returns the number of rows and columns of the matrix

Source

pub fn row_stride(&self) -> RStride

returns the row stride of the matrix, specified in number of elements, not in bytes

Source

pub fn col_stride(&self) -> CStride

returns the column stride of the matrix, specified in number of elements, not in bytes

Source

pub fn ptr_at(&self, row: IdxInc<Rows>, col: IdxInc<Cols>) -> *const T

returns a raw pointer to the element at the given index

Source

pub unsafe fn ptr_inbounds_at(&self, row: Idx<Rows>, col: Idx<Cols>) -> *const T

returns a raw pointer to the element at the given index, assuming the provided index is within the matrix bounds

§safety

the behavior is undefined if any of the following conditions are violated:

  • row < self.nrows()
  • col < self.ncols()
Source

pub fn split_at( self, row: IdxInc<Rows>, col: IdxInc<Cols>, ) -> (MatRef<'a, T, usize, usize, RStride, CStride>, MatRef<'a, T, usize, usize, RStride, CStride>, MatRef<'a, T, usize, usize, RStride, CStride>, MatRef<'a, T, usize, usize, RStride, CStride>)

Source

pub fn split_at_row( self, row: IdxInc<Rows>, ) -> (MatRef<'a, T, usize, Cols, RStride, CStride>, MatRef<'a, T, usize, Cols, RStride, CStride>)

Source

pub fn split_at_col( self, col: IdxInc<Cols>, ) -> (MatRef<'a, T, Rows, usize, RStride, CStride>, MatRef<'a, T, Rows, usize, RStride, CStride>)

Source

pub fn transpose(self) -> MatRef<'a, T, Cols, Rows, CStride, RStride>

Source

pub fn conjugate(self) -> MatRef<'a, T::Conj, Rows, Cols, RStride, CStride>
where T: Conjugate,

Source

pub fn canonical(self) -> MatRef<'a, T::Canonical, Rows, Cols, RStride, CStride>
where T: Conjugate,

Source

pub fn adjoint(self) -> MatRef<'a, T::Conj, Cols, Rows, CStride, RStride>
where T: Conjugate,

Source

pub fn reverse_rows(self) -> MatRef<'a, T, Rows, Cols, RStride::Rev, CStride>

Source

pub fn reverse_cols(self) -> MatRef<'a, T, Rows, Cols, RStride, CStride::Rev>

Source

pub fn reverse_rows_and_cols( self, ) -> MatRef<'a, T, Rows, Cols, RStride::Rev, CStride::Rev>

Source

pub fn submatrix<V: Shape, H: Shape>( self, row_start: IdxInc<Rows>, col_start: IdxInc<Cols>, nrows: V, ncols: H, ) -> MatRef<'a, T, V, H, RStride, CStride>

Source

pub fn subrows<V: Shape>( self, row_start: IdxInc<Rows>, nrows: V, ) -> MatRef<'a, T, V, Cols, RStride, CStride>

Source

pub fn subcols<H: Shape>( self, col_start: IdxInc<Cols>, ncols: H, ) -> MatRef<'a, T, Rows, H, RStride, CStride>

Source

pub fn as_shape<V: Shape, H: Shape>( self, nrows: V, ncols: H, ) -> MatRef<'a, T, V, H, RStride, CStride>

Source

pub fn as_row_shape<V: Shape>( self, nrows: V, ) -> MatRef<'a, T, V, Cols, RStride, CStride>

Source

pub fn as_col_shape<H: Shape>( self, ncols: H, ) -> MatRef<'a, T, Rows, H, RStride, CStride>

Source

pub fn as_dyn_stride(self) -> MatRef<'a, T, Rows, Cols, isize, isize>

Source

pub fn as_dyn(self) -> MatRef<'a, T, usize, usize, RStride, CStride>

Source

pub fn as_dyn_rows(self) -> MatRef<'a, T, usize, Cols, RStride, CStride>

Source

pub fn as_dyn_cols(self) -> MatRef<'a, T, Rows, usize, RStride, CStride>

Source

pub fn row(self, i: Idx<Rows>) -> RowRef<'a, T, Cols, CStride>

Source

pub fn col(self, j: Idx<Cols>) -> ColRef<'a, T, Rows, RStride>

Source

pub fn col_iter( self, ) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = ColRef<'a, T, Rows, RStride>>
where Rows: 'a, Cols: 'a,

Source

pub fn row_iter( self, ) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = RowRef<'a, T, Cols, CStride>>
where Rows: 'a, Cols: 'a,

Source

pub fn par_col_iter( self, ) -> impl 'a + IndexedParallelIterator<Item = ColRef<'a, T, Rows, RStride>>
where T: Sync, Rows: 'a, Cols: 'a,

Source

pub fn par_row_iter( self, ) -> impl 'a + IndexedParallelIterator<Item = RowRef<'a, T, Cols, CStride>>
where T: Sync, Rows: 'a, Cols: 'a,

Source

pub fn par_col_chunks( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, T, Rows, usize, RStride, CStride>>
where T: Sync, Rows: 'a, Cols: 'a,

Source

pub fn par_col_partition( self, count: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, T, Rows, usize, RStride, CStride>>
where T: Sync, Rows: 'a, Cols: 'a,

Source

pub fn par_row_chunks( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, T, usize, Cols, RStride, CStride>>
where T: Sync, Rows: 'a, Cols: 'a,

Source

pub fn par_row_partition( self, count: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, T, usize, Cols, RStride, CStride>>
where T: Sync, Rows: 'a, Cols: 'a,

Source

pub fn try_as_col_major( self, ) -> Option<MatRef<'a, T, Rows, Cols, ContiguousFwd, CStride>>

Source

pub fn try_as_row_major( self, ) -> Option<MatRef<'a, T, Rows, Cols, RStride, ContiguousFwd>>

Source

pub fn bind<'M, 'N>( self, row: Guard<'M>, col: Guard<'N>, ) -> MatMut<'a, T, Dim<'M>, Dim<'N>, RStride, CStride>

see [MatRef::)]] #[doc(hidden)]

Source

pub fn get<RowRange, ColRange>( self, row: RowRange, col: ColRange, ) -> <MatRef<'a, T, Rows, Cols, RStride, CStride> as MatIndex<RowRange, ColRange>>::Target
where MatRef<'a, T, Rows, Cols, RStride, CStride>: MatIndex<RowRange, ColRange>,

Source

pub unsafe fn get_unchecked<RowRange, ColRange>( self, row: RowRange, col: ColRange, ) -> <MatRef<'a, T, Rows, Cols, RStride, CStride> as MatIndex<RowRange, ColRange>>::Target
where MatRef<'a, T, Rows, Cols, RStride, CStride>: MatIndex<RowRange, ColRange>,

Source

pub fn get_mut<RowRange, ColRange>( self, row: RowRange, col: ColRange, ) -> <MatMut<'a, T, Rows, Cols, RStride, CStride> as MatIndex<RowRange, ColRange>>::Target
where MatMut<'a, T, Rows, Cols, RStride, CStride>: MatIndex<RowRange, ColRange>,

Source

pub unsafe fn get_mut_unchecked<RowRange, ColRange>( self, row: RowRange, col: ColRange, ) -> <MatMut<'a, T, Rows, Cols, RStride, CStride> as MatIndex<RowRange, ColRange>>::Target
where MatMut<'a, T, Rows, Cols, RStride, CStride>: MatIndex<RowRange, ColRange>,

Source§

impl<'a, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> MatMut<'a, T, Rows, Cols, RStride, CStride>

Source

pub fn as_ptr_mut(&self) -> *mut T

Source

pub fn ptr_at_mut(&self, row: IdxInc<Rows>, col: IdxInc<Cols>) -> *mut T

Source

pub unsafe fn ptr_inbounds_at_mut( &self, row: Idx<Rows>, col: Idx<Cols>, ) -> *mut T

Source

pub fn split_at_mut( self, row: IdxInc<Rows>, col: IdxInc<Cols>, ) -> (MatMut<'a, T, usize, usize, RStride, CStride>, MatMut<'a, T, usize, usize, RStride, CStride>, MatMut<'a, T, usize, usize, RStride, CStride>, MatMut<'a, T, usize, usize, RStride, CStride>)

Source

pub fn split_at_row_mut( self, row: IdxInc<Rows>, ) -> (MatMut<'a, T, usize, Cols, RStride, CStride>, MatMut<'a, T, usize, Cols, RStride, CStride>)

Source

pub fn split_at_col_mut( self, col: IdxInc<Cols>, ) -> (MatMut<'a, T, Rows, usize, RStride, CStride>, MatMut<'a, T, Rows, usize, RStride, CStride>)

Source

pub fn transpose_mut(self) -> MatMut<'a, T, Cols, Rows, CStride, RStride>

Source

pub fn conjugate_mut(self) -> MatMut<'a, T::Conj, Rows, Cols, RStride, CStride>
where T: Conjugate,

Source

pub fn canonical_mut( self, ) -> MatMut<'a, T::Canonical, Rows, Cols, RStride, CStride>
where T: Conjugate,

Source

pub fn adjoint_mut(self) -> MatMut<'a, T::Conj, Cols, Rows, CStride, RStride>
where T: Conjugate,

Source

pub fn reverse_rows_mut( self, ) -> MatMut<'a, T, Rows, Cols, RStride::Rev, CStride>

Source

pub fn reverse_cols_mut( self, ) -> MatMut<'a, T, Rows, Cols, RStride, CStride::Rev>

Source

pub fn reverse_rows_and_cols_mut( self, ) -> MatMut<'a, T, Rows, Cols, RStride::Rev, CStride::Rev>

Source

pub fn submatrix_mut<V: Shape, H: Shape>( self, row_start: IdxInc<Rows>, col_start: IdxInc<Cols>, nrows: V, ncols: H, ) -> MatMut<'a, T, V, H, RStride, CStride>

Source

pub fn subrows_mut<V: Shape>( self, row_start: IdxInc<Rows>, nrows: V, ) -> MatMut<'a, T, V, Cols, RStride, CStride>

Source

pub fn subcols_mut<H: Shape>( self, col_start: IdxInc<Cols>, ncols: H, ) -> MatMut<'a, T, Rows, H, RStride, CStride>

Source

pub fn as_shape_mut<V: Shape, H: Shape>( self, nrows: V, ncols: H, ) -> MatMut<'a, T, V, H, RStride, CStride>

Source

pub fn as_row_shape_mut<V: Shape>( self, nrows: V, ) -> MatMut<'a, T, V, Cols, RStride, CStride>

Source

pub fn as_col_shape_mut<H: Shape>( self, ncols: H, ) -> MatMut<'a, T, Rows, H, RStride, CStride>

Source

pub fn as_dyn_stride_mut(self) -> MatMut<'a, T, Rows, Cols, isize, isize>

Source

pub fn as_dyn_mut(self) -> MatMut<'a, T, usize, usize, RStride, CStride>

Source

pub fn as_dyn_rows_mut(self) -> MatMut<'a, T, usize, Cols, RStride, CStride>

Source

pub fn as_dyn_cols_mut(self) -> MatMut<'a, T, Rows, usize, RStride, CStride>

Source

pub fn row_mut(self, i: Idx<Rows>) -> RowMut<'a, T, Cols, CStride>

Source

pub fn col_mut(self, j: Idx<Cols>) -> ColMut<'a, T, Rows, RStride>

Source

pub fn col_iter_mut( self, ) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = ColMut<'a, T, Rows, RStride>>
where Rows: 'a, Cols: 'a,

Source

pub fn row_iter_mut( self, ) -> impl 'a + ExactSizeIterator + DoubleEndedIterator<Item = RowMut<'a, T, Cols, CStride>>
where Rows: 'a, Cols: 'a,

Source

pub fn par_col_iter_mut( self, ) -> impl 'a + IndexedParallelIterator<Item = ColMut<'a, T, Rows, RStride>>
where T: Send, Rows: 'a, Cols: 'a,

Source

pub fn par_row_iter_mut( self, ) -> impl 'a + IndexedParallelIterator<Item = RowMut<'a, T, Cols, CStride>>
where T: Send, Rows: 'a, Cols: 'a,

Source

pub fn par_col_chunks_mut( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, T, Rows, usize, RStride, CStride>>
where T: Send, Rows: 'a, Cols: 'a,

Source

pub fn par_col_partition_mut( self, count: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, T, Rows, usize, RStride, CStride>>
where T: Send, Rows: 'a, Cols: 'a,

Source

pub fn par_row_chunks_mut( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, T, usize, Cols, RStride, CStride>>
where T: Send, Rows: 'a, Cols: 'a,

Source

pub fn par_row_partition_mut( self, count: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, T, usize, Cols, RStride, CStride>>
where T: Send, Rows: 'a, Cols: 'a,

Source

pub fn split_first_row_mut( self, ) -> Option<(RowMut<'a, T, Cols, CStride>, MatMut<'a, T, usize, Cols, RStride, CStride>)>

Source

pub fn split_first_col_mut( self, ) -> Option<(ColMut<'a, T, Rows, RStride>, MatMut<'a, T, Rows, usize, RStride, CStride>)>

Source

pub fn split_last_row_mut( self, ) -> Option<(RowMut<'a, T, Cols, CStride>, MatMut<'a, T, usize, Cols, RStride, CStride>)>

Source

pub fn split_last_col_mut( self, ) -> Option<(ColMut<'a, T, Rows, RStride>, MatMut<'a, T, Rows, usize, RStride, CStride>)>

Source

pub fn split_first_row( self, ) -> Option<(RowRef<'a, T, Cols, CStride>, MatRef<'a, T, usize, Cols, RStride, CStride>)>

Source

pub fn split_first_col( self, ) -> Option<(ColRef<'a, T, Rows, RStride>, MatRef<'a, T, Rows, usize, RStride, CStride>)>

Source

pub fn split_last_row( self, ) -> Option<(RowRef<'a, T, Cols, CStride>, MatRef<'a, T, usize, Cols, RStride, CStride>)>

Source

pub fn split_last_col( self, ) -> Option<(ColRef<'a, T, Rows, RStride>, MatRef<'a, T, Rows, usize, RStride, CStride>)>

Source

pub fn try_as_col_major_mut( self, ) -> Option<MatMut<'a, T, Rows, Cols, ContiguousFwd, CStride>>

Source

pub fn try_as_row_major_mut( self, ) -> Option<MatMut<'a, T, Rows, Cols, RStride, ContiguousFwd>>

Source

pub fn two_cols_mut( self, i0: Idx<Cols>, i1: Idx<Cols>, ) -> (ColMut<'a, T, Rows, RStride>, ColMut<'a, T, Rows, RStride>)

returns two views over the given columns

§panics

panics if i0 == i1

Source

pub fn two_rows_mut( self, i0: Idx<Rows>, i1: Idx<Rows>, ) -> (RowMut<'a, T, Cols, CStride>, RowMut<'a, T, Cols, CStride>)

returns two views over the given rows

§panics

panics if i0 == i1

Source§

impl<'a, T, Rows: Shape, Cols: Shape> MatMut<'a, T, Rows, Cols>

Source

pub fn from_column_major_slice_mut( slice: &'a mut [T], nrows: Rows, ncols: Cols, ) -> Self
where T: Sized,

creates a MatMut from slice views over the matrix data, and the matrix dimensions. the data is interpreted in a column-major format, so that the first chunk of nrows values from the slices goes in the first column of the matrix, the second chunk of nrows values goes in the second column, and so on

§panics

the function panics if any of the following conditions are violated:

  • nrows * ncols == slice.len()
§example
use faer::{MatMut, mat};

let mut slice = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0_f64];
let view = MatMut::from_column_major_slice_mut(&mut slice, 3, 2);

let expected = mat![[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]];
assert_eq!(expected, view);
Source

pub fn from_column_major_slice_with_stride_mut( slice: &'a mut [T], nrows: Rows, ncols: Cols, col_stride: usize, ) -> Self
where T: Sized,

creates a MatMut from slice views over the matrix data, and the matrix dimensions. the data is interpreted in a column-major format, where the beginnings of two consecutive columns are separated by col_stride elements.

Source

pub fn from_row_major_slice_mut( slice: &'a mut [T], nrows: Rows, ncols: Cols, ) -> Self
where T: Sized,

creates a MatMut from slice views over the matrix data, and the matrix dimensions. the data is interpreted in a row-major format, so that the first chunk of ncols values from the slices goes in the first column of the matrix, the second chunk of ncols values goes in the second column, and so on

§panics

the function panics if any of the following conditions are violated:

  • nrows * ncols == slice.len()
§example
use faer::{MatMut, mat};

let mut slice = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0_f64];
let view = MatMut::from_row_major_slice_mut(&mut slice, 3, 2);

let expected = mat![[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]];
assert_eq!(expected, view);
Source

pub fn from_row_major_slice_with_stride_mut( slice: &'a mut [T], nrows: Rows, ncols: Cols, row_stride: usize, ) -> Self
where T: Sized,

creates a MatMut from slice views over the matrix data, and the matrix dimensions. the data is interpreted in a row-major format, where the beginnings of two consecutive rows are separated by row_stride elements.

Source§

impl<'a, T, Dim: Shape, RStride: Stride, CStride: Stride> MatMut<'a, T, Dim, Dim, RStride, CStride>

Source

pub fn diagonal(self) -> DiagRef<'a, T, Dim, isize>

Source§

impl<'a, T, Dim: Shape, RStride: Stride, CStride: Stride> MatMut<'a, T, Dim, Dim, RStride, CStride>

Source

pub fn diagonal_mut(self) -> DiagMut<'a, T, Dim, isize>

Source§

impl<'a, T, Rows: Shape, Cols: Shape> MatMut<'a, T, Rows, Cols>
where T: RealField,

Source

pub fn min(self) -> Option<T>

Source

pub fn max(self) -> Option<T>

Trait Implementations§

Source§

impl<T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> AsMatMut for MatMut<'_, T, Rows, Cols, RStride, CStride>

Source§

fn as_mat_mut(&mut self) -> MatMut<'_, T, Rows, Cols>

returns a view over self
Source§

impl<T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> AsMatRef for MatMut<'_, T, Rows, Cols, RStride, CStride>

Source§

type Cols = Cols

column dimension type
Source§

type Owned = Mat<Own<T, Rows, Cols>>

owned matrix type
Source§

type Rows = Rows

row dimension type
Source§

type T = T

scalar type
Source§

fn as_mat_ref(&self) -> MatRef<'_, T, Rows, Cols>

returns a view over self
Source§

impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> BiLinOp<T> for MatMut<'_, ViewT>

Source§

fn transpose_apply_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq

computes the workspace size and alignment required to apply the transpose or adjoint o self to a matrix with rhs_ncols columns
Source§

fn transpose_apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies the transpose of self to rhs, and stores the result in out
Source§

fn adjoint_apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies the adjoint of self to rhs, and stores the result in out
Source§

impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> BiPrecond<T> for MatMut<'_, ViewT>

Source§

fn transpose_apply_in_place_scratch( &self, rhs_ncols: usize, par: Par, ) -> StackReq

computes the workspace size and alignment required to apply the transpose or adjoint of self to a matrix with rhs_ncols columns in place
Source§

fn transpose_apply_in_place( &self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack, )

applies the transpose of self to rhs, and stores the result in rhs
Source§

fn adjoint_apply_in_place( &self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack, )

applies the adjoint of self to rhs, and stores the result in rhs
Source§

impl<'a, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> IntoView for &'a MatMut<'_, T, Rows, Cols, RStride, CStride>

Source§

type Target = Mat<Ref<'a, T, Rows, Cols, RStride, CStride>>

Source§

fn into_view(self) -> Self::Target

Source§

impl<'a, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> IntoView for &'a mut MatMut<'_, T, Rows, Cols, RStride, CStride>

Source§

type Target = Mat<Mut<'a, T, Rows, Cols, RStride, CStride>>

Source§

fn into_view(self) -> Self::Target

Source§

impl<'a, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> IntoView for MatMut<'a, T, Rows, Cols, RStride, CStride>

Source§

type Target = Mat<Mut<'a, T, Rows, Cols, RStride, CStride>>

Source§

fn into_view(self) -> Self::Target

Source§

impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> LinOp<T> for MatMut<'_, ViewT>

Source§

fn nrows(&self) -> usize

output dimension of the operator
Source§

fn ncols(&self) -> usize

input dimension of the operator
Source§

fn apply_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq

computes the workspace size and alignment required to apply self or the conjugate o self to a matrix with rhs_ncols columns
Source§

fn apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies self to rhs, and stores the result in out
Source§

fn conj_apply( &self, out: MatMut<'_, T>, rhs: MatRef<'_, T>, par: Par, stack: &mut MemStack, )

applies the conjugate of self to rhs, and stores the result in out
Source§

impl<'a, 'M, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, Dim<'M>, Dim<'N>, Rs, Cs>

Source§

type Target = &'a mut T

sliced view type
Source§

fn get(this: Self, row: Idx<Dim<'M>>, col: Idx<Dim<'N>>) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: Idx<Dim<'M>>, col: Idx<Dim<'N>>, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, 'M, T, Rs: Stride, Cs: Stride> MatIndex<<Dim<'M> as ShapeIdx>::Idx<usize>, <usize as ShapeIdx>::Idx<usize>> for MatMut<'a, T, Dim<'M>, usize, Rs, Cs>

Source§

type Target = &'a mut T

sliced view type
Source§

fn get(this: Self, row: Idx<Dim<'M>>, col: Idx<usize>) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: Idx<Dim<'M>>, col: Idx<usize>, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, 'N, C: Shape, T, Rs: Stride, Cs: Stride, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<<Dim<'N> as ShapeIdx>::Idx<usize>, ColRange> for MatMut<'a, T, Dim<'N>, C, Rs, Cs>

Source§

type Target = Row<Mut<'a, T, <ColRange as IntoRange<<C as ShapeIdx>::IdxInc<usize>>>::Len<C>, Cs>>

sliced view type
Source§

fn get(this: Self, row: Idx<Dim<'N>>, col: ColRange) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: Idx<Dim<'N>>, col: ColRange, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, 'N, T, Rs: Stride, Cs: Stride> MatIndex<<usize as ShapeIdx>::Idx<usize>, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, usize, Dim<'N>, Rs, Cs>

Source§

type Target = &'a mut T

sliced view type
Source§

fn get(this: Self, row: Idx<usize>, col: Idx<Dim<'N>>) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: Idx<usize>, col: Idx<Dim<'N>>, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, T, Rs: Stride, Cs: Stride> MatIndex<<usize as ShapeIdx>::Idx<usize>, <usize as ShapeIdx>::Idx<usize>> for MatMut<'a, T, usize, usize, Rs, Cs>

Source§

type Target = &'a mut T

sliced view type
Source§

fn get(this: Self, row: Idx<usize>, col: Idx<usize>) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: Idx<usize>, col: Idx<usize>, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, C: Shape, T, Rs: Stride, Cs: Stride, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<<usize as ShapeIdx>::Idx<usize>, ColRange> for MatMut<'a, T, usize, C, Rs, Cs>

Source§

type Target = Row<Mut<'a, T, <ColRange as IntoRange<<C as ShapeIdx>::IdxInc<usize>>>::Len<C>, Cs>>

sliced view type
Source§

fn get(this: Self, row: Idx<usize>, col: ColRange) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: Idx<usize>, col: ColRange, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, 'N, R: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> MatIndex<RowRange, <Dim<'N> as ShapeIdx>::Idx<usize>> for MatMut<'a, T, R, Dim<'N>, Rs, Cs>

Source§

type Target = Col<Mut<'a, T, <RowRange as IntoRange<<R as ShapeIdx>::IdxInc<usize>>>::Len<R>, Rs>>

sliced view type
Source§

fn get(this: Self, row: RowRange, col: Idx<Dim<'N>>) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: RowRange, col: Idx<Dim<'N>>, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, R: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>> MatIndex<RowRange, <usize as ShapeIdx>::Idx<usize>> for MatMut<'a, T, R, usize, Rs, Cs>

Source§

type Target = Col<Mut<'a, T, <RowRange as IntoRange<<R as ShapeIdx>::IdxInc<usize>>>::Len<R>, Rs>>

sliced view type
Source§

fn get(this: Self, row: RowRange, col: Idx<usize>) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: RowRange, col: Idx<usize>, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'a, R: Shape, C: Shape, T, Rs: Stride, Cs: Stride, RowRange: IntoRange<IdxInc<R>, Len<R>: 'a>, ColRange: IntoRange<IdxInc<C>, Len<C>: 'a>> MatIndex<RowRange, ColRange> for MatMut<'a, T, R, C, Rs, Cs>

Source§

type Target = Mat<Mut<'a, T, <RowRange as IntoRange<<R as ShapeIdx>::IdxInc<usize>>>::Len<R>, <ColRange as IntoRange<<C as ShapeIdx>::IdxInc<usize>>>::Len<C>, Rs, Cs>>

sliced view type
Source§

fn get(this: Self, row: RowRange, col: ColRange) -> Self::Target

slice this using row and col
Source§

unsafe fn get_unchecked( this: Self, row: RowRange, col: ColRange, ) -> Self::Target

slice this using row and col without bound checks
Source§

impl<'b, T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> MatIndex for MatMut<'b, T, Rows, Cols, RStride, CStride>

Source§

type Cols = Cols

type of columns
Source§

type Dyn = Mat<Mut<'b, T>>

matrix type with type erased dimensions
Source§

type Index = (<Rows as ShapeIdx>::Idx<usize>, <Cols as ShapeIdx>::Idx<usize>)

indexing type
Source§

type Item = &'b mut T

item produced by the zip views
Source§

type LayoutTransform = MatLayoutTransform

layout transformation type
Source§

type Rows = Rows

type of rows
Source§

type Slice = SliceMut<'b, T>

Source§

fn nrows(this: &Self) -> Self::Rows

returns the number of rows
Source§

fn ncols(this: &Self) -> Self::Cols

returns the number of columns
Source§

unsafe fn get_slice_unchecked<'a>( this: &'a mut Self, idx: Self::Index, n_elems: usize, ) -> <Self::Slice as SliceFamily<'a, Self::Item>>::Slice

returns slice at index of length n_elems
Source§

unsafe fn from_dyn_idx(idx: <Self::Dyn as MatIndex>::Index) -> Self::Index

converts a type erased index back to its original representation
Source§

unsafe fn get_unchecked(this: &mut Self, (i, j): Self::Index) -> Self::Item

get the item at the given index, skipping bound checks
Source§

unsafe fn next_unchecked<'a>( slice: &mut <Self::Slice as SliceFamily<'a, Self::Item>>::Slice, ) -> Self::Item

get the item at the given slice position, skipping bound checks
Source§

fn is_contiguous(this: &Self) -> bool

checks if the zip matrices are contiguous
Source§

fn preferred_layout(this: &Self) -> Self::LayoutTransform

computes the preferred iteration layout of the matrices
Source§

fn with_layout(this: Self, layout: Self::LayoutTransform) -> Self::Dyn

applies the layout transformation to the matrices
Source§

impl<T: ComplexField, ViewT: Conjugate<Canonical = T>> Precond<T> for MatMut<'_, ViewT>

Source§

fn apply_in_place_scratch(&self, rhs_ncols: usize, par: Par) -> StackReq

computes the workspace size and alignment required to apply self or the conjugate of self to a matrix with rhs_ncols columns in place
Source§

fn apply_in_place(&self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack)

applies self to rhs, and stores the result in rhs
Source§

fn conj_apply_in_place( &self, rhs: MatMut<'_, T>, par: Par, stack: &mut MemStack, )

applies the conjugate of self to rhs, and stores the result in rhs