Type Alias faer_core::RowRef

source ·
pub type RowRef<'a, E> = Matrix<DenseRowRef<'a, E>>;
Expand description

Immutable view over a row vector, similar to an immutable reference to a strided slice.

§Note

Unlike a slice, the data pointed to by RowRef<'_, 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 RowRef::read, or indirectly through any of the numerical library routines, unless it is explicitly permitted.

Aliased Type§

struct RowRef<'a, E> { /* private fields */ }

Implementations§

source§

impl<'a, E: Entity> RowRef<'a, E>

source

pub fn nrows(&self) -> usize

Returns the number of rows of the row. This is always equal to 1.

source

pub fn ncols(&self) -> usize

Returns the number of columns of the row.

source

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

Returns pointers to the matrix data.

source

pub fn col_stride(&self) -> isize

Returns the column 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, col: usize) -> GroupFor<E, *const E::Unit>

Returns raw pointers to the element at the given index.

source

pub unsafe fn ptr_inbounds_at(self, col: 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:

  • col < self.ncols().
source

pub unsafe fn split_at_unchecked(self, col: 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:

  • left.
  • right.
§Safety

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

  • col <= self.ncols().
source

pub unsafe fn split_at(self, col: 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:

  • col <= self.ncols().
source

pub unsafe fn get_unchecked<ColRange>( self, col: ColRange ) -> <Self as RowIndex<ColRange>>::Target
where Self: RowIndex<ColRange>,

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:

  • col must be contained in [0, self.ncols()).
source

pub fn get<ColRange>( self, col: ColRange ) -> <Self as RowIndex<ColRange>>::Target
where Self: RowIndex<ColRange>,

Returns references to the element at the given index, or subvector if col 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:

  • col must be contained in [0, self.ncols()).
source

pub unsafe fn read_unchecked(&self, col: 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:

  • col < self.ncols().
source

pub fn read(&self, col: 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:

  • col < self.ncols().
source

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

Returns a view over the transpose of self.

source

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

Returns a view over the conjugate of self.

source

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

Returns a view over the conjugate transpose of self.

source

pub fn canonicalize(self) -> (RowRef<'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_cols(self) -> Self

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

source

pub unsafe fn subcols_unchecked(self, col_start: usize, ncols: usize) -> Self

Returns a view over the subvector starting at column col_start, and with number of columns ncols.

§Safety

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

  • col_start <= self.ncols().
  • ncols <= self.ncols() - col_start.
source

pub fn subcols(self, col_start: usize, ncols: usize) -> Self

Returns a view over the subvector starting at col col_start, and with number of cols ncols.

§Panics

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

  • col_start <= self.ncols().
  • ncols <= self.ncols() - col_start.
source

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

Returns an owning Row 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) -> RowRef<'_, E>

Returns a view over the matrix.

Trait Implementations§

source§

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

source§

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

Convert to a 2D matrix view.
source§

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

source§

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

Convert to a 2D matrix view.
source§

impl<E: Entity> AsRowRef<E> for &RowRef<'_, E>

source§

fn as_row_ref(&self) -> RowRef<'_, E>

Convert to a row view.
source§

impl<E: Entity> AsRowRef<E> for RowRef<'_, E>

source§

fn as_row_ref(&self) -> RowRef<'_, E>

Convert to a row view.
source§

impl<'a, E: Entity> Debug for RowRef<'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 RowRef<'_, E>

§

type Output = E

The returned type after indexing.
source§

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

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

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

§

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

source§

fn into_const(self) -> Self::Target

source§

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

§

type Item = Read<'a, E>

Item produced by the zipped views.
source§

unsafe fn get_unchecked(&'a mut self, (_, j): 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 RowRef<'_, E>

§

type Rows = ()

Type of rows.
§

type Cols = usize

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 RowRef<'_, 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, (_, j): Self::Index, n_elems: usize ) -> Self::Slice

Returns slice at index of length n_elems.
source§

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

§

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

source§

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

source§

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

§

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

source§

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

source§

impl<E: Entity> RowIndex<Range<usize>> for RowRef<'_, E>

§

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

Resulting type of the indexing operation.
source§

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

Index the row at col.
source§

unsafe fn get_unchecked(this: Self, col: ColRange) -> Self::Target

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

impl<E: Entity> RowIndex<RangeFrom<usize>> for RowRef<'_, E>

§

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

Resulting type of the indexing operation.
source§

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

Index the row at col.
source§

unsafe fn get_unchecked(this: Self, col: ColRange) -> Self::Target

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

impl<E: Entity> RowIndex<RangeFull> for RowRef<'_, E>

§

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

Resulting type of the indexing operation.
source§

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

Index the row at col.
source§

unsafe fn get_unchecked(this: Self, col: ColRange) -> Self::Target

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

impl<E: Entity> RowIndex<RangeInclusive<usize>> for RowRef<'_, E>

§

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

Resulting type of the indexing operation.
source§

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

Index the row at col.
source§

unsafe fn get_unchecked(this: Self, col: ColRange) -> Self::Target

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

impl<E: Entity> RowIndex<RangeTo<usize>> for RowRef<'_, E>

§

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

Resulting type of the indexing operation.
source§

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

Index the row at col.
source§

unsafe fn get_unchecked(this: Self, col: ColRange) -> Self::Target

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

impl<E: Entity> RowIndex<RangeToInclusive<usize>> for RowRef<'_, E>

§

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

Resulting type of the indexing operation.
source§

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

Index the row at col.
source§

unsafe fn get_unchecked(this: Self, col: ColRange) -> Self::Target

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

impl<'a, E: Entity> RowIndex<usize> for RowRef<'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, col: usize) -> Self::Target

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

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

Index the row at col.
source§

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

§

type Target<'a> = Matrix<DenseRowRef<'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 RowRef<'_, E>

§

type Target<'a> = Matrix<DenseRowRef<'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 RowRef<'_, E>

§

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

View type.
source§

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

Returns the view over self.