pub struct MmapNpyArray2F32 { /* private fields */ }Expand description
Memory-mapped NPY array for f32 values (used for centroids).
This struct provides zero-copy access to 2D f32 arrays stored in NPY format.
Unlike loading into an owned Array2<f32>, this approach lets the OS manage
paging, reducing resident memory usage for large centroid matrices.
Implementations§
Source§impl MmapNpyArray2F32
impl MmapNpyArray2F32
Sourcepub fn from_npy_file(path: &Path) -> Result<Self>
pub fn from_npy_file(path: &Path) -> Result<Self>
Load a 2D f32 array from an NPY file.
Sourcepub fn view(&self) -> ArrayView2<'_, f32>
pub fn view(&self) -> ArrayView2<'_, f32>
Get a view of the entire array as ArrayView2.
This provides zero-copy access to the memory-mapped data.
Sourcepub fn row(&self, idx: usize) -> ArrayView1<'_, f32>
pub fn row(&self, idx: usize) -> ArrayView1<'_, f32>
Get a view of a single row.
Sourcepub fn slice_rows(&self, start: usize, end: usize) -> ArrayView2<'_, f32>
pub fn slice_rows(&self, start: usize, end: usize) -> ArrayView2<'_, f32>
Get a view of rows [start..end] as ArrayView2.
Auto Trait Implementations§
impl Freeze for MmapNpyArray2F32
impl RefUnwindSafe for MmapNpyArray2F32
impl Send for MmapNpyArray2F32
impl Sync for MmapNpyArray2F32
impl Unpin for MmapNpyArray2F32
impl UnsafeUnpin for MmapNpyArray2F32
impl UnwindSafe for MmapNpyArray2F32
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more