Next: , Previous: Compilation with QDP, Up: Compilation with QDP


2.1 Header and macros

The main header file for QDP is qdp.h and must be included in all QDP programs. This will automatically include any other header files that are necessary for the specified number of colors and will also include the QLA headers. Typically the user will want to select a prevailing color and precision for the entire calculation. This allows one to use generic function names and datatypes, making it possible to change colors and precision with a simple recompilation, if desired. The following macros can be defined by the user prior to including this header file:


Optional Macros Choices Default


QDP_Precision 'F', 1, 'D', 2 'F'
QDP_Nc number of colors 3
QDP_Colors 2, 3, 'N' 3

Single quotes are required around nonnumeric values. The QDP_Precision macro sets the default precision to either single (1 or 'F') or double (2 or 'D'). The QDP_Nc macro sets the default number of colors and can be any positive integer. Note however that QLA may have been compiled with a limit on the maximum allowed value. QDP_Colors determines which QDP and QLA library versions will be used for calculations. It is automatically set to 2 when QDP_Nc is 2, 3 when 3, and N otherwise. If for some reason a users wishes to work with the N namespace for two or three colors, rather than the more efficient 2 or 3 namespace, they may do so by setting this macro to 'N' explicitly.

The number of spins is fixed in QDP to be the same value that the QLA library that QDP was compiled against has which defaults to 4.

A sample preamble for double precision SU(3) reads

     #define QDP_Precision 'D'
     #define QDP_Nc 3
     #include <qdp.h>

with the include search path set to QDP_HOME/include and QDP_HOME set to the home directory for QDP. With such a preamble the generic function names and datatypes are automatically mapped to the appropriate specific types. Of course the precision and color macros can also be defined through a compiler flag, as in

gcc -DQDP_Precision=2 -DQDP_Nc=3 ...

For SU(4) one might do

     #define QDP_Precision 'F'
     #define QDP_Nc 4
     #include <qdp.h>