r1c

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinearExpression

type LinearExpression []Term

LinearExpression represent a linear expression of variables

type R1C

R1C used to compute the wires

type SolvingMethod

type SolvingMethod uint8

SolvingMethod is used by the R1CS solver note: it is not in backend/r1cs to avoid an import cycle

const (
	SingleOutput SolvingMethod = iota
	BinaryDec
)

SingleOuput and BinaryDec are types of solving method for rank-1 constraints

type Term

type Term uint64

Term lightweight version of a term, no pointers first 4 bits are reserved next 30 bits represented the coefficient idx (in r1cs.Coefficients) by which the wire is multiplied next 30 bits represent the constraint used to compute the wire if we support more than 1 billion constraints, this breaks (not so soon.)

func Pack

func Pack(constraintID, coeffID int, constraintVisibility backend.Visibility, coeffValue ...int) Term

Pack packs constraintID, coeffID and coeffValue into Term first 5 bits are reserved to encode visibility of the constraint and coeffValue of the coefficient next 30 bits represented the coefficient idx (in r1cs.Coefficients) by which the wire is multiplied next 29 bits represent the constraint used to compute the wire if we support more than 500 millions constraints, this breaks (not so soon.)

func (Term) CoeffID

func (t Term) CoeffID() int

CoeffID returns the coefficient id (see R1CS data structure)

func (Term) CoeffValue

func (t Term) CoeffValue() int

CoeffValue return maxInt if no special value is set if set, returns either -1, 0, 1 or 2

func (Term) ConstraintID

func (t Term) ConstraintID() int

ConstraintID returns the constraintID (see R1CS data structure)

func (Term) ConstraintVisibility

func (t Term) ConstraintVisibility() backend.Visibility

ConstraintVisibility returns encoded backend.Visibility attribute

func (*Term) SetCoeffID

func (t *Term) SetCoeffID(cID int)

SetCoeffID update the bits correponding to the coeffID with cID

func (*Term) SetCoeffValue

func (t *Term) SetCoeffValue(val int)

SetCoeffValue update the bits correponding to the coeffValue with its encoding

func (*Term) SetConstraintID

func (t *Term) SetConstraintID(cID int)

SetConstraintID update the bits correponding to the constraintID with cID

func (*Term) SetConstraintVisibility

func (t *Term) SetConstraintVisibility(v backend.Visibility)

SetConstraintVisibility update the bits correponding to the constraintVisibility with its encoding

func (Term) Unpack

func (t Term) Unpack() (coeffValue, coeffID, constraintID int, constraintVisibility backend.Visibility)

Unpack returns coeffValue, coeffID and constraintID

Jump to

Keyboard shortcuts

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