polynomial

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalEq

func EvalEq(api frontend.API, x, y []frontend.Variable) (eq frontend.Variable)

EvalEq returns Πⁿ₁ Eq(xᵢ, yᵢ) = Πⁿ₁ xᵢyᵢ + (1-xᵢ)(1-yᵢ) = Πⁿ₁ (1 + 2xᵢyᵢ - xᵢ - yᵢ). Is assumes len(x) = len(y) =: n

func InterpolateLDE

func InterpolateLDE(api frontend.API, at frontend.Variable, values []frontend.Variable) frontend.Variable

InterpolateLDE fits a polynomial f of degree len(values)-1 such that f(i) = values[i] whenever defined. Returns f(at)

Types

type MultiLin

type MultiLin []frontend.Variable

func (MultiLin) Clone

func (m MultiLin) Clone() MultiLin

func (MultiLin) Evaluate

func (m MultiLin) Evaluate(api frontend.API, at []frontend.Variable) frontend.Variable

Evaluate assumes len(m) = 1 << len(at) it doesn't modify m

Example
const logSize = 20
const size = 1 << logSize
m := MultiLin(make([]frontend.Variable, size))
e := MultiLin(make([]frontend.Variable, logSize))

cs, err := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, &evalMultiLinCircuit{M: m, At: e, Evaluation: 0})
if err != nil {
	panic(err)
}
fmt.Println("r1cs size:", cs.GetNbConstraints())

cs, err = frontend.Compile(ecc.BN254.ScalarField(), scs.NewBuilder, &evalMultiLinCircuit{M: m, At: e, Evaluation: 0})
if err != nil {
	panic(err)
}
fmt.Println("scs size:", cs.GetNbConstraints())
Output:
r1cs size: 1048627
scs size: 2097226

func (MultiLin) NumVars

func (m MultiLin) NumVars() int

type Polynomial

type Polynomial []frontend.Variable

func (Polynomial) Eval

func (p Polynomial) Eval(api frontend.API, at frontend.Variable) (pAt frontend.Variable)

Jump to

Keyboard shortcuts

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