pub struct SymSqTensorMut<'a, C: Memorable, const D: usize> { /* private fields */ }Expand description
A mutable reference to a symmetric square tensor.
Implementations§
Source§impl<'a, C: Memorable, const D: usize> SymSqTensorMut<'a, C, D>
impl<'a, C: Memorable, const D: usize> SymSqTensorMut<'a, C, D>
Sourcepub unsafe fn from_raw_parts(
data: *mut C,
dims: [usize; D],
strides: [usize; D],
) -> Self
pub unsafe fn from_raw_parts( data: *mut C, dims: [usize; D], strides: [usize; D], ) -> Self
Creates a new SymSqTensorMut from raw parts.
§Safety
The caller must ensure that data points to a valid memory block of C elements,
and that dims and strides accurately describe the layout of the tensor
within that memory block. The data pointer must be valid for the lifetime 'a
and that it is safe to mutate the data.
Sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Returns the total number of elements in the tensor.
Sourcepub fn as_ptr_mut(&mut self) -> *mut C
pub fn as_ptr_mut(&mut self) -> *mut C
Returns a mutable raw pointer to the tensor’s data.
Sourcepub fn get(&self, indices: &[usize; D]) -> &C
pub fn get(&self, indices: &[usize; D]) -> &C
Returns a reference to an element at the given indices.
§Panics
Panics if the indices are out of bounds.
Sourcepub fn get_mut(&mut self, indices: &[usize; D]) -> &mut C
pub fn get_mut(&mut self, indices: &[usize; D]) -> &mut C
Returns a mutable reference to an element at the given indices.
§Panics
Panics if the indices are out of bounds.
Sourcepub unsafe fn get_unchecked(&self, indices: &[usize; D]) -> &C
pub unsafe fn get_unchecked(&self, indices: &[usize; D]) -> &C
Returns an immutable reference to an element at the given indices, without performing bounds checks.
§Safety
Calling this method with out-of-bounds indices is undefined behavior.
Sourcepub unsafe fn get_mut_unchecked(&mut self, indices: &[usize; D]) -> &mut C
pub unsafe fn get_mut_unchecked(&mut self, indices: &[usize; D]) -> &mut C
Returns a mutable reference to an element at the given indices, without performing bounds checks.
§Safety
Calling this method with out-of-bounds indices is undefined behavior.
Source§impl<'a, C: Memorable> SymSqTensorMut<'a, C, 5>
impl<'a, C: Memorable> SymSqTensorMut<'a, C, 5>
Sourcepub fn subtensor_ref(&self, m1: usize, m2: usize) -> TensorRef<'a, C, 3>
pub fn subtensor_ref(&self, m1: usize, m2: usize) -> TensorRef<'a, C, 3>
Returns an immutable reference to the 3D subtensor at the given matrix indices.
Sourcepub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> TensorMut<'a, C, 3>
pub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> TensorMut<'a, C, 3>
Returns a mutable reference to the 3D subtensor at the given matrix indices.
Source§impl<'a, C: Memorable> SymSqTensorMut<'a, C, 4>
impl<'a, C: Memorable> SymSqTensorMut<'a, C, 4>
Sourcepub fn subtensor_ref(&self, m1: usize, m2: usize) -> MatRef<'a, C>
pub fn subtensor_ref(&self, m1: usize, m2: usize) -> MatRef<'a, C>
Returns an immutable matrix reference to the subtensor at the given indices.
Sourcepub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> MatMut<'a, C>
pub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> MatMut<'a, C>
Returns a mutable matrix reference to the subtensor at the given indices.
Source§impl<'a, C: Memorable> SymSqTensorMut<'a, C, 3>
impl<'a, C: Memorable> SymSqTensorMut<'a, C, 3>
Sourcepub fn subtensor_ref(&self, m1: usize, m2: usize) -> RowRef<'a, C>
pub fn subtensor_ref(&self, m1: usize, m2: usize) -> RowRef<'a, C>
Returns an immutable row reference to the subtensor at the given indices.
Sourcepub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> RowMut<'a, C>
pub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> RowMut<'a, C>
Returns a mutable row reference to the subtensor at the given indices.
Source§impl<'a, C: Memorable> SymSqTensorMut<'a, C, 2>
impl<'a, C: Memorable> SymSqTensorMut<'a, C, 2>
Sourcepub fn subtensor_ref(&self, m1: usize, m2: usize) -> &C
pub fn subtensor_ref(&self, m1: usize, m2: usize) -> &C
Returns an immutable reference to the element at the given indices.
Sourcepub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> &mut C
pub fn subtensor_mut(&mut self, m1: usize, m2: usize) -> &mut C
Returns a mutable reference to the element at the given indices.