Documentation ΒΆ
Overview ΒΆ
Package fft provides in-place discrete Fourier transform on powers-of-two subgroups of π½α΅£Λ£ (the multiplicative group (β€/rβ€, x) ).
Index ΒΆ
- func BitReverse(v []fr.Element)
- func BuildExpTable(w fr.Element, table []fr.Element)
- func Generator(m uint64) (fr.Element, error)
- func GeneratorFullMultiplicativeGroup() fr.Element
- type Decimation
- type Domain
- func (d *Domain) CosetTable() ([]fr.Element, error)
- func (d *Domain) CosetTableInv() ([]fr.Element, error)
- func (domain *Domain) FFT(a []fr.Element, decimation Decimation, opts ...Option)
- func (domain *Domain) FFTInverse(a []fr.Element, decimation Decimation, opts ...Option)
- func (d *Domain) ReadFrom(r io.Reader) (int64, error)
- func (d *Domain) Twiddles() ([][]fr.Element, error)
- func (d *Domain) TwiddlesInv() ([][]fr.Element, error)
- func (d *Domain) WriteTo(w io.Writer) (int64, error)
- type DomainOption
- type Option
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func BitReverse ΒΆ
BitReverse applies the bit-reversal permutation to v. len(v) must be a power of 2
func BuildExpTable ΒΆ added in v0.13.0
BuildExpTable precomputes the first n powers of w in parallel table[0] = w^0 table[1] = w^1 ...
func Generator ΒΆ added in v0.10.0
Generator returns a generator for Z/2^(log(m))Z or an error if m is too big (required root of unity doesn't exist)
func GeneratorFullMultiplicativeGroup ΒΆ added in v0.13.0
GeneratorFullMultiplicativeGroup returns a generator of π½α΅£Λ£
Types ΒΆ
type Decimation ΒΆ
type Decimation uint8
Decimation is used in the FFT call to select decimation in time or in frequency
const ( DIT Decimation = iota DIF )
type Domain ΒΆ
type Domain struct { Cardinality uint64 CardinalityInv fr.Element Generator fr.Element GeneratorInv fr.Element FrMultiplicativeGen fr.Element // generator of Fr* FrMultiplicativeGenInv fr.Element // contains filtered or unexported fields }
Domain with a power of 2 cardinality compute a field element of order 2x and store it in FinerGenerator all other values can be derived from x, GeneratorSqrt
func NewDomain ΒΆ
func NewDomain(m uint64, opts ...DomainOption) *Domain
NewDomain returns a subgroup with a power of 2 cardinality cardinality >= m shift: when specified, it's the element by which the set of root of unity is shifted.
func (*Domain) CosetTable ΒΆ
CosetTable returns the cosetTable u*<1,g,..,g^(n-1)> or an error if the domain was created with the WithoutPrecompute option
func (*Domain) CosetTableInv ΒΆ
CosetTableInv returns the cosetTableInv u*<1,g,..,g^(n-1)> or an error if the domain was created with the WithoutPrecompute option
func (*Domain) FFT ΒΆ
func (domain *Domain) FFT(a []fr.Element, decimation Decimation, opts ...Option)
FFT computes (recursively) the discrete Fourier transform of a and stores the result in a if decimation == DIT (decimation in time), the input must be in bit-reversed order if decimation == DIF (decimation in frequency), the output will be in bit-reversed order
func (*Domain) FFTInverse ΒΆ
func (domain *Domain) FFTInverse(a []fr.Element, decimation Decimation, opts ...Option)
FFTInverse computes (recursively) the inverse discrete Fourier transform of a and stores the result in a if decimation == DIT (decimation in time), the input must be in bit-reversed order if decimation == DIF (decimation in frequency), the output will be in bit-reversed order coset sets the shift of the fft (0 = no shift, standard fft) len(a) must be a power of 2, and w must be a len(a)th root of unity in field F.
func (*Domain) Twiddles ΒΆ
Twiddles returns the twiddles factor for the FFT using Generator for each stage of the recursive FFT or an error if the domain was created with the WithoutPrecompute option
func (*Domain) TwiddlesInv ΒΆ
TwiddlesInv returns the twiddles factor for the FFT using GeneratorInv for each stage of the recursive FFT or an error if the domain was created with the WithoutPrecompute option
type DomainOption ΒΆ added in v0.13.0
type DomainOption func(*domainConfig)
DomainOption defines option for altering the definition of the FFT domain See the descriptions of functions returning instances of this type for particular options.
func WithShift ΒΆ added in v0.13.0
func WithShift(shift fr.Element) DomainOption
WithShift sets the FrMultiplicativeGen of the domain. Default is generator of the largest 2-adic subgroup.
func WithoutPrecompute ΒΆ added in v0.13.0
func WithoutPrecompute() DomainOption
WithoutPrecompute disables precomputation of twiddles in the domain. When this option is set, FFTs will be slower, but will use less memory.
type Option ΒΆ added in v0.10.0
type Option func(*fftConfig)
Option defines option for altering the behavior of FFT methods. See the descriptions of functions returning instances of this type for particular options.
func OnCoset ΒΆ added in v0.10.0
func OnCoset() Option
OnCoset if provided, FFT(a) returns the evaluation of a on a coset.
func WithNbTasks ΒΆ added in v0.10.0
WithNbTasks sets the max number of task (go routine) to spawn. Must be between 1 and 512.