Package org.apfloat.internal
Class ParallelThreeNTTConvolutionStrategy
- java.lang.Object
-
- org.apfloat.internal.ThreeNTTConvolutionStrategy
-
- org.apfloat.internal.ParallelThreeNTTConvolutionStrategy
-
- All Implemented Interfaces:
ConvolutionStrategy
public class ParallelThreeNTTConvolutionStrategy extends ThreeNTTConvolutionStrategy
Convolution using three Number Theoretic Transforms and the CRT to get the final result, using multiple threads in parallel.This algorithm is parallelized so that all operations are done in parallel using multiple threads, if the number of processors is greater than one in
ApfloatContext.getNumberOfProcessors()
.If the data block to be transformed is larger than the shared memory threshold setting in the current ApfloatContext, this class will synchronize all data access on the shared memory lock retrieved from
ApfloatContext.getSharedMemoryLock()
.All access to this class must be externally synchronized.
- Since:
- 1.7.0
- Version:
- 1.9.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ParallelThreeNTTConvolutionStrategy.LockFuture
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
key
private static java.util.Map<java.lang.Object,java.util.concurrent.locks.Lock>
locks
-
Fields inherited from class org.apfloat.internal.ThreeNTTConvolutionStrategy
carryCRTStrategy, nttStrategy, stepStrategy
-
-
Constructor Summary
Constructors Constructor Description ParallelThreeNTTConvolutionStrategy(int radix, NTTStrategy nttStrategy)
Creates a new convoluter that uses the specified transform for transforming the data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
lock(long length)
Lock the execution against a synchronization lock.protected void
unlock()
Remove the synchronization lock.-
Methods inherited from class org.apfloat.internal.ThreeNTTConvolutionStrategy
autoConvolute, autoConvoluteOne, convolute, convoluteOne, createCachedDataStorage, createDataStorage
-
-
-
-
Constructor Detail
-
ParallelThreeNTTConvolutionStrategy
public ParallelThreeNTTConvolutionStrategy(int radix, NTTStrategy nttStrategy)
Creates a new convoluter that uses the specified transform for transforming the data.- Parameters:
radix
- The radix to be used.nttStrategy
- The transform to be used.
-
-
Method Detail
-
lock
protected void lock(long length)
Description copied from class:ThreeNTTConvolutionStrategy
Lock the execution against a synchronization lock.- Overrides:
lock
in classThreeNTTConvolutionStrategy
- Parameters:
length
- The length of the data being processed for determining the type of lock to use.
-
unlock
protected void unlock()
Description copied from class:ThreeNTTConvolutionStrategy
Remove the synchronization lock.- Overrides:
unlock
in classThreeNTTConvolutionStrategy
-
-