common

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

Documentation

Index

Constants

View Source
const GKR_MIMC string = "gkr-mimc"

Variables

This section is empty.

Functions

func Assert

func Assert(assertion bool, msg string, args ...interface{})

Assert is equivalent of if ```

if !assertion {
		panic(fmt.Sprintf(msg, args...))
}

```

func FrSliceToString

func FrSliceToString(slice []fr.Element) string

FrSliceToString pretty prints a slice of fr.Element to ease debugging

func FrToGenericArray

func FrToGenericArray(slice []fr.Element) []interface{}

FrToGenericArray downcast to an slice of interface

func GetChallenge

func GetChallenge(challengeSeed []fr.Element) fr.Element

GetChallenge returns a interaction challenge

func GetPath

func GetPath(p string) (string, error)

Helper to create to a file, and does a few checks Ensure it does not create a file from outside the repo The path should be specified assuming it is relative to the root of the project

func IntSliceToString

func IntSliceToString(slice []int) string

IntSliceToString pretty-prints a slice of int for debugging

func Log2Ceil

func Log2Ceil(a int) int

Log2Ceil computes the ceiled value of Log2

func Log2Floor

func Log2Floor(a int) int

Log2Floor computes the floored value of Log2

func Max

func Max(a int, b int) int

Max returns the maximum of two number

func Min

func Min(a int, b int) int

Min returns the minimum of two numbers

func Parallelize

func Parallelize(nbIterations int, work func(int, int), maxCpus ...int)

Parallelize process in parallel the work function

func ProfileTrace

func ProfileTrace(b *testing.B, profiled, traced bool, fn func())

ProfileTrace run the benchmark function with optionally, benchmarking and tracing

func RandomFrArray

func RandomFrArray(size int) []fr.Element

RandomFrArray returns a random array

func TryDispatch

func TryDispatch(nbIteration, minTaskSize int, dispatch func(start, stop int)) int

Split the large task in smaller chunks appropriately, and `dispatch` for all`. Usefull to send jobs to a worker pool, returns `true`. If it's not practical to dispatch asynchronously, does nothing and returns `0`

func Uint64ToFr

func Uint64ToFr(x uint64) fr.Element

Uint64ToFr allows to quickly create fr.Element

func UintSliceToString

func UintSliceToString(slice []uint) string

UintSliceToString pretty-prints a slice of uint for debugging

Types

type TimeTracker

type TimeTracker struct {
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer(label string) TimeTracker

func (TimeTracker) Close

func (t TimeTracker) Close()

Jump to

Keyboard shortcuts

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