25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
416B

  1. package fftutil
  2. import "gonum.org/v1/gonum/dsp/fourier"
  3. type CmplxPlan struct {
  4. fft *fourier.CmplxFFT
  5. n int
  6. }
  7. func NewCmplxPlan(n int) *CmplxPlan {
  8. if n <= 0 {
  9. return &CmplxPlan{}
  10. }
  11. return &CmplxPlan{fft: fourier.NewCmplxFFT(n), n: n}
  12. }
  13. func (p *CmplxPlan) N() int { return p.n }
  14. func (p *CmplxPlan) FFT(out, in []complex128) {
  15. if p == nil || p.fft == nil {
  16. return
  17. }
  18. p.fft.Coefficients(out, in)
  19. }