Open NikZak opened 9 months ago
and Fr_pow
@NikZak
A.
To extend the eval
functions, we can do the following using ruint library:
Fr_neg --> Neg => (M - a)
assuming M is the field's order. This has been used to calculate Sub
Fr_div --> Div => a.mul_mod (b.inv_mod(M), M)
use inv_mod from ruint::algorithms
as this uses Extended Euclidean Algorithm to calculate the inverse.Fr_pow --> Pow => a.pow_mod(b, M)
B.
To extend the eval_fr
functions, we can do the following:
The Prime Field Fr = Fp256<MontBackend<FrConfig, 4>>
elements are implemented using the ark_ff library, which provides functions for calculating negative, division, etc. Adding the following code to the graph.rs
file, under the impl Operation -> eval_fr
might work :
Neg => a.neg_in_place(),
FromString => Fr::from_str("testString"),
Div => a / b
Source:
My circuit requires: Fr_element2str Fr_neg Fr_div Fr_band Fr_shr
I am happy to help implementing those if you could provide a bit of guidance. Thank you!