public class SixStepFNTStrategy extends AbstractStepFNTStrategy
When the data to be transformed is considered to be an n1 x n2 matrix of data, instead of a linear array, the six steps are as follows:
In a convolution algorithm the last transposition step can be omitted to increase performance, as well as the first transposition step in the inverse transform. The convolution's element-by-element multiplication is not sensitive to the order in which the elements are. Also scrambling the data can be omitted.
All access to this class must be externally synchronized.
stepStrategy
Constructor and Description |
---|
SixStepFNTStrategy()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
inverseTransform(DataStorage dataStorage,
int n1,
int n2,
long length,
long totalTransformLength,
int modulus)
Inverse transform the data in steps.
|
protected void |
multiplyElements(ArrayAccess arrayAccess,
int rows,
int columns,
long length,
long totalTransformLength,
boolean isInverse,
int modulus)
Multiply each matrix element by a power of the n:th root of unity.
|
protected void |
transform(DataStorage dataStorage,
int n1,
int n2,
long length,
int modulus)
Transform the data in steps.
|
protected void |
transformFirst(ArrayAccess arrayAccess,
int length,
int count,
boolean isInverse,
int modulus)
The first transform of the rows (or columns) of the data matrix.
|
protected void |
transformSecond(ArrayAccess arrayAccess,
int length,
int count,
boolean isInverse,
int modulus)
The second transform of the rows (or columns) of the data matrix.
|
protected void |
transposeFinal(ArrayAccess arrayAccess,
int n1,
int n2,
boolean isInverse)
The final transpose of the forward transform, or the initial transpose
of the inverse transform.
|
protected void |
transposeInitial(ArrayAccess arrayAccess,
int n1,
int n2,
boolean isInverse)
The initial transpose of the forward transform, or the final transpose
of the inverse transform, to transpose the columns of the matrix to be rows.
|
protected void |
transposeMiddle(ArrayAccess arrayAccess,
int n1,
int n2,
boolean isInverse)
The second transpose of either the forward or inverse transform.
|
getTransformLength, inverseTransform, transform
protected void transform(DataStorage dataStorage, int n1, int n2, long length, int modulus) throws ApfloatRuntimeException
AbstractStepFNTStrategy
transform
in class AbstractStepFNTStrategy
dataStorage
- The data.n1
- Height of the data matrix.n2
- Width of the data matrix.length
- Length of the data.modulus
- Which modulus to use.ApfloatRuntimeException
protected void inverseTransform(DataStorage dataStorage, int n1, int n2, long length, long totalTransformLength, int modulus) throws ApfloatRuntimeException
AbstractStepFNTStrategy
inverseTransform
in class AbstractStepFNTStrategy
dataStorage
- The data.n1
- Height of the data matrix.n2
- Width of the data matrix.length
- Length of the data.totalTransformLength
- Total transform length.modulus
- Which modulus to use.ApfloatRuntimeException
protected void transposeInitial(ArrayAccess arrayAccess, int n1, int n2, boolean isInverse)
arrayAccess
- Accessor to the matrix data. This data will be transposed.n1
- Number of rows in the matrix.n2
- Number of columns in the matrix.isInverse
- true
if an inverse transform is performed, false
if a forward transform is performed.protected void transposeMiddle(ArrayAccess arrayAccess, int n1, int n2, boolean isInverse)
arrayAccess
- Accessor to the matrix data. This data will be transposed.n1
- Number of rows in the matrix.n2
- Number of columns in the matrix.isInverse
- true
if an inverse transform is performed, false
if a forward transform is performed.protected void transposeFinal(ArrayAccess arrayAccess, int n1, int n2, boolean isInverse)
arrayAccess
- Accessor to the matrix data.n1
- Number of rows in the matrix.n2
- Number of columns in the matrix.isInverse
- true
if an inverse transform is performed, false
if a forward transform is performed.protected void transformFirst(ArrayAccess arrayAccess, int length, int count, boolean isInverse, int modulus)
By default the row transforms permute the data, leaving it in the correct order so the element-by-element multiplication is simpler.
arrayAccess
- The memory array to split and transform.length
- Length of one transform (one row physically, by default).count
- Number of transforms.isInverse
- true
if an inverse transform is performed, false
if a forward transform is performed.modulus
- Index of the modulus.protected void transformSecond(ArrayAccess arrayAccess, int length, int count, boolean isInverse, int modulus)
By default the row transforms do not permute the data, leaving it in scrambled order, as this does not matter when the data is only used for convolution.
arrayAccess
- The memory array to split to rows and to transform.length
- Length of one transform (one row).count
- Number of rows.isInverse
- true
if an inverse transform is performed, false
if a forward transform is performed.modulus
- Index of the modulus.protected void multiplyElements(ArrayAccess arrayAccess, int rows, int columns, long length, long totalTransformLength, boolean isInverse, int modulus)
arrayAccess
- The memory array to multiply.rows
- The number of rows in the arrayAccess
to multiply.columns
- The number of columns in the matrix (= n2).length
- The length of data in the matrix being transformed.totalTransformLength
- The total transform length, for the scaling factor. Used only for the inverse case.isInverse
- If the multiplication is done for the inverse transform or not.modulus
- Index of the modulus.Copyright © 2018. All rights reserved.