Documentation
¶
Index ¶
- func AppendRefs[T any](s []any, v []T) []any
- func BinarySearch(slice []int, toFind int) int
- func BinarySearchFunc(eval func(int) int, end int, toFind int) int
- func ByteLen(q *big.Int) int
- func FieldToCurve(q *big.Int) ecc.ID
- func FindInSlice(x []int, target int) (int, bool)
- func ForceUint32(v any) uint32
- func FromInterface(input interface{}) big.Int
- func IntSliceSliceToUint64SliceSlice(in [][]int) [][]uint64
- func InvertPermutation(permutation []int) []int
- func Map[T, S any](in []T, f func(T) S) []S
- func MapAt[K comparable, V any](mp map[K]V) func(K) V
- func MapRange[S any](begin, end int, f func(int) S) []S
- func Parallelize(nbIterations int, work func(int, int), maxCpus ...int)
- func Permute[T any](slice []T, permutation []int)
- func References[T any](v []T) []*T
- func SliceAt[T any](slice []T) func(int) T
- func SlicePtrAt[T any](slice []T) func(int) *T
- func TopologicalSort(inputs [][]int) (sorted []int, uniqueOutputs [][]int)
- func Uint64SliceSliceToIntSliceSlice(in [][]uint64) [][]int
- type IntHeap
- type MultiListSeeker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendRefs ¶ added in v0.13.0
AppendRefs returns append(s, &v[0], &v[1], ...).
func BinarySearch ¶ added in v0.13.0
BinarySearch looks for toFind in a sorted slice, and returns the index at which it either is or would be were it to be inserted.
func BinarySearchFunc ¶ added in v0.13.0
BinarySearchFunc looks for toFind in an increasing function of domain 0 ... (end-1), and returns the index at which it either is or would be were it to be inserted.
func FindInSlice ¶ added in v0.9.0
FindInSlice attempts to find the target in increasing slice x. If not found, returns false and the index where the target would be inserted.
func ForceUint32 ¶ added in v0.13.0
ForceUint32 converts an object that may have been a uint64, or a uint32, to a uint32.
func FromInterface ¶ added in v0.6.0
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 IntSliceSliceToUint64SliceSlice ¶ added in v0.9.0
func InvertPermutation ¶ added in v0.13.0
InvertPermutation input permutation must contain exactly 0, ..., len(permutation)-1
func MapAt ¶ added in v0.13.0
func MapAt[K comparable, V any](mp map[K]V) func(K) V
func Parallelize ¶
Parallelize process in parallel the work function
func Permute ¶ added in v0.13.0
Permute operates in-place but is not thread-safe; it uses the permutation for scratching permutation[i] signifies which index slice[i] is going to
func References ¶ added in v0.13.0
func References[T any](v []T) []*T
References returns a slice of references to the elements of v.
func SlicePtrAt ¶ added in v0.13.0
func TopologicalSort ¶ added in v0.13.0
TopologicalSort takes a list of lists of dependencies and proposes a sorting of the lists in order of dependence. Such that for any wire, any one it depends on occurs before it. It tries to stick to the input order as much as possible. An already sorted list will remain unchanged. As a bonus, it returns for each list its "unique" outputs. That is, a list of its outputs with no duplicates. Worst-case inefficient O(n^2), but that probably won't matter since the circuits are small. Furthermore, it is efficient with already-close-to-sorted lists, which are the expected input. If performance was bad, consider using a heap for finding the value "leastReady". WARNING: Due to the current implementation of intSet, it is ALWAYS O(n^2).
func Uint64SliceSliceToIntSliceSlice ¶ added in v0.9.0
Types ¶
type IntHeap ¶ added in v0.9.0
type IntHeap []int
An IntHeap is a min-heap of linear expressions. It facilitates merging k-linear expressions.
The code is identical to https://pkg.go.dev/container/heap but replaces interfaces with concrete type to avoid memory overhead.
func (*IntHeap) Heapify ¶ added in v0.9.0
func (h *IntHeap) Heapify()
Heapify establishes the heap invariants required by the other routines in this package. Heapify is idempotent with respect to the heap invariants and may be called whenever the heap invariants may have been invalidated. The complexity is O(n) where n = len(*h).
type MultiListSeeker ¶ added in v0.9.0
type MultiListSeeker [][]int
MultiListSeeker looks up increasing integers in a list of increasing lists of integers.
func (MultiListSeeker) Seek ¶ added in v0.9.0
func (s MultiListSeeker) Seek(n int) int
Seek returns the index of the earliest list where n is found, or -1 if not found.