Skip to main content

ParallelVectorNorm

Trait ParallelVectorNorm 

Source
pub trait ParallelVectorNorm<T: FpScalar + Send + Sync>: VectorNorm<T> {
    // Required method
    fn compute_vector_norm_par_iter<I: IntoParallelIterator<Item = T>>(
        iter: I,
    ) -> NonNegativeRealScalar<T::RealType>;

    // Provided method
    fn compute_vector_norm_par(v: &[T]) -> NonNegativeRealScalar<T::RealType> { ... }
}
Expand description

Parallel vector norm computation.

Extends VectorNorm with parallel variants that distribute work across threads using rayon. Chunks are accumulated independently and merged via Accumulator::combine.

Requires T: Send + Sync.

§Methods

Required Methods§

Source

fn compute_vector_norm_par_iter<I: IntoParallelIterator<Item = T>>( iter: I, ) -> NonNegativeRealScalar<T::RealType>

Computes the norm from an owned parallel iterator.

Provided Methods§

Source

fn compute_vector_norm_par(v: &[T]) -> NonNegativeRealScalar<T::RealType>

Computes the norm of a slice in parallel.

The default implementation calls compute_vector_norm_par_iter with v.par_iter().cloned().

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<ScalarType> ParallelVectorNorm<ScalarType> for LinfNorm
where ScalarType: FpScalar,

Source§

impl<T, SumAcc> ParallelVectorNorm<T> for L1Norm<SumAcc>
where T: FpScalar, SumAcc: SumAccumulator<Input = T::RealType> + Send,

Source§

impl<T, SumAcc> ParallelVectorNorm<T> for L2Norm<SumAcc>
where T: FpScalar, SumAcc: SumAccumulator<Input = T::RealType> + Send,