pub struct HypersphericalProjection { /* private fields */ }Expand description
Hyperspherical projection for high-dimensional embeddings
Implementations§
Source§impl HypersphericalProjection
impl HypersphericalProjection
Sourcepub fn new(dimension: usize, lane: PrecisionLane) -> Self
pub fn new(dimension: usize, lane: PrecisionLane) -> Self
Create a new hyperspherical projection
Sourcepub fn to_spherical(&self, cartesian: &[f32]) -> Vec<f32>
pub fn to_spherical(&self, cartesian: &[f32]) -> Vec<f32>
Project Cartesian coordinates to hyperspherical (angles)
Sourcepub fn to_cartesian(&self, angles: &[f32], radius: f32) -> Vec<f32>
pub fn to_cartesian(&self, angles: &[f32], radius: f32) -> Vec<f32>
Project hyperspherical coordinates back to Cartesian
Sourcepub fn geodesic_distance(&self, a: &[f32], b: &[f32]) -> f32
pub fn geodesic_distance(&self, a: &[f32], b: &[f32]) -> f32
Compute geodesic distance on hypersphere
Trait Implementations§
Source§impl Clone for HypersphericalProjection
impl Clone for HypersphericalProjection
Source§fn clone(&self) -> HypersphericalProjection
fn clone(&self) -> HypersphericalProjection
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 HypersphericalProjection
impl RefUnwindSafe for HypersphericalProjection
impl Send for HypersphericalProjection
impl Sync for HypersphericalProjection
impl Unpin for HypersphericalProjection
impl UnwindSafe for HypersphericalProjection
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