Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Circuits for operating over arithmetic values.

Structsยง

AddMany
Given inputs x, output sum(x).
Addition
Given CrtBundles x and y, output x + y.
Constant
Arithmetic constant.
ConstantExponentiation
Given a CrtBundle x and constant exponent c, output x^c.
ConstantMultiplication
Given CrtBundle x and constant c, output x * c.
Division
For CrtBundles x and y, output x / y.
Equality
For CrtBundles x and y, output x == y.
FractionalMixedRadix
For input CrtBundle x and vector of moduli ms, output the MSB of the fractional part of x / M, where M = product(ms).
GreaterThanOrEqual
For CrtBundles x and y, return x >= y.
LessThan
For CrtBundles x and y, return x < y.
Mask
Given a wire b and a CrtBundle x, output 0 if b == 0, otherwise output x.
Max
For a vector of CrtBundles xs, return max(xs).
MixedRadixAddition
Mixed radix addition.
ModChange
Given (x, modulus), change the modulus of x to modulus.
Multiplication
Given CrtBundles x and y, output x * y.
PmrGreaterThanOrEqual
For CrtBundles x and y, output x >= y using PMR representation.
PmrLessThan
For CrtBundles x and y, output x < y using PMR representation.
ReLU
For CrtBundle x, output max(0, x).
Remainder
Given a CrtBundle x and modulus p, compute the remainder with respect to p.
Sgn
For CrtBundle x, if x >= 0 return 1, otherwise return -1, where -1 is interpreted as Q - 1 and Q is the modulus of x.
Sign
For CrtBundle x, return 0 if x >= 0, 1 otherwise.
Subtraction
Given CrtBundles x and y, output x - y.
ToPmr
Convert a CrtBundle x to PMR representation.