MatRef

Type Alias MatRef 

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

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

§Note

unlike a slice, the data pointed to by MatRef<'_, 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

Aliased Type§

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

Tuple Fields§

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

Implementations§

Source§

impl<'a, T> MatRef<'a, T>

Source

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

equivalent to MatRef::from_row_major_slice(array.as_flattened(), ROWS, COLS)

Source

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

equivalent to MatRef::from_column_major_slice(array.as_flattened(), ROWS, COLS)

Source

pub fn from_ref(value: &'a T) -> Self

creates a 1×1 view over the given element

Source§

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

Source

pub fn from_repeated_ref(value: &'a T, nrows: Rows, ncols: Cols) -> Self

creates a MatRef from a view over a single element, repeated nrows×ncols times

Source

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

creates a MatRef 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::{MatRef, mat};

let slice = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0_f64];
let view = MatRef::from_column_major_slice(&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( slice: &'a [T], nrows: Rows, ncols: Cols, col_stride: usize, ) -> Self

creates a MatRef 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(slice: &'a [T], nrows: Rows, ncols: Cols) -> Self

creates a MatRef 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::{MatRef, mat};

let slice = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0_f64];
let view = MatRef::from_row_major_slice(&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( slice: &'a [T], nrows: Rows, ncols: Cols, row_stride: usize, ) -> Self

creates a MatRef 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, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> MatRef<'a, T, Rows, Cols, RStride, CStride>

Source

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

creates a MatRef 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 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 mutable aliasing is allowed. in other words, none of the elements accessible by any matrix unit may be accessed for writes by any other means for the duration of the lifetime 'a
§example
use faer::{MatRef, 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 data = [[1.0, 2.0, 3.0, f64::NAN], [4.0, 5.0, 6.0, f64::NAN]];
let matrix = unsafe { MatRef::from_raw_parts(data.as_ptr() as *const 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>)

splits the matrix horizontally and vertically at the given index into four corners and returns an array of each submatrix, in the following order:

  • top left
  • top right
  • bottom left
  • bottom right
§safety

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

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

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

splits the matrix horizontally at the given row into two parts and returns an array of each submatrix, in the following order:

  • top
  • bottom
§panics

the function panics if the following condition is violated:

  • row <= self.nrows()
Source

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

splits the matrix vertically at the given column into two parts and returns an array of each submatrix, in the following order:

  • left
  • right
§panics

the function panics if the following condition is violated:

  • col <= self.ncols()
Source

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

returns a view over the transpose of self

§example
use faer::mat;

let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let transpose = view.transpose();

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

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

returns a view over the conjugate of self

Source

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

returns an unconjugated view over self

Source

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

returns a view over the conjugate transpose of self.

Source

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

returns a view over the self, with the rows in reversed order

§example
use faer::mat;

let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let reversed_rows = view.reverse_rows();

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

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

returns a view over the self, with the columns in reversed order

§example
use faer::mat;

let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let reversed_cols = view.reverse_cols();

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

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

returns a view over the self, with the rows and the columns in reversed order

§example
use faer::mat;

let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let reversed = view.reverse_rows_and_cols();

let expected = mat![[6.0, 5.0, 4.0], [3.0, 2.0, 1.0]];
assert_eq!(expected.as_ref(), reversed);
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>

returns a view over the submatrix starting at index (row_start, col_start), and with dimensions (nrows, ncols)

§panics

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

  • row_start <= self.nrows()
  • col_start <= self.ncols()
  • nrows <= self.nrows() - row_start
  • ncols <= self.ncols() - col_start
§example
use faer::mat;

let matrix = mat![
	[1.0, 5.0, 9.0], //
	[2.0, 6.0, 10.0],
	[3.0, 7.0, 11.0],
	[4.0, 8.0, 12.0f64],
];

let view = matrix.as_ref();
let submatrix = view.submatrix(
	/* row_start: */ 2, /* col_start: */ 1, /* nrows: */ 2, /* ncols: */ 2,
);

let expected = mat![[7.0, 11.0], [8.0, 12.0f64]];
assert_eq!(expected.as_ref(), submatrix);
Source

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

returns a view over the submatrix starting at row row_start, and with number of rows nrows

§panics

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

  • row_start <= self.nrows()
  • nrows <= self.nrows() - row_start
§example
use faer::mat;

let matrix = mat![
	[1.0, 5.0, 9.0], //
	[2.0, 6.0, 10.0],
	[3.0, 7.0, 11.0],
	[4.0, 8.0, 12.0f64],
];

let view = matrix.as_ref();
let subrows = view.subrows(/* row_start: */ 1, /* nrows: */ 2);

let expected = mat![[2.0, 6.0, 10.0], [3.0, 7.0, 11.0],];
assert_eq!(expected.as_ref(), subrows);
Source

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

returns a view over the submatrix starting at column col_start, and with number of columns ncols

§panics

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

  • col_start <= self.ncols()
  • ncols <= self.ncols() - col_start
§example
use faer::mat;

let matrix = mat![
	[1.0, 5.0, 9.0], //
	[2.0, 6.0, 10.0],
	[3.0, 7.0, 11.0],
	[4.0, 8.0, 12.0f64],
];

let view = matrix.as_ref();
let subcols = view.subcols(/* col_start: */ 2, /* ncols: */ 1);

let expected = mat![[9.0], [10.0], [11.0], [12.0f64]];
assert_eq!(expected.as_ref(), subcols);
Source

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

returns the input matrix with the given shape after checking that it matches the current shape

Source

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

returns the input matrix with the given row shape after checking that it matches the current row shape

Source

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

returns the input matrix with the given column shape after checking that it matches the current column shape

Source

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

returns the input matrix with dynamic stride

Source

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

returns the input matrix with dynamic shape

Source

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

returns the input matrix with dynamic row shape

Source

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

returns the input matrix with dynamic column shape

Source

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

returns a view over the row at the given index

§panics

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

  • row_idx < self.nrows()
Source

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

returns a view over the column at the given index

§panics

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

  • col_idx < self.ncols()
Source

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

returns an iterator over the columns of the matrix

Source

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

returns an iterator over the rows of the matrix

Source

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

returns a parallel iterator over the columns of the matrix

Source

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

returns a parallel iterator over the rows of the matrix

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,

returns a parallel iterator that provides successive chunks of the columns of this matrix, with each having at most chunk_size columns

if the number of columns is a multiple of chunk_size, then all chunks have chunk_size columns

only available with the rayon feature

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,

returns a parallel iterator that provides exactly count successive chunks of the columns of this matrix

only available with the rayon feature

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,

returns a parallel iterator that provides successive chunks of the rows of this matrix, with each having at most chunk_size rows

if the number of rows is a multiple of chunk_size, then all chunks have chunk_size rows

only available with the rayon feature

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,

returns a parallel iterator that provides exactly count successive chunks of the rows of this matrix

only available with the rayon feature

Source

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

returns a reference to the first row and a view over the remaining ones if the matrix has at least one row, otherwise None

Source

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

returns a reference to the first column and a view over the remaining ones if the matrix has at least one column, otherwise None

Source

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

returns a reference to the last row and a view over the remaining ones if the matrix has at least one row, otherwise None

Source

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

returns a reference to the last column and a view over the remaining ones if the matrix has at least one column, otherwise None

Source

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

returns a view over the matrix with a static column stride equal to +1, or None otherwise

Source

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

returns a view over the matrix with a static row stride equal to +1, or None otherwise

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>,

returns references to the element at the given index, or submatrices if either row or col is a range, with bound checks

§panics

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

  • row must be contained in [0, self.nrows())
  • col must be contained in [0, self.ncols())
Source

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

equivalent to self.get(row, ..)

Source

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

equivalent to self.get(.., col)

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>,

returns references to the element at the given index, or submatrices if either row or col is a range, without bound checks

§safety

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

  • row must be contained in [0, self.nrows())
  • col must be contained in [0, self.ncols())
Source§

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

Source

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

returns the diagonal of the matrix

Source§

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

Source

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

Returns the maximum element in the matrix

§Returns
  • Option<T> - The maximum element in the matrix, or None if the matrix is empty
§Examples
use faer::{Mat, mat};

let m = mat![[1.0, 5.0, 3.0], [4.0, 2.0, 9.0], [7.0, 8.0, 6.0],];

assert_eq!(m.max(), Some(9.0));

let empty: Mat<f64> = Mat::new();
assert_eq!(empty.max(), None);
Source

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

Returns the minimum element in the matrix

§Returns
  • Option<T> - The minimum element in the matrix, or None if the matrix is empty
§Examples
use faer::{Mat, mat};

let m = mat![[1.0, 5.0, 3.0], [4.0, 2.0, 9.0], [7.0, 8.0, 6.0],];

assert_eq!(m.min(), Some(1.0));

let empty: Mat<f64> = Mat::new();
assert_eq!(empty.min(), None);

Trait Implementations§

Source§

impl<T, Rows: Shape, Cols: Shape, RStride: Stride, CStride: Stride> AsMatRef for MatRef<'_, 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 MatRef<'_, ViewT>

Source§

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

computes the workspace layout 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 MatRef<'_, ViewT>

Source§

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

computes the workspace layout 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 MatRef<'_, 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 MatRef<'_, 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 MatRef<'a, 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<T: ComplexField, ViewT: Conjugate<Canonical = T>> LinOp<T> for MatRef<'_, 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 layout 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 MatRef<'a, T, Dim<'M>, Dim<'N>, Rs, Cs>

Source§

type Target = &'a 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 MatRef<'a, T, Dim<'M>, usize, Rs, Cs>

Source§

type Target = &'a 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 MatRef<'a, T, Dim<'N>, C, Rs, Cs>

Source§

type Target = Row<Ref<'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 MatRef<'a, T, usize, Dim<'N>, Rs, Cs>

Source§

type Target = &'a 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 MatRef<'a, T, usize, usize, Rs, Cs>

Source§

type Target = &'a 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 MatRef<'a, T, usize, C, Rs, Cs>

Source§

type Target = Row<Ref<'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 MatRef<'a, T, R, Dim<'N>, Rs, Cs>

Source§

type Target = Col<Ref<'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 MatRef<'a, T, R, usize, Rs, Cs>

Source§

type Target = Col<Ref<'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 MatRef<'a, T, R, C, Rs, Cs>

Source§

type Target = Mat<Ref<'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 MatRef<'b, T, Rows, Cols, RStride, CStride>

Source§

type Cols = Cols

type of columns
Source§

type Dyn = Mat<Ref<'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 T

item produced by the zip views
Source§

type Kind = Mat

Source§

type LayoutTransform = MatLayoutTransform

layout transformation type
Source§

type Rows = Rows

type of rows
Source§

type Slice = SliceRef<'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 MatRef<'_, ViewT>

Source§

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

computes the workspace layout 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