1 2 #ifndef NTL_config__H 3 #define NTL_config__H 4 5 /************************************************************************* 6 7 NTL Configuration File 8 ---------------------- 9 10 This file is automatically generated by the configure script. 11 12 You can also edit this file by hand, but that is not generally recommended. 13 14 To set a flag, just replace the pre-processor directive 15 'if 0' by 'if 1' for that flag, which causes the appropriate macro 16 to be defined. Of course, to unset a flag, just replace the 17 'if 1' by an 'if 0'. 18 19 *************************************************************************/ 20 21 22 23 /************************************************************************* 24 * 25 * Basic Configuration Options 26 * 27 *************************************************************************/ 28 29 30 /* None of these flags are set by the configuration wizard; 31 * they must be set by hand, before installation begins. 32 */ 33 34 35 #if 0 36 #define NTL_LEGACY_NO_NAMESPACE 37 38 /* 39 * By default, NTL components are declared inside the namespace NTL. 40 * Set this flag if you want to instead have these components 41 * declared in the global namespace. This is for backward 42 * compatibility only -- not recommended. 43 * 44 */ 45 46 #endif 47 48 49 #if 0 50 #define NTL_LEGACY_INPUT_ERROR 51 52 /* 53 * Also for backward compatibility. Set if you want input 54 * operations to abort on error, instead of just setting the 55 * "fail bit" of the input stream. 56 * 57 */ 58 59 60 #endif 61 62 #if 1 63 #define NTL_TLS_HACK 64 65 /* Set if you want to compile NTL with "TLS hack" 66 * 67 */ 68 69 #endif 70 71 #if 1 72 #define NTL_THREADS 73 74 /* Set if you want to compile NTL as a thread-safe library. 75 * 76 */ 77 78 #endif 79 80 81 #if 0 82 #define NTL_EXCEPTIONS 83 84 /* Set if you want to compile NTL with exceptions enabled 85 * 86 */ 87 88 #endif 89 90 #if 1 91 #define NTL_THREAD_BOOST 92 93 /* Set if you want to compile NTL to exploit threads internally. 94 * 95 */ 96 97 #endif 98 99 100 #if 1 101 #define NTL_GMP_LIP 102 103 /* 104 * Use this flag if you want to use GMP as the long integer package. 105 * This can result in significantly faster code on some platforms. 106 * It requires that the GMP package (version >= 3.1) has already been 107 * installed. You will also have to set the variables GMP_OPT_INCDIR, 108 * GMP_OPT_LIBDIR, GMP_OPT_LIB in the makefile (these are set automatically 109 * by the confiuration script when you pass the flag NTL_GMP_LIP=on 110 * to that script. 111 * 112 * Beware that setting this flag can break some very old NTL codes. 113 * 114 * You may also have to edit the makefile to modify the variables 115 * GMP_OPT_INCDIR, GMP_OPT_LIBDIR, and GMP_OPT_LIB. 116 */ 117 118 #endif 119 120 #if 0 121 #define NTL_GF2X_LIB 122 123 /* 124 * Use this flag if you want to use the gf2x library for 125 * faster GF2X arithmetic. 126 * This can result in significantly faster code, especially 127 * when working with polynomials of huge degree. 128 * You will also have to set the variables GF2X_OPT_INCDIR, 129 * GF2X_OPT_LIBDIR, GF2X_OPT_LIB in the makefile (these are set automatically 130 * by the confiuration script when you pass the flag NTL_GF2X_LIB=on 131 * to that script. 132 * 133 * You may also have to edit the makefile to modify the variables 134 * GF2X_OPT_INCDIR, GF2X_OPT_LIBDIR, and GF2X_OPT_LIB. 135 */ 136 137 #endif 138 139 140 #if 1 141 #define NTL_STD_CXX11 142 143 /* 144 * Set this flag if you want to enable C++11 features within NTL. 145 */ 146 147 #endif 148 149 #if 0 150 #define NTL_STD_CXX14 151 152 /* 153 * Set this flag if you want to enable C++14 features within NTL. 154 */ 155 156 #endif 157 158 #if 1 159 #define NTL_DISABLE_MOVE_ASSIGN 160 161 /* 162 * Set this flag if you want to disable move assignment 163 * operators for vectors (and, by extension, polynomials) 164 * and matrices. 165 */ 166 167 #endif 168 169 #if 0 170 #define NTL_DISABLE_MOVE 171 172 /* 173 * This flag disables all move constructors and assignments. 174 */ 175 176 #endif 177 178 179 #if 0 180 #define NTL_UNSIGNED_LONG_LONG_TYPE unsigned long long 181 182 /* 183 * NTL_UNSIGNED_LONG_LONG_TYPE will be used 184 * to declare 'double word' unsigned integer types. 185 * If left undefined, some "ifdef magic" will attempt 186 * to find the best choice for your platform, depending 187 * on the compiler and wordsize. On 32-bit machines, 188 * this is usually 'unsigned long long'. 189 * 190 */ 191 192 #endif 193 194 195 #if 0 196 #define NTL_CLEAN_INT 197 198 /* 199 * This will disallow the use of some non-standard integer arithmetic 200 * that may improve performance somewhat. 201 * 202 */ 203 204 #endif 205 206 #if 1 207 #define NTL_CLEAN_PTR 208 209 /* 210 * This will disallow the use of some non-standard pointer arithmetic 211 * that may improve performance somewhat. 212 * 213 */ 214 215 #endif 216 217 #if 1 218 #define NTL_SAFE_VECTORS 219 220 /* 221 * This will compile NTL in "safe vector" mode, only assuming 222 * the relocatability property for trivial types and types 223 * explicitly declared relocatable. See vector.txt for more details. 224 */ 225 226 #endif 227 228 #if 0 229 #define NTL_ENABLE_AVX_FFT 230 231 /* 232 * This will compile NTL in a way that enables an AVX implemention 233 * of the small-prime FFT. 234 */ 235 236 #endif 237 238 239 #if 0 240 #define NTL_AVOID_AVX512 241 242 /* 243 * This will compile NTL in a way that avoids 512-bit operations, 244 * even if AVX512 is available. 245 */ 246 247 #endif 248 249 #if 0 250 #define NTL_RANGE_CHECK 251 252 /* 253 * This will generate vector subscript range-check code. 254 * Useful for debugging, but it slows things down of course. 255 * 256 */ 257 258 #endif 259 260 261 262 263 264 #if 1 265 #define NTL_NO_INIT_TRANS 266 267 /* 268 * Without this flag, NTL uses a special code sequence to avoid 269 * copying large objects in return statements. However, if your 270 * compiler optimizes away the return of a *named* local object, 271 * this is not necessary, and setting this flag will result 272 * in *slightly* more compact and efficient code. Although 273 * the emeriging C++ standard allows compilers to perform 274 * this optimization, I know of none that currently do. 275 * Most will avoid copying *temporary* objects in return statements, 276 * and NTL's default code sequence exploits this fact. 277 * 278 */ 279 280 #endif 281 282 283 #if 0 284 #define NTL_X86_FIX 285 286 /* 287 * Forces the "x86 floating point fix", overriding the default behavior. 288 * By default, NTL will apply the "fix" if it looks like it is 289 * necessary, and if knows how to fix it. 290 * The problem addressed here is that x86 processors sometimes 291 * run in a mode where FP registers have more precision than doubles. 292 * This will cause code in quad_float.cpp some trouble. 293 * NTL can normally correctly detect the problem, and fix it, 294 * so you shouldn't need to worry about this or the next flag. 295 * 296 */ 297 298 #elif 0 299 #define NTL_NO_X86_FIX 300 /* 301 * Forces no "x86 floating point fix", overriding the default behavior. 302 */ 303 304 #endif 305 306 307 308 #if 0 309 #define NTL_LEGACY_SP_MULMOD 310 311 /* Forces legacy single-precision MulMod implementation. 312 */ 313 314 #endif 315 316 317 #if 0 318 #define NTL_DISABLE_LONGDOUBLE 319 320 /* Explicitly disables us of long double arithmetic 321 */ 322 323 #endif 324 325 326 #if 0 327 #define NTL_DISABLE_LONGLONG 328 329 /* Explicitly disables us of long long arithmetic 330 */ 331 332 #endif 333 334 #if 0 335 #define NTL_DISABLE_LL_ASM 336 337 /* Explicitly disables us of inline assembly as a replacement 338 * for long lobg arithmetic. 339 */ 340 341 #endif 342 343 344 #if 0 345 #define NTL_MAXIMIZE_SP_NBITS 346 347 /* Allows for 62-bit single-precision moduli on 64-bit platforms. 348 * By default, such moduli are restricted to 60 bits, which 349 * usually gives slightly better performance across a range of 350 * of parameters. 351 */ 352 353 #endif 354 355 /************************************************************************* 356 * 357 * Performance Options 358 * 359 *************************************************************************/ 360 361 362 363 /* There are three strategies to implmement single-precision 364 * modular multiplication with preconditioning (see the MulModPrecon 365 * function in the ZZ module): the default and NTL_SPMM_ULL. 366 * This plays a crucial role in the "small prime FFT" used to 367 * implement polynomial arithmetic, and in other CRT-based methods 368 * (such as linear algebra over ZZ), as well as polynomial and matrix 369 * arithmetic over zz_p. 370 */ 371 372 373 374 #if 1 375 #define NTL_SPMM_ULL 376 377 /* This also causes an "all integer" 378 * implementation of MulModPrecon to be used. 379 * It us usually a faster implementation, 380 * but it is not enturely portable. 381 * It relies on double-word unsigned multiplication 382 * (see NTL_UNSIGNED_LONG_LONG_TYPE above). 383 * 384 */ 385 386 387 #endif 388 389 390 391 /* 392 * The following two flags provide additional control for how the 393 * FFT modulo single-precision primes is implemented. 394 */ 395 396 #if 1 397 #define NTL_FFT_BIGTAB 398 399 /* 400 * Precomputed tables are used to store all the roots of unity 401 * used in FFT computations. 402 * 403 */ 404 405 406 #endif 407 408 409 #if 1 410 #define NTL_FFT_LAZYMUL 411 412 /* 413 * When set, a "lazy multiplication" strategy due to David Harvey: 414 * see his paper "FASTER ARITHMETIC FOR NUMBER-THEORETIC TRANSFORMS". 415 * 416 */ 417 418 419 #endif 420 421 422 423 #if 0 424 #define NTL_AVOID_BRANCHING 425 426 /* 427 * With this option, branches are replaced at several 428 * key points with equivalent code using shifts and masks. 429 * It may speed things up on machines with 430 * deep pipelines and high branch penalities. 431 * This flag mainly affects the implementation of the 432 * single-precision modular arithmetic routines. 433 * 434 */ 435 436 #endif 437 438 439 440 #if 1 441 #define NTL_TBL_REM 442 443 /* 444 * 445 * With this flag, some divisions are avoided in the 446 * ZZ_pX multiplication routines. 447 * 448 */ 449 450 #endif 451 452 453 454 #if 1 455 #define NTL_CRT_ALTCODE 456 457 /* 458 * Employs an alternative CRT strategy. 459 * Only relevant with GMP. 460 * Seems to be marginally faster on some x86_64 platforms. 461 * 462 */ 463 464 #endif 465 466 #if 0 467 #define NTL_CRT_ALTCODE_SMALL 468 469 /* 470 * Employs an alternative CRT strategy for small moduli. 471 * Only relevant with GMP. 472 * Seems to be marginally faster on some x86_64 platforms. 473 * 474 */ 475 476 #endif 477 478 479 #if 0 480 #define NTL_GF2X_ALTCODE 481 482 /* 483 * With this option, the default strategy for implmenting low-level 484 * GF2X multiplication is replaced with an alternative strategy. 485 * This alternative strategy seems to work better on RISC machines 486 * with deep pipelines and high branch penalties (like a powerpc), 487 * but does no better (or even worse) on x86s. 488 * 489 */ 490 491 #elif 1 492 #define NTL_GF2X_ALTCODE1 493 494 495 /* 496 * Yest another alternative strategy for implementing GF2X 497 * multiplication. 498 * 499 */ 500 501 502 #endif 503 504 #if 0 505 #define NTL_GF2X_NOINLINE 506 507 /* 508 * By default, the low-level GF2X multiplication routine in inlined. 509 * This can potentially lead to some trouble on some platforms, 510 * and you can override the default by setting this flag. 511 * 512 */ 513 514 #endif 515 516 #if 0 517 #define NTL_RANDOM_AES256CTR 518 519 /* 520 * By default, the random-number generator is based on ChaCha20. 521 * From a performance perspective, this choice may not be optimal 522 * for platforms featuring AES hardware support. 523 * By setting this flag you can override the default and use an 524 * AES-256-CTR based random-number generator. 525 * 526 */ 527 528 #endif 529 530 531 /* sanity checks */ 532 533 #if (defined(NTL_THREAD_BOOST) && !defined(NTL_THREADS)) 534 #error "NTL_THREAD_BOOST defined but not NTL_THREADS" 535 #endif 536 537 538 #if (defined(NTL_THREADS) && !(defined(NTL_STD_CXX11) || defined(NTL_STD_CXX14))) 539 #error "NTL_THREADS defined but not NTL_STD_CXX11 or NTL_STD_CXX14" 540 #endif 541 542 543 #if (defined(NTL_EXCEPTIONS) && !(defined(NTL_STD_CXX11) || defined(NTL_STD_CXX14))) 544 #error "NTL_EXCEPTIONS defined but not NTL_STD_CXX11 or NTL_STD_CXX14" 545 #endif 546 547 548 #if (defined(NTL_SAFE_VECTORS) && !(defined(NTL_STD_CXX11) || defined(NTL_STD_CXX14))) 549 #error "NTL_SAFE_VECTORS defined but not NTL_STD_CXX11 or NTL_STD_CXX14" 550 #endif 551 552 553 554 555 556 #endif 557