github.com/gopherd/gonum@v0.0.4/dsp/fourier/internal/fftpack/helpers.go (about) 1 // Copyright ©2020 The Gonum Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package fftpack 6 7 // swap returns c with the real and imaginary parts swapped. 8 func swap(c complex128) complex128 { 9 return complex(imag(c), real(c)) 10 } 11 12 // scale scales the complex number c by f. 13 func scale(f float64, c complex128) complex128 { 14 return complex(f*real(c), f*imag(c)) 15 }