Col

Type Alias Col 

Source
pub type Col<T, Rows = usize> = Col<Own<T, Rows>>;
Expand description

heap allocated resizable column vector.

§note

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

Aliased Type§

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

Tuple Fields§

§0: Own<T, Rows>

Implementations§

Source§

impl<T, Rows: Shape> Col<T, Rows>

Source

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

returns a new column with dimension nrows, filled with the provided function

Source

pub fn zeros(nrows: Rows) -> Self
where T: ComplexField,

returns a new column with dimension nrows, filled with zeros

Source

pub fn ones(nrows: Rows) -> Self
where T: ComplexField,

returns a new column with dimension nrows, filled with ones

Source

pub fn full(nrows: Rows, value: T) -> Self
where T: Clone,

returns a new column with dimension nrows, filled with value

Source

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

reserves the minimum capacity for row_capacity rows 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 row_capacity rows without reallocating. does nothing if the capacity is already sufficient

Source

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

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

Source

pub fn truncate(&mut self, new_nrows: Rows)

truncates the column so that its new dimensions are new_nrows.
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_nrows > self.nrows()
Source

pub fn into_row_shape<V: Shape>(self, nrows: V) -> Col<T, V>

Source

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

Source

pub fn into_transpose(self) -> Row<T, Rows>

Source§

impl<T, Rows: Shape> Col<T, Rows>

Source

pub fn nrows(&self) -> Rows

returns the number of rows of the column

Source

pub fn ncols(&self) -> usize

returns the number of columns of the column (always 1)

Source§

impl<T, Rows: Shape> Col<T, Rows>

Source

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

Source

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

Source

pub fn row_stride(&self) -> isize

Source

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

Source

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

Source

pub fn split_at_row( &self, row: IdxInc<Rows>, ) -> (ColRef<'_, T, usize>, ColRef<'_, T, usize>)

Source

pub fn transpose(&self) -> RowRef<'_, T, Rows>

Source

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

Source

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

Source

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

Source

pub fn get<RowRange>( &self, row: RowRange, ) -> <ColRef<'_, T, Rows> as ColIndex<RowRange>>::Target
where for<'a> ColRef<'a, T, Rows>: ColIndex<RowRange>,

Source

pub unsafe fn get_unchecked<RowRange>( &self, row: RowRange, ) -> <ColRef<'_, T, Rows> as ColIndex<RowRange>>::Target
where for<'a> ColRef<'a, T, Rows>: ColIndex<RowRange>,

Source

pub fn reverse_rows(&self) -> ColRef<'_, T, Rows>

Source

pub fn subrows<V: Shape>( &self, row_start: IdxInc<Rows>, nrows: V, ) -> ColRef<'_, T, V>

Source

pub fn as_row_shape<V: Shape>(&self, nrows: V) -> ColRef<'_, T, V>

Source

pub fn as_dyn_rows(&self) -> ColRef<'_, T, usize>

Source

pub fn as_dyn_stride(&self) -> ColRef<'_, T, Rows, 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 par_partition( &self, count: usize, ) -> impl '_ + IndexedParallelIterator<Item = ColRef<'_, T, usize>>
where T: Sync,

Source

pub fn try_as_col_major(&self) -> Option<ColRef<'_, T, Rows, ContiguousFwd>>

Source

pub fn try_as_col_major_mut( &mut self, ) -> Option<ColMut<'_, T, Rows, ContiguousFwd>>

Source

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

Source

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

Source

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

Source§

impl<T, Rows: Shape> Col<T, Rows>

Source

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

Source

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

Source

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

Source

pub fn split_at_row_mut( &mut self, row: IdxInc<Rows>, ) -> (ColMut<'_, T, usize>, ColMut<'_, T, usize>)

Source

pub fn transpose_mut(&mut self) -> RowMut<'_, T, Rows>

Source

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

Source

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

Source

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

Source

pub fn get_mut<RowRange>( &mut self, row: RowRange, ) -> <ColMut<'_, T, Rows> as ColIndex<RowRange>>::Target
where for<'a> ColMut<'a, T, Rows>: ColIndex<RowRange>,

Source

pub unsafe fn get_mut_unchecked<RowRange>( &mut self, row: RowRange, ) -> <ColMut<'_, T, Rows> as ColIndex<RowRange>>::Target
where for<'a> ColMut<'a, T, Rows>: ColIndex<RowRange>,

Source

pub fn reverse_rows_mut(&mut self) -> ColMut<'_, T, Rows>

Source

pub fn subrows_mut<V: Shape>( &mut self, row_start: IdxInc<Rows>, nrows: V, ) -> ColMut<'_, T, V>

Source

pub fn as_row_shape_mut<V: Shape>(&mut self, nrows: V) -> ColMut<'_, T, V>

Source

pub fn as_dyn_rows_mut(&mut self) -> ColMut<'_, T, usize>

Source

pub fn as_dyn_stride_mut(&mut self) -> ColMut<'_, T, Rows, 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 par_partition_mut( &mut self, count: usize, ) -> impl '_ + IndexedParallelIterator<Item = ColMut<'_, T, usize>>
where T: Send,

Source

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

Source§

impl<T, Rows: Shape> Col<T, Rows>
where T: RealField,

Source

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

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

Source

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

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

Trait Implementations§

Source§

impl<T, Rows: Shape> AsMat<T> for Col<T, Rows>

Source§

fn zeros(rows: Rows, _: One) -> Self
where T: ComplexField,

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

fn truncate(&mut self, rows: Self::Rows, _: One)

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

impl<T, Rows: Shape> AsMatMut for Col<T, Rows>

Source§

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

returns a view over self
Source§

impl<T, Rows: Shape> AsMatRef for Col<T, Rows>

Source§

type Cols = One

column dimension type
Source§

type Owned = Col<Own<T, Rows>>

owned matrix type
Source§

type Rows = Rows

row dimension type
Source§

type T = T

scalar type
Source§

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

returns a view over self
Source§

impl<T> FromIterator<T> for Col<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 Col<T, Len>

Source§

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

Source§

fn into_view(self) -> Self::Target

Source§

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

Source§

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

Source§

fn into_view(self) -> Self::Target