NAG - Numerical Algorithms Group library


The NAG Fortran library is an extensive and robust library of numerical algorithms that has been tested over many years. It is reliable and comprehensive.

NAG's own on-line documentation :

  • NAG Ltd. home page
  • Fortran numerical library
  • index to library
  • There are also 8 volumes of manuals in book form (for Version 14) (somewhere). We seem to have Version 17 at the time of writing, but do ls -l /opt/lib/libnag.a to get an up-to-date view. Source code not available. Not currently on Linux.

    Examples (in Fortran) of how to use each routine can also be found in somewhere like here.

    Calling NAG Fortran routines from C/C++:

    Here is a simple example in C++ for the NAG complex division function A02ACF. The source code is:
    #include 
    
    extern "C" {
      void a02acf_(double &XR, double &XI, double &YR, double &YI, double &ZR, double &ZI);
    }
    
    int main() {
      double XR=1.0, XI=1.0, YR=0.0, YI=1.0, ZR, ZI;
      a02acf_(XR,XI,YR,YI,ZR,ZI);
      cout << "z = (" << ZR << "," << ZI << ")\n";
    }
    
    Notes:

    Linking under Solaris:

    NAG with SGI:

    On SGI there are 2 libraries: nag3000 and nag4000, corresponding to two different cpu models (neither compatible with AMMA). I'm not sure we have it installed correctly.

    Acknowledgements:

    Thanks to Jonathan Deane, who supplied most of the information on this page.

    Bill Christmas
    Last modified: Mon Oct 27 14:27:25 GMT 2003