Migrate benches and examples to `impl Neg for Expression`

This commit is contained in:
Jack Grigg 2021-07-25 21:32:11 +01:00
parent 7355462a9f
commit eb2b020d8c
4 changed files with 5 additions and 11 deletions

View File

@ -200,7 +200,7 @@ fn bench_with_k(name: &str, k: u32, c: &mut Criterion) {
let sc = meta.query_fixed(sc, Rotation::cur());
let sm = meta.query_fixed(sm, Rotation::cur());
vec![a.clone() * sa + b.clone() * sb + a * b * sm + (c * sc * (-F::one()))]
vec![a.clone() * sa + b.clone() * sb + a * b * sm - (c * sc)]
});
PlonkConfig {

View File

@ -246,13 +246,7 @@ fn main() {
let sc = meta.query_fixed(sc, Rotation::cur());
let sm = meta.query_fixed(sm, Rotation::cur());
vec![
a.clone() * sa
+ b.clone() * sb
+ a * b * sm
+ (c * sc * (-F::one()))
+ sf * (d * e),
]
vec![a.clone() * sa + b.clone() * sb + a * b * sm - (c * sc) + sf * (d * e)]
});
PlonkConfig {

View File

@ -118,7 +118,7 @@ impl<F: FieldExt> FieldChip<F> {
// has the following properties:
// - When s_mul = 0, any value is allowed in lhs, rhs, and out.
// - When s_mul != 0, this constrains lhs * rhs = out.
vec![s_mul * (lhs * rhs + out * -F::one())]
vec![s_mul * (lhs * rhs - out)]
});
FieldConfig {

View File

@ -170,7 +170,7 @@ impl<F: FieldExt> AddChip<F> {
let out = meta.query_advice(advice[0], Rotation::next());
let s_add = meta.query_selector(s_add);
vec![s_add * (lhs + rhs + out * -F::one())]
vec![s_add * (lhs + rhs - out)]
});
AddConfig { advice, s_add }
@ -311,7 +311,7 @@ impl<F: FieldExt> MulChip<F> {
// has the following properties:
// - When s_mul = 0, any value is allowed in lhs, rhs, and out.
// - When s_mul != 0, this constrains lhs * rhs = out.
vec![s_mul * (lhs * rhs + out * -F::one())]
vec![s_mul * (lhs * rhs - out)]
});
MulConfig { advice, s_mul }