pub type ColRef<'a, E> = Matrix<DenseColRef<'a, E>>;
Expand description
Immutable view over a column vector, similar to an immutable reference to a strided slice.
§Note
Unlike a slice, the data pointed to by ColRef<'_, E>
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, or form references to them, either directly
through ColRef::read
, or indirectly through any of the numerical library routines, unless
it is explicitly permitted.
Aliased Type§
struct ColRef<'a, E> { /* private fields */ }
Implementations§
source§impl<'a, E: Entity> ColRef<'a, E>
impl<'a, E: Entity> ColRef<'a, E>
sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of columns of the column. This is always equal to 1
.
sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the row stride of the matrix, specified in number of elements, not in bytes.
sourcepub fn ptr_at(self, row: usize) -> GroupFor<E, *const E::Unit>
pub fn ptr_at(self, row: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given index.
sourcepub unsafe fn ptr_inbounds_at(self, row: usize) -> GroupFor<E, *const E::Unit>
pub unsafe fn ptr_inbounds_at(self, row: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given index, assuming the provided index is within the size of the vector.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
sourcepub unsafe fn split_at_unchecked(self, row: usize) -> (Self, Self)
pub unsafe fn split_at_unchecked(self, row: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Safety
The behavior is undefined if any of the following conditions are violated:
row <= self.nrows()
.
sourcepub unsafe fn split_at(self, row: usize) -> (Self, Self)
pub unsafe fn split_at(self, row: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Panics
The function panics if any of the following conditions are violated:
row <= self.nrows()
.
sourcepub unsafe fn get_unchecked<RowRange>(
self,
row: RowRange
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
pub unsafe fn get_unchecked<RowRange>(
self,
row: RowRange
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
Returns references to the element at the given index, or subvector if row
is a
range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
sourcepub fn get<RowRange>(
self,
row: RowRange
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
pub fn get<RowRange>(
self,
row: RowRange
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
Returns references to the element at the given index, or subvector if row
is a
range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
sourcepub unsafe fn read_unchecked(&self, row: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
sourcepub fn read(&self, row: usize) -> E
pub fn read(&self, row: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.
sourcepub fn conjugate(self) -> ColRef<'a, E::Conj>where
E: Conjugate,
pub fn conjugate(self) -> ColRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
sourcepub fn adjoint(self) -> RowRef<'a, E::Conj>where
E: Conjugate,
pub fn adjoint(self) -> RowRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
sourcepub fn canonicalize(self) -> (ColRef<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize(self) -> (ColRef<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
sourcepub fn reverse_rows(self) -> Self
pub fn reverse_rows(self) -> Self
Returns a view over the self
, with the rows in reversed order.
sourcepub unsafe fn subrows_unchecked(self, row_start: usize, nrows: usize) -> Self
pub unsafe fn subrows_unchecked(self, row_start: usize, nrows: usize) -> Self
Returns a view over the subvector starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
sourcepub fn subrows(self, row_start: usize, nrows: usize) -> Self
pub fn subrows(self, row_start: usize, nrows: usize) -> Self
Returns a view over the subvector starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
sourcepub fn column_vector_as_diagonal(self) -> Matrix<DiagRef<'a, E>>
pub fn column_vector_as_diagonal(self) -> Matrix<DiagRef<'a, E>>
Given a matrix with a single column, returns an object that interprets the column as a diagonal matrix, whoes diagonal elements are values in the column.
sourcepub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
Returns an owning Col
of the data.
sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Trait Implementations§
source§impl<E: Entity> AsColRef<E> for &ColRef<'_, E>
impl<E: Entity> AsColRef<E> for &ColRef<'_, E>
source§fn as_col_ref(&self) -> ColRef<'_, E>
fn as_col_ref(&self) -> ColRef<'_, E>
source§impl<E: Entity> AsColRef<E> for ColRef<'_, E>
impl<E: Entity> AsColRef<E> for ColRef<'_, E>
source§fn as_col_ref(&self) -> ColRef<'_, E>
fn as_col_ref(&self) -> ColRef<'_, E>
source§impl<E: Entity> ColIndex<RangeInclusive<usize>> for ColRef<'_, E>
impl<E: Entity> ColIndex<RangeInclusive<usize>> for ColRef<'_, E>
§type Target = Matrix<DenseColRef<'_, E>>
type Target = Matrix<DenseColRef<'_, E>>
source§fn get(this: Self, row: RangeInclusive<usize>) -> Self
fn get(this: Self, row: RangeInclusive<usize>) -> Self
row
.source§unsafe fn get_unchecked(this: Self, row: RowRange) -> Self::Target
unsafe fn get_unchecked(this: Self, row: RowRange) -> Self::Target
row
, without bound checks.source§impl<E: Entity> ColIndex<RangeToInclusive<usize>> for ColRef<'_, E>
impl<E: Entity> ColIndex<RangeToInclusive<usize>> for ColRef<'_, E>
§type Target = Matrix<DenseColRef<'_, E>>
type Target = Matrix<DenseColRef<'_, E>>
source§fn get(this: Self, row: RangeToInclusive<usize>) -> Self
fn get(this: Self, row: RangeToInclusive<usize>) -> Self
row
.source§unsafe fn get_unchecked(this: Self, row: RowRange) -> Self::Target
unsafe fn get_unchecked(this: Self, row: RowRange) -> Self::Target
row
, without bound checks.