org.apfloat.internal
Class FloatCarryCRT

java.lang.Object
  extended byorg.apfloat.internal.FloatCRTMath
      extended byorg.apfloat.internal.FloatCarryCRT
All Implemented Interfaces:
FloatModConstants, FloatRadixConstants

public class FloatCarryCRT
extends FloatCRTMath
implements FloatModConstants

Class for performing the final step of a three-modulus Number Theoretic Transform based convolution. Works for the float type.

Version:
1.0
Author:
Mikko Tommila

Field Summary
 
Fields inherited from interface org.apfloat.internal.FloatModConstants
MAX_POWER_OF_TWO_BASE, MAX_POWER_OF_TWO_BITS, MAX_TRANSFORM_LENGTH, MODULUS, PRIMITIVE_ROOT
 
Fields inherited from interface org.apfloat.internal.FloatRadixConstants
BASE, BASE_DIGITS, MAX_EXPONENT, MINIMUM_FOR_DIGITS
 
Constructor Summary
FloatCarryCRT(int radix)
          Creates a carry-CRT object using the specified radix.
 
Method Summary
 DataStorage carryCRT(DataStorage resultMod0, DataStorage resultMod1, DataStorage resultMod2, long resultSize)
          Calculate the final result of a three-NTT convolution.
 
Methods inherited from class org.apfloat.internal.FloatCRTMath
add, compare, divide, multiply, subtract
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloatCarryCRT

public FloatCarryCRT(int radix)
Creates a carry-CRT object using the specified radix.

Parameters:
radix - The radix that will be used.
Method Detail

carryCRT

public DataStorage carryCRT(DataStorage resultMod0,
                            DataStorage resultMod1,
                            DataStorage resultMod2,
                            long resultSize)
                     throws ApfloatRuntimeException
Calculate the final result of a three-NTT convolution.

Performs a Chinese Remainder Theorem (CRT) on each element of the three result data sets to get the result of each element modulo the product of the three moduli. Then it calculates the carries to get the final result.

Note that the return value's initial word may be zero or non-zero, depending on how large the result is.

Assumes that MODULUS[0] > MODULUS[1] > MODULUS[2].

Parameters:
resultMod0 - The result modulo MODULUS[0].
resultMod1 - The result modulo MODULUS[1].
resultMod2 - The result modulo MODULUS[2].
resultSize - The number of elements needed in the final result.
Returns:
The final result with the CRT performed and the carries calculated.
Throws:
ApfloatRuntimeException