pub struct Alphas<F> {
next_power: u32,
mapping: HashMap<ArgumentType, (u32, u32)>,
alphas: Option<Vec<F>>,
}Expand description
This type can be used to create a mapping between powers of alpha and constraint types. See Self::default to create one, and Self::register to register a new mapping. Once you know the alpha value, you can convert this type to a Alphas.
Fields§
§next_power: u32The next power of alpha to use the end result will be [1, alpha^{next_power - 1}]
mapping: HashMap<ArgumentType, (u32, u32)>The mapping between constraint types and powers of alpha
alphas: Option<Vec<F>>The powers of alpha: 1, alpha, alpha^2, etc. If set to Some, you can’t register new constraints.
Implementations§
Source§impl<F: Field> Alphas<F>
impl<F: Field> Alphas<F>
Sourcepub fn register(&mut self, ty: ArgumentType, powers: u32)
pub fn register(&mut self, ty: ArgumentType, powers: u32)
Registers a new ArgumentType,
associating it with a number powers of powers of alpha.
This function will panic if you register the same type twice.
Sourcepub fn get_exponents(
&self,
ty: ArgumentType,
num: u32,
) -> MustConsumeIterator<Range<u32>, u32> ⓘ
pub fn get_exponents( &self, ty: ArgumentType, num: u32, ) -> MustConsumeIterator<Range<u32>, u32> ⓘ
Returns a range of exponents, for a given ArgumentType, upperbounded by num.
Note that this function will panic if you did not register enough powers of alpha.
Sourcepub fn instantiate(&mut self, alpha: F)
pub fn instantiate(&mut self, alpha: F)
Instantiates the ranges with an actual field element alpha.
Once you call this function, you cannot register new constraints via Self::register.
Sourcepub fn get_alphas(
&self,
ty: ArgumentType,
num: u32,
) -> MustConsumeIterator<Cloned<Take<Skip<Iter<'_, F>>>>, F> ⓘ
pub fn get_alphas( &self, ty: ArgumentType, num: u32, ) -> MustConsumeIterator<Cloned<Take<Skip<Iter<'_, F>>>>, F> ⓘ
This function allows us to retrieve the powers of alpha, upperbounded by num