Dim

Struct Dim 

Source
pub struct Dim<R: Unsigned> {
    pub shape: Vec<usize>,
    /* private fields */
}

Fields§

§shape: Vec<usize>

Implementations§

Source§

impl<R: Unsigned> Dim<R>

Source

pub fn new(dim: &[usize]) -> Result<Self, DimError>

Source

pub fn shape(&self) -> Vec<usize>

Source

pub fn get_number_elements(&self) -> usize

Source

pub fn get_indexes(&self, n: &usize) -> Self

Source

pub fn get_flat_pos<R2: Unsigned>( &self, indexes: &Dim<R2>, ) -> Result<usize, DimError>

Source

pub fn remove_element(self, index: usize) -> Dim<Sub1<R>>
where R: Sub<B1>, <R as Sub<B1>>::Output: Unsigned,

Source

pub fn remove_element_notyped(self, index: usize) -> Dim<UTerm>

Source

pub fn insert_element(self, index: usize, element: usize) -> Dim<Add1<R>>
where R: Add<B1>, <R as Add<B1>>::Output: Unsigned,

Source

pub fn insert_element_notyped(self, index: usize, element: usize) -> Dim<UTerm>

Source

pub fn path_shape<R2: Unsigned>(&self, n: usize) -> Result<Dim<R2>, DimError>

Paths a shape of rank R with ones in the left until is rank R2.

Source

pub fn rev_cast_pos<R1: Unsigned, R2: Unsigned>( small_shape: &Dim<R1>, indexes: &Dim<R2>, ) -> Result<usize, DimError>

Source

pub fn broadcast_shape<R2: Unsigned>( &self, other: &Dim<R2>, ) -> Result<Dim<Maximum<R, R2>>, DimError>
where R: Max<R2>, <R as Max<R2>>::Output: Unsigned,

Source

pub fn broadcast_shape_notyped<R2: Unsigned>( &self, other: &Dim<R2>, ) -> Result<Dim<UTerm>, DimError>

Source

pub fn len(&self) -> usize

Source

pub fn reverse(&self) -> Self

Trait Implementations§

Source§

impl<R: Clone + Unsigned> Clone for Dim<R>

Source§

fn clone(&self) -> Dim<R>

Returns a duplicate 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<R: Debug + Unsigned> Debug for Dim<R>

Source§

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

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

impl From<&[usize; 1]> for Dim<U1>

Source§

fn from(value: &[usize; 1]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 10]> for Dim<U10>

Source§

fn from(value: &[usize; 10]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 11]> for Dim<U11>

Source§

fn from(value: &[usize; 11]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 12]> for Dim<U12>

Source§

fn from(value: &[usize; 12]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 13]> for Dim<U13>

Source§

fn from(value: &[usize; 13]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 14]> for Dim<U14>

Source§

fn from(value: &[usize; 14]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 15]> for Dim<U15>

Source§

fn from(value: &[usize; 15]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 16]> for Dim<U16>

Source§

fn from(value: &[usize; 16]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 17]> for Dim<U17>

Source§

fn from(value: &[usize; 17]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 18]> for Dim<U18>

Source§

fn from(value: &[usize; 18]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 19]> for Dim<U19>

Source§

fn from(value: &[usize; 19]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 2]> for Dim<U2>

Source§

fn from(value: &[usize; 2]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 3]> for Dim<U3>

Source§

fn from(value: &[usize; 3]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 4]> for Dim<U4>

Source§

fn from(value: &[usize; 4]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 5]> for Dim<U5>

Source§

fn from(value: &[usize; 5]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 6]> for Dim<U6>

Source§

fn from(value: &[usize; 6]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 7]> for Dim<U7>

Source§

fn from(value: &[usize; 7]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 8]> for Dim<U8>

Source§

fn from(value: &[usize; 8]) -> Self

Converts to this type from the input type.
Source§

impl From<&[usize; 9]> for Dim<U9>

Source§

fn from(value: &[usize; 9]) -> Self

Converts to this type from the input type.
Source§

impl<R: Unsigned> From<&Dim<R>> for Dim<R>

Source§

fn from(value: &Dim<R>) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 1]> for Dim<U1>

Source§

fn from(value: [usize; 1]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 10]> for Dim<U10>

Source§

fn from(value: [usize; 10]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 11]> for Dim<U11>

Source§

fn from(value: [usize; 11]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 12]> for Dim<U12>

Source§

fn from(value: [usize; 12]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 13]> for Dim<U13>

Source§

fn from(value: [usize; 13]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 14]> for Dim<U14>

Source§

fn from(value: [usize; 14]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 15]> for Dim<U15>

Source§

fn from(value: [usize; 15]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 16]> for Dim<U16>

Source§

fn from(value: [usize; 16]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 17]> for Dim<U17>

Source§

fn from(value: [usize; 17]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 18]> for Dim<U18>

Source§

fn from(value: [usize; 18]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 19]> for Dim<U19>

Source§

fn from(value: [usize; 19]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 2]> for Dim<U2>

Source§

fn from(value: [usize; 2]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 3]> for Dim<U3>

Source§

fn from(value: [usize; 3]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 4]> for Dim<U4>

Source§

fn from(value: [usize; 4]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 5]> for Dim<U5>

Source§

fn from(value: [usize; 5]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 6]> for Dim<U6>

Source§

fn from(value: [usize; 6]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 7]> for Dim<U7>

Source§

fn from(value: [usize; 7]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 8]> for Dim<U8>

Source§

fn from(value: [usize; 8]) -> Self

Converts to this type from the input type.
Source§

impl From<[usize; 9]> for Dim<U9>

Source§

fn from(value: [usize; 9]) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Dim<U1>

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl<R: PartialEq + Unsigned> PartialEq for Dim<R>

Source§

fn eq(&self, other: &Dim<R>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R: Eq + Unsigned> Eq for Dim<R>

Source§

impl<R: Unsigned> StructuralPartialEq for Dim<R>

Auto Trait Implementations§

§

impl<R> Freeze for Dim<R>

§

impl<R> RefUnwindSafe for Dim<R>
where R: RefUnwindSafe,

§

impl<R> Send for Dim<R>
where R: Send,

§

impl<R> Sync for Dim<R>
where R: Sync,

§

impl<R> Unpin for Dim<R>
where R: Unpin,

§

impl<R> UnwindSafe for Dim<R>
where R: 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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V