pub struct Matrix<T> { /* private fields */ }Expand description
A tensor of two dimensions accessed using MatrixAddress.
Implementations§
Source§impl<T> Matrix<T>
impl<T> Matrix<T>
Trait Implementations§
Source§impl<T> Tensor<T, MatrixAddress> for Matrix<T>
impl<T> Tensor<T, MatrixAddress> for Matrix<T>
Source§fn new<F>(
bounds: AddressBound<MatrixAddress>,
address_value_converter: F,
) -> Matrix<T>where
F: Fn(MatrixAddress) -> T,
fn new<F>(
bounds: AddressBound<MatrixAddress>,
address_value_converter: F,
) -> Matrix<T>where
F: Fn(MatrixAddress) -> T,
Creates a new instance of a tensor with the given inclusive bounds and an address value mapper closure
Source§fn get(&self, address: &MatrixAddress) -> Option<&T>
fn get(&self, address: &MatrixAddress) -> Option<&T>
Attempts to retrieve a reference to the value at the address.
Returns None if the address is outside the given bound
fn get_mut(&mut self, address: &MatrixAddress) -> Option<&mut T>
Source§fn set(&mut self, address: &MatrixAddress, value: T) -> Result<(), Error>
fn set(&mut self, address: &MatrixAddress, value: T) -> Result<(), Error>
Attempts to reassign the value at the given index. Returns Err if the given address is out of bounds.
Source§fn bounds(&self) -> &AddressBound<MatrixAddress>
fn bounds(&self) -> &AddressBound<MatrixAddress>
Returns a reference to the bounds of the tensor
Source§fn address_iterator<'a>(&'a self) -> AddressIterator<A> ⓘwhere
T: 'a,
fn address_iterator<'a>(&'a self) -> AddressIterator<A> ⓘwhere
T: 'a,
Returns an iterator who generates addresses in row-major order.
Can’t give an address who is out of bounds.
Source§fn transform<F, TNew, TENew>(&self, mapping_function: F) -> TENew
fn transform<F, TNew, TENew>(&self, mapping_function: F) -> TENew
Returns a new tensor, which is a copy of this tensor with the values mapped by the given function.
Source§fn transform_by_address<F, TNew, TENew>(&self, mapping_function: F) -> TENew
fn transform_by_address<F, TNew, TENew>(&self, mapping_function: F) -> TENew
Returns a new tensor, which is a copy of this tensor with the values mapped by the given function.
Source§fn transform_in_place<F>(&mut self, mapping_function: F)
fn transform_in_place<F>(&mut self, mapping_function: F)
Alters every value in the tensor by some mapping function.
Note: the mapping function must have the same input value and output value type.
Source§fn transform_by_address_in_place<F>(&mut self, mapping_function: F)
fn transform_by_address_in_place<F>(&mut self, mapping_function: F)
Alters every value in the tensor by some mapping function.
Note: the mapping function must have the same input value and output value type.
impl<T> StructuralPartialEq for Matrix<T>
Auto Trait Implementations§
impl<T> Freeze for Matrix<T>
impl<T> RefUnwindSafe for Matrix<T>where
T: RefUnwindSafe,
impl<T> Send for Matrix<T>where
T: Send,
impl<T> Sync for Matrix<T>where
T: Sync,
impl<T> Unpin for Matrix<T>where
T: Unpin,
impl<T> UnwindSafe for Matrix<T>where
T: UnwindSafe,
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