Type Alias faer_core::ColRef

source ·
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>

source

pub fn nrows(&self) -> usize

Returns the number of rows of the column.

source

pub fn ncols(&self) -> usize

Returns the number of columns of the column. This is always equal to 1.

source

pub fn as_ptr(self) -> GroupFor<E, *const E::Unit>

Returns pointers to the matrix data.

source

pub fn row_stride(&self) -> isize

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

source

pub fn as_2d(self) -> MatRef<'a, E>

Returns self as a matrix view.

source

pub fn ptr_at(self, row: usize) -> GroupFor<E, *const E::Unit>

Returns raw pointers to the element at the given index.

source

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().
source

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().
source

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().
source

pub unsafe fn get_unchecked<RowRange>( self, row: RowRange ) -> <Self as ColIndex<RowRange>>::Target
where 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()).
source

pub fn get<RowRange>( self, row: RowRange ) -> <Self as ColIndex<RowRange>>::Target
where 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()).
source

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().
source

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().
source

pub fn transpose(self) -> RowRef<'a, E>

Returns a view over the transpose of self.

source

pub fn conjugate(self) -> ColRef<'a, E::Conj>
where E: Conjugate,

Returns a view over the conjugate of self.

source

pub fn adjoint(self) -> RowRef<'a, E::Conj>
where E: Conjugate,

Returns a view over the conjugate transpose of self.

source

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.

source

pub fn reverse_rows(self) -> Self

Returns a view over the self, with the rows in reversed order.

source

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.
source

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.
source

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.

source

pub fn to_owned(&self) -> Col<E::Canonical>
where E: Conjugate,

Returns an owning Col of the data.

source

pub fn has_nan(&self) -> bool
where E: ComplexField,

Returns true if any of the elements is NaN, otherwise returns false.

source

pub fn is_all_finite(&self) -> bool
where E: ComplexField,

Returns true if all of the elements are finite, otherwise returns false.

source

pub fn norm_max(&self) -> E::Real
where E: ComplexField,

Returns the maximum norm of self.

source

pub fn norm_l2(&self) -> E::Real
where E: ComplexField,

Returns the L2 norm of self.

source

pub fn sum(&self) -> E
where E: ComplexField,

Returns the sum of self.

source

pub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>
where E: ComplexField,

Kroneckor product of self and rhs.

This is an allocating operation; see kron for the allocation-free version or more info in general.

source

pub fn as_ref(&self) -> ColRef<'_, E>

Returns a view over the matrix.

Trait Implementations§

source§

impl<E: Entity> As2D<E> for &ColRef<'_, E>

source§

fn as_2d_ref(&self) -> MatRef<'_, E>

Convert to a 2D matrix view.
source§

impl<E: Entity> As2D<E> for ColRef<'_, E>

source§

fn as_2d_ref(&self) -> MatRef<'_, E>

Convert to a 2D matrix view.
source§

impl<E: Entity> AsColRef<E> for &ColRef<'_, E>

source§

fn as_col_ref(&self) -> ColRef<'_, E>

Convert to a column view.
source§

impl<E: Entity> AsColRef<E> for ColRef<'_, E>

source§

fn as_col_ref(&self) -> ColRef<'_, E>

Convert to a column view.
source§

impl<E: Entity> ColIndex<Range<usize>> for ColRef<'_, E>

§

type Target = Matrix<DenseColRef<'_, E>>

Resulting type of the indexing operation.
source§

fn get(this: Self, row: Range<usize>) -> Self

Index the column at row.
source§

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

Index the column at row, without bound checks.
source§

impl<E: Entity> ColIndex<RangeFrom<usize>> for ColRef<'_, E>

§

type Target = Matrix<DenseColRef<'_, E>>

Resulting type of the indexing operation.
source§

fn get(this: Self, row: RangeFrom<usize>) -> Self

Index the column at row.
source§

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

Index the column at row, without bound checks.
source§

impl<E: Entity> ColIndex<RangeFull> for ColRef<'_, E>

§

type Target = Matrix<DenseColRef<'_, E>>

Resulting type of the indexing operation.
source§

fn get(this: Self, row: RangeFull) -> Self

Index the column at row.
source§

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

Index the column at row, without bound checks.
source§

impl<E: Entity> ColIndex<RangeInclusive<usize>> for ColRef<'_, E>

§

type Target = Matrix<DenseColRef<'_, E>>

Resulting type of the indexing operation.
source§

fn get(this: Self, row: RangeInclusive<usize>) -> Self

Index the column at row.
source§

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

Index the column at row, without bound checks.
source§

impl<E: Entity> ColIndex<RangeTo<usize>> for ColRef<'_, E>

§

type Target = Matrix<DenseColRef<'_, E>>

Resulting type of the indexing operation.
source§

fn get(this: Self, row: RangeTo<usize>) -> Self

Index the column at row.
source§

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

Index the column at row, without bound checks.
source§

impl<E: Entity> ColIndex<RangeToInclusive<usize>> for ColRef<'_, E>

§

type Target = Matrix<DenseColRef<'_, E>>

Resulting type of the indexing operation.
source§

fn get(this: Self, row: RangeToInclusive<usize>) -> Self

Index the column at row.
source§

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

Index the column at row, without bound checks.
source§

impl<'a, E: Entity> ColIndex<usize> for ColRef<'a, E>

§

type Target = <<E as Entity>::Group as ForType>::FaerOf<&'a <E as Entity>::Unit>

Resulting type of the indexing operation.
source§

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

Index the column at row, without bound checks.
source§

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

Index the column at row.
source§

impl<'a, E: Entity> Debug for ColRef<'a, E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: SimpleEntity> Index<usize> for ColRef<'_, E>

§

type Output = E

The returned type after indexing.
source§

fn index(&self, row: usize) -> &E

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, E: Entity> IntoConst for ColRef<'a, E>

§

type Target = Matrix<DenseColRef<'a, E>>

source§

fn into_const(self) -> Self::Target

source§

impl<'a, E: Entity> MatIndex<'a> for ColRef<'_, E>

§

type Item = Read<'a, E>

Item produced by the zipped views.
source§

unsafe fn get_unchecked(&'a mut self, (i, _): Self::Index) -> Self::Item

Get the item at the given index, skipping bound checks.
source§

unsafe fn get_from_slice_unchecked( slice: &'a mut Self::Slice, idx: usize ) -> Self::Item

Get the item at the given slice position, skipping bound checks.
source§

fn is_contiguous(&self) -> bool

Checks if the zipped matrices are contiguous.
source§

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

Computes the preferred iteration layout of the matrices.
source§

fn with_layout(self, layout: Self::LayoutTransform) -> Self

Applies the layout transformation to the matrices.
source§

impl<E: Entity> MatShape for ColRef<'_, E>

§

type Rows = usize

Type of rows.
§

type Cols = ()

Type of columns.
source§

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

Returns the number of rows.
source§

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

Returns the number of columns.
source§

impl<E: Entity> MaybeContiguous for ColRef<'_, E>

§

type Index = (usize, ())

Indexing type.
§

type Slice = <<E as Entity>::Group as ForType>::FaerOf<&'static [MaybeUninit<<E as Entity>::Unit>]>

Contiguous slice type.
§

type LayoutTransform = VecLayoutTransform

Layout transformation type.
source§

unsafe fn get_slice_unchecked( &mut self, (i, _): Self::Index, n_elems: usize ) -> Self::Slice

Returns slice at index of length n_elems.
source§

impl<'short, 'a, E: Entity> Reborrow<'short> for ColRef<'a, E>

§

type Target = Matrix<DenseColRef<'short, E>>

source§

fn rb(&'short self) -> Self::Target

source§

impl<'short, 'a, E: Entity> ReborrowMut<'short> for ColRef<'a, E>

§

type Target = Matrix<DenseColRef<'short, E>>

source§

fn rb_mut(&'short mut self) -> Self::Target

source§

impl<E: Entity> ViewMut for &ColRef<'_, E>

§

type Target<'a> = Matrix<DenseColRef<'a, E>> where Self: 'a

View type.
source§

fn view_mut(&mut self) -> Self::Target<'_>

Returns the view over self.
source§

impl<E: Entity> ViewMut for &mut ColRef<'_, E>

§

type Target<'a> = Matrix<DenseColRef<'a, E>> where Self: 'a

View type.
source§

fn view_mut(&mut self) -> Self::Target<'_>

Returns the view over self.
source§

impl<E: Entity> ViewMut for ColRef<'_, E>

§

type Target<'a> = Matrix<DenseColRef<'a, E>> where Self: 'a

View type.
source§

fn view_mut(&mut self) -> Self::Target<'_>

Returns the view over self.