ICICLE example: Polynomials in Golang
ICICLE
provides Golang bindings to CUDA-accelerated C++ implementation of Polynomials.
Usage
Backend Initialization
InitPolyBackend()
Construction
poly1 := CreateFromCoeffecitients(/* Coefficients of polynomial */ coeffs)
poly2 := CreateFromROUEvaluations(/* evaluations */ evals)
poly3 := Clone(/* polynomial to clone */ poly1)
Arithmetic
polyAdd := poly1.Add(&poly2)
polySub := poly1.Subtract(&poly2)
polyMul := poly1.Multiply(&poly2)
polyMulScalar := MultiplyByScalar(scalar)
quotient, remainder := poly1.Divide(&poly2)
Evaluation
ev := poly1.Eval(scalar)
ev2 := poly1.EvalOnDomain(scalars)
In this example we use BN254
and Babybear
fields. The examples shows arithmetic operations and evaluations execution.
What's in the example
- Define the size of polynomials.
- Initialize backends.
- Generate random polynomials.
- Execute arithmetic operations.
- Execute evaluations.
- Execute slicing.
Running the example:
go run main.go