Struct prio::pcp::gadgets::MeanVarUnsigned [−][src]
pub struct MeanVarUnsigned<F: FieldElement> { /* fields omitted */ }
Expand description
The gadget for the MeanVarUnsignedVector type. It is not designed for general use.
MeanVarUnsigned is parameterized by a positive integer bits
. Its arity is 2*bits+1
:
- The first
bits
values are interpreted as a vectorr_vec
. - The next
bits
values are interpreted as a vectorx_vec
. - The last value is interpreted as a singleton
x
.
The gadget is designed to output x^2
as long as x_vec
is a vector comprised of 0s and 1s.
It first computes w[l] = p(x_vec[l]) * r_vec[l]
for each 0 <= l < bits
, where p(x) = x(x-1)
. It then computes w = w[0] + ... + w[bits-1]
and returns w + x^2
.
If vec_x[l] == 1
or vec_x[l] == 0
, then p(vec_x[l]) == 0
; otherwise, p(vec_x[l]) != 0
.
The validity circuit for MeanVarUnsignedVector sets r_vec[l] = r^(l+1)
, where r
is a
uniform random field element. This is ensures that, if p(vec_x[l]) != 0
for some l
, then
w != 0
with high probability.
Implementations
Trait Implementations
Evaluates the gadget on input inp
and returns the output.
Evaluate the gadget on input of a sequence of polynomials. The output is written to outp
.
Returns the arity of the gadget. This is the length of inp
passed to call
or
call_poly
. Read more
Returns the circuit’s arithmetic degree. This determines the minimum length the outp
buffer passed to call_poly
. Read more