## Class DoubleNTTConvolutionStepStrategy

• All Implemented Interfaces:
`Parallelizable`, `NTTConvolutionStepStrategy`

```public class DoubleNTTConvolutionStepStrategy
extends DoubleModMath
implements NTTConvolutionStepStrategy, Parallelizable```
Steps of a three-NTT convolution for the `double` type. This class implements the details of the element-by-element multiplication and element-by-element squaring of the transformed elements.

The in-place multiplication and squaring of the data elements is done using a parallel algorithm, if the data fits in memory.

Since:
1.7.0
Version:
1.9.0
Author:
Mikko Tommila
• ### Constructor Summary

Constructors
Constructor Description
`DoubleNTTConvolutionStepStrategy()`
Default constructor.
• ### Method Summary

Modifier and Type Method Description
`protected ParallelRunnable` ```createMultiplyInPlaceParallelRunnable​(DataStorage sourceAndDestination, DataStorage source, int modulus)```
Create a ParallelRunnable for multiplying the elements in-place.
`protected ParallelRunnable` ```createSquareInPlaceParallelRunnable​(DataStorage sourceAndDestination, int modulus)```
Create a ParallelRunnable for squaring the elements in-place.
`void` ```multiplyInPlace​(DataStorage sourceAndDestination, DataStorage source, int modulus)```
Linear multiplication in the number theoretic domain.
`void` ```squareInPlace​(DataStorage sourceAndDestination, int modulus)```
Linear squaring in the number theoretic domain.
• ### Methods inherited from class org.apfloat.internal.DoubleModMath

`createWTable, getForwardNthRoot, getInverseNthRoot, modDivide, modInverse, modPow, negate`
• ### Methods inherited from class org.apfloat.internal.DoubleElementaryModMath

`getModulus, modAdd, modMultiply, modSubtract, setModulus`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### DoubleNTTConvolutionStepStrategy

`public DoubleNTTConvolutionStepStrategy()`
Default constructor.
• ### Method Detail

• #### multiplyInPlace

```public void multiplyInPlace​(DataStorage sourceAndDestination,
DataStorage source,
int modulus)
throws ApfloatRuntimeException```
Description copied from interface: `NTTConvolutionStepStrategy`
Linear multiplication in the number theoretic domain. The operation is `sourceAndDestination[i] *= source[i] (mod m)`.

For maximum performance, `sourceAndDestination` should be in memory if possible.

Specified by:
`multiplyInPlace` in interface `NTTConvolutionStepStrategy`
Parameters:
`sourceAndDestination` - The first source data storage, which is also the destination.
`source` - The second source data storage.
`modulus` - Which modulus to use (0, 1, 2)
Throws:
`ApfloatRuntimeException`
• #### squareInPlace

```public void squareInPlace​(DataStorage sourceAndDestination,
int modulus)
throws ApfloatRuntimeException```
Description copied from interface: `NTTConvolutionStepStrategy`
Linear squaring in the number theoretic domain. The operation is `sourceAndDestination[i] *= sourceAndDestination[i] (mod m)`.

For maximum performance, `sourceAndDestination` should be in memory if possible.

Specified by:
`squareInPlace` in interface `NTTConvolutionStepStrategy`
Parameters:
`sourceAndDestination` - The source data storage, which is also the destination.
`modulus` - Which modulus to use (0, 1, 2)
Throws:
`ApfloatRuntimeException`
• #### createMultiplyInPlaceParallelRunnable

```protected ParallelRunnable createMultiplyInPlaceParallelRunnable​(DataStorage sourceAndDestination,
DataStorage source,
int modulus)```
Create a ParallelRunnable for multiplying the elements in-place.
Parameters:
`sourceAndDestination` - The first source data storage, which is also the destination.
`source` - The second source data storage.
`modulus` - Which modulus to use (0, 1, 2)
Returns:
An object suitable for multiplying the elements in parallel.
• #### createSquareInPlaceParallelRunnable

```protected ParallelRunnable createSquareInPlaceParallelRunnable​(DataStorage sourceAndDestination,
int modulus)```
Create a ParallelRunnable for squaring the elements in-place.
Parameters:
`sourceAndDestination` - The source data storage, which is also the destination.
`modulus` - Which modulus to use (0, 1, 2)
Returns:
An object suitable for squaring the elements in parallel.