Struct faer_core::RowRef

source ·
pub struct RowRef<'a, T> { /* private fields */ }
Expand description

Row vector view with general column stride.

For usage examples, see MatRef.

Implementations§

source§

impl<'a, T> RowRef<'a, T>

source

pub unsafe fn from_raw_parts( ptr: *const T, ncols: usize, col_stride: isize ) -> Self

Returns a row vector slice from the given arguments.
ptr: pointer to the first element of the row vector.
ncols: number of columns of the row vector.
col_stride: offset between the first elements of two successive columns in the row vector.

Safety

ptr must be non null and properly aligned for type T.
For each j < ncols,
ptr.offset(j as isize * col_stride) must point to a valid initialized object of type T, unless memory pointing to that address is never read.
The referenced memory must not be mutated during the lifetime 'a.

source

pub fn as_ptr(self) -> *const T

Returns a pointer to the first (left) element of the row vector.

source

pub fn nrows(&self) -> usize

Returns the number of rows of the row vector. Always returns 1.

source

pub fn ncols(&self) -> usize

Returns the number of columns of the row vector.

source

pub fn col_stride(&self) -> isize

Returns the offset between the first elements of two successive columns in the row vector.

source

pub fn ptr_at(self, j: usize) -> *const T

Returns a pointer to the element at position (0, j) in the row vector.

source

pub unsafe fn ptr_in_bounds_at_unchecked(self, j: usize) -> *const T

Returns a pointer to the element at position (0, j) in the row vector, assuming it falls within its bounds with no bound checks.

Safety

Requires that

  • j < self.ncols().

Otherwise, the behavior is undefined.

source

pub fn ptr_in_bounds_at(self, j: usize) -> *const T

Returns a pointer to the element at position (0, j) in the row vector, while asserting that it falls within its bounds.

Panics

Requires that

  • j < self.ncols().

Otherwise, it panics.

source

pub unsafe fn split_at_unchecked(self, j: usize) -> (Self, Self)

Splits the row vector into two parts in the following order: left, right.

Safety

Requires that

  • j <= self.ncols().

Otherwise, the behavior is undefined.

source

pub fn split_at(self, j: usize) -> (Self, Self)

Splits the row vector into two parts in the following order: left, right.

Panics

Requires that

  • j <= self.ncols().

Otherwise, it panics.

source

pub unsafe fn get_unchecked(self, j: usize) -> &'a T

Returns a reference to the element at position (0, j), with no bound checks.

Safety

Requires j < self.ncols().

Otherwise, the behavior is undefined.

source

pub fn get(self, j: usize) -> &'a T

Returns a reference to the element at position (0, j), or panics if the index is out of bounds.

source

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

Returns an equivalent matrix view over the same data.

source

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

Returns the transpose of self.

source

pub fn cwise(self) -> ZipRow<(Self,)>

Returns a thin wrapper that can be used to execute coefficientwise operations on matrices.

source

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

Returns a view over subcolumns of self, starting at position j with a column count of ncols.

Safety

Requires that

  • j <= self.ncols(),
  • ncols <= self.ncols() - j.

Otherwise, the behavior is undefined.

source

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

Returns a view over subcolumnss of self, starting at position j with a col count of ncols.

Panics

Requires that

  • j <= self.ncols(),
  • ncols <= self.ncols() - j.

Otherwise, it panics.

source§

impl<'a, T> RowRef<'a, Complex<T>>

source

pub fn into_real_imag(self) -> (RowRef<'a, T>, RowRef<'a, T>)

Trait Implementations§

source§

impl<'a, T> Clone for RowRef<'a, T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, T: 'static, U: 'static> Coerce<RowRef<'a, U>> for RowRef<'a, T>

source§

fn coerce(self) -> RowRef<'a, U>

source§

impl<'short, 'a, T> CwiseRow<'short, &'short RowRef<'a, T>> for RowRef<'a, T>

§

type Item = &'short T

source§

fn ncols(&self) -> usize

source§

fn is_contiguous(&self) -> bool

source§

unsafe fn get_unchecked(&'short mut self, i: usize) -> Self::Item

source§

unsafe fn get_contiguous_unchecked(&'short mut self, i: usize) -> Self::Item

source§

impl<'a, T: Debug + 'static> Debug for RowRef<'a, T>

source§

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

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

impl<'a, T> Index<usize> for RowRef<'a, T>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, j: usize) -> &Self::Output

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

impl<'a, T> IntoConst for RowRef<'a, T>

§

type Target = RowRef<'a, T>

source§

fn into_const(self) -> Self::Target

source§

impl<'a, T> IntoIterator for RowRef<'a, T>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = ElemIter<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'b, 'a, T> Reborrow<'b, &'b RowRef<'a, T>> for RowRef<'a, T>

§

type Target = RowRef<'b, T>

source§

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

source§

impl<'b, 'a, T> ReborrowMut<'b, &'b RowRef<'a, T>> for RowRef<'a, T>

§

type Target = RowRef<'b, T>

source§

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

source§

impl<'a, T> Copy for RowRef<'a, T>

source§

impl<'a, T: Sync> Send for RowRef<'a, T>

source§

impl<'a, T: Sync> Sync for RowRef<'a, T>

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for RowRef<'a, T>where T: RefUnwindSafe,

§

impl<'a, T> Unpin for RowRef<'a, T>

§

impl<'a, T> UnwindSafe for RowRef<'a, T>where T: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> SameLayoutAs<T> for T