Class AbstractSpectralTransform

java.lang.Object
net.algart.matrices.spectra.AbstractSpectralTransform
All Implemented Interfaces:
SpectralTransform
Direct Known Subclasses:
FastFourierTransform, SeparableFastHartleyTransform

public abstract class AbstractSpectralTransform extends Object implements SpectralTransform

A skeletal implementation of the SpectralTransform interface to minimize the effort required to implement this interface.

The main purpose of this class is implementing n-dimensional directTransformMatrix / inverseTransformMatrix methods via more simple (and more abstract) one-dimensional directTransform / inverseTransform methods. The algorithm of this implementation is the following:

In other words, the transform is sequentially applied along the dimension 0,1,...,N−1.

The "real" case is chosen above if the second matrixIm argument of directTransformMatrix / inverseTransformMatrix methods is null; in this case, the RealScalarSampleArray.asSampleArray or RealVectorSampleArray.asSampleArray method is applied to the corresponding subarrays of the underlying array of the matrixRe argument.

The "complex" case is chosen if the second matrixIm argument is not null; in this case, the ComplexScalarSampleArray.asSampleArray or ComplexVectorSampleArray.asSampleArray method is applied to the pairs of corresponding subarrays of the underlying arrays of both matrixRe and matrixIm arguments.

This algorithm is a traditional way of generalizing 1-dimensional FFT (Fourier transform) to 2-dimensional and multidimensional case. For FHT (Hartley transform), this generalization leads to so-called separable multidimensional Hartley transform.

The described algorithm is only a basic scheme of the implementation of directTransformMatrix and inverseTransformMatrix methods by this class. Really, this implementation performs much more: for example, downloads parts of large matrices into Java memory (SimpleMemoryModel) for better performance; splits the execution into several parallel tasks on multi-core or multiprocessor computers, according the passed ArrayContext or via DefaultThreadPoolFactory when this context is null; provides used interruption and showing progress via the passed ArrayContext (if it's not null); etc.

Please note: for very large matrices, much greater than the available Java RAM, the algorithms, implemented in this class, are designed to tiled matrices. For non-tiled matrices, these algorithms can work slowly.

Author:
Daniel Alievsky