pub struct SimdGraphUtils;Expand description
General SIMD-accelerated vector utilities for graph computations.
Implementations§
Source§impl SimdGraphUtils
impl SimdGraphUtils
Sourcepub fn axpy(alpha: f64, x: &ArrayView1<'_, f64>, y: &mut [f64])
pub fn axpy(alpha: f64, x: &ArrayView1<'_, f64>, y: &mut [f64])
SIMD-accelerated AXPY: y = alpha * x + y.
§Arguments
alpha- Scalar multiplierx- Input vectory- Accumulator vector (modified in place)
Sourcepub fn norm_l2(v: &ArrayView1<'_, f64>) -> f64
pub fn norm_l2(v: &ArrayView1<'_, f64>) -> f64
L2 norm of a vector using SIMD.
Sourcepub fn norm_l1(v: &ArrayView1<'_, f64>) -> f64
pub fn norm_l1(v: &ArrayView1<'_, f64>) -> f64
L1 norm of a vector using SIMD.
Sourcepub fn norm_linf(v: &ArrayView1<'_, f64>) -> f64
pub fn norm_linf(v: &ArrayView1<'_, f64>) -> f64
Linf norm (max absolute value) of a vector using SIMD.
Sourcepub fn dot(a: &ArrayView1<'_, f64>, b: &ArrayView1<'_, f64>) -> f64
pub fn dot(a: &ArrayView1<'_, f64>, b: &ArrayView1<'_, f64>) -> f64
SIMD dot product.
Sourcepub fn normalize_l2(v: &ArrayView1<'_, f64>) -> Option<Array1<f64>>
pub fn normalize_l2(v: &ArrayView1<'_, f64>) -> Option<Array1<f64>>
Normalize a vector to unit L2 norm using SIMD.
Returns None if the vector is zero.
Sourcepub fn cosine_similarity(
a: &ArrayView1<'_, f64>,
b: &ArrayView1<'_, f64>,
) -> f64
pub fn cosine_similarity( a: &ArrayView1<'_, f64>, b: &ArrayView1<'_, f64>, ) -> f64
Compute cosine similarity between two vectors using SIMD.
Sourcepub fn difference(
a: &ArrayView1<'_, f64>,
b: &ArrayView1<'_, f64>,
) -> Array1<f64>
pub fn difference( a: &ArrayView1<'_, f64>, b: &ArrayView1<'_, f64>, ) -> Array1<f64>
Element-wise vector difference using SIMD.
Sourcepub fn weighted_sum(
a: &ArrayView1<'_, f64>,
weight_a: f64,
b: &ArrayView1<'_, f64>,
weight_b: f64,
) -> Array1<f64>
pub fn weighted_sum( a: &ArrayView1<'_, f64>, weight_a: f64, b: &ArrayView1<'_, f64>, weight_b: f64, ) -> Array1<f64>
Element-wise weighted sum: result = a * weight_a + b * weight_b.
Auto Trait Implementations§
impl Freeze for SimdGraphUtils
impl RefUnwindSafe for SimdGraphUtils
impl Send for SimdGraphUtils
impl Sync for SimdGraphUtils
impl Unpin for SimdGraphUtils
impl UnsafeUnpin for SimdGraphUtils
impl UnwindSafe for SimdGraphUtils
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