Skip to main content

VariableBaseMSM

Trait VariableBaseMSM 

Source
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§

Required Associated Types§

Source

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§

Source

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

Source

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.

Source

fn msm_bigint( bases: &[Self::MulBase], bigints: &[<Self::ScalarField as PrimeField>::BigInt], ) -> Self

Optimized implementation of multi-scalar multiplication.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>,

Streaming multi-scalar multiplication algorithm with hard-coded chunk size.

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.

Implementors§

Source§

impl<P: DOCurveConfig> VariableBaseMSM for ark_ec::models::double_odd::Projective<P>

Source§

const ZERO_BUCKET: Self = Self::ZERO

Source§

type Bucket = Projective<P>

Source§

impl<P: SWCurveConfig> VariableBaseMSM for ark_ec::models::short_weierstrass::Projective<P>

Source§

const ZERO_BUCKET: Self::Bucket = Bucket::ZERO

Source§

type Bucket = Bucket<P>

Source§

impl<P: TECurveConfig> VariableBaseMSM for ark_ec::models::twisted_edwards::Projective<P>

Source§

const ZERO_BUCKET: Self = Self::ZERO

Source§

type Bucket = Projective<P>

Source§

impl<P: Pairing> VariableBaseMSM for PairingOutput<P>

Source§

const ZERO_BUCKET: Self::Bucket = Self::ZERO

Source§

type Bucket = PairingOutput<P>