Documentation
¶
Index ¶
- Constants
- func CostOfCompress(deg0, deg1, deg2 int) int
- func CostOfMultiply(aDeg0, aDeg1, bDeg0, bDeg1 int) int
- func FromInterface(input interface{}) big.Int
- func NextPowerOfTwo(x int, is4 bool) int
- func ShowProfiling(varSourceInfo []SourceInfo, varCost []int)
- func SortIntSeq(s []int, cmpLess func(int, int) bool)
- type Hashable
- type InputBuf
- func (i *InputBuf) IsEnd() bool
- func (i *InputBuf) ReadBigInt(n int) *big.Int
- func (i *InputBuf) ReadFieldElement(field SimpleField) constraint.Element
- func (i *InputBuf) ReadIntSlice() []int
- func (i *InputBuf) ReadUint32() uint32
- func (i *InputBuf) ReadUint64() uint64
- func (i *InputBuf) ReadUint8() uint8
- type IntSeq
- type Map
- type OutputBuf
- func (o *OutputBuf) AppendBigInt(n int, x *big.Int)
- func (o *OutputBuf) AppendFieldElement(field SimpleField, x constraint.Element)
- func (o *OutputBuf) AppendIntSlice(x []int)
- func (o *OutputBuf) AppendUint32(x uint32)
- func (o *OutputBuf) AppendUint64(x uint64)
- func (o *OutputBuf) AppendUint8(x uint8)
- func (o *OutputBuf) Bytes() []byte
- type SimpleField
- type SourceInfo
Constants ¶
const CostOfAddGate = 3
const CostOfCstGate = 3
const CostOfInput = 1000
const CostOfMulGate = 10
const CostOfVariable = 100
Variables ¶
This section is empty.
Functions ¶
func CostOfCompress ¶
func CostOfMultiply ¶
func FromInterface ¶
FromInterface converts an interface to a big.Int element
input must be primitive (uintXX, intXX, []byte, string) or implement BigInt(res *big.Int) (which is the case for gnark-crypto field elements)
if the input is a string, it calls (big.Int).SetString(input, 0). In particular: The number prefix determines the actual base: A prefix of ”0b” or ”0B” selects base 2, ”0”, ”0o” or ”0O” selects base 8, and ”0x” or ”0X” selects base 16. Otherwise, the selected base is 10 and no prefix is accepted.
panics if the input is invalid
func NextPowerOfTwo ¶
pad to 2^n gates (and 4^n for first layer) 4^n exists for historical reasons, not used now
func ShowProfiling ¶
func ShowProfiling(varSourceInfo []SourceInfo, varCost []int)
Types ¶
type InputBuf ¶
type InputBuf struct {
// contains filtered or unexported fields
}
func NewInputBuf ¶
func (*InputBuf) ReadFieldElement ¶
func (i *InputBuf) ReadFieldElement(field SimpleField) constraint.Element
func (*InputBuf) ReadIntSlice ¶
func (*InputBuf) ReadUint32 ¶
func (*InputBuf) ReadUint64 ¶
type Map ¶
type Map map[uint64][]mapEntry
func (Map) FilterKeys ¶
filter (e, v) in the map using f(v), returns the keys
type OutputBuf ¶
type OutputBuf struct {
// contains filtered or unexported fields
}
func (*OutputBuf) AppendFieldElement ¶
func (o *OutputBuf) AppendFieldElement(field SimpleField, x constraint.Element)
func (*OutputBuf) AppendIntSlice ¶
func (*OutputBuf) AppendUint32 ¶
func (*OutputBuf) AppendUint64 ¶
func (*OutputBuf) AppendUint8 ¶
type SimpleField ¶
type SimpleField interface { SerializedLen() int ToBigInt(c constraint.Element) *big.Int FromInterface(i interface{}) constraint.Element }