public class ThreeNTTConvolutionStrategy extends Object implements ConvolutionStrategy
Multiplication can be done in linear time in the transform domain, where the multiplication is simply an element-by-element multiplication.
All access to this class must be externally synchronized.
| Modifier and Type | Field and Description |
|---|---|
protected CarryCRTStrategy |
carryCRTStrategy
The carry-CRT to use.
|
protected NTTStrategy |
nttStrategy
The transform to use.
|
protected NTTConvolutionStepStrategy |
stepStrategy
The convolution steps to use.
|
| Constructor and Description |
|---|
ThreeNTTConvolutionStrategy(int radix,
NTTStrategy nttStrategy)
Creates a new convoluter that uses the specified
transform for transforming the data.
|
| Modifier and Type | Method and Description |
|---|---|
protected DataStorage |
autoConvolute(DataStorage x,
long resultSize)
Convolutes a data set with itself.
|
protected DataStorage |
autoConvoluteOne(DataStorage x,
long length,
int modulus,
boolean cached)
Performs an autoconvolution modulo one modulus, of the specified transform length.
|
DataStorage |
convolute(DataStorage x,
DataStorage y,
long resultSize)
Convolutes the two sets of data.
|
protected DataStorage |
convoluteOne(DataStorage x,
DataStorage y,
long length,
int modulus,
boolean cached)
Performs a convolution modulo one modulus, of the specified transform length.
|
protected DataStorage |
createCachedDataStorage(long size)
Create a cached (if possible) data storage for the specified number of elements.
|
protected DataStorage |
createDataStorage(DataStorage dataStorage)
Create a cached data storage from the (possibly) cached data storage.
|
protected void |
lock(long length)
Lock the execution against a synchronization lock.
|
protected void |
unlock()
Remove the synchronization lock.
|
protected NTTStrategy nttStrategy
protected CarryCRTStrategy carryCRTStrategy
protected NTTConvolutionStepStrategy stepStrategy
public ThreeNTTConvolutionStrategy(int radix,
NTTStrategy nttStrategy)
radix - The radix to be used.nttStrategy - The transform to be used.public DataStorage convolute(DataStorage x, DataStorage y, long resultSize) throws ApfloatRuntimeException
ConvolutionStrategyconvolute in interface ConvolutionStrategyx - First data set.y - Second data set.resultSize - Number of elements needed in the result data.ApfloatRuntimeExceptionprotected DataStorage convoluteOne(DataStorage x, DataStorage y, long length, int modulus, boolean cached) throws ApfloatRuntimeException
x - First data set.y - Second data set.length - Length of the transformation.modulus - Which modulus to use.cached - If the result data should be kept cached in memory when possible.ApfloatRuntimeExceptionprotected DataStorage autoConvolute(DataStorage x, long resultSize) throws ApfloatRuntimeException
x - The data set.resultSize - Number of elements needed in the result data.ApfloatRuntimeExceptionprotected DataStorage autoConvoluteOne(DataStorage x, long length, int modulus, boolean cached) throws ApfloatRuntimeException
x - The data set.length - Length of the transformation.modulus - Which modulus to use.cached - If the result data should be kept cached in memory when possible.ApfloatRuntimeExceptionprotected void lock(long length)
length - The length of the data being processed for determining the type of lock to use.protected void unlock()
protected DataStorage createCachedDataStorage(long size) throws ApfloatRuntimeException
size - The number of elements.ApfloatRuntimeExceptionprotected DataStorage createDataStorage(DataStorage dataStorage) throws ApfloatRuntimeException
dataStorage - The data storage, which may be cached.ApfloatRuntimeExceptionCopyright © 2025. All rights reserved.