poly

package
v0.0.0-...-81eada0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkOfEqTable

func ChunkOfEqTable(preallocatedEq []fr.Element, chunkID, chunkSize int, qPrime []fr.Element, multiplier ...fr.Element)

Computes only a chunk of the eqTable for a given chunkSize and chunkID

func ClearPool

func ClearPool() int

Clear the pool completely, shields against memory leaks Eg: if we forgot to dump a polynomial at some point, this will ensure the value get dumped eventually Returns how many polynomials were cleared that way

func CountPool

func CountPool() int

Returns the number of element in the pool Does not mutate it

func DumpLarge

func DumpLarge(arrs ...MultiLin) int

Dumps a set of polynomials into the pool Returns the number of deallocated large polys

func DumpSmall

func DumpSmall(arrs ...MultiLin) int

Dumps a set of polynomials into the pool Returns the number of deallocated small polys

func EvalEq

func EvalEq(qPrime, nextQPrime []fr.Element) fr.Element

EvalEq computes Eq(q1', ... , qn', h1', ... , hn') = Π_1^n Eq(qi', hi') where Eq(x,y) = xy + (1-x)(1-y) = 1 - x - y + xy + xy interpolates

    _________________
    |       |       |
    |   0   |   1   |
    |_______|_______|
y   |       |       |
    |   1   |   0   |
    |_______|_______|

            x

func EvalUnivariate

func EvalUnivariate(coeffs []fr.Element, x fr.Element) fr.Element

EvalUnivariate evaluates a polynomial from its coefficients

func GetLagrangePolynomial

func GetLagrangePolynomial(domainSize int) [][]fr.Element

GetLagrangePolynomial returns a precalculated array representing the univariate lagrange polynomials on domainSize.

func InterpolateOnRange

func InterpolateOnRange(values []fr.Element) []fr.Element

InterpolateOnRange performs the interpolation of the given list of elements On the range [0, 1,..., len(values) - 1]

func LagrangeCoefficient

func LagrangeCoefficient(domainSize int) [][]fr.Element

LagrangeCoefficient returns the matrix of Lagrange polynomials for the domain [[0; n - 1]]

Types

type MultiLin

type MultiLin []fr.Element

MultiLin tracks the values of a (dense i.e. not sparse) multilinear polynomial

func FoldedEqTable

func FoldedEqTable(preallocated MultiLin, qPrime []fr.Element, multiplier ...fr.Element) (eq MultiLin)

FoldedEqTable ought to start life as a sparse bookkeepingtable depending on 2n variables and containing 2^n ones only to be folded n times according to the values in qPrime. The resulting table will no longer be sparse. Instead we directly compute the folded array of length 2^n containing the values of Eq(q1, ... , qn, *, ... , *) where qPrime = [q1 ... qn].

func MakeLarge

func MakeLarge(n int) MultiLin

Tries to find a reusable MultiLin or allocate a new one

func MakeSmall

func MakeSmall(n int) MultiLin

Tries to find a reusable MultiLin or allocate a new one

func RandMultiLin

func RandMultiLin(size int) MultiLin

RandomFrArray returns a random array

func (MultiLin) Add

func (bkt MultiLin) Add(left, right MultiLin)

Add two bookKeepingTable

func (MultiLin) DeepCopy

func (bkt MultiLin) DeepCopy() MultiLin

DeepCopy creates a deep copy of a book-keeping table. Both ultilinear interpolation and sumcheck require folding an underlying array, but folding changes the array. To do both one requires a deep copy of the book-keeping table.

func (MultiLin) DeepCopyLarge

func (bkt MultiLin) DeepCopyLarge() MultiLin

DeepCopy creates a deep copy of a multi-linear table.

func (MultiLin) Evaluate

func (bkt MultiLin) Evaluate(coordinates []fr.Element) fr.Element

Evaluate takes a dense book-keeping table, deep copies it, folds it along the variables on which the table depends by substituting the corresponding coordinate from relevantCoordinates. After folding, bkCopy is reduced to a one item slice containing the evaluation of the original bkt at relevantCoordinates. This is returned.

func (*MultiLin) Fold

func (bkt *MultiLin) Fold(r fr.Element)

Fold folds the table on its first coordinate using the given value r

func (*MultiLin) FoldChunk

func (bkt *MultiLin) FoldChunk(r fr.Element, start, stop int)

Folds one part of the table

func (MultiLin) String

func (bkt MultiLin) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL