pub struct MemoryLayoutManager { /* private fields */ }Expand description
Memory-efficient data layout manager
Implementations§
Source§impl MemoryLayoutManager
impl MemoryLayoutManager
pub fn new(layout: ExplanationDataLayout) -> Self
Sourcepub fn get_optimized_layout(
&self,
n_samples: usize,
n_features: usize,
) -> ExplanationDataLayout
pub fn get_optimized_layout( &self, n_samples: usize, n_features: usize, ) -> ExplanationDataLayout
Get optimized memory layout for explanation data
Sourcepub fn allocate_aligned(&self, size: usize) -> Vec<Float> ⓘ
pub fn allocate_aligned(&self, size: usize) -> Vec<Float> ⓘ
Allocate aligned memory for explanation computation
Sourcepub fn deallocate(&self, memory: Vec<Float>)
pub fn deallocate(&self, memory: Vec<Float>)
Return memory to pool for reuse
Sourcepub unsafe fn copy_with_prefetch(
&self,
src: *const Float,
dst: *mut Float,
len: usize,
)
pub unsafe fn copy_with_prefetch( &self, src: *const Float, dst: *mut Float, len: usize, )
Unsafe memory copy with prefetching for better cache performance
§Safety
This function is safe when:
srcanddstare valid pointerssrcanddstdo not overlaplenis within bounds for both arrays
Sourcepub unsafe fn vectorized_add(
&self,
a: *const Float,
b: *const Float,
result: *mut Float,
len: usize,
)
pub unsafe fn vectorized_add( &self, a: *const Float, b: *const Float, result: *mut Float, len: usize, )
Unsafe vectorized addition with SIMD for maximum performance
§Safety
This function is safe when:
a,b, andresultare valid pointers- All arrays have at least
lenelements - The arrays are properly aligned for SIMD operations
Sourcepub unsafe fn fast_dot_product(
&self,
a: *const Float,
b: *const Float,
len: usize,
) -> Float
pub unsafe fn fast_dot_product( &self, a: *const Float, b: *const Float, len: usize, ) -> Float
Unsafe fast dot product computation with SIMD
§Safety
This function is safe when:
aandbare valid pointers- Both arrays have at least
lenelements - The arrays are properly aligned for SIMD operations
Auto Trait Implementations§
impl Freeze for MemoryLayoutManager
impl RefUnwindSafe for MemoryLayoutManager
impl Send for MemoryLayoutManager
impl Sync for MemoryLayoutManager
impl Unpin for MemoryLayoutManager
impl UnwindSafe for MemoryLayoutManager
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