Skip to main content

MatrixAddress

Struct MatrixAddress 

Source
pub struct MatrixAddress {
    pub x: i32,
    pub y: i32,
}

Fields§

§x: i32§y: i32

Implementations§

Source§

impl MatrixAddress

Source

pub fn scale(self, scalar: f64) -> Self

Scales the position of the matrix address by the floating point scalar. Epsilon is added to the results before truncation to avoid floating point precision issues

§Arguments
  • scalar: The scalar to multiply the value with.

Returns: MatrixAddress

§Examples
use rust_tensors::matrix_address::MatrixAddress;
let address = MatrixAddress {x: 5, y: 10};
assert_eq!(address.scale(0.5), MatrixAddress {x: 2, y: 5});

Trait Implementations§

Source§

impl Add for MatrixAddress

Source§

type Output = MatrixAddress

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Addressable<i32, 2> for MatrixAddress

Source§

impl Clone for MatrixAddress

Source§

fn clone(&self) -> MatrixAddress

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for MatrixAddress

Source§

impl Debug for MatrixAddress

Source§

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

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

impl Eq for MatrixAddress

Source§

impl From<[i32; 2]> for MatrixAddress

Source§

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

Converts to this type from the input type.
Source§

impl<T> Index<MatrixAddress> for Matrix<T>

Source§

type Output = T

The returned type after indexing.
Source§

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

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

impl<T> IndexMut<MatrixAddress> for Matrix<T>

Source§

fn index_mut(&mut self, index: MatrixAddress) -> &mut Self::Output

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

impl Into<[i32; 2]> for MatrixAddress

Source§

fn into(self) -> [i32; 2]

Converts this type into the (usually inferred) input type.
Source§

impl Neg for MatrixAddress

Source§

type Output = MatrixAddress

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for MatrixAddress

Source§

fn eq(&self, other: &MatrixAddress) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for MatrixAddress

Source§

impl Sub for MatrixAddress

Source§

type Output = MatrixAddress

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> Tensor<T, i32, MatrixAddress, 2> for Matrix<T>

Source§

fn smallest_contained_address(&self) -> MatrixAddress

Source§

fn largest_contained_address(&self) -> MatrixAddress

Source§

fn get(&self, address: A) -> Result<&T, String>

Attempts to get a reference of the value at the given address. Will return Err if the address is not contained in the matrix. Read more
Source§

fn get_mut(&mut self, address: A) -> Result<&mut T, String>

Attempts to get a mutable reference of the value at the given address. Will return Err if the address is not contained in the matrix. Read more
Source§

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

Evaluates whether an address is valid and has an associated value in the tensor. Read more
Source§

fn address_iter(&self) -> AddressIterator<V, A, DIMENSION>

Creates an iterator over the addresses within the bounds of the tensor. Read more

Auto Trait Implementations§

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, 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.