pub struct PointStore {
pub vectors: Vec<f32>,
pub dim: usize,
pub len: usize,
pub attrs: Vec<Vec<u32>>,
}Expand description
Flat f32 storage for vectors + per-point attribute metadata.
Vectors are stored in a contiguous Vec<f32> with stride = dim.
Attributes are stored as k arrays of u32, one per attribute dimension.
Fields§
§vectors: Vec<f32>Contiguous vector data: point i is at vectors[i*dim..(i+1)*dim]
dim: usizeNumber of dimensions per vector
len: usizeNumber of points
attrs: Vec<Vec<u32>>Attribute values: attrs[j][i] = value of attribute j for point i
Implementations§
Source§impl PointStore
impl PointStore
pub fn new(dim: usize, k: usize) -> Self
Sourcepub fn from_parts(vectors: Vec<f32>, dim: usize, attrs: Vec<Vec<u32>>) -> Self
pub fn from_parts(vectors: Vec<f32>, dim: usize, attrs: Vec<Vec<u32>>) -> Self
Build from pre-allocated vectors and attributes.
Sourcepub fn push(&mut self, vector: &[f32], attr_values: &[u32]) -> u32
pub fn push(&mut self, vector: &[f32], attr_values: &[u32]) -> u32
Append a single point. Returns its id.
Sourcepub fn cardinality(&self, j: usize) -> usize
pub fn cardinality(&self, j: usize) -> usize
Number of distinct values for attribute dimension j.
Trait Implementations§
Source§impl Drop for PointStore
impl Drop for PointStore
Auto Trait Implementations§
impl Freeze for PointStore
impl RefUnwindSafe for PointStore
impl Send for PointStore
impl Sync for PointStore
impl Unpin for PointStore
impl UnsafeUnpin for PointStore
impl UnwindSafe for PointStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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