Package org.apfloat.internal
Class AbstractStepFNTStrategy
- java.lang.Object
-
- org.apfloat.internal.AbstractStepFNTStrategy
-
- All Implemented Interfaces:
Parallelizable
,NTTStrategy
- Direct Known Subclasses:
SixStepFNTStrategy
,TwoPassFNTStrategy
public abstract class AbstractStepFNTStrategy extends java.lang.Object implements NTTStrategy, Parallelizable
Abstract superclass for step-based FNT strategies.All access to this class must be externally synchronized.
- Since:
- 1.7.0
- Version:
- 1.8.0
- See Also:
NTTStepStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected NTTStepStrategy
stepStrategy
The NTT steps.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractStepFNTStrategy()
Subclass constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
getTransformLength(long size)
Return the supported transform length for the specified data size.protected abstract void
inverseTransform(DataStorage dataStorage, int n1, int n2, long length, long totalTransformLength, int modulus)
Inverse transform the data in steps.void
inverseTransform(DataStorage dataStorage, int modulus, long totalTransformLength)
Perform an inverse transform on the data.void
transform(DataStorage dataStorage, int modulus)
Perform a forward transform on the data.protected abstract void
transform(DataStorage dataStorage, int n1, int n2, long length, int modulus)
Transform the data in steps.
-
-
-
Field Detail
-
stepStrategy
protected NTTStepStrategy stepStrategy
The NTT steps.
-
-
Method Detail
-
transform
public void transform(DataStorage dataStorage, int modulus) throws ApfloatRuntimeException
Description copied from interface:NTTStrategy
Perform a forward transform on the data.Multiple moduli can be used, if the convolution algorithm uses the Chinese Remainder Theorem to calculate the final result.
- Specified by:
transform
in interfaceNTTStrategy
- Parameters:
dataStorage
- The data to be transformed.modulus
- Number of modulus to use (in case the transform supports multiple moduli).- Throws:
ApfloatRuntimeException
-
inverseTransform
public void inverseTransform(DataStorage dataStorage, int modulus, long totalTransformLength) throws ApfloatRuntimeException
Description copied from interface:NTTStrategy
Perform an inverse transform on the data.Multiple moduli can be used, if the convolution algorithm uses the Chinese Remainder Theorem to calculate the final result.
- Specified by:
inverseTransform
in interfaceNTTStrategy
- Parameters:
dataStorage
- The data to be transformed.modulus
- Number of modulus to use (in case the transform supports multiple moduli).totalTransformLength
- Total transform length; the final result elements are divided by this value.- Throws:
ApfloatRuntimeException
-
getTransformLength
public long getTransformLength(long size)
Description copied from interface:NTTStrategy
Return the supported transform length for the specified data size.- Specified by:
getTransformLength
in interfaceNTTStrategy
- Parameters:
size
- Length of the data to be transformed.- Returns:
- Length of the transform needed by this transform.
-
transform
protected abstract void transform(DataStorage dataStorage, int n1, int n2, long length, int modulus) throws ApfloatRuntimeException
Transform the data in steps.- Parameters:
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.- Throws:
ApfloatRuntimeException
-
inverseTransform
protected abstract void inverseTransform(DataStorage dataStorage, int n1, int n2, long length, long totalTransformLength, int modulus) throws ApfloatRuntimeException
Inverse transform the data in steps.- Parameters:
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.- Throws:
ApfloatRuntimeException
-
-