Using the NAG C library

We currently use the Mark 5 version of the NAG C library. The library documentation is available on WWW at: http://wwwinfo.cern.ch/asd/lhc++/Nag_C/Cl05_main.html. It is highly recommended that you read the essential introduction.

Using the library within the LHCb CMT environment

The NAG C must be available in your local installation (for distribution outside CERN, please refer to the Anaphe registration page).

If you are using the standard LHCb CMT settings, just add the line
         use NAGC v5r*
to your CMT requirements file.

Using the library within the GAUDI framework

In theory you can call any NAG C function directly from an algorithm within the Gaudi framework, just following the instructions in the NAG C library manual. There are, however, a number of points that you should be aware of:

Certain common types (such as Boolean, Integer, Complex) are defined in <nag_types.h>, which is included in <nag.h>, and then used in many function prototypes. You have to use these definitions to declare your arguments to the NAG C functions.
 

Certain common names are used for macros defined in <nag.h>. For example:
#define TRUE 1
#define FALSE 0
#define ABS(x) (x>=0 ? x : -(x)) /* Absolute value */
#define SIGN(x,y) (y>0 ? ABS(x) : -ABS(x)) /* Sign transfer */
#define MAX(x,y) (x>=y ? x : y) /* Maximum of two arguments */
#define MIN(x,y) (x<y ? x : y) /* Minimum of two arguments */
 

Certain NAG C library functions will output error messages to the standard error output stream in case of failure. The library provides a facility to declare an external error handling function to trap these error messages. Classes are provided in Gaudi to redirect these messages to the Gaudi Message Service. See here for details.


Marco Cattaneo 21 May, 2002