Struct faer_core::ColRef

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

Column vector view with general row stride.

For usage examples, see MatRef.

Implementations§

source§

impl<'a, T> ColRef<'a, T>

source

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

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

Safety

ptr must be non null and properly aligned for type T.
For each i < nrows,
ptr.offset(i as isize * row_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 (top) element of the column vector.

source

pub fn nrows(&self) -> usize

Returns the number of rows of the column vector.

source

pub fn ncols(&self) -> usize

Returns the number of columns of the column vector. Always returns 1.

source

pub fn row_stride(&self) -> isize

Returns the offset between the first elements of two successive rows in the column vector.

source

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

Returns a pointer to the element at position (i, 0) in the column vector.

source

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

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

Safety

Requires that

  • i < self.nrows().

Otherwise, the behavior is undefined.

source

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

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

Panics

Requires that

  • i < self.nrows().

Otherwise, it panics.

source

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

Splits the column vector into two parts in the following order: top, bottom.

Safety

Requires that

  • i <= self.nrows().

Otherwise, the behavior is undefined.

source

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

Splits the column vector into two parts in the following order: top, bottom.

Panics

Requires that

  • i <= self.nrows().

Otherwise, it panics.

source

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

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

Safety

Requires i < self.nrows().

Otherwise, the behavior is undefined.

source

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

Returns a reference to the element at position (i, 0), 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) -> RowRef<'a, T>

Returns the transpose of self.

source

pub unsafe fn subrows_unchecked(self, i: usize, nrows: usize) -> Self

Returns a view over subrows of self, starting at position i with a row count of nrows.

Safety

Requires that

  • i <= self.nrows(),
  • nrows <= self.nrows() - i.

Otherwise, the behavior is undefined.

source

pub fn subrows(self, i: usize, nrows: usize) -> Self

Returns a view over subrows of self, starting at position i with a row count of nrows.

Panics

Requires that

  • i <= self.nrows(),
  • nrows <= self.nrows() - i.

Otherwise, it panics.

source

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

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

source§

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

source

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

Trait Implementations§

source§

impl<'a, T> Clone for ColRef<'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<ColRef<'a, U>> for ColRef<'a, T>

source§

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

source§

impl<'short, 'a, T> CwiseCol<'short, &'short ColRef<'a, T>> for ColRef<'a, T>

§

type Item = &'short T

source§

fn nrows(&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 ColRef<'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 ColRef<'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 ColRef<'a, T>

§

type Target = ColRef<'a, T>

source§

fn into_const(self) -> Self::Target

source§

impl<'a, T> IntoIterator for ColRef<'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 ColRef<'a, T>> for ColRef<'a, T>

§

type Target = ColRef<'b, T>

source§

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

source§

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

§

type Target = ColRef<'b, T>

source§

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

source§

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

source§

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

source§

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

Auto Trait Implementations§

§

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

§

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

§

impl<'a, T> UnwindSafe for ColRef<'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