mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
Account for Rotations of LagrangeCoeff values
This commit is contained in:
parent
8e56b415fb
commit
df2d818891
2 changed files with 28 additions and 6 deletions
|
|
@ -97,16 +97,22 @@ impl<F: FieldExt> Argument<F> {
|
||||||
.map(|expression| {
|
.map(|expression| {
|
||||||
expression.evaluate(
|
expression.evaluate(
|
||||||
&|index| {
|
&|index| {
|
||||||
let column_index = pk.vk.cs.fixed_queries[index].0.index();
|
let query = pk.vk.cs.fixed_queries[index];
|
||||||
fixed_values[column_index].clone()
|
let column_index = query.0.index();
|
||||||
|
let rotation = query.1;
|
||||||
|
fixed_values[column_index].clone().rotate(rotation)
|
||||||
},
|
},
|
||||||
&|index| {
|
&|index| {
|
||||||
let column_index = pk.vk.cs.advice_queries[index].0.index();
|
let query = pk.vk.cs.advice_queries[index];
|
||||||
advice_values[column_index].clone()
|
let column_index = query.0.index();
|
||||||
|
let rotation = query.1;
|
||||||
|
advice_values[column_index].clone().rotate(rotation)
|
||||||
},
|
},
|
||||||
&|index| {
|
&|index| {
|
||||||
let column_index = pk.vk.cs.instance_queries[index].0.index();
|
let query = pk.vk.cs.instance_queries[index];
|
||||||
instance_values[column_index].clone()
|
let column_index = query.0.index();
|
||||||
|
let rotation = query.1;
|
||||||
|
instance_values[column_index].clone().rotate(rotation)
|
||||||
},
|
},
|
||||||
&|a, b| a + &b,
|
&|a, b| a + &b,
|
||||||
&|a, b| {
|
&|a, b| {
|
||||||
|
|
|
||||||
16
src/poly.rs
16
src/poly.rs
|
|
@ -187,6 +187,22 @@ impl<'a, F: Field> Mul<&'a Polynomial<F, ExtendedLagrangeCoeff>>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, F: Field> Polynomial<F, LagrangeCoeff> {
|
||||||
|
/// Rotates the values in a Lagrange basis polynomial by `Rotation`
|
||||||
|
pub fn rotate(&self, rotation: Rotation) -> Polynomial<F, LagrangeCoeff> {
|
||||||
|
let mut values = self.values.clone();
|
||||||
|
if rotation.0 < 0 {
|
||||||
|
values.rotate_right((-rotation.0) as usize);
|
||||||
|
} else {
|
||||||
|
values.rotate_left(rotation.0 as usize);
|
||||||
|
}
|
||||||
|
Polynomial {
|
||||||
|
values,
|
||||||
|
_marker: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, F: Field, B: Basis> Mul<F> for Polynomial<F, B> {
|
impl<'a, F: Field, B: Basis> Mul<F> for Polynomial<F, B> {
|
||||||
type Output = Polynomial<F, B>;
|
type Output = Polynomial<F, B>;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue