gates

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddGate

type AddGate struct{}

AddGate performs an addition

func (AddGate) Degrees

func (a AddGate) Degrees() (degHL, degHR, degHPrime int)

Degrees returns the degrees of the gate on hL, hR and hPrime

func (AddGate) Eval

func (a AddGate) Eval(res, vL, vR *fr.Element)

Eval return the result vL + vR

func (AddGate) EvalManyVL

func (a AddGate) EvalManyVL(res []fr.Element, vLs []fr.Element, vR *fr.Element)

EvalManyVL performs an element-wise addition of many vLs values by one vR value

func (AddGate) EvalManyVR

func (a AddGate) EvalManyVR(res []fr.Element, vL *fr.Element, vRs []fr.Element)

EvalManyVR performs an element-wise addition of many vRs values by one vL value res must be initialized with the same size as vRs

func (AddGate) GnarkEval

func (a AddGate) GnarkEval(cs frontend.API, vL, vR frontend.Variable) frontend.Variable

GnarkEval compute the gate on a gnark circuit

func (AddGate) ID

func (a AddGate) ID() string

ID returns the gate ID

type CipherGate

type CipherGate struct {
	Ark fr.Element
}

CipherGate cipher gate returns vL + (vR + c)^7

func NewCipherGate

func NewCipherGate(ark fr.Element) *CipherGate

NewCipherGate construct a new cipher gate given an ark CipherGate cipher gate returns vL + (vR + c)^7

func (*CipherGate) Degree

func (c *CipherGate) Degree() (degHPrime int)

Degree returns the Degree of the gate on hL, hR and hPrime

func (*CipherGate) Eval

func (c *CipherGate) Eval(res *fr.Element, xs ...*fr.Element)

Eval returns (vL + vR + c)^7

func (*CipherGate) EvalBatch

func (c *CipherGate) EvalBatch(res []fr.Element, xs ...[]fr.Element)

Eval returns (vR + c + vL)^7, on the range of output

func (*CipherGate) GnarkEval

func (c *CipherGate) GnarkEval(cs frontend.API, xs ...frontend.Variable) frontend.Variable

GnarkEval performs the cipher operation on gnark variables

func (*CipherGate) ID

func (c *CipherGate) ID() string

ID returns the id of the cipher gate and print the ark as well

type IdentityGate

type IdentityGate struct{}

IdentityGate performs a copy of the vL value and ignores the vR value

func (IdentityGate) Degree

func (c IdentityGate) Degree() (degHPrime int)

Degree returns the Degree of the gate on hL, hR and hPrime

func (IdentityGate) Eval

func (c IdentityGate) Eval(res *fr.Element, xs ...*fr.Element)

Eval returns vL

func (IdentityGate) EvalBatch

func (c IdentityGate) EvalBatch(res []fr.Element, xs ...[]fr.Element)

Eval returns for a range of inputs

func (IdentityGate) GnarkEval

func (c IdentityGate) GnarkEval(cs frontend.API, x ...frontend.Variable) frontend.Variable

GnarkEval performs the copy on gnark variable

func (IdentityGate) ID

func (c IdentityGate) ID() string

ID returns "CopyGate" as an ID for CopyGate

type MulGate

type MulGate struct{}

MulGate performs a multiplication

func (MulGate) Degrees

func (m MulGate) Degrees() (degHL, degHR, degHPrime int)

Degrees returns the degrees of the gate on hL, hR and hPrime

func (MulGate) Eval

func (m MulGate) Eval(res, vL, vR *fr.Element)

Eval returns vL * vR

func (MulGate) EvalManyVL

func (m MulGate) EvalManyVL(res, vLs []fr.Element, vR *fr.Element)

EvalManyVL performs an element-wise multiplication of many vLs values by one vR value

func (MulGate) EvalManyVR

func (m MulGate) EvalManyVR(res []fr.Element, vL *fr.Element, vRs []fr.Element)

EvalManyVR performs an element-wise multiplication of many vRs values by one vL value

func (MulGate) GnarkEval

func (m MulGate) GnarkEval(cs frontend.API, vL, vR frontend.Variable) frontend.Variable

GnarkEval performs the gate operation on gnark variables

func (MulGate) ID

func (m MulGate) ID() string

ID returns the MulGate as ID

Jump to

Keyboard shortcuts

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