Defines | Functions

K:/Projects/scplusplus/gpl_releases/nttw/include/number32.h File Reference

NTT Header/Object for the NTTW C Library. More...

#include <stdlib.h>
#include "global.h"
Include dependency graph for number32.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MODULUS   40961
#define PROOT   3
#define MODSUB(a, b, m)   ( ((a) < (b)) ? ((a)-(b)) + m : ((a)-(b)) )
#define MODADD(a,b, m)   ( ((a+b) >= m) ? (a+b) - m : (a+b) )
#define MODADD2(a,b, m)   ( ((a+b) < a || (a+b) >= m) ? (a+b) - m : (a+b) )
#define MODMUL(a, b, m)   ( ((a*b) >= (m)) ? (unsigned long long)((a*b) - (m)) : (unsigned long long)(a*b) )

Functions

NTTW_DLL_SYM void rearrange (nttw_integer *data, const size_t n)
 Bit-reversal of Data of size n. n should be dyadic.
NTTW_DLL_SYM int bigshr (nttw_integer *d, nttw_integer *s, const size_t n)
 Shifts s right one bit to d, returns carry bit.
NTTW_DLL_SYM nttw_integer pow_mod (nttw_integer base, nttw_integer exp)
 Computers the power of the base modulo the defined MODULUS.
NTTW_DLL_SYM nttw_integer pow_mod2 (nttw_integer base, nttw_integer exp, nttw_integer modulus)
 Computers the power of the base modulo the given modulus.
NTTW_DLL_SYM nttw_integer pow_mod2_long (nttw_integer base, nttw_integer exp, nttw_integer modulus)
 Computers the power of the base modulo the given modulus. Force unsigned long long's in calculations.
NTTW_DLL_SYM nttw_integer pow_mod_long (nttw_integer base, nttw_integer exp)
 Computers the power of the base modulo the given modulus. Big Integer version.
NTTW_DLL_SYM void fntt (nttw_integer *data, const size_t nn, const nttw_integer pr, const int isign)
 Computes the 1D Fast Number Theoretic Transform (FNTT) using the Cooley-Tukey algorithm.
NTTW_DLL_SYM void fntt_2D (nttw_integer *data, nttw_integer *result, const size_t nn, const int isign)
 Computes the 2D Fast Number Theoretic Transform (FNTT) using the Cooley-Tukey algorithm.
NTTW_DLL_SYM void fntt_prime (const nttw_integer *inData, nttw_integer *outData, const size_t p, const nttw_integer root, const nttw_integer primeDash, const nttw_integer proot, int isign, const int norm)
 Computes the Prime Length Fast Number Theoretic Transform (FNTT) using Rader's algorithm.
NTTW_DLL_SYM void fntt_2D_prime (nttw_integer *data, nttw_integer *result, const size_t n, const nttw_integer root, const nttw_integer primeDash, const nttw_integer proot, const int isign, const int norm)
 Computes the 2D Prime Length Fast Number Theoretic Transform (FNTT) using Rader's algorithm.
NTTW_DLL_SYM nttw_integerpadData_Rader (nttw_integer *data, const size_t p, const size_t newSize, const nttw_integer primeDash)
 Pads the data to the nearest highly composite length as needed by Rader's algorithm.
NTTW_DLL_SYM nttw_integerpadTransformMatrix_Rader (nttw_integer *transData, const size_t p, const size_t newSize)
 Pads the transform matrix to the nearest highly composite length as needed by Rader's algorithm.
NTTW_DLL_SYM void extractResult_Rader (nttw_integer *paddedData, nttw_integer *data, const size_t p)
 Extracts the data for the result from the padded result.
NTTW_DLL_SYM void ntt_norm (nttw_integer *data, const size_t n)
 Normalises data of length n in the number field of MODULUS.

Detailed Description

NTT Header/Object for the NTTW C Library.

NTTW NTT 32-bit Module

This file defines the functions for the Generic 32-bit Modulus NTTs.

This file is part of NTTW Library.

NTTW is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

NTTW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with NTTW. If not, see <http://www.gnu.org/licenses/>.

Author:
Shekhar S. Chandra, 2008-9

Definition in file number32.h.


Define Documentation

#define MODADD (   a,
  b,
  m 
)    ( ((a+b) >= m) ? (a+b) - m : (a+b) )

Definition at line 61 of file number32.h.

#define MODADD2 (   a,
  b,
  m 
)    ( ((a+b) < a || (a+b) >= m) ? (a+b) - m : (a+b) )

Definition at line 62 of file number32.h.

#define MODMUL (   a,
  b,
  m 
)    ( ((a*b) >= (m)) ? (unsigned long long)((a*b) - (m)) : (unsigned long long)(a*b) )

Definition at line 63 of file number32.h.

#define MODSUB (   a,
  b,
  m 
)    ( ((a) < (b)) ? ((a)-(b)) + m : ((a)-(b)) )

Definition at line 60 of file number32.h.

#define MODULUS   40961

Modulus (For Reasonable N) define Modulus 2113929217ULL //63*2^25+1 define PrimitiveRoot 5 define Modulus 4293918721ULL //2^32-2^20+1 define PrimitiveRoot 19 Modulus (For Reasonable N) define Modulus 1811939329U // define PrimitiveRoot 13 Modulus (For Reasonable N) define MODULUS 2147473409U // define PROOT 3 define Modulus 18446742974197923841ULL //2^64-2^40+1 define PrimitiveRoot 19 define MODULUS 65537U //upto 2^16 (p=2^16+1) define PROOT 3 define MODULUS 40961 //upto 2^13 (p=5*2^13+1) define PROOT 3

Definition at line 56 of file number32.h.

#define PROOT   3

Definition at line 57 of file number32.h.