Trait nyx_space::linalg::allocator::Reallocator [−][src]
pub trait Reallocator<T, RFrom, CFrom, RTo, CTo>: Allocator<T, RFrom, CFrom> + Allocator<T, RTo, CTo> where
T: Scalar,
RFrom: Dim,
CFrom: Dim,
RTo: Dim,
CTo: Dim, {
unsafe fn reallocate_copy(
nrows: RTo,
ncols: CTo,
buf: Self::Buffer
) -> Self::Buffer;
}
Expand description
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
unsafe fn reallocate_copy(
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.