pub trait SparseDot: Sized {
type Weight;
type Output;
// Required method
fn sparse_dot(
a_indices: &[Self],
b_indices: &[Self],
a_weights: &[Self::Weight],
b_weights: &[Self::Weight],
) -> Self::Output;
}Expand description
Computes sparse dot product between two sorted sparse vectors with weights.
Each vector consists of sorted indices and corresponding weights. The dot product is computed over the intersection of indices, summing the products of weights.
Required Associated Types§
Required Methods§
Sourcefn sparse_dot(
a_indices: &[Self],
b_indices: &[Self],
a_weights: &[Self::Weight],
b_weights: &[Self::Weight],
) -> Self::Output
fn sparse_dot( a_indices: &[Self], b_indices: &[Self], a_weights: &[Self::Weight], b_weights: &[Self::Weight], ) -> Self::Output
Computes sparse dot product.
Returns the sum of a_weights[i] × b_weights[j] for all pairs where a_indices[i] == b_indices[j].
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.