github.com/noriah/catnip@v1.8.5/fft/gonum.go (about) 1 //go:build !cgo || (!withfftw && !fftw) 2 3 package fft 4 5 import "gonum.org/v1/gonum/dsp/fourier" 6 7 // FFTW is false if Catnip is not built with cgo. It will use gonum instead. 8 const FFTW = false 9 10 // Plan holds a gonum FFT plan. 11 type Plan struct { 12 input []float64 13 output []complex128 14 fft *fourier.FFT 15 } 16 17 // Init sets up the plan so we dont run checks during execute 18 func (p *Plan) init() { 19 if p.fft == nil { 20 p.fft = fourier.NewFFT(len(p.input)) 21 } 22 } 23 24 // Execute executes the gonum plan. 25 func (p *Plan) Execute() { 26 p.fft.Coefficients(p.output, p.input) 27 }