pub fn evaluate_constraints<CS: ConstraintSystem<F>, FG>(&self, 
        mut cs: CS,
        x: &FG) -> FG
        where FG: FieldGadget<F, F>
    {
        let mut vp_cs = &mut cs.ns(|| "vanishing polynomial");
        if self.dim_h == 1
        {
            let result = x.sub(&mut vp_cs.ns(|| "compute result"), x).unwrap();
            return result;
        }
        let mut cur = x.square(vp_cs.ns(|| format!("compute x^(2^{:?})", 1))).unwrap();
        for i in 1..self.dim_h 
        {
            cur.square_in_place(vp_cs.ns(|| format!("compute x^(2^{:?})", i + 1))).unwrap();
        }
        cur.sub_constant_in_place(vp_cs.ns(|| "compute result"), &self.constant_term).unwrap();
        cur
    }
/// Evaluates the constraints and just gives you the gadget for the result.
/// Caution for use in holographic lincheck: The output has 2 entries in one matrix
Evaluates the constraints and just gives you the gadget for the result.
Caution for use in holographic lincheck: The output has 2 entries in one matrix
Evaluates the constraints and just gives you the gadget for the result . Caution for use in holographic lincheck : The output has 2 entries in one matrix
pub fn evaluate_constraints<CS: ConstraintSystem<F>, FG>(&self, 
        mut cs: CS,
        x: &FG) -> FG
        where FG: FieldGadget<F, F>
    {
        let mut vp_cs = &mut cs.ns(|| "vanishing polynomial");
        if self.dim_h == 1
        {
            let result = x.sub(&mut vp_cs.ns(|| "compute result"), x).unwrap();
            return result;
        }
        let mut cur = x.square(vp_cs.ns(|| format!("compute x^(2^{:?})", 1))).unwrap();
        for i in 1..self.dim_h 
        {
            cur.square_in_place(vp_cs.ns(|| format!("compute x^(2^{:?})", i + 1))).unwrap();
        }
        cur.sub_constant_in_place(vp_cs.ns(|| "compute result"), &self.constant_term).unwrap();
        cur
    }
pub fn evaluate_constraints < CS : ConstraintSystem < F > , FG > ( & self , mut cs : CS , x : & FG ) -> FG where FG : FieldGadget < F , F > { let mut vp_cs = & mut cs . ns ( | | " " ) ; if self . dim_h == 1 { let result = x . sub ( & mut vp_cs . ns ( | | " " ) , x ) . unwrap ( ) ; return result ; } let mut cur = x . square ( vp_cs . ns ( | | format ! ( " " 1 ) ) ) . unwrap ( ) ; for i in 1 .. self . dim_h { cur . square_in_place ( vp_cs . ns ( | | format ! ( " " i 1 ) ) ) . unwrap ( ) ; } cur . sub_constant_in_place ( vp_cs . ns ( | | " " ) , & self . constant_term ) . unwrap ( ) ; cur }
Evaluates the constraints and just gives you the gadget for the result.
Evaluates the constraints and just gives you the gadget for the result .
&self
cs
CS
x
&FG