pub struct SymSqTensorRef<'a, C: Memorable, const D: usize> { /* private fields */ }Expand description
An immutable reference to a symmetric square tensor.
Implementations§
Source§impl<'a, C: Memorable, const D: usize> SymSqTensorRef<'a, C, D>
impl<'a, C: Memorable, const D: usize> SymSqTensorRef<'a, C, D>
Sourcepub unsafe fn from_raw_parts(
data: *const C,
dims: [usize; D],
strides: [usize; D],
) -> Self
pub unsafe fn from_raw_parts( data: *const C, dims: [usize; D], strides: [usize; D], ) -> Self
Creates a new SymSqTensorRef 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.
Sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Returns the total number of elements in the tensor.
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.
Source§impl<'a, C: Memorable> SymSqTensorRef<'a, C, 5>
impl<'a, C: Memorable> SymSqTensorRef<'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.
Source§impl<'a, C: Memorable> SymSqTensorRef<'a, C, 4>
impl<'a, C: Memorable> SymSqTensorRef<'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.
Source§impl<'a, C: Memorable> SymSqTensorRef<'a, C, 3>
impl<'a, C: Memorable> SymSqTensorRef<'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.
Source§impl<'a, C: Memorable> SymSqTensorRef<'a, C, 2>
impl<'a, C: Memorable> SymSqTensorRef<'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.
Trait Implementations§
Source§impl<'a, C: Clone + Memorable, const D: usize> Clone for SymSqTensorRef<'a, C, D>
impl<'a, C: Clone + Memorable, const D: usize> Clone for SymSqTensorRef<'a, C, D>
Source§fn clone(&self) -> SymSqTensorRef<'a, C, D>
fn clone(&self) -> SymSqTensorRef<'a, C, D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more