Trait rin::math::allocator::Reallocator [−][src]
pub trait Reallocator<N, RFrom, CFrom, RTo, CTo>: Allocator<N, RFrom, CFrom> + Allocator<N, RTo, CTo> where
CFrom: Dim,
CTo: Dim,
N: Scalar,
RFrom: Dim,
RTo: Dim, { unsafe fn reallocate_copy(
nrows: RTo,
ncols: CTo,
buf: Self::Buffer
) -> Self::Buffer; }
A matrix reallocator. Changes the size of the memory buffer that initially contains (RFrom × CFrom) elements to a smaller or larger size (RTo, CTo).
Required Methods
unsafe fn reallocate_copy(
nrows: RTo,
ncols: CTo,
buf: Self::Buffer
) -> Self::Buffer
nrows: RTo,
ncols: CTo,
buf: Self::Buffer
) -> Self::Buffer
Reallocates a buffer of shape (RTo, CTo)
, possibly reusing a previously allocated buffer
buf
. Data stored by buf
are linearly copied to the output:
- The copy is performed as if both were just arrays (without a matrix structure).
- If
buf
is larger than the output size, then extra elements ofbuf
are truncated. - If
buf
is smaller than the output size, then extra elements of the output are left uninitialized.
Implementors
impl<N, RFrom, RTo> Reallocator<N, RFrom, Dynamic, RTo, Dynamic> for DefaultAllocator where
N: Scalar,
RFrom: DimName,
RTo: DimName,impl<N, RFrom, CFrom, CTo> Reallocator<N, RFrom, CFrom, Dynamic, CTo> for DefaultAllocator where
CFrom: DimName,
CTo: Dim,
N: Scalar,
RFrom: DimName,
<RFrom as DimName>::Value: Mul<<CFrom as DimName>::Value>,
<<RFrom as DimName>::Value as Mul<<CFrom as DimName>::Value>>::Output: ArrayLength<N>,impl<N, RFrom, CTo> Reallocator<N, RFrom, Dynamic, Dynamic, CTo> for DefaultAllocator where
CTo: Dim,
N: Scalar,
RFrom: DimName,impl<N, RFrom, CFrom, RTo, CTo> Reallocator<N, RFrom, CFrom, RTo, CTo> for DefaultAllocator where
CFrom: Dim,
CTo: DimName,
N: Scalar,
RFrom: Dim,
RTo: DimName,
DefaultAllocator: Allocator<N, RFrom, CFrom>,
<RTo as DimName>::Value: Mul<<CTo as DimName>::Value>,
<<RTo as DimName>::Value as Mul<<CTo as DimName>::Value>>::Output: ArrayLength<N>,impl<N, CFrom, RTo> Reallocator<N, Dynamic, CFrom, RTo, Dynamic> for DefaultAllocator where
CFrom: Dim,
N: Scalar,
RTo: DimName,impl<N, CFrom, CTo> Reallocator<N, Dynamic, CFrom, Dynamic, CTo> for DefaultAllocator where
CFrom: Dim,
CTo: Dim,
N: Scalar,impl<N, RFrom, CFrom, RTo> Reallocator<N, RFrom, CFrom, RTo, Dynamic> for DefaultAllocator where
CFrom: DimName,
N: Scalar,
RFrom: DimName,
RTo: DimName,
<RFrom as DimName>::Value: Mul<<CFrom as DimName>::Value>,
<<RFrom as DimName>::Value as Mul<<CFrom as DimName>::Value>>::Output: ArrayLength<N>,