pub trait Reallocator<N: Scalar, RFrom: Dim, CFrom: Dim, RTo: Dim, CTo: Dim>: Allocator<N, RFrom, CFrom> + Allocator<N, RTo, CTo> {
    unsafe fn reallocate_copy(
        nrows: RTo,
        ncols: CTo,
        buf: <Self as Allocator<N, RFrom, CFrom>>::Buffer
    ) -> <Self as Allocator<N, RTo, CTo>>::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§

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 of buf are truncated.
  • If buf is smaller than the output size, then extra elements of the output are left uninitialized.

Implementors§