extendr_api::prelude::modules::core::zip

Struct ZipEq

pub struct ZipEq<Rows, Cols, Head, Tail>(Head, Tail)
where
    Head: MatShape<Rows = Rows, Cols = Cols>,
    Tail: MatShape<Rows = Rows, Cols = Cols>;
Expand description

Zipped matrix views.

Tuple Fields§

§0: Head§1: Tail

Implementations§

§

impl<Rows, Cols, Head, Tail> ZipEq<Rows, Cols, Head, Tail>
where Rows: Copy + Eq + Debug, Cols: Copy + Eq + Debug, Head: MatShape<Rows = Rows, Cols = Cols>, Tail: MatShape<Rows = Rows, Cols = Cols>,

pub fn new(head: Head, tail: Tail) -> ZipEq<Rows, Cols, Head, Tail>

Creates a zipped matrix, after asserting that the dimensions match.

pub fn new_unchecked(head: Head, tail: Tail) -> ZipEq<Rows, Cols, Head, Tail>

Creates a zipped matrix, assuming that the dimensions match.

§

impl<Head, Tail> ZipEq<(), usize, Head, Tail>
where Head: for<'a> MatIndex<'a, Rows = (), Cols = usize, Index = ((), usize), LayoutTransform = VecLayoutTransform>, Tail: for<'a> MatIndex<'a, Rows = (), Cols = usize, Index = ((), usize), LayoutTransform = VecLayoutTransform>,

pub fn for_each( self, f: impl for<'a> FnMut(<ZipEq<(), usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of self.

pub fn for_each_with_index( self, f: impl for<'a> FnMut(usize, <ZipEq<(), usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of self, while passing in the index of the current element.

pub fn map<E>( self, f: impl for<'a> FnMut(<ZipEq<(), usize, Head, Tail> as MatIndex<'a>>::Item) -> E, ) -> Row<E>
where E: Entity,

Applies f to each element of self and collect its result into a new row.

§

impl<Head, Tail> ZipEq<usize, (), Head, Tail>
where Head: for<'a> MatIndex<'a, Rows = usize, Cols = (), Index = (usize, ()), LayoutTransform = VecLayoutTransform>, Tail: for<'a> MatIndex<'a, Rows = usize, Cols = (), Index = (usize, ()), LayoutTransform = VecLayoutTransform>,

pub fn for_each( self, f: impl for<'a> FnMut(<ZipEq<usize, (), Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of self.

pub fn for_each_with_index( self, f: impl for<'a> FnMut(usize, <ZipEq<usize, (), Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of self, while passing in the index of the current element.

pub fn map<E>( self, f: impl for<'a> FnMut(<ZipEq<usize, (), Head, Tail> as MatIndex<'a>>::Item) -> E, ) -> Col<E>
where E: Entity,

Applies f to each element of self and collect its result into a new column.

§

impl<Head, Tail> ZipEq<usize, usize, Head, Tail>
where Head: for<'a> MatIndex<'a, Rows = usize, Cols = usize, Index = (usize, usize), LayoutTransform = MatLayoutTransform>, Tail: for<'a> MatIndex<'a, Rows = usize, Cols = usize, Index = (usize, usize), LayoutTransform = MatLayoutTransform>,

pub fn for_each( self, f: impl for<'a> FnMut(<ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of self.

pub fn for_each_with_index( self, f: impl for<'a> FnMut(usize, usize, <ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of self, while passing the indices of the position of the current element.

pub fn for_each_triangular_lower_with_index( self, diag: Diag, f: impl for<'a> FnMut(usize, usize, <ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of the lower triangular half of self, while passing the indices of the position of the current element.

diag specifies whether the diagonal should be included or excluded.

pub fn for_each_triangular_upper_with_index( self, diag: Diag, f: impl for<'a> FnMut(usize, usize, <ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of the upper triangular half of self, while passing the indices of the position of the current element.

diag specifies whether the diagonal should be included or excluded.

pub fn for_each_triangular_lower( self, diag: Diag, f: impl for<'a> FnMut(<ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of the lower triangular half of self.

diag specifies whether the diagonal should be included or excluded.

pub fn for_each_triangular_upper( self, diag: Diag, f: impl for<'a> FnMut(<ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item), )

Applies f to each element of the upper triangular half of self.

diag specifies whether the diagonal should be included or excluded.

pub fn map<E>( self, f: impl for<'a> FnMut(<ZipEq<usize, usize, Head, Tail> as MatIndex<'a>>::Item) -> E, ) -> Mat<E>
where E: Entity,

Applies f to each element of self and collect its result into a new matrix.

Trait Implementations§

§

impl<Rows, Cols, Head, Tail> Clone for ZipEq<Rows, Cols, Head, Tail>
where Rows: Clone, Cols: Clone, Head: Clone + MatShape<Rows = Rows, Cols = Cols>, Tail: Clone + MatShape<Rows = Rows, Cols = Cols>,

§

fn clone(&self) -> ZipEq<Rows, Cols, Head, Tail>

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
§

impl<Rows, Cols, Head, Tail> Debug for ZipEq<Rows, Cols, Head, Tail>
where Rows: Debug, Cols: Debug, Head: Debug + MatShape<Rows = Rows, Cols = Cols>, Tail: Debug + MatShape<Rows = Rows, Cols = Cols>,

§

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

Formats the value using the given formatter. Read more
§

impl<'a, Rows, Cols, Head, Tail> MatIndex<'a> for ZipEq<Rows, Cols, Head, Tail>
where Rows: Debug + Copy + Eq, Cols: Copy + Eq + Debug, Head: MatIndex<'a, Rows = Rows, Cols = Cols>, Tail: MatIndex<'a, Rows = Rows, Cols = Cols, Index = <Head as MaybeContiguous>::Index, LayoutTransform = <Head as MaybeContiguous>::LayoutTransform>,

§

type Item = Zip<<Head as MatIndex<'a>>::Item, <Tail as MatIndex<'a>>::Item>

Item produced by the zipped views.
§

unsafe fn get_unchecked( &'a mut self, index: <ZipEq<Rows, Cols, Head, Tail> as MaybeContiguous>::Index, ) -> <ZipEq<Rows, Cols, Head, Tail> as MatIndex<'a>>::Item

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

unsafe fn get_from_slice_unchecked( slice: &'a mut <ZipEq<Rows, Cols, Head, Tail> as MaybeContiguous>::Slice, idx: usize, ) -> <ZipEq<Rows, Cols, Head, Tail> as MatIndex<'a>>::Item

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

fn is_contiguous(&self) -> bool

Checks if the zipped matrices are contiguous.
§

fn preferred_layout( &self, ) -> <ZipEq<Rows, Cols, Head, Tail> as MaybeContiguous>::LayoutTransform

Computes the preferred iteration layout of the matrices.
§

fn with_layout( self, layout: <ZipEq<Rows, Cols, Head, Tail> as MaybeContiguous>::LayoutTransform, ) -> ZipEq<Rows, Cols, Head, Tail>

Applies the layout transformation to the matrices.
§

impl<Rows, Cols, Head, Tail> MatShape for ZipEq<Rows, Cols, Head, Tail>
where Rows: Copy + Eq + Debug, Cols: Copy + Eq + Debug, Head: MatShape<Rows = Rows, Cols = Cols>, Tail: MatShape<Rows = Rows, Cols = Cols>,

§

type Rows = Rows

Type of rows.
§

type Cols = Cols

Type of columns.
§

fn nrows(&self) -> <ZipEq<Rows, Cols, Head, Tail> as MatShape>::Rows

Returns the number of rows.
§

fn ncols(&self) -> <ZipEq<Rows, Cols, Head, Tail> as MatShape>::Cols

Returns the number of columns.
§

impl<Rows, Cols, Head, Tail> MaybeContiguous for ZipEq<Rows, Cols, Head, Tail>
where Rows: Debug + Copy + Eq, Cols: Copy + Eq + Debug, Head: MaybeContiguous<Rows = Rows, Cols = Cols>, Tail: MaybeContiguous<Rows = Rows, Cols = Cols, Index = <Head as MaybeContiguous>::Index, LayoutTransform = <Head as MaybeContiguous>::LayoutTransform>,

§

type Index = <Head as MaybeContiguous>::Index

Indexing type.
§

type Slice = Zip<<Head as MaybeContiguous>::Slice, <Tail as MaybeContiguous>::Slice>

Contiguous slice type.
§

type LayoutTransform = <Head as MaybeContiguous>::LayoutTransform

Layout transformation type.
§

unsafe fn get_slice_unchecked( &mut self, idx: <ZipEq<Rows, Cols, Head, Tail> as MaybeContiguous>::Index, n_elems: usize, ) -> <ZipEq<Rows, Cols, Head, Tail> as MaybeContiguous>::Slice

Returns slice at index of length n_elems.
§

impl<Rows, Cols, Head, Tail> Copy for ZipEq<Rows, Cols, Head, Tail>
where Rows: Copy, Cols: Copy, Head: Copy + MatShape<Rows = Rows, Cols = Cols>, Tail: Copy + MatShape<Rows = Rows, Cols = Cols>,

Auto Trait Implementations§

§

impl<Rows, Cols, Head, Tail> Freeze for ZipEq<Rows, Cols, Head, Tail>
where Head: Freeze, Tail: Freeze,

§

impl<Rows, Cols, Head, Tail> RefUnwindSafe for ZipEq<Rows, Cols, Head, Tail>
where Head: RefUnwindSafe, Tail: RefUnwindSafe,

§

impl<Rows, Cols, Head, Tail> Send for ZipEq<Rows, Cols, Head, Tail>
where Head: Send, Tail: Send,

§

impl<Rows, Cols, Head, Tail> Sync for ZipEq<Rows, Cols, Head, Tail>
where Head: Sync, Tail: Sync,

§

impl<Rows, Cols, Head, Tail> Unpin for ZipEq<Rows, Cols, Head, Tail>
where Head: Unpin, Tail: Unpin,

§

impl<Rows, Cols, Head, Tail> UnwindSafe for ZipEq<Rows, Cols, Head, Tail>
where Head: UnwindSafe, Tail: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.