Documentation
¶
Overview ¶
Package fft is numpy.fft for ndarray arrays: the discrete Fourier transforms of go-fft (github.com/go-fft/fft), applied along any axes of an N-dimensional array, with numpy's n/s, axes and norm arguments and its dtypes.
Every transform takes an array of any dtype. As in NumPy 2, float32 and complex64 inputs are transformed in single precision and give complex64 (or float32 for the real inverses); every other dtype is transformed in double precision. Problems NumPy reports with an exception — an axis out of range or repeated, a length below one — are errors here.
Index ¶
- Constants
- Variables
- func FFT(a *ndarray.Array) (*ndarray.Array, error)
- func FFT2(a *ndarray.Array) (*ndarray.Array, error)
- func FFT2With(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func FFTFreq(n int, d float64) (*ndarray.Array, error)
- func FFTN(a *ndarray.Array) (*ndarray.Array, error)
- func FFTNWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func FFTShift(a *ndarray.Array, axes ...int) (*ndarray.Array, error)
- func FFTWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func HFFT(a *ndarray.Array) (*ndarray.Array, error)
- func HFFTWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IFFT(a *ndarray.Array) (*ndarray.Array, error)
- func IFFT2(a *ndarray.Array) (*ndarray.Array, error)
- func IFFT2With(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IFFTN(a *ndarray.Array) (*ndarray.Array, error)
- func IFFTNWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IFFTShift(a *ndarray.Array, axes ...int) (*ndarray.Array, error)
- func IFFTWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IHFFT(a *ndarray.Array) (*ndarray.Array, error)
- func IHFFTWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IRFFT(a *ndarray.Array) (*ndarray.Array, error)
- func IRFFT2(a *ndarray.Array) (*ndarray.Array, error)
- func IRFFT2With(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IRFFTN(a *ndarray.Array) (*ndarray.Array, error)
- func IRFFTNWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func IRFFTWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func RFFT(a *ndarray.Array) (*ndarray.Array, error)
- func RFFT2(a *ndarray.Array) (*ndarray.Array, error)
- func RFFT2With(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func RFFTFreq(n int, d float64) (*ndarray.Array, error)
- func RFFTN(a *ndarray.Array) (*ndarray.Array, error)
- func RFFTNWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- func RFFTWith(a *ndarray.Array, o Options) (*ndarray.Array, error)
- type Norm
- type Options
Constants ¶
const ( Backward = gofft.NormBackward Ortho = gofft.NormOrtho Forward = gofft.NormForward )
The three scalings.
Variables ¶
var ErrArgs = errors.New("fft: invalid arguments")
ErrArgs is returned for arguments numpy.fft rejects: an axis out of range, a length below one, S and Axes of different lengths, or a complex input to a transform of real signals. An axis listed twice is accepted, as NumPy accepts it: the transform runs along it twice.
Functions ¶
func FFTFreq ¶
FFTFreq is numpy.fft.fftfreq: the sample frequencies of an n-point FFT with sample spacing d.
func FFTShift ¶
FFTShift is numpy.fft.fftshift: it rotates each of the given axes (every axis when none is given) by half its length, moving the zero frequency to the centre.
func HFFT ¶
HFFT is numpy.fft.hfft: the transform of a signal with Hermitian symmetry, given by its first half, which is real.
func IRFFT ¶
IRFFT is numpy.fft.irfft: the inverse of RFFT, a real signal of length 2*(m-1) for m bins unless Options.S says otherwise.
func IRFFT2With ¶
IRFFT2With is numpy.fft.irfft2(a, s, axes, norm).
func IRFFTNWith ¶
IRFFTNWith is numpy.fft.irfftn(a, s, axes, norm).
func RFFT ¶
RFFT is numpy.fft.rfft: the transform of a real signal along the last axis, keeping the n/2+1 non-negative frequencies. A complex input is an error, as in NumPy 2.
func RFFTFreq ¶
RFFTFreq is numpy.fft.rfftfreq: the n/2+1 non-negative frequencies of an n-point RFFT.
Types ¶
type Norm ¶
Norm selects how a forward/inverse pair is scaled, as numpy.fft's norm argument does. The zero value, Backward, is numpy's default: the forward transform is unscaled and the inverse divides by n.
type Options ¶
type Options struct {
// S is numpy's n (for the 1-D transforms, one entry) or s (for the
// others): the length of each transformed axis. The input is truncated or
// zero-padded to it along that axis. For the real inverses (IRFFT,
// IRFFTN, HFFT) it is the length of the real output along the last
// transformed axis. nil keeps the input's lengths (and, for the real
// inverses, 2*(m-1) along the last axis, m being its number of bins).
S []int
// Axes are the axes to transform; negative values count from the end.
// nil means numpy's default: the last axis for the 1-D transforms, the
// last two for the 2-D ones, all of them for the N-D ones (or the last
// len(S) when S is set).
Axes []int
// Norm scales the result.
Norm Norm
}
Options carries numpy.fft's optional arguments. Its zero value is numpy's defaults, so FFTWith(a, Options{}) is FFT(a).