package tezos-plonk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Polynomial.EvaluationsSource

Sourcetype scalar = scalar
Sourcetype polynomial = Polynomial.t
Sourcetype t
Sourceval make_evaluation : (int * scalar array) -> t

make_evaluation (d, e) creates a value of type t from the evaluation representation of a polynomial e of degree d, i.e, it converts an OCaml array to a C array

Sourceval string_of_eval : t -> string

string_of_eval e returns the string representation of evaluation e

Sourcetype domain = Domain.t
Sourceval of_domain : domain -> t

of_domain d converts d from type domain to type t.

Note: of_domain d doesn't create a copy of d

Sourceval to_domain : t -> domain

to_domain d converts d from type t to type domain.

Note: to_domain d doesn't create a copy of d

Sourceval zero : t

zero returns the evaluation representation of the zero polynomial

Sourceval degree : t -> int

degree returns the degree of a polynomial. Returns -1 for the zero polynomial

Sourceval length : t -> int

length e returns the size of domain where a polynomial is evaluated, or equally, the size of a C array where evaluation e is stored

Sourceval create : int -> t

create len returns the evaluation representation of a zero polynomial of size len

Sourceval copy : ?res:t -> t -> t

copy ?res a returns a copy of evaluation a. The function writes the result in res if res has the correct size and allocates a new array for the result otherwise

Sourceval get : t -> int -> scalar

get p i returns the i-th element of a given array p

Sourceval mul_by_scalar : scalar -> t -> t

mul_by_scalar computes muliplication of a polynomial by a blst_fr element

Sourceval mul_c : ?res:t -> evaluations:t list -> ?composition_gx:(int list * int) -> ?powers:int list -> unit -> t

mul_c computes p₁(gᶜ₁·x)ᵐ₁·p₂(gᶜ₂·x)ᵐ₂·…·pₖ(gᶜₖ·x)ᵐₖ, where

  • pᵢ = List.nth evaluations i
  • mᵢ = List.nth powers i
  • cᵢ = List.nth (fst composition_gx) i
  • n = snd composition_gx is the order of generator, i.e., gⁿ = 1

The function writes the result in res if res has the correct size (= min (size pᵢ)) and allocates a new array for the result otherwise

Note: res can be equal to pᵢ when cᵢ = 0

Sourceval linear_c : ?res:t -> evaluations:t list -> ?linear_coeffs:scalar list -> ?composition_gx:(int list * int) -> ?add_constant:scalar -> unit -> t

linear_c computes λ₁·p₁(gᶜ₁·x) + λ₂·p₂(gᶜ₂·x) + … + λₖ·pₖ(gᶜₖ·x) + add_constant, where

  • pᵢ = List.nth evaluations i
  • λᵢ = List.nth linear_coeffs i
  • cᵢ = List.nth (fst composition_gx) i
  • n = snd composition_gx is the order of generator, i.e., gⁿ = 1

The function writes the result in res if res has the correct size (= min (size pᵢ)) and allocates a new array for the result otherwise

Note: res and pᵢ are disjoint

Sourceval add : ?res:t -> t -> t -> t

add ?res a b computes polynomial addition of a and b. The function writes the result in res if res has the correct size (= min (size (a, b))) and allocates a new array for the result otherwise

Note: res can be equal to either a or b

Sourceval equal : t -> t -> bool

equal a b checks whether a polynomial a is equal to a polynomial b

Note: equal is defined as restrictive equality, i.e., the same polynomial evaluated on different domains are said to be different

Sourceval evaluation_fft : domain -> polynomial -> t

evaluation_fft domain p converts the coefficient representation of a polynomial p to the evaluation representation. domain can be obtained using Domain.build

Note:

  • size of domain must be a power of two
  • size of a polynomial must be less than or equal to size of domain
Sourceval interpolation_fft : domain -> t -> polynomial

interpolation_fft domain p converts the evaluation representation of a polynomial p to the coefficient representation. domain can be obtained using Domain.build

Note:

  • size of domain must be a power of two
  • size of a polynomial must be equal to size of domain
Sourceval evaluation_fft2 : domain -> polynomial -> scalar array
Sourceval interpolation_fft2 : domain -> scalar array -> polynomial
OCaml

Innovation. Community. Security.