class

CrImage::FftUtil

Inherits Reference < Object

Utility class for Fast Fourier Transforms

At some point in the future, this may be moved to its own shard.

Class methods

fft1d(inp : Array(Float64), buffer : Array(Complex) | Nil = nil) : Array(Complex)

Perform Fast Fourier Transform on inp.

Can optionally pass in buffer which must be the same length as inp

Source
fft1d(inp : Array(Complex), buffer : Array(Complex) = inp.dup) : Array(Complex)

Perform Fast Fourier Transform on inp.

Can optionally pass in buffer which must be the same length as inp

Source
fft1d_unsafe(ret : Array(Complex) | Slice(Complex), buffer : Array(Complex) | Slice(Complex) = ret.dup) : Array(Complex) | Slice(Complex)

Calculates Fast Fourier Transform of ret. Uses and modifies ret in place.

Can optionally pass in buffer which must be the same length as inp. This method makes no bound checks or error checks.

Source
fft2d(width : Int32, inp : Array(Float64), buffer : Array(Complex) | Nil = nil) : Array(Complex)

Perform Fast Fourier Transform, treating as inp as a 2 dimensional array with width.

Can optionally pass in buffer which must be an array at least the larger of width or inp.size // width.

Source
fft2d(width : Int32, inp : Array(Complex), buffer : Array(Complex) | Nil = nil) : Array(Complex)

Perform Fast Fourier Transform, treating as inp as a 2 dimensional array with width.

Can optionally pass in buffer which must be an array at least the larger of width or inp.size // width.

Source
fft2d_unsafe(width : Int32, ret : Array(Complex), buffer : Array(Complex)) : Array(Complex)

Perform Fast Fourier Transform, using and rewriting ret for the output, as a 2 dimensional array with width. buffer must be an array of length at least the longer of width or height of the input array.

Source
ifft1d(inp : Array(Complex), buffer : Array(Complex) = inp.dup) : Array(Complex)

Perform Inverse Fast Fourier Transform on inp.

Can optionally pass in buffer which must be at least the same size of inp.

Source
ifft1d_unsafe(ret : Array(Complex) | Slice(Complex), buffer : Array(Complex) = ret.dup) : Array(Complex) | Slice(Complex)

Perform Inverse Fast Fourier Transform on ret. Will use and overwrite the original values in ret to do so.

Can optionally pass in buffer which must be at least the same size of inp. This method makes no bound checks or error checks.

Source
ifft2d(width : Int32, inp : Array(Complex), buffer : Array(Complex) | Nil = nil) : Array(Complex)

Perform Inverse Fast Fourier Transform, treating as inp as a 2 dimensional array with width.

Can optionally pass in buffer which must be an array at least the larger of width or inp.size // width.

Source
ifft2d_unsafe(width : Int32, ret : Array(Complex), buffer : Array(Complex)) : Array(Complex)
Source