source: git/ntl/src/cfile @ 26e030

spielwiese
Last change on this file since 26e030 was 26e030, checked in by Hans Schönemann <hannes@…>, 14 years ago
*hannes: update to 5.5.1 git-svn-id: file:///usr/local/Singular/svn/trunk@11949 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 16.3 KB
Line 
1
2#ifndef NTL_config__H
3#define NTL_config__H
4
5/*************************************************************************
6
7                          NTL Configuration File
8                          ----------------------
9
10This file may be modified prior to building NTL so as to specify
11some basic configuration options, and to customize
12how code is generated so as to improve performance.
13
14The Basic Configuration Options must be set by hand.  If you use the
15configuration wizard, then these flags should be set before
16the installation process begins;  there values will be retained
17by the wizard.
18
19The Performance Options can be set either by hand, by editing this
20file, or (on most Unix platforms) can be set automatically using
21the configuration wizard which runs when NTL is installed.
22
23All NTL header files include this file.
24By setting these flags here, instead of on the compiler command line,
25it is easier to guarantee that NTL library and client code use
26consistent settings. 
27
28
29                                How to do it
30                                ------------
31
32To set a flag, just replace the pre-processor directive
33'if 0' by 'if 1' for that flag, which causes the appropriate macro
34to be defined.  Of course,  to unset a flag, just replace the
35'if 1' by an 'if 0'.
36
37You can also do this more conveniently via the command line
38using the configure script.
39
40
41 *************************************************************************/
42
43
44
45/*************************************************************************
46 *
47 * Basic Configuration Options
48 *
49 *************************************************************************/
50
51
52 /* None of these flags are set by the configuration wizard;
53  * they must be set by hand, before installation begins.
54  */
55
56
57#if @{NTL_STD_CXX}
58#define NTL_STD_CXX
59
60/*
61 * Use this flag if you want to use the "Standard C++" version of NTL.
62 * In this version, all of NTL is "wrapped" inside the namespace NTL,
63 * and are no longer directly accessible---you must either use
64 * explicit qualification, or using directives, or using declarations.
65 * However, note that all names that begin with "NTL_" are macros,
66 * and as such do not belong to any namespace.
67 * Additionally, instead of including the standard headers
68 * <stdlib.h>, <math.h>, and <iostream.h>, the standard headers
69 * <cstdlib>, <cmath>, and <iostream> are included.
70 * These "wrap" some (but not all) names in namespace std.
71 * Also, the 'nothrow' version on the 'new' operator is used.
72 *
73 * To re-build after changing this flag: rm *.o; make ntl.a
74 */
75
76#endif
77
78/* The following three flags may be used if you want to use some
79 * of the features of Standard C++, but your compiler is deficient.
80 * Instead of setting the NTL_STD_CXX, you can set any subset
81 * of the these three.  Setting all three of these flags is equivalent
82 * to setting NTL_STD_CXX.  No harm is done if NTL_STD_CXX is set
83 * and some of the following three flags are set.
84 *
85 * To re-build after changing any of these flags: rm *.o; make ntl.a
86 */
87
88#if @{NTL_PSTD_NNS}
89#define NTL_PSTD_NNS
90
91/* Set if NTL library components are to be wrapped in namespace 'NTL'. */
92
93#endif
94
95#if @{NTL_PSTD_NHF}
96#define NTL_PSTD_NHF
97
98/* Set if you want to use the new header files <cstdlib>, <cmath>, and
99 * <iostream>, instead of the traditional header files <stdlib.h>,
100 * <math.h>, and <iostream.h>.
101 * If new header files are used, then it is assumed that all standard
102 * library components are wrapped in namespace std; otherwise,
103 * it is assumed that all standard library components are in the
104 * global namespace.
105 *
106 * Also, when set, some internal NTL files use the header <fstream>
107 * in place of <fstream.h>.                                                     
108 */
109
110#endif
111
112#if @{NTL_PSTD_NTN}
113#define NTL_PSTD_NTN
114
115/* Set if you want to use the 'nothrow' version of new. */
116
117#endif
118
119
120#if @{NTL_GMP_LIP}
121#define NTL_GMP_LIP
122
123/*
124 * Use this flag if you want to use GMP as the long integer package.
125 * This can result in significantly faster code on some platforms.
126 * It requires that the GMP package (version >= 3.1) has already been
127 * installed.  You will also have to set the variables GMP_OPT_INCDIR,
128 * GMP_OPT_LIBDIR, GMP_OPT_LIB in the makefile (these are set automatically
129 * by the confiuration script when you pass the flag NTL_GMP_LIP=on
130 * to that script.
131 *
132 * Beware that setting this flag can break some older NTL codes.
133 * If you want complete backward compatability, but not quite
134 * the full performance of GMP, use the flag NTL_GMP_HACK below.
135 * See the full NTL documentation for more details.
136 *
137 * To re-build after changing this flag:
138 *   rm *.o; make setup3; make ntl.a
139 * You may also have to edit the makefile to modify the variables
140 * GMP_OPT_INCDIR, GMP_OPT_LIBDIR, and GMP_OPT_LIB.
141 */
142
143#elif @{NTL_GMP_HACK}
144#define NTL_GMP_HACK
145
146/*
147 * Use this flag if you want to use GMP as the long integer package.
148 * This can result in significantly faster code on some platforms.
149 * It requires that the GMP package (version >= 2.0.2) has already been
150 * installed.  You will also have to set the variables GMP_OPT_INCDIR,
151 * GMP_OPT_LIBDIR, GMP_OPT_LIB in the makefile (these are set automatically
152 * by the confiuration script when you pass the flag NTL_GMP_HACK=on
153 * to that script.
154 *
155 * Unlike the NTL_GMP_LIP flag above, setting this flag maintains
156 * complete backward compatability with older NTL codes, but
157 * you do not get the full performance of GMP.
158 *
159 * To re-build after changing this flag:
160 *   rm lip.o; make setup3; make ntl.a
161 * You may also have to edit the makefile to modify the variables
162 * GMP_OPT_INCDIR, GMP_OPT_LIBDIR, and GMP_OPT_LIB.
163 *
164 */
165
166#endif
167
168#if @{NTL_GF2X_LIB}
169#define NTL_GF2X_LIB
170
171/*
172 * Use this flag if you want to use the gf2x library for
173 * faster GF2X arithmetic.
174 * This can result in significantly faster code, especially
175 * when working with polynomials of huge degree.
176 * You will also have to set the variables GF2X_OPT_INCDIR,
177 * GF2X_OPT_LIBDIR, GF2X_OPT_LIB in the makefile (these are set automatically
178 * by the confiuration script when you pass the flag NTL_GF2X_LIB=on
179 * to that script.
180 *
181 * To re-build after changing this flag:
182 *   rm GF2X.o; GF2X1.o; make ntl.a
183 * You may also have to edit the makefile to modify the variables
184 * GF2X_OPT_INCDIR, GF2X_OPT_LIBDIR, and GF2X_OPT_LIB.
185 */
186
187#endif
188
189#if @{FLAG_LONG_LONG_TYPE}
190#define NTL_LONG_LONG_TYPE @{NTL_LONG_LONG_TYPE}
191
192/*
193 *   If you set the flag NTL_LONG_LONG, then the value of
194 *   NTL_LONG_LONG_TYPE will be used
195 *   to declare 'double word' signed integer types.
196 *   Irrelevant when NTL_GMP_LIP is set.
197 *   If left undefined, some "ifdef magic" will attempt
198 *   to find the best choice for your platform, depending
199 *   on the compiler and wordsize.  On 32-bit machines,
200 *   this is usually 'long long'.
201 *
202 *   To re-build after changing this flag: rm lip.o; make ntl.a
203 */
204
205#endif
206
207
208#if @{FLAG_UNSIGNED_LONG_LONG_TYPE}
209#define NTL_UNSIGNED_LONG_LONG_TYPE @{NTL_UNSIGNED_LONG_LONG_TYPE}
210
211/*
212 *   If you set the flag NTL_SPMM_ULL, then the value of
213 *   NTL_UNSIGNED_LONG_LONG_TYPE will be used
214 *   to declare 'double word' unsigned integer types.
215 *   If left undefined, some "ifdef magic" will attempt
216 *   to find the best choice for your platform, depending
217 *   on the compiler and wordsize.  On 32-bit machines,
218 *   this is usually 'unsigned long long'.
219 *
220 *   To re-build after changing this flag: rm *.o; make ntl.a
221 */
222
223#endif
224
225
226#if @{NTL_CXX_ONLY}
227#define NTL_CXX_ONLY
228
229/*
230 *   It is possible to compile everything using C++ only.
231 *   If you want to do this, make CC and CXX in the makefile the same.
232 *   You may also want to set this flag, which eliminates some
233 *   "C" linkage that is no longer necessary.
234 *   However, it should still work without it.
235 *   
236 *   This flag can be set independently of NTL_STD_CXX.
237 *   All functions that may have "C" linkage are never wrapped in
238 *   namespace NTL;  instead, their names always start with "_ntl_",
239 *   and as such, they should not conflict with other global names.
240 *   All such names are undocumented, and should never be used
241 *   by NTL clients under normal circumstances.
242 *
243 *   To re-build after changing this flag: rm *.o; make ntl.a
244 */
245
246#endif
247
248#if @{NTL_CLEAN_INT}
249#define NTL_CLEAN_INT
250
251/*
252 *   This will disallow the use of some non-standard integer arithmetic
253 *   that may improve performance somewhat.
254 *
255 *   To re-build after changing this flag: rm *.o; make ntl.a
256 */
257
258#endif
259
260#if @{NTL_CLEAN_PTR}
261#define NTL_CLEAN_PTR
262
263/*
264 *   This will disallow the use of some non-standard pointer arithmetic
265 *   that may improve performance somewhat.
266 *
267 *   To re-build after changing this flag: rm *.o; make ntl.a
268 */
269
270#endif
271
272 
273#if @{NTL_RANGE_CHECK}
274#define NTL_RANGE_CHECK
275
276/*
277 *   This will generate vector subscript range-check code.
278 *   Useful for debugging, but it slows things down of course.
279 *
280 *   To re-build after changing this flag: rm *.o; make ntl.a
281 */
282
283#endif
284
285
286
287
288
289#if @{NTL_NO_INIT_TRANS}
290#define NTL_NO_INIT_TRANS
291
292/*
293 *   Without this flag, NTL uses a special code sequence to avoid
294 *   copying large objects in return statements.  However, if your
295 *   compiler optimizes away the return of a *named* local object,
296 *   this is not necessary, and setting this flag will result
297 *   in *slightly* more compact and efficient code.  Although
298 *   the emeriging C++ standard allows compilers to perform
299 *   this optimization, I know of none that currently do.
300 *   Most will avoid copying *temporary* objects in return statements,
301 *   and NTL's default code sequence exploits this fact.
302 *
303 *   To re-build after changing this flag: rm *.o; make ntl.a
304 */
305
306#endif
307
308
309#if @{NTL_X86_FIX}
310#define NTL_X86_FIX
311
312/*
313 *  Forces the "x86 floating point fix", overriding the default behavior.
314 *  By default, NTL will apply the "fix" if it looks like it is
315 *  necessary, and if knows how to fix it.
316 *  The problem addressed here is that x86 processors sometimes
317 *  run in a mode where FP registers have more precision than doubles.
318 *  This will cause code in quad_float.c some trouble.
319 *  NTL can normally correctly detect the problem, and fix it,
320 *  so you shouldn't need to worry about this or the next flag.
321
322 *  To re-build after changing this flag: rm quad_float.o; make ntl.a
323 * 
324 */
325
326#elif @{NTL_NO_X86_FIX}
327#define NTL_NO_X86_FIX
328/*
329 *  Forces no "x86 floating point fix", overriding the default behavior.
330
331 *  To re-build after changing this flag: rm quad_float.o; make ntl.a
332 */
333
334#endif
335
336
337
338
339/*************************************************************************
340 *
341 *  Performance Options
342 *
343 *************************************************************************/
344
345
346/* One can choose one of four different stragtegies for long integer
347 * arithmetic: the default, NTL_LONG_LONG, NTL_AVOID_FLOAT, or NTL_SINGLE_MUL.
348 * The configuration wizard will choose among the first three; the use of
349 * NTL_SINGLE_MUL is only allowed if NTL_CLEAN_INT is not set, and its
350 * use is not recommended.
351 *
352 * These flags are irrelevant when NTL_GMP_LIP is set, and are simply ignored,
353 * except for NTL_SINGLE_MUL -- setting that causes a complie-time error.
354 *
355 */
356
357#if @{NTL_LONG_LONG}
358#define NTL_LONG_LONG
359
360/*
361 *
362 *   For platforms that support it, this flag can be set to cause
363 *   the low-level multiplication code to use the type "long long",
364 *   which may yield a significant performance gain,
365 *   but on others, it can yield no improvement and can even
366 *   slow things down.
367 *
368 *
369 *   See below (NTL_LONG_LONG_TYPE) for how to use a type name
370 *   other than "long long".
371 *
372 *   If you set NTL_LONG_LONG, you might also want to set
373 *   the flag NTL_TBL_REM (see below).
374 *
375 *   To re-build after changing this flag:  rm lip.o; make ntl.a
376 */
377
378#elif @{NTL_AVOID_FLOAT}
379#define NTL_AVOID_FLOAT
380
381/*
382 *
383 *   On machines with slow floating point or---more comminly---slow int/float
384 *   conversions, this flag can lead to faster code.
385 *
386 *   If you set NTL_AVOID_FLOAT, you should probably also
387 *   set NTL_TBL_REM (see below).
388 *
389 *   To re-build after changing this flag:  rm lip.o; make ntl.a
390 */
391
392#elif 0
393#define NTL_SINGLE_MUL
394
395/*   This was developed originally to improve performance on
396 *   ancient Sparc stations that did not have built-in integer mul
397 *   instructions.  Unless you have such an old-timer, I would not
398 *   recommend using this option.  This option only works on
399 *   32-bit machines with IEEE floating point, and is not truly
400 *   portable.  If you use this option, you get a 26-bit radix.
401 *
402 *   To re-build after changing this flag: rm *.o; make ntl.a
403 */
404
405#endif
406
407
408/* There are four strategies to implmement single-precision
409 * modular multiplication with precondinition (see the MulModPrecon
410 * function in the ZZ module): the default, NTL_SPMM_UL, and NTL_SPMM_ULL,
411 * and NTL_SPMM_ASM.
412 * This plays a crucial role in the  "small prime FFT" used to
413 * implement polynomial arithmetic, and in other CRT-based methods
414 * (such as linear  algebra over ZZ), as well as polynomial andd matrix
415 * arithmetic over zz_p. 
416 */
417
418
419#if @{NTL_SPMM_UL}
420#define NTL_SPMM_UL
421
422/*    The default MulModPrecon implementation uses a mix of
423 *    int and float arithmetic, which may be slow on certain machines.
424 *    This flag causes an "all integer" implementation to be used.
425 *    It is entirely portable.
426 *    To re-build after changing this flag: rm *.o; make ntl.a
427 */
428
429
430
431#elif @{NTL_SPMM_ULL}
432#define NTL_SPMM_ULL
433
434/*    Like this previous flag, this also causes an "all integer"
435 *    implementation of MulModPrecon to be used.
436 *    It us usually a faster implementation,
437 *    but it is not enturely portable.
438 *    It relies on double-word unsigned multiplication
439 *    (see NTL_UNSIGNED_LONG_LONG_TYPE above).
440 *
441 *    To re-build after changing this flag: rm *.o; make ntl.a
442 */
443
444#elif @{NTL_SPMM_ASM}
445#define NTL_SPMM_ASM
446
447/*    Like this previous two flag, this also causes an "all integer"
448 *    implementation of MulModPrecon to be used.
449 *    It relies assembler code to do double-word unsigned multiplication.
450 *    This is only supported on a select mechines under GCC.
451 *
452 *    To re-build after changing this flag: rm *.o; make ntl.a
453 */
454
455
456#endif
457
458
459
460
461
462/* The next five flags NTL_AVOID_BRANCHING, NTL_TBL_REM,
463 * NTL_GF2X_ALTCODE, NTL_GF2X_ALTCODE1, and NTL_GF2X_NOINLINE
464 * are also set by the configuration wizard. 
465 */
466
467
468
469#if @{NTL_AVOID_BRANCHING}
470#define NTL_AVOID_BRANCHING
471
472/*
473 *   With this option, branches are replaced at several
474 *   key points with equivalent code using shifts and masks.
475 *   It may speed things up on machines with
476 *   deep pipelines and high branch penalities.
477 *   This flag mainly affects the implementation of the
478 *   single-precision modular arithmetic routines.
479 *
480 *   To re-build after changing this flag: rm *.o; make ntl.a
481 */
482
483#endif
484
485
486
487#if @{NTL_TBL_REM}
488#define NTL_TBL_REM
489
490/*
491 *
492 *   With this flag, some divisions are avoided in the
493 *   ZZ_pX multiplication routines.  If you use the NTL_AVOID_FLOAT
494 *   or NTL_LONG_LONG flags, then you should probably use this one too.
495 *
496 *   Irrelevent when NTL_GMP_LIP is set.
497 *
498 *   To re-build after changing this flag:
499 *      rm lip.o; make ntl.a
500 */
501
502#endif
503
504
505#if @{NTL_GF2X_ALTCODE}
506#define NTL_GF2X_ALTCODE
507
508/*
509 * With this option, the default strategy for implmenting low-level
510 * GF2X multiplication is replaced with an alternative strategy.
511 * This alternative strategy seems to work better on RISC machines
512 * with deep pipelines and high branch penalties (like a powerpc),
513 * but does no better (or even worse) on x86s.
514 *
515 * To re-build after changing this flag: rm GF2X.o; make ntl.a
516 */
517
518#elif @{NTL_GF2X_ALTCODE1}
519#define NTL_GF2X_ALTCODE1
520
521
522/*
523 * Yest another alternative strategy for implementing GF2X
524 * multiplication.
525 *
526 * To re-build after changing this flag: rm GF2X.o; make ntl.a
527 */
528
529
530#endif
531
532#if @{NTL_GF2X_NOINLINE}
533#define NTL_GF2X_NOINLINE
534
535/*
536 * By default, the low-level GF2X multiplication routine in inlined.
537 * This can potentially lead to some trouble on some platforms,
538 * and you can override the default by setting this flag.
539 *
540 * To re-build after changing this flag: rm GF2X.o; make ntl.a
541 */
542
543#endif
544
545
546
547
548/* The following flag is not set by the configuration wizard;  its use
549 * is not generally recommended.
550 */
551
552 
553#if 0
554#define NTL_FAST_INT_MUL
555
556/*
557 *   Really esoteric.
558 *   If using NTL_SINGLE_MUL, and your machine
559 *   has a fast integer multiply instruction, this might yield
560 *   faster code.  Experiment!
561 *
562 *   Irrelevent when NTL_GMP_LIP is set.
563 *
564 *   To re-build after changing this flag: rm *.o; make ntl.a
565 */
566
567#endif
568
569
570@{WIZARD_HACK}
571
572
573
574
575#endif
Note: See TracBrowser for help on using the repository browser.