Tech Tip: Using Example Programs Within the NAG Libraries
Not sure how to get started with a NAG library routine?
We've included some code to speed up the process. With each of our library products NAG provide example programs and, where relevant, data files, exercising every routine in the library. Along with NAG's detailed documentation, the example programs can be useful program templates for you to edit to help you get started.
For example, you want to use NAG's nag_opt_nlp (e04ucc), an optimization routine for a non-linear objective function with linear and non-linear constraints contained in NAG's C Library. To access the source code of the example program relevant for your implementation and any data, simply look for these on the release media. The precise location of the information is given in the Installer's Note.
If you do not have access to the programs, perhaps because whoever installed the product chose not to install them onto your hard disk, then NAG does provide some useful generic programs on its web site athttp://www.nag.co.uk/numeric/fl/manual/html/FLlibrarymanual.asp via the individual chapter and routine routes. These programs are generic DOUBLE PRECISION programs, which is the most widely used version of our libraries; you should check that your library is not single precision.
The user is strongly advised not to type in the example programs from the documentation. Apart from the possible introduction of errors and the waste of effort, the question of precision for the Fortran libraries is a common pitfall. The generic 'real' being type literally as REAL when in all probability it should be DOUBLE PRECISION. Also included is a script file (Nagex.bat for Windows versions) that will compile and run any of the example programs to allow you to verify them on your system. Similar instructions apply to the NAG Fortran Library and the NAG Fortran 90 Library (fl90). Please note that the NAG Fortran Library example programs can be used in conjunction with the NAG SMP Library.
For specific technical advice in using NAG's products, please contact our technical experts.
Return to Technical Tips & Hints index page.