pub trait VariableBaseMSM: ScalarMul + for<'a> AddAssign<&'a Self::Bucket> {
type Bucket: Default + Copy + Clone + for<'a> AddAssign<&'a Self::Bucket> + for<'a> SubAssign<&'a Self::Bucket> + AddAssign<Self::MulBase> + SubAssign<Self::MulBase> + for<'a> AddAssign<&'a Self::MulBase> + for<'a> SubAssign<&'a Self::MulBase> + Send + Sync + Into<Self>;
const ZERO_BUCKET: Self::Bucket;
// Provided methods
fn msm_unchecked(
bases: &[Self::MulBase],
scalars: &[Self::ScalarField],
) -> Self { ... }
fn msm(
bases: &[Self::MulBase],
scalars: &[Self::ScalarField],
) -> Result<Self, usize> { ... }
fn msm_bigint(
bases: &[Self::MulBase],
bigints: &[<Self::ScalarField as PrimeField>::BigInt],
) -> Self { ... }
fn msm_u1(bases: &[Self::MulBase], scalars: &[bool]) -> Self { ... }
fn msm_u8(bases: &[Self::MulBase], scalars: &[u8]) -> Self { ... }
fn msm_u16(bases: &[Self::MulBase], scalars: &[u16]) -> Self { ... }
fn msm_u32(bases: &[Self::MulBase], scalars: &[u32]) -> Self { ... }
fn msm_u64(bases: &[Self::MulBase], scalars: &[u64]) -> Self { ... }
fn msm_chunks<I, J>(bases_stream: &J, scalars_stream: &I) -> Self
where I: Iterable + ?Sized,
I::Item: Borrow<Self::ScalarField>,
J: Iterable,
J::Item: Borrow<Self::MulBase> { ... }
}Required Associated Constants§
const ZERO_BUCKET: Self::Bucket
Required Associated Types§
type Bucket: Default + Copy + Clone + for<'a> AddAssign<&'a Self::Bucket> + for<'a> SubAssign<&'a Self::Bucket> + AddAssign<Self::MulBase> + SubAssign<Self::MulBase> + for<'a> AddAssign<&'a Self::MulBase> + for<'a> SubAssign<&'a Self::MulBase> + Send + Sync + Into<Self>
Provided Methods§
Sourcefn msm_unchecked(bases: &[Self::MulBase], scalars: &[Self::ScalarField]) -> Self
fn msm_unchecked(bases: &[Self::MulBase], scalars: &[Self::ScalarField]) -> Self
Computes an inner product between the PrimeField elements in scalars
and the corresponding group elements in bases.
If the elements have different length, it will chop the slices to the
shortest length between scalars.len() and bases.len().
Reference: VariableBaseMSM::msm
Sourcefn msm(
bases: &[Self::MulBase],
scalars: &[Self::ScalarField],
) -> Result<Self, usize>
fn msm( bases: &[Self::MulBase], scalars: &[Self::ScalarField], ) -> Result<Self, usize>
Performs multi-scalar multiplication.
§Warning
This method checks that bases and scalars have the same length.
If they are unequal, it returns an error containing
the shortest length over which the MSM can be performed.
Sourcefn msm_bigint(
bases: &[Self::MulBase],
bigints: &[<Self::ScalarField as PrimeField>::BigInt],
) -> Self
fn msm_bigint( bases: &[Self::MulBase], bigints: &[<Self::ScalarField as PrimeField>::BigInt], ) -> Self
Optimized implementation of multi-scalar multiplication.
Sourcefn msm_u1(bases: &[Self::MulBase], scalars: &[bool]) -> Self
fn msm_u1(bases: &[Self::MulBase], scalars: &[bool]) -> Self
Performs multi-scalar multiplication when the scalars are known to be boolean.
The default implementation is faster than Self::msm_bigint.
Sourcefn msm_u8(bases: &[Self::MulBase], scalars: &[u8]) -> Self
fn msm_u8(bases: &[Self::MulBase], scalars: &[u8]) -> Self
Performs multi-scalar multiplication when the scalars are known to be u8-sized.
The default implementation is faster than Self::msm_bigint.
Sourcefn msm_u16(bases: &[Self::MulBase], scalars: &[u16]) -> Self
fn msm_u16(bases: &[Self::MulBase], scalars: &[u16]) -> Self
Performs multi-scalar multiplication when the scalars are known to be u16-sized.
The default implementation is faster than Self::msm_bigint.
Sourcefn msm_u32(bases: &[Self::MulBase], scalars: &[u32]) -> Self
fn msm_u32(bases: &[Self::MulBase], scalars: &[u32]) -> Self
Performs multi-scalar multiplication when the scalars are known to be u32-sized.
The default implementation is faster than Self::msm_bigint.
Sourcefn msm_u64(bases: &[Self::MulBase], scalars: &[u64]) -> Self
fn msm_u64(bases: &[Self::MulBase], scalars: &[u64]) -> Self
Performs multi-scalar multiplication when the scalars are known to be u64-sized.
The default implementation is faster than Self::msm_bigint.
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.