pub unsafe trait TensorMut<T, const D: usize>: TensorRef<T, D> {
// Required methods
fn get_reference_mut(&mut self, indexes: [usize; D]) -> Option<&mut T>;
unsafe fn get_reference_unchecked_mut(
&mut self,
indexes: [usize; D],
) -> &mut T;
}
Expand description
Required Methods§
Sourcefn get_reference_mut(&mut self, indexes: [usize; D]) -> Option<&mut T>
fn get_reference_mut(&mut self, indexes: [usize; D]) -> Option<&mut T>
Gets a mutable reference to the value at the index, if the index is in range. Otherwise returns None.
Sourceunsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; D]) -> &mut T
unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; D]) -> &mut T
Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see get_reference_mut.
§Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. Valid indexes are defined as in TensorRef.
Trait Implementations§
Source§impl<T, const D: usize> TensorMut<T, D> for Box<dyn TensorMut<T, D>>
A box of a dynamic TensorMut also implements TensorMut.
impl<T, const D: usize> TensorMut<T, D> for Box<dyn TensorMut<T, D>>
A box of a dynamic TensorMut also implements TensorMut.
Source§fn get_reference_mut(&mut self, indexes: [usize; D]) -> Option<&mut T>
fn get_reference_mut(&mut self, indexes: [usize; D]) -> Option<&mut T>
Source§unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; D]) -> &mut T
unsafe fn get_reference_unchecked_mut(&mut self, indexes: [usize; D]) -> &mut T
Source§impl<T, const D: usize> TensorRef<T, D> for Box<dyn TensorMut<T, D>>
A box of a dynamic TensorMut also implements TensorRef.
impl<T, const D: usize> TensorRef<T, D> for Box<dyn TensorMut<T, D>>
A box of a dynamic TensorMut also implements TensorRef.
Source§fn get_reference(&self, indexes: [usize; D]) -> Option<&T>
fn get_reference(&self, indexes: [usize; D]) -> Option<&T>
Source§fn view_shape(&self) -> [(Dimension, usize); D]
fn view_shape(&self) -> [(Dimension, usize); D]
Source§unsafe fn get_reference_unchecked(&self, indexes: [usize; D]) -> &T
unsafe fn get_reference_unchecked(&self, indexes: [usize; D]) -> &T
Source§fn data_layout(&self) -> DataLayout<D>
fn data_layout(&self) -> DataLayout<D>
Implementations on Foreign Types§
Source§impl<'source, T, S, const D: usize> TensorMut<T, D> for &'source mut Swhere
S: TensorMut<T, D>,
If some type implements TensorMut, then an exclusive reference to it implements TensorMut
as well
impl<'source, T, S, const D: usize> TensorMut<T, D> for &'source mut Swhere
S: TensorMut<T, D>,
If some type implements TensorMut, then an exclusive reference to it implements TensorMut as well
Source§impl<T, S, const D: usize> TensorMut<T, D> for Box<S>where
S: TensorMut<T, D>,
A box of a TensorMut also implements TensorMut.
impl<T, S, const D: usize> TensorMut<T, D> for Box<S>where
S: TensorMut<T, D>,
A box of a TensorMut also implements TensorMut.
Source§impl<T, const D: usize> TensorMut<T, D> for Box<dyn TensorMut<T, D>>
A box of a dynamic TensorMut also implements TensorMut.
impl<T, const D: usize> TensorMut<T, D> for Box<dyn TensorMut<T, D>>
A box of a dynamic TensorMut also implements TensorMut.
Implementors§
impl<'a, T, S, const D: usize> TensorMut<(T, usize), D> for RecordTensor<'a, T, S, D>
RecordTensor implements TensorMut when the source does, returning mutable references to the
tuples of T
and Index
.
impl<T, S1, S2> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2), 0>
impl<T, S1, S2> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2), 1>
impl<T, S1, S2> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2), 2>
impl<T, S1, S2> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2), 3>
impl<T, S1, S2> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2), 4>
impl<T, S1, S2> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2), 5>
impl<T, S1, S2, S3> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3), 0>
impl<T, S1, S2, S3> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3), 1>
impl<T, S1, S2, S3> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3), 2>
impl<T, S1, S2, S3> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3), 3>
impl<T, S1, S2, S3> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3), 4>
impl<T, S1, S2, S3> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3), 5>
impl<T, S1, S2, S3, S4> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3, S4), 0>
impl<T, S1, S2, S3, S4> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3, S4), 1>
impl<T, S1, S2, S3, S4> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3, S4), 2>
impl<T, S1, S2, S3, S4> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3, S4), 3>
impl<T, S1, S2, S3, S4> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3, S4), 4>
impl<T, S1, S2, S3, S4> TensorMut<T, { $d + 1 }> for TensorStack<T, (S1, S2, S3, S4), 5>
impl<T, S1, S2, S3, S4, const D: usize> TensorMut<T, D> for TensorChain<T, (S1, S2, S3, S4), D>
impl<T, S1, S2, S3, const D: usize> TensorMut<T, D> for TensorChain<T, (S1, S2, S3), D>
impl<T, S1, S2, const D: usize> TensorMut<T, D> for TensorChain<T, (S1, S2), D>
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 1>where
S: TensorMut<T, 0>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 2>where
S: TensorMut<T, 0>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 3>where
S: TensorMut<T, 0>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 4>where
S: TensorMut<T, 0>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 5>where
S: TensorMut<T, 0>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 0, 6>where
S: TensorMut<T, 0>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 1>where
S: TensorMut<T, 1>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 2>where
S: TensorMut<T, 1>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 3>where
S: TensorMut<T, 1>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 4>where
S: TensorMut<T, 1>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 1, 5>where
S: TensorMut<T, 1>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 1>where
S: TensorMut<T, 2>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 2>where
S: TensorMut<T, 2>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 3>where
S: TensorMut<T, 2>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 2, 4>where
S: TensorMut<T, 2>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 3, 1>where
S: TensorMut<T, 3>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 3, 2>where
S: TensorMut<T, 3>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 3, 3>where
S: TensorMut<T, 3>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 4, 1>where
S: TensorMut<T, 4>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 4, 2>where
S: TensorMut<T, 4>,
impl<T, S> TensorMut<T, { $d + $i }> for TensorExpansion<T, S, 5, 1>where
S: TensorMut<T, 5>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 1, 1>where
S: TensorMut<T, 1>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 2, 1>where
S: TensorMut<T, 2>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 2, 2>where
S: TensorMut<T, 2>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 3, 1>where
S: TensorMut<T, 3>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 3, 2>where
S: TensorMut<T, 3>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 3, 3>where
S: TensorMut<T, 3>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 4, 1>where
S: TensorMut<T, 4>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 4, 2>where
S: TensorMut<T, 4>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 4, 3>where
S: TensorMut<T, 4>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 4, 4>where
S: TensorMut<T, 4>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 5, 1>where
S: TensorMut<T, 5>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 5, 2>where
S: TensorMut<T, 5>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 5, 3>where
S: TensorMut<T, 5>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 5, 4>where
S: TensorMut<T, 5>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 5, 5>where
S: TensorMut<T, 5>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 6, 1>where
S: TensorMut<T, 6>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 6, 2>where
S: TensorMut<T, 6>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 6, 3>where
S: TensorMut<T, 6>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 6, 4>where
S: TensorMut<T, 6>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 6, 5>where
S: TensorMut<T, 6>,
impl<T, S> TensorMut<T, { $d - $i }> for TensorIndex<T, S, 6, 6>where
S: TensorMut<T, 6>,
impl<T, S, N> TensorMut<T, 2> for TensorRefMatrix<T, S, N>
impl<T, S, const D: usize> TensorMut<T, D> for TensorAccess<T, S, D>where
S: TensorMut<T, D>,
A TensorAccess implements TensorMut, with the dimension order and indexing matching that of the TensorAccess shape.
impl<T, S, const D: usize> TensorMut<T, D> for TensorTranspose<T, S, D>where
S: TensorMut<T, D>,
A TensorTranspose implements TensorMut, with the dimension order and indexing matching that of the TensorTranspose shape.
impl<T, S, const D: usize> TensorMut<T, D> for TensorMask<T, S, D>where
S: TensorMut<T, D>,
A TensorMask implements TensorMut, with the dimension lengths reduced by the mask the the TensorMask was created with.
impl<T, S, const D: usize> TensorMut<T, D> for TensorRange<T, S, D>where
S: TensorMut<T, D>,
A TensorRange implements TensorMut, with the dimension lengths reduced to the range the the TensorRange was created with.
impl<T, S, const D: usize> TensorMut<T, D> for TensorRename<T, S, D>where
S: TensorMut<T, D>,
A TensorRename implements TensorMut, with the dimension names the TensorRename was created with overriding the dimension names in the original source.
impl<T, S, const D: usize> TensorMut<T, D> for TensorReverse<T, S, D>where
S: TensorMut<T, D>,
A TensorReverse implements TensorMut, with the dimension names the TensorReverse was created with iterating in reverse order compared to the dimension names in the original source.
impl<T, S, const D: usize, const D2: usize> TensorMut<T, D2> for TensorReshape<T, S, D, D2>where
S: TensorMut<T, D>,
A TensorReshape implements TensorMut, with the data in the same order as the original source.