Documentation
¶
Index ¶
- Variables
- func Abs(n int) (val int, positive bool)
- func AbsInt(i int) int
- func Addicity(n int) int
- func AdicityBig(input *big.Int) (twoadicity int)
- func BigArraysEqual(a, b []*big.Int) bool
- func BigIsOdd(n *big.Int) bool
- func Equal(a, b int) int
- func ExtendArrayWithZeros(in []*big.Int, desiredLength int) []*big.Int
- func IsPowerTwo(in uint64) bool
- func IsZeroArray(a []*big.Int) bool
- func MaxInt(a, b int) int
- func Mod(a, b int) int
- func NextPowerOfTwo(n int) int
- func Parallelize(nbIterations int, work func(int, int), maxCpus ...int)
- func PrintWithLineNumbering(s string)
- type AvlNode
- func (root *AvlNode) AllNodes(t *[]Entry)
- func (self *AvlNode) Get(key uint) (value *big.Int, err error)
- func (self *AvlNode) Has(key uint) (has bool)
- func (self *AvlNode) Height() int
- func (self *AvlNode) Key() uint
- func (self *AvlNode) Left() *AvlNode
- func (self *AvlNode) Put(key uint, value *big.Int, insert func(old, new *big.Int) *big.Int) (_ *AvlNode, updated bool)
- func (self *AvlNode) Remove(key uint) (_ *AvlNode, value *big.Int, err error)
- func (self *AvlNode) Right() *AvlNode
- func (self *AvlNode) Size() int
- func (s AvlNode) String() string
- func (self *AvlNode) Value() *big.Int
- type AvlTree
- func (t *AvlTree) ChannelNodes(ascendingOrder bool) (collectedNodes chan Entry)
- func (a *AvlTree) Clone() *AvlTree
- func (t *AvlTree) DecendingNodes() (collectedNodes []Entry)
- func (self *AvlTree) Get(key uint) (value *big.Int, err error)
- func (self *AvlTree) Has(key uint) bool
- func (t *AvlTree) Insert(key uint, value *big.Int) (err error)
- func (t *AvlTree) InsertNoOverwriteAllowed(key uint, value *big.Int) (err error)
- func (t *AvlTree) MaxNode() *AvlNode
- func (t *AvlTree) MaxPower() uint
- func (t *AvlTree) MinNode() *AvlNode
- func (self *AvlTree) Put(key uint, value *big.Int, insert func(old, new *big.Int) *big.Int) (err error)
- func (self *AvlTree) Remove(key uint) (value *big.Int, err error)
- func (self *AvlTree) Root() *AvlNode
- func (self *AvlTree) Size() int
- func (t *AvlTree) String() string
- func (t *AvlTree) ToArray(length int) (collectedNodes []*big.Int)
- type Entry
- type FFT_PrecomputedParas
- type FastBool
- type Fields
- type Fq
- func (fq Fq) Add(a, b *big.Int) *big.Int
- func (f Fq) AddPolynomials(polynomials []*AvlTree) (sumPoly *AvlTree)
- func (fq Fq) AddToSparse(a, b *AvlTree) *AvlTree
- func (fq Fq) Affine(a *big.Int) *big.Int
- func (f Fq) Combine(a *AvlTree, w []*big.Int) (scaledPolynomial *AvlTree)
- func (fq Fq) Copy(a *big.Int) *big.Int
- func (fq Fq) Div(a, b *big.Int) *big.Int
- func (fq Fq) DivideSparse(a, b *AvlTree) (result, rem *AvlTree)
- func (fq Fq) Double(a *big.Int) *big.Int
- func (fq Fq) Equal(a, b *big.Int) bool
- func (fq Fq) EvalPoly(v Poly, x *big.Int) *big.Int
- func (fq Fq) EvalSparsePoly(poly *AvlTree, at *big.Int) (result *big.Int)
- func (fq Fq) Exp(base *big.Int, e *big.Int) *big.Int
- func (fq Fq) ExpInt(base *big.Int, e int64) *big.Int
- func (fq Fq) Inverse(a *big.Int) *big.Int
- func (fq Fq) IsZero(a *big.Int) bool
- func (f Fq) LinearCombine(polynomials []*AvlTree, w []*big.Int) (scaledPolynomials []*AvlTree)
- func (fq Fq) Mul(a, b *big.Int) *big.Int
- func (fq Fq) MulSparse(a, b *AvlTree) *AvlTree
- func (fq Fq) MulSparseScalar(a *AvlTree, scalar *big.Int) *AvlTree
- func (fq Fq) Neg(a *big.Int) *big.Int
- func (fq Fq) One() *big.Int
- func (fq Fq) Rand() (*big.Int, error)
- func (fq Fq) ScalarProduct(l, r []*big.Int) (sum *big.Int)
- func (f Fq) SparseScalarProduct(a *AvlTree, b []*big.Int) (res *big.Int)
- func (fq Fq) Square(a *big.Int) *big.Int
- func (fq Fq) StringToFieldElement(a string) (v *big.Int, s bool)
- func (fq Fq) Sub(a, b *big.Int) *big.Int
- func (fq Fq) SubToSparse(a, b *AvlTree) *AvlTree
- func (fq Fq) Zero() *big.Int
- type Poly
- type PolynomialField
- func (pf PolynomialField) Add(a, b Poly) Poly
- func (pf PolynomialField) AddPolynomials(polynomials []Poly) (sumPoly Poly)
- func (pf *PolynomialField) DFFT(polynomial Poly, shift *big.Int) (evaluatedAtRoots []*big.Int)
- func (pf PolynomialField) Div(a, b Poly) (Poly, Poly)
- func (pf PolynomialField) DivFFT(a, b Poly) (Poly, Poly)
- func (pf PolynomialField) DomainPolynomial(len int) Poly
- func (pf PolynomialField) EvalPoly(v Poly, x *big.Int) *big.Int
- func (pf PolynomialField) InterpolateSparseArray(dataArray *AvlTree, degree int) (polynom *AvlTree)
- func (pf *PolynomialField) InvDFFT(ValuesAtRoots []*big.Int, shift *big.Int) (coefficients Poly)
- func (pf PolynomialField) LagrangeInterpolation(datapoints Poly) (polynom Poly)
- func (pf *PolynomialField) LagrangeInterpolation_RootOfUnity(datapoints Poly) (polynom Poly)
- func (pf PolynomialField) LinearCombine(polynomials []Poly, w Poly) (scaledPolynomials []Poly)
- func (pf *PolynomialField) MulFFT(a, b Poly) Poly
- func (pf *PolynomialField) MulNaive(a, b Poly) Poly
- func (pf PolynomialField) MulScalar(polynomial Poly, w *big.Int) (scaledPolynomial Poly)
- func (pf PolynomialField) NewPolZeroAt(pointPos, totalPoints int, height *big.Int) Poly
- func (pf PolynomialField) PointwiseAdd(a Poly, b Poly) (ab Poly)
- func (pf PolynomialField) PointwiseMultiplication(a Poly, b Poly) (ab Poly)
- func (pf PolynomialField) PointwiseSub(a Poly, b Poly) (ab Poly)
- func (pf *PolynomialField) PrecomputeLagrange(totalPoints int)
- func (pf *PolynomialField) PrecomputeLagrangeFFT(points int)
- func (pf *PolynomialField) PrecomputeLagrangeFFT_2(points int)
- func (pf *PolynomialField) PrecomputeLagrangeFFT_3(points int)
- func (pf *PolynomialField) PrepareFFT(length int) *FFT_PrecomputedParas
- func (pf PolynomialField) Sub(a, b Poly) Poly
Constants ¶
This section is empty.
Variables ¶
var Field = PrepareFields(bn256.Order)
Todo I dont like this pubic accessible thing here
Functions ¶
func Abs ¶
returns the absolute value of a signed int and a flag telling if the input was positive or not this implementation is awesome and fast (see Henry S Warren, Hackers's Delight)
func AdicityBig ¶
AdicityBig returns the biggest power of 2, that divides the input i.e. 2^n | in
func BigArraysEqual ¶
func IsPowerTwo ¶
checks if a integer is a power of 2 From Henry Warrens Hackers Delight
func IsZeroArray ¶
func NextPowerOfTwo ¶
func Parallelize ¶
Parallelize process in parallel the work function
func PrintWithLineNumbering ¶
func PrintWithLineNumbering(s string)
Types ¶
type AvlNode ¶
type AvlNode struct {
// contains filtered or unexported fields
}
type AvlTree ¶
type AvlTree struct {
// contains filtered or unexported fields
}
func NewAvlTree ¶
func NewAvlTree() *AvlTree
func NewSparseArrayFromArray ¶
func TransposeSparse ¶
func (*AvlTree) ChannelNodes ¶
Each recursively traverses tree `tree` and collects all nodes array is filled up from highest to lowest degree
func (*AvlTree) DecendingNodes ¶
Each recursively traverses tree `tree` and collects all nodes array is filled up from highest to lowest degree
func (*AvlTree) InsertNoOverwriteAllowed ¶
Add inserts an element to tree with root `t`
type FFT_PrecomputedParas ¶
type FFT_PrecomputedParas struct { RootOfUnity *big.Int RootOfUnitys_SquareSteps []*big.Int // w,w^2,w^4,w^8.. RootOfUnity_inv *big.Int RootOfUnity_invs_SquareSteps []*big.Int // w^-1,w^-2,w^-4,w^-8.. RootOfUnitys []*big.Int // 1,w,w^2,w^3,w^4.., RootOfUnity_invs []*big.Int // 1,w^-1,w^-2,w^-3,w^-4.. Size int //number of points we want to consider, rounded to the next power of two Domain Poly //p(x) = x^size - 1 // contains filtered or unexported fields }
type FastBool ¶
type FastBool struct {
// contains filtered or unexported fields
}
func NewFastBool ¶
func NewFastBool() FastBool
type Fields ¶
type Fields struct { ArithmeticField Fq PolynomialField PolynomialField }
func PrepareFields ¶
PrepareFields For prime r, in order to prove statements about F_r-arithmetic circuit satisfiability, one instantiates (G, P, V ) using an elliptic curve E defined over some finite field F_q , where the group E(F_q) of F_q-rational points has order r = #E(F q ) (or, more generally, r divides #E(F q )).
type Fq ¶
Fq is the Z field over modulus Q
func (Fq) AddPolynomials ¶
func (Fq) AddToSparse ¶
func (Fq) DivideSparse ¶
Div divides two polinomials over the Finite Field, returning the result and the remainder
func (Fq) EvalSparsePoly ¶
EvalPoly Evaluates a sparse polynomial
func (Fq) LinearCombine ¶
func (Fq) MulSparseScalar ¶
Mul multiplies a sparse polynomail with a scalar over the Finite Field
func (Fq) SparseScalarProduct ¶
func (Fq) SubToSparse ¶
Sub subtracts two polinomials over the Finite Field
type Poly ¶
func ArrayOfBigZeros ¶
ArrayOfBigZeros creates a *big.Int array with n elements to zero
type PolynomialField ¶
type PolynomialField struct { F Fq // contains filtered or unexported fields }
PolynomialField is the Polynomial over a Finite Field where the polynomial operations are performed
func NewPolynomialField ¶
func NewPolynomialField(f Fq) (pf *PolynomialField)
func (PolynomialField) Add ¶
func (pf PolynomialField) Add(a, b Poly) Poly
Add adds two polinomials over the Finite Field
func (PolynomialField) AddPolynomials ¶
func (pf PolynomialField) AddPolynomials(polynomials []Poly) (sumPoly Poly)
func (PolynomialField) Div ¶
func (pf PolynomialField) Div(a, b Poly) (Poly, Poly)
Div divides two polinomials over the Finite Field, returning the result and the remainder
func (PolynomialField) DomainPolynomial ¶
func (pf PolynomialField) DomainPolynomial(len int) Poly
returns (x)(x-1)..(x-(len-1))
func (PolynomialField) EvalPoly ¶
EvalPoly Evaluates a polynomial v at position x, using the Horners Rule
func (PolynomialField) InterpolateSparseArray ¶
func (pf PolynomialField) InterpolateSparseArray(dataArray *AvlTree, degree int) (polynom *AvlTree)
LagrangeInterpolation performs the Lagrange Interpolation / Lagrange Polynomials operation
func (*PolynomialField) InvDFFT ¶
input an array of datapoints, returns the coefficients of a polynomial that interpolates the data at the roots of unity
func (PolynomialField) LagrangeInterpolation ¶
func (pf PolynomialField) LagrangeInterpolation(datapoints Poly) (polynom Poly)
LagrangeInterpolation performs the Lagrange Interpolation / Lagrange Polynomials operation
func (*PolynomialField) LagrangeInterpolation_RootOfUnity ¶
func (pf *PolynomialField) LagrangeInterpolation_RootOfUnity(datapoints Poly) (polynom Poly)
LagrangeInterpolation performs the Lagrange Interpolation / Lagrange Polynomials operation
func (PolynomialField) LinearCombine ¶
func (pf PolynomialField) LinearCombine(polynomials []Poly, w Poly) (scaledPolynomials []Poly)
func (*PolynomialField) MulFFT ¶
func (pf *PolynomialField) MulFFT(a, b Poly) Poly
MulFFT multiplies two polynomials over the Finite Field
func (*PolynomialField) MulNaive ¶
func (pf *PolynomialField) MulNaive(a, b Poly) Poly
MulNaive multiplies two polinomials over the Finite Field
func (PolynomialField) MulScalar ¶
func (pf PolynomialField) MulScalar(polynomial Poly, w *big.Int) (scaledPolynomial Poly)
func (PolynomialField) NewPolZeroAt ¶
func (pf PolynomialField) NewPolZeroAt(pointPos, totalPoints int, height *big.Int) Poly
NewPolZeroAt generates a new polynomial that has value zero at the given value
func (PolynomialField) PointwiseAdd ¶
func (pf PolynomialField) PointwiseAdd(a Poly, b Poly) (ab Poly)
func (PolynomialField) PointwiseMultiplication ¶
func (pf PolynomialField) PointwiseMultiplication(a Poly, b Poly) (ab Poly)
func (PolynomialField) PointwiseSub ¶
func (pf PolynomialField) PointwiseSub(a Poly, b Poly) (ab Poly)
func (*PolynomialField) PrecomputeLagrange ¶
func (pf *PolynomialField) PrecomputeLagrange(totalPoints int)
LagrangeInterpolation performs the Lagrange Interpolation / Lagrange Polynomials operation
func (*PolynomialField) PrecomputeLagrangeFFT ¶
func (pf *PolynomialField) PrecomputeLagrangeFFT(points int)
LagrangeInterpolation performs the Lagrange Interpolation / Lagrange Polynomials operation
func (*PolynomialField) PrecomputeLagrangeFFT_2 ¶
func (pf *PolynomialField) PrecomputeLagrangeFFT_2(points int)
func (*PolynomialField) PrecomputeLagrangeFFT_3 ¶
func (pf *PolynomialField) PrecomputeLagrangeFFT_3(points int)
Author Mathias Wolf 2020
func (*PolynomialField) PrepareFFT ¶
func (pf *PolynomialField) PrepareFFT(length int) *FFT_PrecomputedParas
func (PolynomialField) Sub ¶
func (pf PolynomialField) Sub(a, b Poly) Poly
Sub subtracts two polinomials over the Finite Field