MatrixAddress

Struct MatrixAddress 

Source
pub struct MatrixAddress<I>
where I: Coordinate,
{ pub row: I, pub column: I, }
Expand description

MatrixAddress references a cell in a matrix by its row and column. Rows are numbered from zero at the top, and columns are numbered from zero at the left. Thus (0, 0), the origin, is positioned at the upper-left of the matrix. Any built in numeric or character type that fits in usize can be used as the index (thus in practice up to i16 / u16).

Fields§

§row: I§column: I

Implementations§

Source§

impl<I> MatrixAddress<I>
where I: Coordinate,

Source

pub fn neighbors<'a, T>( &self, matrix: &dyn Matrix<'a, T, I>, ) -> Vec<MatrixAddress<I>>
where T: 'static, I: Coordinate,

Source

pub fn transpose(&self) -> MatrixAddress<I>

Trait Implementations§

Source§

impl<I> Add for MatrixAddress<I>
where I: Coordinate,

Source§

type Output = MatrixAddress<I>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<I> Clone for MatrixAddress<I>
where I: Coordinate + Clone,

Source§

fn clone(&self) -> MatrixAddress<I>

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<I> Debug for MatrixAddress<I>
where I: Coordinate + Debug,

Source§

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

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

impl<I> Default for MatrixAddress<I>
where I: Coordinate,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<I> Display for MatrixAddress<I>
where I: Coordinate,

Source§

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

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

impl<I> From<[I; 2]> for MatrixAddress<I>
where I: Coordinate,

Source§

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

Converts to this type from the input type.
Source§

impl<I> From<MatrixAddress<I>> for [I; 2]
where I: Coordinate,

Source§

fn from(value: MatrixAddress<I>) -> Self

Converts to this type from the input type.
Source§

impl<I> Hash for MatrixAddress<I>
where I: Coordinate + Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<I> Index<LogicalDimension> for MatrixAddress<I>
where I: Coordinate,

Source§

type Output = I

The returned type after indexing.
Source§

fn index(&self, dimension: LogicalDimension) -> &Self::Output

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

impl<'a, T, I> Index<MatrixAddress<I>> for DenseMatrix<T, I>
where I: Coordinate,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: MatrixAddress<I>) -> &Self::Output

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

impl<I> Index<usize> for MatrixAddress<I>
where I: Coordinate,

Source§

type Output = I

The returned type after indexing.
Source§

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

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

impl<T, I> IndexMut<MatrixAddress<I>> for DenseMatrix<T, I>
where I: Coordinate,

Source§

fn index_mut(&mut self, index: MatrixAddress<I>) -> &mut T

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

impl<I> Ord for MatrixAddress<I>
where I: Coordinate + Ord,

Source§

fn cmp(&self, other: &MatrixAddress<I>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<I> PartialEq for MatrixAddress<I>
where I: Coordinate + PartialEq,

Source§

fn eq(&self, other: &MatrixAddress<I>) -> 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<I> PartialOrd for MatrixAddress<I>

Source§

fn partial_cmp(&self, other: &MatrixAddress<I>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<I> Sub for MatrixAddress<I>
where I: Coordinate,

Source§

type Output = MatrixAddress<I>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T: 'a, I> Tensor<T, I, MatrixAddress<I>, 2> for DenseMatrix<T, I>
where I: Coordinate,

Source§

fn range(&self) -> Range<MatrixAddress<I>>

range provides the bounds of the address space for the Tensor. The lower (inclusive bound) is the origin, conceptually placed at the left of a vector, the upper left of a matrix, and so on. That lower bound is conventionally zero-based, but does not have to be. The upper bound (exclusive) is the right side of the vector, the lower right of the matrix, etc. Be aware that while Range provides iterator functionality, once you move beyond single-dimension Tensors, that iterator does not provide the correct iteration of available addresses.
Source§

fn get(&self, address: MatrixAddress<I>) -> Option<&T>

An out-of-range-safe version of the Index trait.
Source§

fn get_mut(&mut self, address: MatrixAddress<I>) -> Option<&mut T>

An out-of-range-safe version of the IndexMut trait.
Source§

fn contains(&self, address: A) -> bool

contains is true if the given address is within the Tensor’s bounds for all dimensions.
Source§

impl<I> Address<I, 2> for MatrixAddress<I>
where I: Coordinate,

Source§

impl<I> Copy for MatrixAddress<I>
where I: Coordinate + Copy,

Source§

impl<I> Eq for MatrixAddress<I>
where I: Coordinate + Eq,

Source§

impl<I> StructuralPartialEq for MatrixAddress<I>
where I: Coordinate,

Auto Trait Implementations§

§

impl<I> Freeze for MatrixAddress<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for MatrixAddress<I>
where I: RefUnwindSafe,

§

impl<I> Send for MatrixAddress<I>
where I: Send,

§

impl<I> Sync for MatrixAddress<I>
where I: Sync,

§

impl<I> Unpin for MatrixAddress<I>
where I: Unpin,

§

impl<I> UnwindSafe for MatrixAddress<I>
where I: 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.