Struct slas::StaticCowVec
source · [−]Expand description
Vectors as copy-on-write smart pointers. Use full for situations where you don’t know,
if you need mutable access to your data, at compile time.
See moo
for how to create a StaticCowVec.
Implementations
sourceimpl<'a, T: Copy, const LEN: usize> StaticCowVec<'a, T, LEN>
impl<'a, T: Copy, const LEN: usize> StaticCowVec<'a, T, LEN>
pub const fn is_borrowed(&self) -> bool
pub const fn is_owned(&self) -> bool
sourcepub const unsafe fn from_ptr(ptr: *const T) -> Self
pub const unsafe fn from_ptr(ptr: *const T) -> Self
Cast StaticCowVec from pointer.
Safety
Is safe as long as *ptr
is contiguous and *ptr
has a length of LEN
.
sourcepub const unsafe fn from_ptr_unchecked(ptr: *const T) -> Self
pub const unsafe fn from_ptr_unchecked(ptr: *const T) -> Self
Cast StaticCowVec from pointer without checking if it is null. Very very very unsafe.
Safety
Is safe as long as *ptr
is contiguous, *ptr
has a length of LEN
and ptr
is not NULL.
Methods from Deref<Target = StaticVecUnion<'a, T, LEN>>
sourcepub fn matrix_ref<B: Backend<T>, const M: usize, const K: usize>(
&'a self
) -> Matrix<T, &'a Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
pub fn matrix_ref<B: Backend<T>, const M: usize, const K: usize>(
&'a self
) -> Matrix<T, &'a Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
Return crate::tensor::Tensor
with shape crate::tensor::MatrixShape::<M, K>
.
sourcepub fn reshape_ref<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a self,
shape: S,
backend: B
) -> Tensor<T, &'a Self, B, NDIM, LEN, S> where
Self: Sized,
pub fn reshape_ref<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a self,
shape: S,
backend: B
) -> Tensor<T, &'a Self, B, NDIM, LEN, S> where
Self: Sized,
Example
use slas::prelude::*;
let a = moo![f32: 0..6].reshape(&[3, 2], slas_backend::Blas);
let b = [0.; 6].reshape(&[2, 3], slas_backend::Blas);
assert_eq!(a.matrix().matrix_mul(&b.matrix()), [0.; 4]);
In this example the matricies a
and b
have dynamic shapes.
If you wan’t to create matricies with static shapes, you should use StaticVec::matrix
.
sourcepub fn matrix_mut_ref<B: Backend<T>, const M: usize, const K: usize>(
&'a mut self
) -> Matrix<T, &'a mut Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
pub fn matrix_mut_ref<B: Backend<T>, const M: usize, const K: usize>(
&'a mut self
) -> Matrix<T, &'a mut Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
Return crate::tensor::Tensor
with shape crate::tensor::MatrixShape::<M, K>
.
sourcepub fn reshape_mut_ref<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a mut self,
shape: S,
backend: B
) -> Tensor<T, &'a mut Self, B, NDIM, LEN, S> where
Self: Sized,
pub fn reshape_mut_ref<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a mut self,
shape: S,
backend: B
) -> Tensor<T, &'a mut Self, B, NDIM, LEN, S> where
Self: Sized,
Example
use slas::prelude::*;
let a = moo![f32: 0..6].reshape(&[3, 2], slas_backend::Blas);
let b = [0.; 6].reshape(&[2, 3], slas_backend::Blas);
assert_eq!(a.matrix().matrix_mul(&b.matrix()), [0.; 4]);
In this example the matricies a
and b
have dynamic shapes.
If you wan’t to create matricies with static shapes, you should use StaticVec::matrix
.
Methods from Deref<Target = [T; LEN]>
1.57.0 · sourcepub fn as_slice(&self) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn as_slice(&self) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns a slice containing the entire array. Equivalent to &s[..]
.
1.57.0 · sourcepub fn as_mut_slice(&mut self) -> &mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn as_mut_slice(&mut self) -> &mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns a mutable slice containing the entire array. Equivalent to
&mut s[..]
.
sourcepub fn each_ref(&self) -> [&T; N]
🔬 This is a nightly-only experimental API. (array_methods
)
pub fn each_ref(&self) -> [&T; N]
array_methods
)Borrows each element and returns an array of references with the same
size as self
.
Example
#![feature(array_methods)]
let floats = [3.1, 2.7, -1.0];
let float_refs: [&f64; 3] = floats.each_ref();
assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);
This method is particularly useful if combined with other methods, like
map
. This way, you can avoid moving the original
array if its elements are not Copy
.
#![feature(array_methods)]
let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
let is_ascii = strings.each_ref().map(|s| s.is_ascii());
assert_eq!(is_ascii, [true, false, true]);
// We can still access the original array: it has not been moved.
assert_eq!(strings.len(), 3);
sourcepub fn each_mut(&mut self) -> [&mut T; N]
🔬 This is a nightly-only experimental API. (array_methods
)
pub fn each_mut(&mut self) -> [&mut T; N]
array_methods
)Borrows each element mutably and returns an array of mutable references
with the same size as self
.
Example
#![feature(array_methods)]
let mut floats = [3.1, 2.7, -1.0];
let float_refs: [&mut f64; 3] = floats.each_mut();
*float_refs[0] = 0.0;
assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
assert_eq!(floats, [0.0, 2.7, -1.0]);
sourcepub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
🔬 This is a nightly-only experimental API. (split_array
)
pub fn split_array_ref<const M: usize>(&self) -> (&[T; M], &[T])
split_array
)Divides one array reference into two at an index.
The first will contain all indices from [0, M)
(excluding
the index M
itself) and the second will contain all
indices from [M, N)
(excluding the index N
itself).
Panics
Panics if M > N
.
Examples
#![feature(split_array)]
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.split_array_ref::<0>();
assert_eq!(left, &[]);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<2>();
assert_eq!(left, &[1, 2]);
assert_eq!(right, &[3, 4, 5, 6]);
}
{
let (left, right) = v.split_array_ref::<6>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}
sourcepub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
🔬 This is a nightly-only experimental API. (split_array
)
pub fn split_array_mut<const M: usize>(&mut self) -> (&mut [T; M], &mut [T])
split_array
)Divides one mutable array reference into two at an index.
The first will contain all indices from [0, M)
(excluding
the index M
itself) and the second will contain all
indices from [M, N)
(excluding the index N
itself).
Panics
Panics if M > N
.
Examples
#![feature(split_array)]
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.split_array_mut::<2>();
assert_eq!(left, &mut [1, 0][..]);
assert_eq!(right, &mut [3, 0, 5, 6]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
sourcepub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
🔬 This is a nightly-only experimental API. (split_array
)
pub fn rsplit_array_ref<const M: usize>(&self) -> (&[T], &[T; M])
split_array
)Divides one array reference into two at an index from the end.
The first will contain all indices from [0, N - M)
(excluding
the index N - M
itself) and the second will contain all
indices from [N - M, N)
(excluding the index N
itself).
Panics
Panics if M > N
.
Examples
#![feature(split_array)]
let v = [1, 2, 3, 4, 5, 6];
{
let (left, right) = v.rsplit_array_ref::<0>();
assert_eq!(left, &[1, 2, 3, 4, 5, 6]);
assert_eq!(right, &[]);
}
{
let (left, right) = v.rsplit_array_ref::<2>();
assert_eq!(left, &[1, 2, 3, 4]);
assert_eq!(right, &[5, 6]);
}
{
let (left, right) = v.rsplit_array_ref::<6>();
assert_eq!(left, &[]);
assert_eq!(right, &[1, 2, 3, 4, 5, 6]);
}
sourcepub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
🔬 This is a nightly-only experimental API. (split_array
)
pub fn rsplit_array_mut<const M: usize>(&mut self) -> (&mut [T], &mut [T; M])
split_array
)Divides one mutable array reference into two at an index from the end.
The first will contain all indices from [0, N - M)
(excluding
the index N - M
itself) and the second will contain all
indices from [N - M, N)
(excluding the index N
itself).
Panics
Panics if M > N
.
Examples
#![feature(split_array)]
let mut v = [1, 0, 3, 0, 5, 6];
let (left, right) = v.rsplit_array_mut::<4>();
assert_eq!(left, &mut [1, 0]);
assert_eq!(right, &mut [3, 0, 5, 6][..]);
left[1] = 2;
right[1] = 4;
assert_eq!(v, [1, 2, 3, 4, 5, 6]);
Trait Implementations
sourceimpl<'a, T: Clone + Copy, const LEN: usize> Clone for StaticCowVec<'a, T, LEN>
impl<'a, T: Clone + Copy, const LEN: usize> Clone for StaticCowVec<'a, T, LEN>
sourcefn clone(&self) -> StaticCowVec<'a, T, LEN>
fn clone(&self) -> StaticCowVec<'a, T, LEN>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a, T: Copy, const LEN: usize> Deref for StaticCowVec<'a, T, LEN>
impl<'a, T: Copy, const LEN: usize> Deref for StaticCowVec<'a, T, LEN>
type Target = StaticVecUnion<'a, T, LEN>
type Target = StaticVecUnion<'a, T, LEN>
The resulting type after dereferencing.
sourceimpl<'a, T: Copy, const LEN: usize> DerefMut for StaticCowVec<'a, T, LEN>
impl<'a, T: Copy, const LEN: usize> DerefMut for StaticCowVec<'a, T, LEN>
sourceimpl<'a, T: Copy, const LEN: usize> StaticVec<T, LEN> for &StaticCowVec<'a, T, LEN>
impl<'a, T: Copy, const LEN: usize> StaticVec<T, LEN> for &StaticCowVec<'a, T, LEN>
sourceunsafe fn as_mut_ptr(&mut self) -> *mut T
unsafe fn as_mut_ptr(&mut self) -> *mut T
Return mutable pointer to first element. Read more
sourcefn moo_ref<'a>(&'a self) -> StaticVecRef<'a, T, LEN> where
T: Copy,
fn moo_ref<'a>(&'a self) -> StaticVecRef<'a, T, LEN> where
T: Copy,
Return a reference to self with the type of StaticVecUnion
sourcefn mut_moo_ref<'a>(&'a mut self) -> MutStaticVecRef<'a, T, LEN> where
T: Copy,
fn mut_moo_ref<'a>(&'a mut self) -> MutStaticVecRef<'a, T, LEN> where
T: Copy,
Return a mutable reference to self with the type of StaticVecUnion
.
If you want to write to a StaticVec, this is the method that should be used.
This method is re-implemented for StaticCowVecs,
so it perserves cow behavior even when cows are borrowed as StaticVec’s. Read more
sourcefn moo<'a>(&'a self) -> StaticCowVec<'a, T, LEN> where
T: Copy,
fn moo<'a>(&'a self) -> StaticCowVec<'a, T, LEN> where
T: Copy,
Return a cow vector containing a reference to self.
sourceunsafe fn get_unchecked<'a>(&'a self, i: usize) -> &'a T
unsafe fn get_unchecked<'a>(&'a self, i: usize) -> &'a T
Indexing without bounds checking. Read more
sourceunsafe fn get_unchecked_mut<'a>(&'a mut self, i: usize) -> &'a mut T where
T: Copy,
unsafe fn get_unchecked_mut<'a>(&'a mut self, i: usize) -> &'a mut T where
T: Copy,
Same as Self::get_unchecked
but mutable. Read more
sourceunsafe fn static_slice_unchecked<'a, const SLEN: usize>(
&'a self,
i: usize
) -> &'a [T; SLEN]
unsafe fn static_slice_unchecked<'a, const SLEN: usize>(
&'a self,
i: usize
) -> &'a [T; SLEN]
Returns a static slice spanning from index i to i+SLEN. Read more
sourceunsafe fn mut_static_slice_unchecked<'a, const SLEN: usize>(
&'a mut self,
i: usize
) -> &'a mut [T; SLEN]
unsafe fn mut_static_slice_unchecked<'a, const SLEN: usize>(
&'a mut self,
i: usize
) -> &'a mut [T; SLEN]
Returns a mutable static slice spanning from index i to i+SLEN. Read more
sourcefn moo_owned(&self) -> StaticVecUnion<'static, T, LEN> where
T: Copy,
Self: Sized,
fn moo_owned(&self) -> StaticVecUnion<'static, T, LEN> where
T: Copy,
Self: Sized,
Copies self into a StaticVecUnion.
sourcefn static_backend<B: Backend<T> + Default>(
self
) -> WithStaticBackend<T, Self, B, LEN> where
Self: Sized,
fn static_backend<B: Backend<T> + Default>(
self
) -> WithStaticBackend<T, Self, B, LEN> where
Self: Sized,
Statically use B
as a backend for self.
sourcefn matrix<B: Backend<T>, const M: usize, const K: usize>(
self
) -> Matrix<T, Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
fn matrix<B: Backend<T>, const M: usize, const K: usize>(
self
) -> Matrix<T, Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
Return crate::tensor::Tensor
with shape crate::tensor::MatrixShape::<M, K>
.
sourcefn reshape<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
self,
shape: S,
backend: B
) -> Tensor<T, Self, B, NDIM, LEN, S> where
Self: Sized,
fn reshape<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
self,
shape: S,
backend: B
) -> Tensor<T, Self, B, NDIM, LEN, S> where
Self: Sized,
Example Read more
unsafe fn reshape_unchecked_ref_mut<'a, B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a mut self,
shape: S,
backend: B
) -> Tensor<T, &mut [T; LEN], B, NDIM, LEN, S> where
Self: Sized,
unsafe fn reshape_unchecked_ref<'a, B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a self,
shape: S,
backend: B
) -> Tensor<T, &[T; LEN], B, NDIM, LEN, S> where
Self: Sized,
sourceimpl<'a, T: Copy, const LEN: usize> StaticVec<T, LEN> for &mut StaticCowVec<'a, T, LEN>
impl<'a, T: Copy, const LEN: usize> StaticVec<T, LEN> for &mut StaticCowVec<'a, T, LEN>
sourceunsafe fn as_mut_ptr(&mut self) -> *mut T
unsafe fn as_mut_ptr(&mut self) -> *mut T
Return mutable pointer to first element. Read more
sourcefn moo_ref<'a>(&'a self) -> StaticVecRef<'a, T, LEN> where
T: Copy,
fn moo_ref<'a>(&'a self) -> StaticVecRef<'a, T, LEN> where
T: Copy,
Return a reference to self with the type of StaticVecUnion
sourcefn mut_moo_ref<'a>(&'a mut self) -> MutStaticVecRef<'a, T, LEN> where
T: Copy,
fn mut_moo_ref<'a>(&'a mut self) -> MutStaticVecRef<'a, T, LEN> where
T: Copy,
Return a mutable reference to self with the type of StaticVecUnion
.
If you want to write to a StaticVec, this is the method that should be used.
This method is re-implemented for StaticCowVecs,
so it perserves cow behavior even when cows are borrowed as StaticVec’s. Read more
sourcefn moo<'a>(&'a self) -> StaticCowVec<'a, T, LEN> where
T: Copy,
fn moo<'a>(&'a self) -> StaticCowVec<'a, T, LEN> where
T: Copy,
Return a cow vector containing a reference to self.
sourceunsafe fn get_unchecked<'a>(&'a self, i: usize) -> &'a T
unsafe fn get_unchecked<'a>(&'a self, i: usize) -> &'a T
Indexing without bounds checking. Read more
sourceunsafe fn get_unchecked_mut<'a>(&'a mut self, i: usize) -> &'a mut T where
T: Copy,
unsafe fn get_unchecked_mut<'a>(&'a mut self, i: usize) -> &'a mut T where
T: Copy,
Same as Self::get_unchecked
but mutable. Read more
sourceunsafe fn static_slice_unchecked<'a, const SLEN: usize>(
&'a self,
i: usize
) -> &'a [T; SLEN]
unsafe fn static_slice_unchecked<'a, const SLEN: usize>(
&'a self,
i: usize
) -> &'a [T; SLEN]
Returns a static slice spanning from index i to i+SLEN. Read more
sourceunsafe fn mut_static_slice_unchecked<'a, const SLEN: usize>(
&'a mut self,
i: usize
) -> &'a mut [T; SLEN]
unsafe fn mut_static_slice_unchecked<'a, const SLEN: usize>(
&'a mut self,
i: usize
) -> &'a mut [T; SLEN]
Returns a mutable static slice spanning from index i to i+SLEN. Read more
sourcefn moo_owned(&self) -> StaticVecUnion<'static, T, LEN> where
T: Copy,
Self: Sized,
fn moo_owned(&self) -> StaticVecUnion<'static, T, LEN> where
T: Copy,
Self: Sized,
Copies self into a StaticVecUnion.
sourcefn static_backend<B: Backend<T> + Default>(
self
) -> WithStaticBackend<T, Self, B, LEN> where
Self: Sized,
fn static_backend<B: Backend<T> + Default>(
self
) -> WithStaticBackend<T, Self, B, LEN> where
Self: Sized,
Statically use B
as a backend for self.
sourcefn matrix<B: Backend<T>, const M: usize, const K: usize>(
self
) -> Matrix<T, Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
fn matrix<B: Backend<T>, const M: usize, const K: usize>(
self
) -> Matrix<T, Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
Return crate::tensor::Tensor
with shape crate::tensor::MatrixShape::<M, K>
.
sourcefn reshape<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
self,
shape: S,
backend: B
) -> Tensor<T, Self, B, NDIM, LEN, S> where
Self: Sized,
fn reshape<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
self,
shape: S,
backend: B
) -> Tensor<T, Self, B, NDIM, LEN, S> where
Self: Sized,
Example Read more
unsafe fn reshape_unchecked_ref_mut<'a, B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a mut self,
shape: S,
backend: B
) -> Tensor<T, &mut [T; LEN], B, NDIM, LEN, S> where
Self: Sized,
unsafe fn reshape_unchecked_ref<'a, B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a self,
shape: S,
backend: B
) -> Tensor<T, &[T; LEN], B, NDIM, LEN, S> where
Self: Sized,
sourceimpl<'a, T: Copy, const LEN: usize> StaticVec<T, LEN> for StaticCowVec<'a, T, LEN>
impl<'a, T: Copy, const LEN: usize> StaticVec<T, LEN> for StaticCowVec<'a, T, LEN>
sourceunsafe fn as_mut_ptr(&mut self) -> *mut T
unsafe fn as_mut_ptr(&mut self) -> *mut T
For StaticCowVec
calling as_mut_ptr
will dereference self and thereby copy the contents of self.borrowed into self, if self is borrowed.
sourcefn mut_moo_ref<'b>(&'b mut self) -> MutStaticVecRef<'b, T, LEN> where
T: Copy,
fn mut_moo_ref<'b>(&'b mut self) -> MutStaticVecRef<'b, T, LEN> where
T: Copy,
For StaticCowVec
calling mut_moo_ref
will dereference self and thereby copy the contents of self.borrowed into self, if self is borrowed.
sourcefn moo_ref<'a>(&'a self) -> StaticVecRef<'a, T, LEN> where
T: Copy,
fn moo_ref<'a>(&'a self) -> StaticVecRef<'a, T, LEN> where
T: Copy,
Return a reference to self with the type of StaticVecUnion
sourcefn moo<'a>(&'a self) -> StaticCowVec<'a, T, LEN> where
T: Copy,
fn moo<'a>(&'a self) -> StaticCowVec<'a, T, LEN> where
T: Copy,
Return a cow vector containing a reference to self.
sourceunsafe fn get_unchecked<'a>(&'a self, i: usize) -> &'a T
unsafe fn get_unchecked<'a>(&'a self, i: usize) -> &'a T
Indexing without bounds checking. Read more
sourceunsafe fn get_unchecked_mut<'a>(&'a mut self, i: usize) -> &'a mut T where
T: Copy,
unsafe fn get_unchecked_mut<'a>(&'a mut self, i: usize) -> &'a mut T where
T: Copy,
Same as Self::get_unchecked
but mutable. Read more
sourceunsafe fn static_slice_unchecked<'a, const SLEN: usize>(
&'a self,
i: usize
) -> &'a [T; SLEN]
unsafe fn static_slice_unchecked<'a, const SLEN: usize>(
&'a self,
i: usize
) -> &'a [T; SLEN]
Returns a static slice spanning from index i to i+SLEN. Read more
sourceunsafe fn mut_static_slice_unchecked<'a, const SLEN: usize>(
&'a mut self,
i: usize
) -> &'a mut [T; SLEN]
unsafe fn mut_static_slice_unchecked<'a, const SLEN: usize>(
&'a mut self,
i: usize
) -> &'a mut [T; SLEN]
Returns a mutable static slice spanning from index i to i+SLEN. Read more
sourcefn moo_owned(&self) -> StaticVecUnion<'static, T, LEN> where
T: Copy,
Self: Sized,
fn moo_owned(&self) -> StaticVecUnion<'static, T, LEN> where
T: Copy,
Self: Sized,
Copies self into a StaticVecUnion.
sourcefn static_backend<B: Backend<T> + Default>(
self
) -> WithStaticBackend<T, Self, B, LEN> where
Self: Sized,
fn static_backend<B: Backend<T> + Default>(
self
) -> WithStaticBackend<T, Self, B, LEN> where
Self: Sized,
Statically use B
as a backend for self.
sourcefn matrix<B: Backend<T>, const M: usize, const K: usize>(
self
) -> Matrix<T, Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
fn matrix<B: Backend<T>, const M: usize, const K: usize>(
self
) -> Matrix<T, Self, B, LEN, false, MatrixShape<M, K>> where
Self: Sized,
Return crate::tensor::Tensor
with shape crate::tensor::MatrixShape::<M, K>
.
sourcefn reshape<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
self,
shape: S,
backend: B
) -> Tensor<T, Self, B, NDIM, LEN, S> where
Self: Sized,
fn reshape<B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
self,
shape: S,
backend: B
) -> Tensor<T, Self, B, NDIM, LEN, S> where
Self: Sized,
Example Read more
unsafe fn reshape_unchecked_ref_mut<'a, B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a mut self,
shape: S,
backend: B
) -> Tensor<T, &mut [T; LEN], B, NDIM, LEN, S> where
Self: Sized,
unsafe fn reshape_unchecked_ref<'a, B: Backend<T>, S: Shape<NDIM>, const NDIM: usize>(
&'a self,
shape: S,
backend: B
) -> Tensor<T, &[T; LEN], B, NDIM, LEN, S> where
Self: Sized,
impl<'a, T: Copy + Copy, const LEN: usize> Copy for StaticCowVec<'a, T, LEN>
Auto Trait Implementations
impl<'a, T, const LEN: usize> RefUnwindSafe for StaticCowVec<'a, T, LEN> where
T: RefUnwindSafe,
impl<'a, T, const LEN: usize> Send for StaticCowVec<'a, T, LEN> where
T: Send + Sync,
impl<'a, T, const LEN: usize> Sync for StaticCowVec<'a, T, LEN> where
T: Sync,
impl<'a, T, const LEN: usize> Unpin for StaticCowVec<'a, T, LEN> where
T: Unpin,
impl<'a, T, const LEN: usize> UnwindSafe for StaticCowVec<'a, T, LEN> where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more