Module dock_crypto_utils::ff
source · Expand description
Finite field utilities like inner product, weighted inner product, hadamard product, etc
Functions§
- Add two vectors of scalars
- Hadamard product of two vectors of scalars
- Inner product of 2 vectors
a
andb
- Powers of a finite field as
[1, s, s^2, .. s^{num-1}]
- Powers of a finite field as
[start, start*exp, start * exp^2, .. start * exp^{num-1}]
- Return a scaled vector by multiplying each of its elements by
factor
. Returns[arr_0 * factor, arr_1 * factor, arr_2 * factor, ...]
- Mutate a vector
arr
by multiplying each of its elements byfactor
. - SUM of a geometric progression SUM a^i = (1 - a^n) / (1 - a) = -(1-a^n)/-(1-a) = (a^n - 1) / (a - 1)
- Weighted inner product of 2 vectors
a
andb
with weightw
. Calculated as\sum_{i=0}(a_i * b_i * w^{i+1})
- Weighted inner product of the vector
n
with itself. Calculated as\sum_{i=0}(n_i * n_i * w^{i+1})