pub struct SphericalCapMetadata {
pub centroid: Vec<f32>,
pub theta_max: f32,
pub min_dot_to_centroid: f32,
pub max_dot_to_centroid: f32,
pub vector_count: u32,
pub mean_dot_to_centroid: f32,
}Expand description
Spherical cap metadata for a list/partition
Represents the region of the unit sphere covered by vectors in this list. Used to compute tight bounds for cosine/dot similarity.
Fields§
§centroid: Vec<f32>Centroid direction (unit vector)
theta_max: f32Maximum angular deviation from centroid (in radians) θ_max = max_{v∈L} arccos(v·c)
min_dot_to_centroid: f32Minimum dot product with centroid min_dot = min_{v∈L} v·c = cos(θ_max)
max_dot_to_centroid: f32Maximum dot product with centroid (typically ~1.0 for tight clusters)
vector_count: u32Number of vectors in this list
mean_dot_to_centroid: f32Mean dot product with centroid (for statistics)
Implementations§
Source§impl SphericalCapMetadata
impl SphericalCapMetadata
Sourcepub fn from_vectors(vectors: &[Vec<f32>], centroid: &[f32]) -> Self
pub fn from_vectors(vectors: &[Vec<f32>], centroid: &[f32]) -> Self
Sourcepub fn from_flat_vectors(data: &[f32], dim: usize, centroid: &[f32]) -> Self
pub fn from_flat_vectors(data: &[f32], dim: usize, centroid: &[f32]) -> Self
Build metadata from flat vector data
Sourcepub fn add_vector(&mut self, vector: &[f32])
pub fn add_vector(&mut self, vector: &[f32])
Update metadata incrementally when a new vector is added
Sourcepub fn angular_radius(&self) -> f32
pub fn angular_radius(&self) -> f32
Get the angular radius of the spherical cap (in radians)
Sourcepub fn angular_radius_degrees(&self) -> f32
pub fn angular_radius_degrees(&self) -> f32
Get the angular radius in degrees
Trait Implementations§
Source§impl Clone for SphericalCapMetadata
impl Clone for SphericalCapMetadata
Source§fn clone(&self) -> SphericalCapMetadata
fn clone(&self) -> SphericalCapMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SphericalCapMetadata
impl RefUnwindSafe for SphericalCapMetadata
impl Send for SphericalCapMetadata
impl Sync for SphericalCapMetadata
impl Unpin for SphericalCapMetadata
impl UnsafeUnpin for SphericalCapMetadata
impl UnwindSafe for SphericalCapMetadata
Blanket Implementations§
impl<T> Allocation for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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