pub trait Space<R>:
Additive
+ for<'a> MulAssign<&'a R>
+ for<'a> Mul<&'a R, Output = Self> {
// Provided method
fn msm(points: &[Self], scalars: &[R], _concurrency: usize) -> Self { ... }
}Expand description
A type which implements Additive, and supports scaling by some other type.
Mathematically, this is a (right) R-module.
The following operations must be supported (in addition to Additive):
T *= &R,T * &R
§Usage
// We use .clone() whenever ownership is needed.
fn example<R, T: Space<R>>(mut x: T, y: R) {
x *= &y;
x.clone() * &y;
}Provided Methods§
Sourcefn msm(points: &[Self], scalars: &[R], _concurrency: usize) -> Self
fn msm(points: &[Self], scalars: &[R], _concurrency: usize) -> Self
Calculate sum_i points[i] * scalars[i].
There’s a default implementation, but for many types, a more efficient algorithm is possible.
Both slices should be considered as padded with Additive::zero so
that they have the same length.
For empty slices, the result should be Additive::zero;
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.