Template Class NumberTheoreticTransformNat
Defined in File transformnat.h
Page Contents
Template Parameter Order
typename VecType
Class Documentation
-
template<typename VecType>
class intnat::NumberTheoreticTransformNat Number Theoretic Transform implementation.
Public Functions
-
void ForwardTransformIterative(const VecType &element, const VecType &rootOfUnityTable, VecType *result)
Forward transform in the ring Z_q[X]/(X^n-1).
- Parameters
&element – is the input to the transform of type VecType and length n s.t. n|q-1.
&rootOfUnityTable – is the table with the root of unity powers.
- Returns
is the result of the transform, a VecType should be of the same size as input or a throw if an error occurs.
-
void InverseTransformIterative(const VecType &element, const VecType &rootOfUnityInverseTable, VecType *result)
Inverse transform in the ring Z_q[X]/(X^n-1) with prime q and power-of-two n s.t. n|q-1.
- Parameters
&element – [inout] is the input and output to the transform of type VecType and length n.
&rootOfUnityTable – is the table with the inverse n-th root of unity powers.
- Returns
is the result of the transform, a VecType should be of the same size as input or a throw if an error occurs.
-
void ForwardTransformToBitReverse(const VecType &element, const VecType &rootOfUnityTable, VecType *result)
Copies
element
intoresult
and calls ForwardTransformToBitReverseInPlace()Forward transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. [Algorithm 1 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&element – [in] is the input to the transform of type VecType and length n.
&rootOfUnityTable – is the table with the n-th root of unity powers in bit reverse order.
*result – [out] is the result of the transform, a VecType should be of the same size as input or a throw if an error occurs.
-
void ForwardTransformToBitReverseInPlace(const VecType &rootOfUnityTable, VecType *element)
In-place forward transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. [Algorithm 1 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&rootOfUnityTable – is the table with the n-th root of unity powers in bit reverse order.
&element[in, out] – is the input/output of the transform of type VecType and length n.
- Returns
none
-
void ForwardTransformToBitReverse(const VecType &element, const VecType &rootOfUnityTable, const VecType &preconRootOfUnityTable, VecType *result)
Copies
element
intoresult
and calls ForwardTransformToBitReverseInPlace()Forward transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. The method works for the NativeInteger case based on NTL’s modular multiplication. [Algorithm 1 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&element – is the input to the transform of type VecType and length n.
&rootOfUnityTable – is the table with the root of unity powers in bit reverse order.
&preconRootOfUnityTable – is NTL-specific precomputations for optimized NativeInteger modulo multiplications.
*result – [out] is the result of the transform, a VecType should be of the same size as input or a throw if an error occurs.
- Returns
none
-
void ForwardTransformToBitReverseInPlace(const VecType &rootOfUnityTable, const VecType &preconRootOfUnityTable, VecType *element)
In-place forward transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. The method works for the NativeInteger case based on NTL’s modular multiplication. [Algorithm 1 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&rootOfUnityTable – is the table with the root of unity powers in bit reverse order.
&preconRootOfUnityTable – is NTL-specific precomputations for optimized NativeInteger modulo multiplications.
&element – [inout] is the input/output of the transform of type VecType and length n.
- Returns
none
-
void InverseTransformFromBitReverse(const VecType &element, const VecType &rootOfUnityInverseTable, const IntType &cycloOrderInv, VecType *result)
Copies
element
intoresult
and calls InverseTransformFromBitReverseInPlace()Inverse transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. [Algorithm 2 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&element – is the input to the transform of type VecType and length n.
&rootOfUnityInverseTable – is the table with the inverse 2n-th root of unity powers in bit reverse order.
&cycloOrderInv – is inverse of n modulo q
*result – [out] is the result of the transform, a VecType should be of the same size as input or a throw if an error occurs.
- Returns
none
-
void InverseTransformFromBitReverseInPlace(const VecType &rootOfUnityInverseTable, const IntType &cycloOrderInv, VecType *element)
In-place inverse transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. [Algorithm 2 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&rootOfUnityInverseTable – is the table with the inverse 2n-th root of unity powers in bit reverse order.
&cycloOrderInv – is inverse of n modulo q
&element – [inout] is the input/output of the transform of type VecType and length n.
- Returns
none
-
void InverseTransformFromBitReverse(const VecType &element, const VecType &rootOfUnityInverseTable, const VecType &preconRootOfUnityInverseTable, const IntType &cycloOrderInv, const IntType &preconCycloOrderInv, VecType *result)
Copies
element
intoresult
and calls InverseTransformFromBitReverseInPlace()Inverse transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. The method works for the NativeInteger case based on NTL’s modular multiplication. [Algorithm 2 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&element – is the input to the transform of type VecType and length n.
&rootOfUnityInverseTable – is the table with the inverse 2n-th root of unity powers in bit reverse order.
&preconRootOfUnityInverseTable – is NTL-specific precomputations for optimized NativeInteger modulo multiplications.
&cycloOrderInv – is inverse of n modulo q
&preconCycloOrderInv – is NTL-specific precomputations for optimized NativeInteger modulo multiplications.
*result – is the result of the transform, a VecType should be of the same size as input or a throw if an error occurs.
- Returns
none.
-
void InverseTransformFromBitReverseInPlace(const VecType &rootOfUnityInverseTable, const VecType &preconRootOfUnityInverseTable, const IntType &cycloOrderInv, const IntType &preconCycloOrderInv, VecType *element)
In-place Inverse transform in the ring Z_q[X]/(X^n+1) with prime q and power-of-two n s.t. 2n|q-1. Bit reversing indexes. The method works for the NativeInteger case based on NTL’s modular multiplication. [Algorithm 2 in https://eprint.iacr.org/2016/504.pdf]
- Parameters
&rootOfUnityInverseTable – is the table with the inverse 2n-th root of unity powers in bit reverse order.
&preconRootOfUnityInverseTable – is NTL-specific precomputations for optimized NativeInteger modulo multiplications.
&cycloOrderInv – is inverse of n modulo q
&preconCycloOrderInv – is NTL-specific precomputations for optimized NativeInteger modulo multiplications.
&element[in, out] – is the input/output of the transform of type VecType and length n.
- Returns
none
-
void ForwardTransformIterative(const VecType &element, const VecType &rootOfUnityTable, VecType *result)