fft

package
v0.1.147 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: GPL-2.0, GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package fft provides a radix-2 Cooley-Tukey FFT implementation for cross-correlation in the subsync package.

Index

Constants

This section is empty.

Variables

View Source
var WorkspacePool = sync.Pool{
	New: func() any { return &Workspace{} },
}

WorkspacePool reuses allocated complex128 slices across correlations to reduce GC pressure from large FFT buffers.

Functions

func FFT

func FFT(x []complex128) []complex128

FFT computes the discrete Fourier transform in-place using the iterative Cooley-Tukey radix-2 decimation-in-time algorithm. Input length must be a power of 2. Variable names follow standard DSP convention.

func IFFT

func IFFT(x []complex128) []complex128

IFFT computes the inverse discrete Fourier transform by conjugating, applying the forward FFT, then conjugating and scaling.

func NextPow2

func NextPow2(n int) int

NextPow2 returns the smallest power of 2 >= n.

Types

type Workspace

type Workspace struct {
	A, B, Product []complex128
}

Workspace holds reusable buffers for FFT cross-correlation.

func (*Workspace) Ensure

func (w *Workspace) Ensure(n int)

Ensure grows workspace buffers to at least n elements, reusing capacity.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL