pub struct MatrixAddress {
pub x: i32,
pub y: i32,
}Fields§
§x: i32§y: i32Implementations§
Source§impl MatrixAddress
impl MatrixAddress
Sourcepub fn scale(self, scalar: f64) -> Self
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
impl Add for MatrixAddress
Source§impl Addressable<i32, 2> for MatrixAddress
impl Addressable<i32, 2> for MatrixAddress
fn get_value_at_dimension_index(&self, index: usize) -> i32
Source§impl Clone for MatrixAddress
impl Clone for MatrixAddress
Source§fn clone(&self) -> MatrixAddress
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MatrixAddress
Source§impl Debug for MatrixAddress
impl Debug for MatrixAddress
impl Eq for MatrixAddress
Source§impl<T> Index<MatrixAddress> for Matrix<T>
impl<T> Index<MatrixAddress> for Matrix<T>
Source§impl<T> IndexMut<MatrixAddress> for Matrix<T>
impl<T> IndexMut<MatrixAddress> for Matrix<T>
Source§impl Neg for MatrixAddress
impl Neg for MatrixAddress
Source§impl PartialEq for MatrixAddress
impl PartialEq for MatrixAddress
Source§fn eq(&self, other: &MatrixAddress) -> bool
fn eq(&self, other: &MatrixAddress) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MatrixAddress
Source§impl Sub for MatrixAddress
impl Sub for MatrixAddress
Source§impl<T> Tensor<T, i32, MatrixAddress, 2> for Matrix<T>
impl<T> Tensor<T, i32, MatrixAddress, 2> for Matrix<T>
fn smallest_contained_address(&self) -> MatrixAddress
fn largest_contained_address(&self) -> MatrixAddress
Source§fn get(&self, address: A) -> Result<&T, String>
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>
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
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>
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§
impl Freeze for MatrixAddress
impl RefUnwindSafe for MatrixAddress
impl Send for MatrixAddress
impl Sync for MatrixAddress
impl Unpin for MatrixAddress
impl UnsafeUnpin for MatrixAddress
impl UnwindSafe for MatrixAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more