Package org.apache.sysds.runtime.matrix.data

# Class LibMatrixFourier

java.lang.Object
org.apache.sysds.runtime.matrix.data.LibMatrixFourier

public class LibMatrixFourier extends Object

## Constructor Summary

Constructors
Constructor
Description
`LibMatrixFourier()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`fft(double[] re, double[] im, int rows, int cols, int threads, boolean inclColCalc)`
Function to perform FFT for two given double arrays.
`static MatrixBlock[]`
`fft(MatrixBlock re, int threads)`
Function to perform FFT for a given matrix.
`static MatrixBlock[]`
`fft(MatrixBlock re, MatrixBlock im, int threads)`
Function to perform FFT for two given matrices.
`static MatrixBlock[]`
`fft_linearized(MatrixBlock re, int threads)`
Function to perform FFT for each row of a given matrix.
`static MatrixBlock[]`
`fft_linearized(MatrixBlock re, MatrixBlock im, int threads)`
Function to perform FFT for each row of two given matrices.
`static void`
`fft_one_dim(double[] re, double[] im, double[] re_inter, double[] im_inter, int start, int stop, int num, int minStep)`
Function to perform one-dimensional FFT for two given double arrays.
`static void`
`ifft(double[] re, double[] im, int rows, int cols, int threads, boolean inclColCalc)`
Function to perform IFFT for two given double arrays.
`static MatrixBlock[]`
`ifft(MatrixBlock re, int threads)`
Function to perform IFFT for a given matrix.
`static MatrixBlock[]`
`ifft(MatrixBlock re, MatrixBlock im, int threads)`
Function to perform IFFT for two given matrices.
`static MatrixBlock[]`
`ifft_linearized(MatrixBlock re, int threads)`
Function to perform IFFT for each row of a given matrix.
`static MatrixBlock[]`
`ifft_linearized(MatrixBlock re, MatrixBlock im, int threads)`
Function to perform IFFT for each row of two given matrices.
`static boolean`
`isPowerOfTwo(int n)`
Function for checking whether the given integer is a power of two.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LibMatrixFourier

public LibMatrixFourier()

## Method Details

### fft

public static MatrixBlock[] fft(MatrixBlock re, MatrixBlock im, int threads)
Function to perform FFT for two given matrices. The first one represents the real values and the second one the imaginary values. The output also contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `im` - matrix object representing the imaginary values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### ifft

public static MatrixBlock[] ifft(MatrixBlock re, MatrixBlock im, int threads)
Function to perform IFFT for two given matrices. The first one represents the real values and the second one the imaginary values. The output also contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `im` - matrix object representing the imaginary values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### fft_linearized

public static MatrixBlock[] fft_linearized(MatrixBlock re, MatrixBlock im, int threads)
Function to perform FFT for each row of two given matrices. The first one represents the real values and the second one the imaginary values. The output also contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `im` - matrix object representing the imaginary values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### ifft_linearized

public static MatrixBlock[] ifft_linearized(MatrixBlock re, MatrixBlock im, int threads)
Function to perform IFFT for each row of two given matrices. The first one represents the real values and the second one the imaginary values. The output also contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `im` - matrix object representing the imaginary values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### fft

public static void fft(double[] re, double[] im, int rows, int cols, int threads, boolean inclColCalc)
Function to perform FFT for two given double arrays. The first one represents the real values and the second one the imaginary values. Both arrays get updated and contain the result.

Parameters:
  `re` - array representing the real values
  `im` - array representing the imaginary values
  `rows` - number of rows
  `cols` - number of rows
  `threads` - number of threads
  `inclColCalc` - if true, fft is also calculated for each column, otherwise only for each row

### ifft

public static void ifft(double[] re, double[] im, int rows, int cols, int threads, boolean inclColCalc)
Function to perform IFFT for two given double arrays. The first one represents the real values and the second one the imaginary values. Both arrays get updated and contain the result.

Parameters:
  `re` - array representing the real values
  `im` - array representing the imaginary values
  `rows` - number of rows
  `cols` - number of rows
  `threads` - number of threads
  `inclColCalc` - if true, fft is also calculated for each column, otherwise only for each row

### fft_one_dim

public static void fft_one_dim(double[] re, double[] im, double[] re_inter, double[] im_inter, int start, int stop, int num, int minStep)
Function to perform one-dimensional FFT for two given double arrays. The first one represents the real values and the second one the imaginary values. Both arrays get updated and contain the result.

Parameters:
  `re` - array representing the real values
  `im` - array representing the imaginary values
  `re_inter` - array for the real values of intermediate results
  `im_inter` - array for the imaginary values of intermediate results
  `start` - start index (incl.)
  `stop` - stop index (excl.)
  `num` - number of values used for fft
  `minStep` - step size between values used for fft

### isPowerOfTwo

public static boolean isPowerOfTwo(int n)
Function for checking whether the given integer is a power of two.

Parameters:
  `n` - integer to check
Returns:
  true if n is a power of two, false otherwise

### fft

public static MatrixBlock[] fft(MatrixBlock re, int threads)
Function to perform FFT for a given matrix. The given matrix only represents real values. The output contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### ifft

public static MatrixBlock[] ifft(MatrixBlock re, int threads)
Function to perform IFFT for a given matrix. The given matrix only represents real values. The output contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### fft_linearized

public static MatrixBlock[] fft_linearized(MatrixBlock re, int threads)
Function to perform FFT for each row of a given matrix. The given matrix only represents real values. The output contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `threads` - number of threads
Returns:
  array of two matrix blocks

### ifft_linearized

public static MatrixBlock[] ifft_linearized(MatrixBlock re, int threads)
Function to perform IFFT for each row of a given matrix. The given matrix only represents real values. The output contains one matrix for the real and one for the imaginary values.

Parameters:
  `re` - matrix object representing the real values
  `threads` - number of threads
Returns:
  array of two matrix blocks