pub struct ProjectionCache {
pub directions: Vec<Vec<f32>>,
pub num_projections: usize,
pub dim: usize,
}Expand description
Cache for random projection directions
Fields§
§directions: Vec<Vec<f32>>Random unit directions [P × dim]
num_projections: usizeNumber of projections
dim: usizeDimension
Implementations§
Source§impl ProjectionCache
impl ProjectionCache
Sourcepub fn new(dim: usize, num_projections: usize, seed: u64) -> Self
pub fn new(dim: usize, num_projections: usize, seed: u64) -> Self
Create new projection cache with P random directions
Sourcepub fn project(&self, vector: &[f32]) -> Vec<f32>
pub fn project(&self, vector: &[f32]) -> Vec<f32>
Project a single vector onto all directions Returns [P] projected values
Sourcepub fn project_into(&self, vector: &[f32], out: &mut [f32])
pub fn project_into(&self, vector: &[f32], out: &mut [f32])
Project a single vector into pre-allocated buffer
Trait Implementations§
Source§impl Clone for ProjectionCache
impl Clone for ProjectionCache
Source§fn clone(&self) -> ProjectionCache
fn clone(&self) -> ProjectionCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProjectionCache
impl RefUnwindSafe for ProjectionCache
impl Send for ProjectionCache
impl Sync for ProjectionCache
impl Unpin for ProjectionCache
impl UnwindSafe for ProjectionCache
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