public class IntNTTConvolutionStepStrategy extends IntModMath implements NTTConvolutionStepStrategy, Parallelizable
int
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.
All access to this class must be externally synchronized.
Constructor and Description |
---|
IntNTTConvolutionStepStrategy()
Default constructor.
|
Modifier and Type | Method and 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.
|
createWTable, getForwardNthRoot, getInverseNthRoot, modDivide, modInverse, modPow, negate
getModulus, modAdd, modMultiply, modSubtract, setModulus
public IntNTTConvolutionStepStrategy()
public void multiplyInPlace(DataStorage sourceAndDestination, DataStorage source, int modulus) throws ApfloatRuntimeException
NTTConvolutionStepStrategy
sourceAndDestination[i] *= source[i] (mod m)
.
For maximum performance, sourceAndDestination
should be in memory if possible.
multiplyInPlace
in interface NTTConvolutionStepStrategy
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)ApfloatRuntimeException
public void squareInPlace(DataStorage sourceAndDestination, int modulus) throws ApfloatRuntimeException
NTTConvolutionStepStrategy
sourceAndDestination[i] *= sourceAndDestination[i] (mod m)
.
For maximum performance, sourceAndDestination
should be in memory if possible.
squareInPlace
in interface NTTConvolutionStepStrategy
sourceAndDestination
- The source data storage, which is also the destination.modulus
- Which modulus to use (0, 1, 2)ApfloatRuntimeException
protected ParallelRunnable createMultiplyInPlaceParallelRunnable(DataStorage sourceAndDestination, DataStorage source, int modulus)
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)protected ParallelRunnable createSquareInPlaceParallelRunnable(DataStorage sourceAndDestination, int modulus)
sourceAndDestination
- The source data storage, which is also the destination.modulus
- Which modulus to use (0, 1, 2)Copyright © 2018. All rights reserved.