# 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
Author:
  Mikko Tommila

- ## Field Summary

  ### Fields inherited from class 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

  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 ThreeNTTConvolutionStrategy

  `autoConvolute, autoConvoluteOne, convolute, convoluteOne, createCachedDataStorage, createDataStorage`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### 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 Details

  - ### lock

    protected void lock(long length)
    Description copied from class: `ThreeNTTConvolutionStrategy`
    Lock the execution against a synchronization lock.
    Overrides:
      `lock` in class `ThreeNTTConvolutionStrategy`
    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 class `ThreeNTTConvolutionStrategy`