Row

Type Alias Row 

Source
pub type Row<T, Cols = usize> = Row<Own<T, Cols>>;
Expand description

heap allocated resizable row vector.

§note

the memory layout of Row is guaranteed to be row-major, meaning that it has a column stride of 1.

Aliased Type§

#[repr(transparent)]
pub struct Row<T, Cols = usize>(pub Own<T, Cols>);

Tuple Fields§

§0: Own<T, Cols>

Implementations§

Source§

impl<T, Cols: Shape> Row<T, Cols>

Source

pub fn from_fn(ncols: Cols, f: impl FnMut(Idx<Cols>) -> T) -> Self

returns a new row with dimension ncols, filled with the provided function

Source

pub fn zeros(ncols: Cols) -> Self
where T: ComplexField,

returns a new row with dimension ncols, filled with zeros

Source

pub fn ones(ncols: Cols) -> Self
where T: ComplexField,

returns a new row with dimension ncols, filled with ones

Source

pub fn full(ncols: Cols, value: T) -> Self
where T: Clone,

returns a new row with dimension ncols, filled with value

Source

pub fn try_reserve( &mut self, new_row_capacity: usize, ) -> Result<(), TryReserveError>

reserves the minimum capacity for col_capacity columns without reallocating, or returns an error in case of failure. does nothing if the capacity is already sufficient

Source

pub fn reserve(&mut self, new_row_capacity: usize)

reserves the minimum capacity for col_capacity columns without reallocating. does nothing if the capacity is already sufficient

Source

pub fn resize_with(&mut self, new_ncols: Cols, f: impl FnMut(Idx<Cols>) -> T)

resizes the row in-place so that the new dimension is new_ncols. new elements are created with the given function f, so that elements at index j are created by calling f(j)

Source

pub fn truncate(&mut self, new_ncols: Cols)

truncates the row so that its new dimensions are new_ncols.
the new dimension must be smaller than or equal to the current dimension

§panics

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

  • new_ncols > self.ncols()
Source

pub fn into_col_shape<V: Shape>(self, ncols: V) -> Row<T, V>

Source

pub fn into_diagonal(self) -> Diag<T, Cols>

Source

pub fn into_transpose(self) -> Col<T, Cols>

Source§

impl<T, Cols: Shape> Row<T, Cols>

Source

pub fn nrows(&self) -> usize

returns the number of rows of the row (always 1)

Source

pub fn ncols(&self) -> Cols

returns the number of columns of the row

Source§

impl<T, Cols: Shape> Row<T, Cols>

Source

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

Source

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

Source

pub fn col_stride(&self) -> isize

Source

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

Source

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

Source

pub fn split_at_col( &self, col: IdxInc<Cols>, ) -> (RowRef<'_, T, usize>, RowRef<'_, T, usize>)

Source

pub fn transpose(&self) -> ColRef<'_, T, Cols>

Source

pub fn conjugate(&self) -> RowRef<'_, T::Conj, Cols>
where T: Conjugate,

Source

pub fn canonical(&self) -> RowRef<'_, T::Canonical, Cols>
where T: Conjugate,

Source

pub fn adjoint(&self) -> ColRef<'_, T::Conj, Cols>
where T: Conjugate,

Source

pub fn get<ColRange>( &self, col: ColRange, ) -> <RowRef<'_, T, Cols> as RowIndex<ColRange>>::Target
where for<'a> RowRef<'a, T, Cols>: RowIndex<ColRange>,

Source

pub unsafe fn get_unchecked<ColRange>( &self, col: ColRange, ) -> <RowRef<'_, T, Cols> as RowIndex<ColRange>>::Target
where for<'a> RowRef<'a, T, Cols>: RowIndex<ColRange>,

Source

pub fn reverse_cols(&self) -> RowRef<'_, T, Cols>

Source

pub fn subcols<V: Shape>( &self, col_start: IdxInc<Cols>, ncols: V, ) -> RowRef<'_, T, V>

Source

pub fn as_col_shape<V: Shape>(&self, ncols: V) -> RowRef<'_, T, V>

Source

pub fn as_dyn_cols(&self) -> RowRef<'_, T, usize>

Source

pub fn as_dyn_stride(&self) -> RowRef<'_, T, Cols, isize>

Source

pub fn iter( &self, ) -> impl '_ + ExactSizeIterator + DoubleEndedIterator<Item = &T>

Source

pub fn par_iter(&self) -> impl '_ + IndexedParallelIterator<Item = &T>
where T: Sync,

Source

pub fn try_as_row_major(&self) -> Option<RowRef<'_, T, Cols, ContiguousFwd>>

Source

pub fn as_diagonal(&self) -> DiagRef<'_, T, Cols>

Source

pub unsafe fn const_cast(&self) -> RowMut<'_, T, Cols>

Source

pub fn as_mat(&self) -> MatRef<'_, T, usize, Cols, isize>

Source

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

Source§

impl<T, Cols: Shape> Row<T, Cols>

Source

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

Source

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

Source

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

Source

pub fn split_at_col_mut( &mut self, col: IdxInc<Cols>, ) -> (RowMut<'_, T, usize>, RowMut<'_, T, usize>)

Source

pub fn transpose_mut(&mut self) -> ColMut<'_, T, Cols>

Source

pub fn conjugate_mut(&mut self) -> RowMut<'_, T::Conj, Cols>
where T: Conjugate,

Source

pub fn canonical_mut(&mut self) -> RowMut<'_, T::Canonical, Cols>
where T: Conjugate,

Source

pub fn adjoint_mut(&mut self) -> ColMut<'_, T::Conj, Cols>
where T: Conjugate,

Source

pub fn get_mut<ColRange>( &mut self, col: ColRange, ) -> <RowMut<'_, T, Cols> as RowIndex<ColRange>>::Target
where for<'a> RowMut<'a, T, Cols>: RowIndex<ColRange>,

Source

pub unsafe fn get_mut_unchecked<ColRange>( &mut self, col: ColRange, ) -> <RowMut<'_, T, Cols> as RowIndex<ColRange>>::Target
where for<'a> RowMut<'a, T, Cols>: RowIndex<ColRange>,

Source

pub fn reverse_cols_mut(&mut self) -> RowMut<'_, T, Cols>

Source

pub fn subcols_mut<V: Shape>( &mut self, col_start: IdxInc<Cols>, ncols: V, ) -> RowMut<'_, T, V>

Source

pub fn as_col_shape_mut<V: Shape>(&mut self, ncols: V) -> RowMut<'_, T, V>

Source

pub fn as_dyn_cols_mut(&mut self) -> RowMut<'_, T, usize>

Source

pub fn as_dyn_stride_mut(&mut self) -> RowMut<'_, T, Cols, isize>

Source

pub fn iter_mut( &mut self, ) -> impl '_ + ExactSizeIterator + DoubleEndedIterator<Item = &mut T>

Source

pub fn par_iter_mut( &mut self, ) -> impl '_ + IndexedParallelIterator<Item = &mut T>
where T: Send,

Source

pub fn try_as_row_major_mut( &mut self, ) -> Option<RowMut<'_, T, Cols, ContiguousFwd>>

Source

pub fn as_diagonal_mut(&mut self) -> DiagMut<'_, T, Cols>

Source§

impl<T, Cols: Shape> Row<T, Cols>
where T: RealField,

Source

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

Returns the maximum element in the row, or None if the row is empty

Source

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

Returns the minimum element in the row, or None if the row is empty

Trait Implementations§

Source§

impl<T, Cols: Shape> AsMat<T> for Row<T, Cols>

Source§

fn zeros(_: One, cols: Cols) -> Self
where T: ComplexField,

returns a matrix with dimensions (rows, cols) filled with zeros
Source§

fn truncate(&mut self, _: One, cols: Self::Cols)

returns a matrix with dimensions (rows, cols) filled with zeros
Source§

impl<T, Cols: Shape> AsMatMut for Row<T, Cols>

Source§

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

returns a view over self
Source§

impl<T, Cols: Shape> AsMatRef for Row<T, Cols>

Source§

type Cols = Cols

column dimension type
Source§

type Owned = Row<Own<T, Cols>>

owned matrix type
Source§

type Rows = One

row dimension type
Source§

type T = T

scalar type
Source§

fn as_mat_ref(&self) -> MatRef<'_, Self::T, One, Self::Cols>

returns a view over self
Source§

impl<T> FromIterator<T> for Row<T>

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl<'a, T, Len: Shape> IntoView for &'a Row<T, Len>

Source§

type Target = Row<Ref<'a, T, Len, ContiguousFwd>>

Source§

fn into_view(self) -> Self::Target

Source§

impl<'a, T, Len: Shape> IntoView for &'a mut Row<T, Len>

Source§

type Target = Row<Mut<'a, T, Len, ContiguousFwd>>

Source§

fn into_view(self) -> Self::Target