public class LongNTTStepStrategy extends LongTableFNT implements NTTStepStrategy, Parallelizable
All access to this class must be externally synchronized.
Constructor and Description |
---|
LongNTTStepStrategy()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected ParallelRunnable |
createMultiplyElementsParallelRunnable(ArrayAccess arrayAccess,
int startRow,
int startColumn,
int rows,
int columns,
long length,
long totalTransformLength,
boolean isInverse,
int modulus)
Create a ParallelRunnable object for multiplying the elements of the matrix.
|
protected ParallelRunnable |
createTransformRowsParallelRunnable(ArrayAccess arrayAccess,
int length,
int count,
boolean isInverse,
boolean permute,
int modulus)
Create a ParallelRunnable object for transforming the rows of the matrix.
|
long |
getMaxTransformLength()
Get the maximum transform length.
|
void |
multiplyElements(ArrayAccess arrayAccess,
int startRow,
int startColumn,
int rows,
int columns,
long length,
long totalTransformLength,
boolean isInverse,
int modulus)
Multiply each matrix element
(i, j) by wi * j / totalTransformLength . |
void |
transformRows(ArrayAccess arrayAccess,
int length,
int count,
boolean isInverse,
boolean permute,
int modulus)
Transform the rows of the data matrix.
|
inverseTableFNT, tableFNT
createWTable, getForwardNthRoot, getInverseNthRoot, modDivide, modInverse, modPow, negate
getModulus, modAdd, modMultiply, modSubtract, setModulus
public void multiplyElements(ArrayAccess arrayAccess, int startRow, int startColumn, int rows, int columns, long length, long totalTransformLength, boolean isInverse, int modulus) throws ApfloatRuntimeException
NTTStepStrategy
(i, j)
by wi * j / totalTransformLength
.
The matrix size is n1 x n2.multiplyElements
in interface NTTStepStrategy
arrayAccess
- The memory array to multiply.startRow
- Which row in the whole matrix the starting row in the arrayAccess
is.startColumn
- Which column in the whole matrix the starting column in the arrayAccess
is.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.ApfloatRuntimeException
public void transformRows(ArrayAccess arrayAccess, int length, int count, boolean isInverse, boolean permute, int modulus) throws ApfloatRuntimeException
NTTStepStrategy
ApfloatContext.getNumberOfProcessors()
.transformRows
in interface NTTStepStrategy
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.permute
- If permutation should be done.modulus
- Index of the modulus.ApfloatRuntimeException
public long getMaxTransformLength()
NTTStepStrategy
getMaxTransformLength
in interface NTTStepStrategy
protected ParallelRunnable createMultiplyElementsParallelRunnable(ArrayAccess arrayAccess, int startRow, int startColumn, int rows, int columns, long length, long totalTransformLength, boolean isInverse, int modulus) throws ApfloatRuntimeException
arrayAccess
- The memory array to multiply.startRow
- Which row in the whole matrix the starting row in the arrayAccess
is.startColumn
- Which column in the whole matrix the starting column in the arrayAccess
is.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.ApfloatRuntimeException
protected ParallelRunnable createTransformRowsParallelRunnable(ArrayAccess arrayAccess, int length, int count, boolean isInverse, boolean permute, int modulus) throws ApfloatRuntimeException
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.permute
- If permutation should be done.modulus
- Index of the modulus.ApfloatRuntimeException
Copyright © 2017. All rights reserved.