<!----><?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><title>Essential Introduction : NAG Library, Mark 23</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a class="genint" href="../../pdf/GENINT/essint.pdf">Essential Introduction (PDF version)</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library<br/><br/>Essential Introduction</h1><div class="paramtext"><b>Note:</b> <span class="italic">this document is essential reading for any prospective user of the Library.</span></div><div class="htmltoc">
<h2 class="htmltoc"><span class="htmltochead" onclick="showLevel('htmltoc');"><span class="htmltocplus" id="htmltocplus">+</span><span class="htmltocminus" id="htmltocminus">&#8722;</span></span>&#160;Contents</h2>
<div class="htmltocitem" id="htmltoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#summary">1&#160;&#160;<b>Summary for All Users</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('toclibanddoc');"><span class="htmltocplus" id="toclibanddocplus">+</span><span class="htmltocminus" id="toclibanddocminus">&#8722;</span></span>
<a class="htmltoc" href="#libanddoc">2&#160;&#160;<b>The Library and its Documentation</b></a>
<div class="htmltocitem" id="toclibanddoc">
<div class="htmltoc">
<span class="htmltoc" onclick="showLevel('toclibanddoc1');"><span class="htmltocplus" id="toclibanddoc1plus">+</span><span class="htmltocminus" id="toclibanddoc1minus">&#8722;</span></span>
<a class="htmltoc" href="#libanddoc1">2.1&#160;&#160;<b>Structure of the Library</b></a>
<div class="htmltocitem" id="toclibanddoc1">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#longnames">2.1.1&#160;&#160;<b>Long Names for Library Routines</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#libanddoc2">2.2&#160;&#160;<b>Structure of the Documentation</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#libanddoc5">2.3&#160;&#160;<b>Implementations of the Library</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#libanddoc7">2.4&#160;&#160;<b>Library Identification</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#libanddoc8">2.5&#160;&#160;<b>Fortran Language Standards</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('toclibrary');"><span class="htmltocplus" id="toclibraryplus">+</span><span class="htmltocminus" id="toclibraryminus">&#8722;</span></span>
<a class="htmltoc" href="#library">3&#160;&#160;<b>Using the Library</b></a>
<div class="htmltocitem" id="toclibrary">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#library1">3.1&#160;&#160;<b>General Advice</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('toclibrary2');"><span class="htmltocplus" id="toclibrary2plus">+</span><span class="htmltocminus" id="toclibrary2minus">&#8722;</span></span>
<a class="htmltoc" href="#library2">3.2&#160;&#160;<b>Programming Advice</b></a>
<div class="htmltocitem" id="toclibrary2">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#alternativenames">3.2.1&#160;&#160;<b>Alternative Routine Names</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fortranenv">3.2.2&#160;&#160;<b>The NAG Fortran Environment</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocerrorhandling');"><span class="htmltocplus" id="tocerrorhandlingplus">+</span><span class="htmltocminus" id="tocerrorhandlingminus">&#8722;</span></span>
<a class="htmltoc" href="#errorhandling">3.3&#160;&#160;<b>Error Handling and the Parameter IFAIL</b></a>
<div class="htmltocitem" id="tocerrorhandling">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#background1">3.3.1&#160;&#160;<b>Errors, Failure and Warning Conditions</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#background2">3.3.2&#160;&#160;<b>The IFAIL Parameter</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#background3">3.3.3&#160;&#160;<b>Hard Fail Option</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#background4">3.3.4&#160;&#160;<b>Soft Fail Option</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#background5">3.3.5&#160;&#160;<b>Historical Note</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#inputoutput">3.4&#160;&#160;<b>Input/output in the Library</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#library5">3.5&#160;&#160;<b>Auxiliary Routines as External Procedure Parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#dynamicmemory">3.6&#160;&#160;<b>Dynamic Memory Allocation</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#licman">3.7&#160;&#160;<b>License Management</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#threadsafety">3.8&#160;&#160;<b>Thread Safety</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#SMPperformance">3.9&#160;&#160;<b>Performance on SMP systems</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#library7">3.10&#160;&#160;<b>Calling the Library from Other Languages</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#arithmetic">3.11&#160;&#160;<b>Arithmetic Considerations and Reproducibility of Results</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocdoc');"><span class="htmltocplus" id="tocdocplus">+</span><span class="htmltocminus" id="tocdocminus">&#8722;</span></span>
<a class="htmltoc" href="#doc">4&#160;&#160;<b>Using the Documentation</b></a>
<div class="htmltocitem" id="tocdoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc1">4.1&#160;&#160;<b>Using the Manual</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc2">4.2&#160;&#160;<b>Structure of Routine Documents</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocdoc3');"><span class="htmltocplus" id="tocdoc3plus">+</span><span class="htmltocminus" id="tocdoc3minus">&#8722;</span></span>
<a class="htmltoc" href="#doc3">4.3&#160;&#160;<b>Specification of Parameters</b></a>
<div class="htmltocitem" id="tocdoc3">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc31">4.3.1&#160;&#160;<b>Classification of parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc32">4.3.2&#160;&#160;<b>Constraints and suggested values</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc33">4.3.3&#160;&#160;<b>Array parameters</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc4">4.4&#160;&#160;<b>Implementation-dependent Information</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#doc5">4.5&#160;&#160;<b>Example Programs and Results</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#support">5&#160;&#160;<b>Support from NAG</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#further">6&#160;&#160;<b>Background to NAG</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">7&#160;&#160;<b>References</b></a>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="summary" id="summary"/>1&#160;&#160;Summary for All Users</h2>
<div class="paramtext">All users both familiar or unfamiliar with this Library who are thinking of using a routine from it, are asked to please follow these instructions: 
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline"><a name="itema" id="itema"/>(a)</td>
<td valign="top">read the whole of this <b>Essential Introduction</b>;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemb" id="itemb"/>(b)</td>
<td valign="top">select an appropriate chapter or routine by:
  <ul class="listind"><li class="listind">&#8211; searching through the <b><a class="genint" href="../INDEXES/KWIC/kwic.xml#KWIC">Keyword Index</a></b>;</li><li class="listind">&#8211; searching via online search facility; or</li><li class="listind">&#8211; searching through the <b><a class="genint" href="../INDEXES/GAMS/gams.xml#GAMS">GAMS Classification Index</a></b>;</li></ul></td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemc" id="itemc"/>(c)</td>
<td valign="top">read the relevant <b>Chapter Introduction</b>;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemd" id="itemd"/>(d)</td>
<td valign="top">choose a routine, and read the <b>routine document</b>. If the routine does not after all meet your needs, return to step <a class="item" href="#itemb">(b)</a>;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="iteme" id="iteme"/>(e)</td>
<td valign="top">read the <b><a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a></b> for your implementation;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemf" id="itemf"/>(f)</td>
<td valign="top">consult local documentation, which should be provided by your local support staff, about access to the Library on your computing system;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemg" id="itemg"/>(g)</td>
<td valign="top">obtain an online copy of the example program for the particular routine of interest and experiment with it.</td>
</tr></table>
</div><div class="paramtext">You should now be in a position to include a call to the routine in a program, and to attempt to compile and run it. You may of course need to refer back to the relevant documentation in the case of difficulties, for advice on assessment of results, and so on.</div><div class="paramtext">As you become familiar with the Library, some of steps <a class="item" href="#itema">(a)</a> to <a class="item" href="#itemg">(g)</a> can be omitted, but it is always essential to: 
<ul class="listind"><li class="listind">be familiar with this <b>Essential Introduction</b>;</li><li class="listind">be familiar with the <b>Chapter Introduction</b>;</li><li class="listind">read the <b>routine document</b>;</li><li class="listind">be aware of the <b><a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a></b> for your implementation.</li></ul>
</div><h2 class="standard"><a class="sec" name="libanddoc" id="libanddoc"/>2&#160;&#160;The Library and its Documentation</h2><h3 class="standard"><a class="sec" name="libanddoc1" id="libanddoc1"/>2.1&#160;&#160;Structure of the Library</h3>
<div class="paramtext">The NAG Library for SMP &amp; Multicore is the same collection of routines as those available in the NAG Library, many of which have been specially tuned to maximize their performance on Symmetric Multiprocessor (SMP) machines. The document entitled &#8216;<a class="genint" href="../GENINT/smpint.xml#SMPINT">Introduction to the NAG Library for SMP &amp; Multicore</a>&#8217; is <span class="bitalic">essential</span> reading for NAG Library for SMP &amp; Multicore users.</div><div class="paramtext">The Library is divided into <b>chapters</b>, each devoted to a branch of numerical analysis or statistics.  Each chapter has a three-character name and a title, 
e.g.,
<ul class="listind"><li class="listind"><a class="chap" href="../D01/d01conts.xml">Chapter D01 &#8211; Quadrature</a></li></ul>
</div><div class="paramtext">Exceptionally, <a class="chap" href="../H/hconts.xml">Chapters H</a> and <a class="chap" href="../S/sconts.xml">S</a> have one-character names. The chapters and their names are based on the ACM modified SHARE classification index (see <a class="ref" href="#ref226">ACM (1960&#8211;1976)</a>).</div><div class="paramtext">All documented routines in the Library have six-character names, beginning with the characters of the chapter name, 
e.g.,
<ul class="listind"><li class="listind"><a class="rout" href="../D01/d01ajf.xml">D01AJF</a></li></ul>
</div><div class="paramtext">Note that the second and third characters are <b>digits</b>, not letters; e.g., 0 is the digit zero, not the letter O. The last letter of each routine name almost always appears as &#8216;F&#8217; in the documentation. <a class="chap" href="../D03/d03conts.xml">Chapters D03</a> and <a class="chap" href="../E04/e04conts.xml">E04</a> have some routines whose last letter is &#8216;A&#8217; rather than &#8216;F&#8217;.  An &#8216;A&#8217; version is always paired with an &#8216;F&#8217; routine, the &#8216;A&#8217; version being safe to use in a multithreaded environment, but otherwise having identical functionality to the &#8216;F&#8217; version.</div><div class="paramtext"><a class="chap" href="../F06/f06conts.xml">Chapter F06</a> (<a class="chap" href="../F06/f06conts.xml">Linear Algebra Support Routines</a>) contains all the Basic Linear Algebra Subprograms, BLAS (<a class="ref" href="#ref763">Blackford <span class="italic">et al.</span> (2002)</a>), with NAG-style names as well as with the actual BLAS names, e.g., <a class="rout" href="../F06/f06paf.xml">F06PAF (DGEMV)</a>.  The names in brackets are the equivalent double precision BLAS names. <a class="chap" href="../F16/f16conts.xml">Chapter F16</a> contains some of the routines specified in the BLAS Technical Form (<a class="ref" href="#ref720">The BLAS Technical Forum Standard (2001)</a>) and also some additional routines for integer valued vectors that are not in the standard.  Some of the routines in <a class="chap" href="../F16/f16conts.xml">Chapter F16</a> have both NAG style names and BLAS names. <a class="chap" href="../F07/f07conts.xml">Chapter F07</a> (<a class="chap" href="../F07/f07conts.xml">Linear Equations (LAPACK)</a>) and <a class="chap" href="../F08/f08conts.xml">Chapter F08</a> (<a class="chap" href="../F08/f08conts.xml">Least Squares and Eigenvalue Problems (LAPACK)</a>) contain routines derived from the LAPACK project (<a class="ref" href="#ref252">Anderson <span class="italic">et al.</span> (1999)</a>); also, <a class="chap" href="../F01/f01conts.xml">Chapter F01</a> (<a class="chap" href="../F01/f01conts.xml">Matrix Operations, Including Inversion</a>) contains storage conversion routines derived from the LAPACK project.  Like the BLAS, these routines have NAG-style names as well as LAPACK names, e.g., <a class="rout" href="../F07/f07adf.xml">F07ADF (DGETRF)</a>.  Details regarding these alternate names can be found in the relevant Chapter Introductions.</div><div class="paramtext">In order to take full advantage of machine-specific versions of BLAS and LAPACK routines provided by some computer hardware vendors, you are encouraged to use the BLAS and LAPACK names (e.g., <a class="rout" href="../F06/f06paf.xml">DGEMV</a> and <a class="rout" href="../F07/f07adf.xml">DGETRF</a>) rather than the corresponding NAG-style names (e.g., <a class="rout" href="../F06/f06paf.xml">F06PAF</a> and <a class="rout" href="../F07/f07adf.xml">F07ADF</a>) wherever possible in your programs.</div><h4 class="standard"><a class="sec" name="longnames" id="longnames"/>2.1.1&#160;&#160;Long Names for Library Routines</h4>
<div class="paramtext">Each documented routine has, in addition to its short six-character name, a long name beginning with the root <b>nagf_</b> and consisting of an underscore separated list of words. The long-name naming scheme has been chosen so that the long names group like routines together and group routines within a suite together.</div><div class="paramtext">The long name for each routine in a chapter is listed in the respective Chapter Contents page. The second word in the long name is fixed for each chapter, e.g., routines in <a class="chap" href="../D01/d01conts.xml">Chapter D01</a> (<a class="chap" href="../D01/d01conts.xml">Quadrature</a>) all have long names that begin <b>nagf_quad_</b>.</div><div class="paramtext">Each chapter has a unique second word in its set of long names with the exception of <a class="chap" href="../F07/f07conts.xml">Chapters F07</a> and <a class="chap" href="../F08/f08conts.xml">F08</a> which share the same second word (<b>lapack</b>).</div><div class="paramtext">Note that the long names of BLAS and LAPACK routines, such as <a class="rout" href="../F06/f06yaf.xml">nagf_blas_dgemm</a>, will not take advantage of machine-specific versions of BLAS and LAPACK.  As mentioned in <a class="sec" href="#libanddoc1">Section 2.1</a> you are recommended to use the plain BLAS or LAPACK name (in this case <a class="rout" href="../F06/f06yaf.xml">DGEMM</a>) for performance reasons.</div><div class="paramtext">Routines that are marked for withdrawal have long names that have the third word <b>withdraw</b>. At subsequent marks of the library, any routine that becomes marked for withdrawal will have the third word <b>withdraw</b> inserted into its long name; the original long name will no longer be available for the given routine at that stage.</div><div class="paramtext">For those chapters that have both A and F versions of a routine, the long name for the F version is the same as that of the A version, but with an additional last word (<b>old</b> &#8211; signifying that the F version predates the A version).</div><div class="paramtext">It should be noted that the long names are implemented by use of aliasing in the NAG Library interface block modules, and so long names are only accessible when calling the NAG Library from a Fortran program the USEs nag_library.mod.</div><div class="paramtext">Please refer to <a class="sec" href="#alternativenames">Section 3.2.1</a> for advice on supplying alternative routine names and, possibly, simplified routine interfaces.</div><h3 class="standard"><a class="sec" name="libanddoc2" id="libanddoc2"/>2.2&#160;&#160;Structure of the Documentation</h3>
<div class="paramtext">The NAG Library Manual is the principal documentation for both the NAG Library and the NAG Library for SMP &amp; Multicore.


It has the same chapter structure as the Library: each chapter of routines in the Library has a corresponding chapter (of the same name) in the Manual.  The chapters occur in alphanumeric order.  General introductory documents appear at the beginning of the Manual.</div><div class="paramtext">Each chapter consists of the following documents:
<ul class="listind"><li class="listind"><b>Chapter Contents</b>, e.g., <a class="chap" href="../D01/d01conts.xml">Chapter D01</a>;</li><li class="listind"><b>Chapter Introduction</b>, e.g., the <a class="chapint" href="../D01/d01intro.xml">D01 Chapter Introduction</a>;</li><li class="listind"><b>Routine Documents</b>, one for each documented routine in the chapter.</li></ul>
</div><div class="paramtext">A routine document has the same name as the routine which it describes.  Within each chapter, routine documents occur in alphanumeric order. For those chapters that have both &#8216;A&#8217; and &#8216;F&#8217; versions of a routine, the routine descriptions are combined into one routine document.  


</div><div class="paramtext">Documentation is provided in the following formats: 
<ul class="listind"><li class="listind"><b>XHTML+MathML</b>, a fully linked version of the manual using XHTML and MathML (recommended for browsing) and providing links to the PDF version of each document (recommended for printing); and</li><li class="listind"><b>PDF</b>, a full PDF manual browsed using the PDF bookmarks, or via HTML index files.</li><li class="listind"><b>Single file PDF</b>, the manual as a single PDF file.</li><li class="listind"><b>Windows HTML help</b>, Windows HTML help version as a single file.</li></ul>
</div><div class="paramtext">Advice on viewing and navigating the formats available can be found in the document <a class="genint" href="../GENINT/onlinehelp.xml#ONLINEHELP">Online Documentation</a>.</div><div class="paramtext">The most up-to-date version of the documentation is accessible via the NAG <a class="url" href="http://www.nag.com">web site</a> (see <a class="sec" href="#support">Section 5</a>).</div><h3 class="standard"><a class="sec" name="libanddoc5" id="libanddoc5"/>2.3&#160;&#160;Implementations of the Library</h3>
<div class="paramtext">The Library is available on many different computer systems.  For each distinct system, an <b>implementation</b> of the Library is prepared by NAG, e.g., the Sun Solaris 64-bit implementation.  The implementation is distributed to sites as a tested compiled library.</div><div class="paramtext">An implementation is usually specific to a range of machines (e.g., the SPARC systems); it may also be specific to a particular Fortran compiler, or compiler option 
 
(such as scalar or vector mode or thread safe).</div><div class="paramtext">Essentially the same facilities are provided in all implementations of the Library, but, because of differences in arithmetic behaviour and in the compilation system, routines cannot be expected to give identical results on different systems, especially for sensitive numerical problems.</div><div class="paramtext">The documentation supports all implementations of the Library, with the help of a few simple conventions, and a small amount of implementation-dependent information, which is published in a separate <b><a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a></b> for each implementation (see <a class="sec" href="#doc4">Section 4.4</a>).</div><h3 class="standard"><a class="sec" name="libanddoc7" id="libanddoc7"/>2.4&#160;&#160;Library Identification</h3>
<div class="paramtext">Periodically a new <b>Mark</b> of the NAG Library is released: new routines are added, corrections and/or improvements are made to existing routines; and occasionally routines are withdrawn if they have been superseded by improved routines.</div><div class="paramtext">You must know <b>which implementation</b>, <b>which precision</b> and <b>which mark</b> of the Library you are using or intend to use.  To find out which implementation, precision and mark of the Library is available at your site, you can run a program which calls the NAG  Library routine <a class="rout" href="../A00/a00aaf.xml">A00AAF</a>.</div><div class="paramtext">The program could be:
<pre class="verbatim">
USE nag_library, ONLY: a00aaf
CALL a00aaf
END
</pre></div><div class="paramtext">Alternatively, the example program for <a class="rout" href="../A00/a00aaf.xml">A00AAF</a> can be run using the <span class="mono">nagexample</span> scripts supplied with your implementation (see the <a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a> for details).</div><div class="paramtext">An example of the output is:
<pre class="verbatim">
 *** Start of NAG Library implementation details ***

 Implementation title: Linux/NAG nagfor
            Precision: FORTRAN double precision
         Product Code: FLL6A23D9L
                 Mark: 23 (self-contained)
 
 *** End of NAG Library implementation details ***
</pre></div><h3 class="standard"><a class="sec" name="libanddoc8" id="libanddoc8"/>2.5&#160;&#160;Fortran Language Standards</h3>
<div class="paramtext">All routines in the Library conform to the ISO Fortran 95 Standard (<a class="ref" href="#ref643">ISO (1997)</a>). 
</div><h2 class="standard"><a class="sec" name="library" id="library"/>3&#160;&#160;Using the Library</h2><h3 class="standard"><a class="sec" name="library1" id="library1"/>3.1&#160;&#160;General Advice</h3>
<div class="paramtext">A NAG Library routine <b>cannot</b> be guaranteed to return meaningful results irrespective of the data supplied to it.  Care and thought <b>must</b> be exercised in:
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline">(a)</td>
<td valign="top">formulating the problem;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(b)</td>
<td valign="top">programming the use of Library routines;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(c)</td>
<td valign="top">assessing the significance of the results.</td>
</tr></table>
</div><div class="paramtext">The Foreword to the Manual provides some further discussion of points (a) and (c); the remainder of <a class="sec" href="#library">Section 3</a> is concerned with (b).</div><h3 class="standard"><a class="sec" name="library2" id="library2"/>3.2&#160;&#160;Programming Advice</h3>
<div class="paramtext">The Library and its documentation are designed with the assumption that you will write a calling program in Fortran (although it may be called from other languages &#8211; see <a class="sec" href="#library7">Section 3.10</a>).</div><div class="paramtext">When programming a call to a routine, read the routine document carefully, especially the description of the <b>Parameters</b>.  This states clearly which parameters must have values assigned to them on entry to the routine, and which return useful values on exit.  See <a class="sec" href="#doc3">Section 4.3</a> for further guidance.</div><div class="paramtext">The most common types of programming error in using the Library are:
<ul class="listind"><li class="listind">incorrect parameters in a call to a Library routine;</li><li class="listind">calling the Library from a single precision program.</li></ul>
</div><div class="paramtext">The USE of the <span class="mono">nag_library</span> MODULE will help detect or prevent some of these errors.  For example, when using this, incorrect parameter types will be caught at compile time and using <span class="mono">KIND=nag_wp</span> in the type of real and complex variables will maintain consistency with the Library.</div><div class="paramtext">Therefore if a call to a Library routine results in an unexpected error message from the system (or possibly from within the Library), <b>check</b> the following:
<ul class="listind"><li class="listind"><b>Have some actual array arguments been passed as different dummy arguments (i.e., an array appears more than once in the argument) list with different INTENTs.</b></li><li class="listind"><b>Have all array parameters been dimensioned correctly?</b></li></ul>
</div><div class="paramtext">Avoid the use of NAG-type names for your own program units or COMMON blocks: in general, do not use names which contain a three-character NAG chapter name embedded in them; they may clash with the names of an auxiliary routine or COMMON block used by the NAG Library.</div><h4 class="standard"><a class="sec" name="alternativenames" id="alternativenames"/>3.2.1&#160;&#160;Alternative Routine Names</h4>
<div class="paramtext">If the Library is called from a Fortran program then it is possible to use alternative names for user-callable routines.  This can be done via the &#8216;USE nag_library&#8217; statement at the start of the (sub)program in which the Library routine is called.  For example, you wish to use the name BesselJ0 instead of the Library name <a class="rout" href="../S/s17aef.xml">S17AEF</a>.  In this case the line
   <pre class="verbatim">
    USE nag_library, ONLY: s17aef
   </pre>
   would be replaced by
   <pre class="verbatim">
    USE nag_library, ONLY: BesselJ0 =&gt; s17aef
   </pre>
   </div><div class="paramtext">The (sub)program would then use the name BesselJ0 in place of <a class="rout" href="../S/s17aef.xml">S17AEF</a> and call it with the identical interface.</div><div class="paramtext">If Library routines are called from other environments then many such environments offer ways of &#8216;aliasing&#8217; a routine name by a preferred alternative name.</div><div class="paramtext">For many of the Library routines with more complex interfaces it is likely that only a subset of the functionality is required and that some parameter values will always remain unchanged or will not be referenced.  In such cases it may be preferable to write your own wrapper to the Library routine with a much simpler interface and with a preferred alternative name.  For example, if you wish to integrate a system of stiff ordinary differential equations without root finding or intermediate output, you could create the simple interface wrapper to the more complicated <a class="rout" href="../D02/d02ejf.xml">D02EJF</a> interface.
   <pre class="verbatim">
    SUBROUTINE BDFsolve(xend,y)
    USE nag_library, ONLY: nag_wp, d02ejf, d02ejw, d02ejx, d02ejy
    REAL(kind=nag_wp) :: xend, y(:)
    REAL(kind=nag_wp) :: tol, xstart
    INTEGER           :: ifail, iw, n
    CHARACTER         :: relabs
    REAL(kind=nag_wp), ALLOCATABLE :: w(:)
    
    n = SIZE(y)
    tol = 1.0e-3_nag_wp
    relabs = 'M'
    iw = (12+n)*n + 50
    ALLOCATE(w(iw))
    ifail = 0
    xstart = 0.0_nag_wp
    CALL d02ejf(xstart,xend,n,y,fcn,d02ejy,tol,relabs,d02ejx, &amp;
    &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d02ejw,w,iw,ifail)
    RETURN
    END SUBROUTINE BDFsolve
   </pre>
   </div><div class="paramtext">The above example of a user-defined wrapper would be compiled and linked with a main program that would include the simple call:
   <pre class="verbatim">
    CALL BDFsolve(xend,y)
   </pre>
   </div><h4 class="standard"><a class="sec" name="fortranenv" id="fortranenv"/>3.2.2&#160;&#160;The NAG Fortran Environment</h4>
<div class="paramtext">The environment for the NAG Library is defined by the <span class="mono">nag_library</span> MODULE.  Certain routines require you to USE this to access definitions of NAG-defined TYPEs or named constants.  It is recommended that you also USE the MODULE to enable checking of INTERFACEs in the Library.</div><div class="paramtext">The exact location of <span class="mono">nag_library.mod</span> is installation dependent; please see the <a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a> for your implementation.</div><h3 class="standard"><a class="sec" name="errorhandling" id="errorhandling"/>3.3&#160;&#160;Error Handling and the Parameter IFAIL</h3><h4 class="standard"><a class="sec" name="background1" id="background1"/>3.3.1&#160;&#160;Errors, Failure and Warning Conditions</h4>
<div class="paramtext">The error, failure or warning conditions considered here are those that can be detected by explicit coding in a Library routine.  Such conditions must be anticipated by the author of the routine.  They should not be confused with run-time errors detected by the compilation system,  e.g., detection of overflow or failure to assign an initial value to a variable.</div><div class="paramtext">In the rest of this document we use the word &#8216;error&#8217; to cover all types of error, failure or warning conditions detected by the routine.  They fall roughly into three classes.
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline">(i)</td>
<td valign="top">On entry to the routine the value of a parameter is out of range. This means that it is not useful, or perhaps even meaningful, to begin computation.</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(ii)</td>
<td valign="top">During computation the routine decides that it cannot yield the desired results, and indicates a failure condition. For example, a matrix inversion routine will indicate a failure condition if it considers that the matrix is singular and so cannot be inverted.</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(iii)</td>
<td valign="top">Although the routine completes the computation and returns results, it cannot guarantee that the results are completely reliable; it therefore returns a warning. For example, an optimization routine may return a warning if it cannot guarantee that it has found a local minimum.</td>
</tr></table>
<b>All three classes of errors are handled in the same way by the Library.</b></div><div class="paramtext">Each error which can be detected by a Library routine is associated with a number.  Some numbers such as those associated with a failure in dynamic memory allocation (see <a class="sec" href="#dynamicmemory">Section 3.6</a>) or detecting a valid licence (<a class="sec" href="#licman">Section 3.7</a>) are the same for all Library routines and may not be listed in individual routine documents.  All other numbers, with explanations of the errors, are listed in Section 6 (Error Indicators and Warnings) in the routine  document.  Unless the document specifically states to the contrary,  you should not assume that the routine necessarily tests for the occurrence of the errors in their order of error number, i.e., the detection of an error does not imply that other errors have or have not been detected.</div><h4 class="standard"><a class="sec" name="background2" id="background2"/>3.3.2&#160;&#160;The IFAIL Parameter</h4>
<div class="paramtext">Most of the NAG Library routines which can be called directly by you have a parameter called IFAIL.  This parameter is concerned with the NAG Library error trapping mechanism (and, for some routines, with controlling the output of error messages and advisory messages).</div><div class="paramtext">IFAIL has <b>two</b> purposes:
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline"><a name="item1" id="item1"/>(i)</td>
<td valign="top">to allow you to specify what action the Library routine should take if an error is detected;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="item2" id="item2"/>(ii)</td>
<td valign="top">to inform you of the outcome of the call of the routine.</td>
</tr></table>
</div><div class="paramtext">For purpose <a class="item" href="#item1">(i)</a>, you <b>must</b> assign a value to IFAIL before the call to the Library routine.  Since IFAIL is reset by the routine for purpose <a class="item" href="#item2">(ii)</a>, the parameter must be the name of a variable, <b>not</b> a literal or constant.</div><div class="paramtext">The value assigned to IFAIL before entry should be either <m:math><m:mn>0</m:mn></m:math>&#160;(<b>hard fail</b> option), or 1 or &#8211; <m:math><m:mn>1</m:mn></m:math>&#160;(<b>soft fail</b>  option).  If after completing its computation the routine has not detected an error, IFAIL is reset to <m:math><m:mn>0</m:mn></m:math>&#160;to indicate a <b>successful call.</b> Control returns to the calling program in the normal way.  If the routine  does detect an error, its action depends on whether the hard or soft fail option was chosen.</div><h4 class="standard"><a class="sec" name="background3" id="background3"/>3.3.3&#160;&#160;Hard Fail Option</h4>
<div class="paramtext">If you set IFAIL to <m:math><m:mn>0</m:mn></m:math>&#160;before calling the Library routine,  execution of the program will terminate if the routine detects an error.  Before the program is stopped, this error message is output:
<pre class="verbatim">
** ABNORMAL EXIT from NAG Library routine XXXXXX: IFAIL = n
** NAG hard failure - execution terminated
</pre>
where  <span class="mono">XXXXXX</span> is the routine name, and <span class="mono">n</span> is the number associated with the detected error.  An explanation of error number <span class="mono">n</span> is given in Section 6 of the routine document  <span class="mono">XXXXXX</span>.</div><div class="paramtext">In addition, most routines output explanatory error messages immediately before the standard termination message shown above.</div><div class="paramtext">The hard fail option should be selected if you are in any doubt about continuing the execution of the program after an unsuccessful call to a NAG Library routine.  For environments where it might be inappropriate to halt program execution when an error is detected it is recommended that the hard fail option is <b>not</b> used.</div><h4 class="standard"><a class="sec" name="background4" id="background4"/>3.3.4&#160;&#160;Soft Fail Option</h4>
<div class="paramtext">To select this option, you must set IFAIL to <m:math><m:mn>1</m:mn></m:math>&#160;or <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>&#160;before calling the Library routine.</div><div class="paramtext">If the routine detects an error, IFAIL is reset to the associated error number; further computation within the routine is suspended and control returns to the calling program.</div><div class="paramtext">If you set IFAIL to <m:math><m:mn>1</m:mn></m:math>, then no error message is output (<b>silent exit</b>).  If the output of error messages is undesirable, then silent exit is recommended.</div><div class="paramtext">If you set IFAIL to <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>&#160;(<b>noisy exit</b>),  then before control is returned to the calling program, the following error message is output:
<pre class="verbatim">
** ABNORMAL EXIT from NAG Library routine XXXXXX: IFAIL = n
** NAG soft failure - control returned
</pre>
In addition, most routines output explanatory error messages immediately before the above standard message.</div><div class="paramtext"><b>It is most important to test the value of IFAIL on exit if the soft fail option is selected.</b>  A nonzero exit value of IFAIL implies that the call was not successful so it is imperative that your program be coded to take appropriate action.  That action may simply be to print IFAIL with an explanatory caption and then terminate the program.  Many of the example programs in Section 9 of the routine documents have IFAIL-exit tests of this form.  In the more ambitious case, where you wish your program to continue, it is essential that the program can branch to a point at which it is <b>sensible</b> to resume computation.</div><div class="paramtext">The soft fail option puts the onus on you to handle any errors detected by the Library routine.  With the proviso that you are able to implement it <b>properly</b>, it is clearly more flexible than the hard fail option since it allows computation to continue in the case of errors.  In particular there are at least two cases where its flexibility is useful:
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline">(i)</td>
<td valign="top">where additional information about the error or the progress of computation is returned via some of the other parameters;</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(ii)</td>
<td valign="top">in some routines, &#8216;partial&#8217; success can be achieved, e.g., a probable solution found but not all conditions fully satisfied, so the routine returns a warning. On the basis of the advice in Section 6 and elsewhere in the routine document, you may decide that this partially successful call is adequate for certain purposes.</td>
</tr></table>
</div><h4 class="standard"><a class="sec" name="background5" id="background5"/>3.3.5&#160;&#160;Historical Note</h4>
<div class="paramtext">The error handling mechanism described above was introduced into the NAG Library at Mark 12.  It supersedes the earlier mechanism which for most routines allowed IFAIL to be set by you to <m:math><m:mn>0</m:mn></m:math>&#160;or 1 only.  The new mechanism is compatible with the old except that the details of the messages output on hard failure have changed.  The new mechanism also allows you to set IFAIL to <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>&#160;(soft failure,  noisy exit).</div><div class="paramtext">A few routines (introduced mainly at Marks 7 and 8) use IFAIL in a different way to control the output of error messages, and also of advisory messages (see <a class="chap" href="../X04/x04conts.xml">Chapter X04</a>).  In those routines IFAIL is regarded as a decimal integer whose least significant digits are denoted <m:math><m:mi>b</m:mi><m:mi>a</m:mi></m:math>&#160;with the following significance:
<div class="tablediv"><table class="frame-none" align="center">
  
  
  <tbody>
   <tr>
    <td class="libdoc" valign="top" align="left" style="width:12em;"><m:math><m:mi>a</m:mi><m:mo>=</m:mo><m:mn>0</m:mn></m:math>: hard failure</td>
    <td class="libdoc" valign="top" align="left" style="width:12em;"><m:math><m:mi>a</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:math>: soft failure</td>
   </tr><tr>
    <td class="libdoc" valign="top" align="left" style="width:12em;"><m:math><m:mi>b</m:mi><m:mo>=</m:mo><m:mn>0</m:mn></m:math>: silent exit</td>
    <td class="libdoc" valign="top" align="left" style="width:12em;"><m:math><m:mi>b</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:math>: noisy exit</td>
   </tr>
  </tbody>
 </table></div>
</div><div class="paramtext">Details are given in the documents of the relevant routines; for those routines this alternative use of IFAIL remains valid.</div><h3 class="standard"><a class="sec" name="inputoutput" id="inputoutput"/>3.4&#160;&#160;Input/output in the Library</h3>
<div class="paramtext">Most NAG Library routines perform no output to an external file, except possibly to output an error message.  All error messages are written to a logical <b>error message</b> unit.  This unit number (which is set by default to 6 in most implementations) can be changed by calling the Library routine <a class="rout" href="../X04/x04aaf.xml">X04AAF</a>.</div><div class="paramtext">Some NAG Library routines may optionally output their final results, or intermediate results to monitor the course of computation.  In general, output other than error messages is written to a logical <b>advisory message</b> unit.  This unit number (which is also set by default to 6 in most implementations) can be changed by calling the Library routine <a class="rout" href="../X04/x04abf.xml">X04ABF</a>.  Although it is logically distinct from the error message unit, in practice the two unit numbers may be the same.  A few routines in <a class="chap" href="../E04/e04conts.xml">Chapter E04</a> allow this unit number to be specified directly as an option.</div><div class="paramtext">All output from the Library is appropriately formatted.</div><div class="paramtext">There are only a few Library routines which perform input from an external file.  These examples occur in <a class="chap" href="../E04/e04conts.xml">Chapters E04</a>, <a class="chap" href="../E05/e05conts.xml">E05</a> and <a class="chap" href="../H/hconts.xml">H</a>.  The unit number of the external file is a parameter to the routine, and all input is formatted.</div><div class="paramtext">You must ensure that the relevant Fortran unit numbers are associated with the desired external files, either by an OPEN statement in your calling program, or by operating system commands.</div><h3 class="standard"><a class="sec" name="library5" id="library5"/>3.5&#160;&#160;Auxiliary Routines as External Procedure Parameters</h3>
<div class="paramtext">In addition to those Library routines which are documented and are intended to be called by you directly, the Library also contains many auxiliary routines.</div><div class="paramtext">In general, you need not be concerned with them at all, although you may be made aware of their existence if, for example, you examine a memory map of an executable program which calls NAG routines.  The only exception is that when calling some NAG Library routines you may be required or allowed to supply the name of an auxiliary routine from the NAG Library as an external procedure parameter.  The routine documents give the necessary details.  In such cases, you only need to supply the name of the routine; you <b>never</b> need to know details of its parameter list.</div><div class="paramtext">NAG auxiliary routines have names which are similar to the name of the documented routine(s) to which they are related, but with last letter &#8216;Z&#8217;, &#8216;Y&#8217;, and so on, e.g.,
<ul class="listind"><li class="listind">D01BAZ is an auxiliary routine called by <a class="rout" href="../D01/d01baf.xml">D01BAF</a>.</li></ul>
</div><div class="paramtext">A few chapters contain auxiliary routines whose names are obtained by adding 50 to the second and third characters of the chapter name.  For instance, <a class="chap" href="../E04/e04conts.xml">Chapter E04</a> has an auxiliary routine with the name E54NFU which is normally used as the actual argument for the <a class="arg" href="../E04/e04nff.xml#QPHESS">QPHESS</a> parameter of <a class="rout" href="../E04/e04nff.xml">E04NFA</a>; the corresponding name to be used with <a class="rout" href="../E04/e04nff.xml">E04NFF</a> is E04NFU.</div><h3 class="standard"><a class="sec" name="dynamicmemory" id="dynamicmemory"/>3.6&#160;&#160;Dynamic Memory Allocation</h3>
<div class="paramtext">Some NAG Library routines perform dynamic memory allocation to simplify their interfaces.

Where possible, the amount of memory allocated by a routine will be given in the routine document (usually as a function of routine parameters).
All memory allocated by NAG routines is deallocated before exit.
</div><div class="paramtext">In the case where a routine detects a failure to dynamically allocate sufficient memory, the routine will set an error condition, by setting <m:math><m:mi mathvariant="normal">IFAIL</m:mi><m:mo>=</m:mo><m:mrow><m:mo>-</m:mo><m:mn>999</m:mn></m:mrow></m:math>, and exit with an appropriate error message.</div><h3 class="standard"><a class="sec" name="licman" id="licman"/>3.7&#160;&#160;License Management</h3>
<div class="paramtext">If your implementation is license managed then your local site will have details on how the license management is implemented; please contact your site installer for details. To determine whether a valid license is available on your machine run the example program for <a class="rout" href="../A00/a00acf.xml">A00ACF</a>.</div><div class="paramtext">Should a valid license not be found when calling license managed routines from the Library then the routine will set an error condition, by setting <m:math>
 <m:mi mathvariant="normal">IFAIL</m:mi><m:mo>=</m:mo><m:mrow><m:mo>-</m:mo><m:mn>399</m:mn></m:mrow>
</m:math>, and exit with an appropriate error message.  The appropriate environment variables should then be checked (e.g., NAG_KUSARI_FILE) to make sure this points to the licence file containing a valid licence, and the licence file should be checked for any obvious errors (e.g., the licence refers to a different implementation).  If everything appears to be correct then please contact <a class="url" href="http://www.nag.co.uk">NAG</a> (see <a class="sec" href="#support">Section 5</a> for details).</div><h3 class="standard"><a class="sec" name="threadsafety" id="threadsafety"/>3.8&#160;&#160;Thread Safety</h3>
<div class="paramtext">Some implementations of the Library facilitate the use of threads; that is, you can call routines from the Library from within a multithreaded application.  See the <a class="genint" href="../GENINT/safety.xml#SAFETY">Thread Safety</a> document for more detailed guidance on using the Library in a multithreaded context.  You may also need to refer to the <a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a> for details of whether your implementation of the Library has been compiled in a manner that facilitates the use of threads.</div><div class="paramtext">Note that in some implementations, the Library is linked with one or more vendor libraries to provide, for example, efficient BLAS routines.  NAG cannot guarantee that any such vendor library is thread safe.</div><h3 class="standard"><a class="sec" name="SMPperformance" id="SMPperformance"/>3.9&#160;&#160;Performance on SMP systems</h3>
<div class="paramtext">The introduction of multicore processors and the availability of more affordable multisocket systems mean that SMP systems are increasingly common. Users of the NAG Fortran Library on these systems may benefit directly from any SMP parallelism present in the underlying vendor library (e.g., in BLAS and LAPACK routines), and indirectly via any Library routine which internally uses these parallelised vendor routines. To benefit from this, you should set the appropriate environment variable (usually OMP_NUM_THREADS) to the desired number of threads. Generally this should not be more than the number of available (idle) cores on your system. You should consult the relevant vendor library documentation for further information and contact <a class="url" href="http://www.nag.co.uk">NAG</a> (see <a class="sec" href="#support">Section 5</a> for details) for advice if required.</div><div class="paramtext">The NAG Library for SMP &amp; Multicore is designed to give further benefit on SMP systems. Key Library routines have been explicitly parallelised using <a class="ref" href="#ref836">OpenMP</a> to offer enhanced performance over a wider range of routines compared with the NAG Fortran Library which relies solely on the parallelism in vendor libraries. Further information is given in the <a class="genint" href="../GENINT/smpint.xml#SMPINT">Introduction to the NAG Library for SMP &amp; Multicore</a>.</div><div class="paramtext">Note that the performance increase achieved, if any, will vary depending upon which routine is called, problem sizes and other parameters, system design and operating system configuration. If you frequently call a routine with similar data sizes and other parameters, it may be worthwhile to experiment with different numbers of threads, to determine the choice that gives optimal performance.</div><h3 class="standard"><a class="sec" name="library7" id="library7"/>3.10&#160;&#160;Calling the Library from Other Languages</h3>
<div class="paramtext">In general the NAG Library can be called from other computer languages (such as C and Visual Basic) provided that appropriate mappings exist between their data types.</div><div class="paramtext">NAG has produced C Header Files which comprise of a set of header files, indicating the match between C and Fortran data types for various compilers, documentation and examples.  The documentation, examples and C Header Files are available from the NAG Web sites (see <a class="sec" href="#support">Section 5</a>).</div><div class="paramtext">The Dynamic Link Library (DLL) implementation can be called in a straightforward manner from a number of languages and environments, e.g., Visual Basic, Visual Basic for Applications (Excel), Delphi, C and C++.  Guidance on this is provided as part of NAG Library DLLs.  Further details can be found on the NAG Web sites.</div><h3 class="standard"><a class="sec" name="arithmetic" id="arithmetic"/>3.11&#160;&#160;Arithmetic Considerations and Reproducibility of Results</h3>
<div class="paramtext">The results obtained when calling a NAG Library routine depend not only on the algorithm used to solve the problem, but also on the compiler used to build the library, compiler run-time libraries, and also the arithmetic properties of the machine on which the code is run.</div><div class="paramtext">Historically, different kinds of computer hardware tended to have different kinds of arithmetic. Some machines would store floating point numbers using a base 16 significand and exponent system, others would use base 2, and some even used base 8 or 10. Such differences caused major headaches for software library providers because code that worked well on one arithmetic system might not behave in exactly the same way on another. This meant that great care had to be taken to make the library code <b>portable</b>.</div><div class="paramtext">In addition, it was not unheard of for machine arithmetic to have flaws or errors where basic operations such as multiplication or division could sometimes give incorrect results, especially on numbers that were in some way &#8216;extreme&#8217;, such as being very large or small.</div><div class="paramtext">After the first of the IEEE standards for floating point arithmetic (<a class="ref" href="#ref553">ANSI/IEEE (1985)</a>) was introduced in the 1980s, the situation improved greatly. Nowadays most significant hardware, and certainly most hardware that NAG libraries run on, will use IEEE-style base 2 arithmetic. This makes production of portable code easier, but there are still problems, partly due to the latitude allowed by the IEEE standards. For example, hardware which uses extra-precise 80-bit internal registers for arithmetic, as originally introduced in the Intel 8087 coprocessor in the 1980s, behaves slightly differently from hardware that uses 64-bit registers, particularly if a compiler generates optimized code which holds arithmetic subexpressions in the extra-precise registers.</div><div class="paramtext">Since for performance reasons computer arithmetic is generally finite precision (as is certainly the case for IEEE standard
arithmetic) most of the numerical methods implemented by NAG Library routines can only return an approximation to the true solution, simply due to accumulation of rounding errors.</div><div class="paramtext">It should therefore be clear that running a program which calls a NAG Library routine with the same data on two different machines can give different results, due to compiler, hardware and run-time library considerations. Usually these differences are small &#8211; it may be that a result computed on one machine differs only in the last few significant bits from the same result computed on another machine &#8211; for example, when solving a well-conditioned set of linear equations on two different machines. Occasionally small differences may be magnified, for example if a conditional test depends on an imprecise result. A routine that searches for a mininum of an optimization problem may converge to a different local minimum, but in general, so long as the routine's documentation doesn't claim that the <b>same</b> local minimum will always be obtained, this should be acceptable. Even if an algorithm converges to the same local minimum, arithmetic differences may mean that a different number of iterations is taken to get there.</div><div class="paramtext">Modern hardware and optimizing compilers have introduced further scope for arithmetic quirks. An example is in the use of <b>Streaming SIMD Extension (SSE)</b> instructions. These low-level machine instructions allow hardware to operate on more than one number in parallel, if your compiler is smart enough to generate and use them correctly, or if you hand-code your own assembly language routines.</div><div class="paramtext">SSE instructions enable low-level parallelism of floating point arithmetic operations. For example, a 128-bit SSE register can hold two 64-bit double precision (or four 32-bit single precision) numbers at the same time, and operate on them all simultaneously. This can lead to big time savings when working on large amounts of data.</div><div class="paramtext">But this may come at a price. Efficient use of SSE instructions can sometimes depend on exactly how the memory used to store data is aligned. Some SSE instructions for moving data to and from memory need memory to be aligned on a 16-byte boundary. If it happens that the memory (for example, a pointer to an array of numbers) that a NAG routine uses is <b>not</b> aligned nicely, then it may not be possible to use those SSE instructions.
An optimizing compiler might well generate two instruction streams, one for when it detects that memory is aligned, and one for when it is not.</div><div class="paramtext">An example should serve to make things clearer. Suppose we wish to compute the inner product of two vectors, X and Y, each of length N. The inner product (or dot product) of two vectors is computed by multiplying together corresponding elements of the two vectors, and summing the individual products to get the result. A routine compiled by a good optimizing compiler would load numbers two or four at a time, multiply them together two or four at a time, and accumulate the results into the final result.</div><div class="paramtext">But if the memory is not nicely aligned &#8211; and it may well not be &#8211; the compiler needs to generate a different code path to deal with the situation. Here the result will take longer to get because the products must be computed and accumulated one at a time. At run-time, the code checks whether it can take the fast path or not, and works appropriately.</div><div class="paramtext">The problem is that by altering the order of the accumulations, we are quite possibly changing the final result, simply due to rounding differences when working with finite precision computer arithmetic. Instead of getting the inner product

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>s</m:mi>
 <m:mo>=</m:mo>
 <m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub>
 <m:mo>&#215;</m:mo>
 <m:msub><m:mi>y</m:mi><m:mn>1</m:mn></m:msub>
 <m:mo>+</m:mo>
 <m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub>
 <m:mo>&#215;</m:mo>
 <m:msub><m:mi>y</m:mi><m:mn>2</m:mn></m:msub>
 <m:mo>+</m:mo>
 <m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub>
 <m:mo>&#215;</m:mo>
 <m:msub><m:mi>y</m:mi><m:mn>3</m:mn></m:msub>
 <m:mo>+</m:mo>
 <m:mo>&#8943;</m:mo>
 <m:mo>+</m:mo>
 <m:msub><m:mi>x</m:mi><m:mi>n</m:mi></m:msub>
 <m:mo>&#215;</m:mo>
 <m:msub><m:mi>y</m:mi><m:mi>n</m:mi></m:msub>
</m:math></td><td class="formula2"/></tr></table></div>

we may get

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>s</m:mi>
 <m:mo>=</m:mo>
 <m:mfenced separators="">
  <m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub>
  <m:mo>&#215;</m:mo>
  <m:msub><m:mi>y</m:mi><m:mn>1</m:mn></m:msub>
  <m:mo>+</m:mo>
  <m:msub><m:mi>x</m:mi><m:mn>3</m:mn></m:msub>
  <m:mo>&#215;</m:mo>
  <m:msub><m:mi>y</m:mi><m:mn>3</m:mn></m:msub>
 </m:mfenced>
 <m:mo>+</m:mo>
 <m:mfenced separators="">
  <m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub>
  <m:mo>&#215;</m:mo>
  <m:msub><m:mi>y</m:mi><m:mn>2</m:mn></m:msub>
  <m:mo>+</m:mo>
  <m:msub><m:mi>x</m:mi><m:mn>4</m:mn></m:msub>
  <m:mo>&#215;</m:mo>
  <m:msub><m:mi>y</m:mi><m:mn>4</m:mn></m:msub>
 </m:mfenced>
 <m:mo>+</m:mo>
 <m:mo>&#8943;</m:mo>
 <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><div class="paramtext">It is likely that the result will be just as accurate either way &#8211; neither result will be precise due to finite arithmetic &#8211; but they may differ by a tiny amount. And if that tiny difference leads to a different decision made by the code that called the inner product routine, the difference may be magnified.</div><div class="paramtext">Furthermore, it is possible that the same program running with bitwise identical data on the same machine may give different results when run twice in a row simply because, when the program is loaded, by chance some piece of memory may or may not be aligned on a particular boundary. Such non-deterministic results can be frustrating if the user of the program depends on always getting identical results for the same data.</div><div class="paramtext">On even newer hardware, <b>AVX</b> instructions use 256-bit registers, and can therefore operate on more numbers at a time. For AVX instructions, memory may need to be 32-byte aligned.</div><div class="paramtext">Some memory used by NAG Library routines is allocated inside the NAG Library. In order to minimize differences due to effects like that described above, we can try to make sure the memory is always aligned nicely &#8211; for example, by use of more controllable memory allocation routines where available &#8211; but that is not always possible since it partly depends on the support of the compiler.</div><div class="paramtext">Of course, no Library routine has control over memory you have allocated before being passed to the routine. If you do observe non-deterministic results which you suspect are due to memory considerations, and you are unable to accept this variation, then you are advised to make sure that any memory you allocate is aligned nicely; unfortunately, precisely how you do this is dependent on your system, but you may be able to get advice through <a class="url" href="http://www.nag.co.uk">NAG</a>'s usual support channels.</div><h2 class="standard"><a class="sec" name="doc" id="doc"/>4&#160;&#160;Using the Documentation</h2><h3 class="standard"><a class="sec" name="doc1" id="doc1"/>4.1&#160;&#160;Using the Manual</h3>
<div class="paramtext">The Manual is designed to serve the following functions
 for both the NAG Library and the NAG Library for SMP &amp; Multicore:

<ul class="listind"><li class="listind">to give background information about different areas of numerical and statistical computation;</li><li class="listind">to advise on the choice of the most suitable NAG Library routine or routines to solve a particular problem;</li><li class="listind">to give all the information needed to call a NAG Library routine correctly from a Fortran program, and to assess the results.</li></ul>
</div><div class="paramtext">At the beginning of the Manual are some general introductory documents which provide some background and additional information.
There are a small number of documents which are specific to NAG Library or to the NAG Library for SMP &amp; Multicore, you only need to read those specific to the library you are using.  All other general introductory documents are relevant to both libraries.</div><div class="paramtext">The document entitled &#8216;<a class="genint" href="../GENINT/smpint.xml#SMPINT">Introduction to the NAG Library for SMP &amp; Multicore</a>&#8217; is <span class="bitalic">essential</span> reading for NAG Library for SMP &amp; Multicore users.</div><div class="paramtext">The documents entitled &#8216;<a class="genint" href="../GENINT/news.xml#NEWS">Mark 23 NAG Fortran Library News</a>&#8217; and &#8216;<a class="genint" href="../GENINT/smpnews.xml#SMPNEWS">Mark 23 NAG Library for SMP &amp; Multicore News</a>&#8217; provide 

details of new routines added, details of routines scheduled for withdrawal and details of routines withdrawn at this mark.
The <a class="genint" href="../GENINT/smpnews.xml#SMPNEWS">Mark 23 NAG Library for SMP &amp; Multicore News</a> also provides details of routines which have been tuned or enhanced at this mark; a full list of such routines is available in the document &#8216;<a class="genint" href="../GENINT/smptuned.xml#SMPTUNED">Tuned and Enhanced Routines in the  NAG Library for SMP &amp; Multicore</a>&#8217;.</div><div class="paramtext">The document entitled &#8216;<a class="genint" href="../GENINT/withdrawn.xml#WITHDRAWN">Routines Withdrawn or Scheduled for Withdrawal</a>&#8217; provides full details of all routines withdrawn from the NAG Library and the document entitled &#8216;<a class="genint" href="../GENINT/replace.xml#REPLACE">Advice on Replacement Calls for Withdrawn/Superseded Routines</a>&#8217; provides advice on how to modify your program.</div><div class="paramtext">The online documentation provides you with a fully linked HTML <a class="genint" href="../INDEXES/KWIC/kwic.xml#KWIC">Keyword Index</a> (a keyword index to routines) and <a class="genint" href="../INDEXES/GAMS/gams.xml#GAMS">GAMS Classification Index</a> (a list of NAG routines classified according to the GAMS scheme).</div><div class="paramtext">Having found a likely chapter or routine, you should read the corresponding <b>Chapter Introduction,</b> which gives background information about that area of numerical computation, and recommendations on the choice of a routine, including indexes, tables or decision trees.</div><div class="paramtext">When you have chosen a routine, you must consult the <b>routine document</b>.  Each routine document is essentially self-contained (it may, however, contain references to related documents).  It includes a description of the method, detailed specifications of each parameter, explanations of each error exit, remarks on accuracy, and (in most cases) an example program to illustrate the use of the routine.</div><h3 class="standard"><a class="sec" name="doc2" id="doc2"/>4.2&#160;&#160;Structure of Routine Documents</h3>
<div class="paramtext">All routine documents have the same structure consisting of nine numbered sections:
<table class="standard-100"><tr>
<td style="width:2.4em;" valign="baseline"><b>1.</b></td>
<td valign="top"><b>Purpose</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>2.</b></td>
<td valign="top"><b>Specification</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>3.</b></td>
<td valign="top"><b>Description</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>4.</b></td>
<td valign="top"><b>References</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>5.</b></td>
<td valign="top"><b>Parameters</b> (see <a class="sec" href="#doc3">Section 4.3</a> below)</td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>6.</b></td>
<td valign="top"><b>Error Indicators and Warnings</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>7.</b></td>
<td valign="top"><b>Accuracy</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>8.</b></td>
<td valign="top"><b>Further Comments</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>9.</b></td>
<td valign="top"><b>Example</b> (see <a class="sec" href="#doc5">Section 4.5</a> below)</td>
</tr></table>
</div><div class="paramtext">In a few documents (notably <a class="chap" href="../E04/e04conts.xml">Chapters E04</a>, <a class="chap" href="../E05/e05conts.xml">E05</a> and <a class="chap" href="../H/hconts.xml">H</a>) there are a further three sections:
<table class="standard-100"><tr>
<td style="width:2.4em;" valign="baseline"><b>10.</b></td>
<td valign="top"><b>Algorithmic Details</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>11.</b></td>
<td valign="top"><b>Optional Parameters</b></td>
</tr><tr>
<td style="width:2.4em;" valign="baseline"><b>12.</b></td>
<td valign="top"><b>Description of Monitoring Information</b></td>
</tr></table>
</div><h3 class="standard"><a class="sec" name="doc3" id="doc3"/>4.3&#160;&#160;Specification of Parameters</h3>
<div class="paramtext">Section 5 of each routine document contains the specification of the parameters, in the order of their appearance in the parameter list.</div><h4 class="standard"><a class="sec" name="doc31" id="doc31"/>4.3.1&#160;&#160;Classification of parameters</h4>
<div class="paramtext">Parameters are classified as follows.</div><div class="paramtext"><span class="italic">Input</span>: you must assign values to these parameters on or before entry to the routine, and these values are unchanged on exit from the routine.</div><div class="paramtext"><span class="italic">Output</span>: you need not assign values to these parameters before entry to the routine; the routine may assign values to them.</div><div class="paramtext"><span class="italic">Input/Output</span>: you must assign values to these parameters before entry to the routine, and the routine may then change these values.</div><div class="paramtext"><span class="italic">Workspace</span>: array parameters which are used as workspace by the routine.  You must supply arrays of the correct type and dimension.  In general, you need not be concerned with their contents.</div><div class="paramtext"><span class="italic">Communication Array</span>:
 
parameters which are used to communicate data from one routine call to another.</div><div class="paramtext"><span class="italic">External Procedure</span>: a routine which must be supplied (e.g., to evaluate an integrand or to print intermediate output).  Usually it must be supplied as part of your calling program, in which case its specification includes full details of its parameter list and specifications of its parameters (all enclosed in a box).  Its parameters are classified in the same way as those of the Library routine, but because you must write the procedure rather than call it, the significance of the classification is different.
<ul class="listind"><li class="listind"><span class="italic">Input</span>: values may be supplied on entry, which your procedure <b>must not</b> change.</li><li class="listind"><span class="italic">Output</span>: you may or must assign values to these parameters before exit from your procedure.</li><li class="listind"><span class="italic">Input/Output</span>: values may be supplied on entry, and you may or must assign values to them before exit from your procedure.</li></ul>
</div><div class="paramtext">Occasionally, as mentioned in <a class="sec" href="#library5">Section 3.5</a>, the procedure can be supplied from the NAG Library, and then you only need to know its name.</div><div class="paramtext"><span class="italic">User Workspace</span>: array parameters which are passed by the Library routine to an external procedure parameter.  They are not used by the routine, but you may use them to pass information between your calling program and the external procedure.</div><div class="paramtext"><span class="italic">Dummy</span>: a simple variable which is not used by the routine.  A variable or constant of the correct type must be supplied, but its value need not be set. (A dummy parameter is usually a parameter which was required by an earlier version of the routine and is retained in the parameter list for compatibility.)</div><h4 class="standard"><a class="sec" name="doc32" id="doc32"/>4.3.2&#160;&#160;Constraints and suggested values</h4>
<div class="paramtext">The word &#8216;<span class="italic">Constraint</span>:&#8217; or &#8216;<span class="italic">Constraints</span>:&#8217; in the specification of an <span class="italic">Input</span> parameter introduces a statement of the range of valid values for that parameter, e.g.,
<ul class="listind"><li class="listind"><span class="italic">Constraint</span>: <m:math><m:mi mathvariant="normal">N</m:mi><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math>.</li></ul>
</div><div class="paramtext">If the routine is called with an invalid value for the parameter
(e.g., <m:math><m:mi mathvariant="normal">N</m:mi><m:mo>=</m:mo> <m:mn>0</m:mn></m:math>), the routine will usually take an error exit, returning a nonzero value of IFAIL (see <a class="sec" href="#errorhandling">Section 3.3</a>).</div><div class="paramtext">Constraints on parameters of type CHARACTER only list upper case alphabetic characters, e.g.,
<ul class="listind"><li class="listind"><span class="italic">Constraint</span>: <m:math><m:mi mathvariant="normal">CHECK</m:mi><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>.</li></ul>
</div><div class="paramtext">In practice, all routines with CHARACTER parameters will permit the use of lower case characters.</div><div class="paramtext">The phrase &#8216;<span class="italic">Suggested Values</span>:&#8217; introduces a suggestion for a reasonable initial setting for an <span class="italic">Input</span> parameter (e.g., accuracy or maximum number of iterations) in case you are unsure what value to use; you should be prepared to use a different setting if the suggested value turns out to be unsuitable for your problem.</div><h4 class="standard"><a class="sec" name="doc33" id="doc33"/>4.3.3&#160;&#160;Array parameters</h4>
<div class="paramtext">Most array parameters have dimensions which depend on the size of the problem.  In Fortran terminology they have &#8216;adjustable dimensions&#8217;: the dimensions occurring in their declarations are integer variables which are also parameters of the Library routine.</div><div class="paramtext">For example, a Library routine might have the specification:
<pre class="verbatim">SUBROUTINE &lt;name&gt; (M, N, A, B, LDB)
INTEGER            M, N, A(N), B(LDB,N), LDB</pre>
</div><div class="paramtext">For a <b>one-dimensional</b> array parameter, such as A in this example, the specification would begin
<ul class="listind"><li class="listind">A(N) &#8211; INTEGER array</li></ul>
</div><div class="paramtext">You must ensure that the dimension of the array, as declared in your calling (sub)program, is at least as large as the value you supply for N.  It may be larger, but the routine uses only the first N elements.</div><div class="paramtext">For a <b>two-dimensional</b> array parameter, such as B in the example, the specification might be
<ul class="listind"><li class="listind">B(LDB,N) &#8211; INTEGER array</li><li class="listind"><span class="italic">On entry</span>: the <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;matrix <m:math><m:mi>B</m:mi></m:math>.</li></ul>
and the parameter LDB might be described as follows:
<ul class="listind"><li class="listind">LDB &#8211; INTEGER</li><li class="listind"><span class="italic">On entry</span>: the first dimension of the array B as declared in the (sub)program from which &lt;name&gt; is called.</li><li class="listind"><span class="italic">Constraint</span>: <m:math><m:mi mathvariant="normal">LDB</m:mi> <m:mo>&#8805; </m:mo><m:mi mathvariant="normal">M</m:mi></m:math>.</li></ul>
</div><div class="paramtext">You <b>must</b> supply the <b>first</b> dimension of the array B, as declared in your calling (sub)program, through the parameter LDB, even though the number of rows actually used by the routine is determined by the parameter M.  You must ensure that the first dimension of the array is at least as large as the value you supply for M.  The extra parameter LDB is needed 
to allow the routine to act on subarrays of a larger two-dimensional array, e.g., factorizing a diagonal submatrix of a larger matrix.

</div><div class="paramtext">You must also ensure that the <b>second</b> dimension of the array, as declared in your calling (sub)program, is at least as large as the value you supply for N.  It may be larger, but the routine uses only the first N columns.</div><div class="paramtext">A program to call the hypothetical routine used as an example in this section might include the statements:</div><div class="paramtext">
<div class="left-tablediv"><table class="frame-none">
 
 
 
<tbody>
<tr>
 <td class="libdoc" valign="top">
  <pre class="verbatim">INTEGER AA(100), BB(100,50)
LDB = 100
.
.
.
M = 80
N = 20
CALL &lt;name&gt;(M,N,AA,BB,LDB)
  </pre>
 </td>
 <td class="libdoc" valign="top">or</td>
 <td class="libdoc" valign="top">
  <pre class="verbatim">INTEGER ALLOCATABLE :: AA(:), BB(:,:)
INTEGER &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;:: M, N, LDB
.
.
.
READ(5,*) M, N
LDB = M
ALLOCATE (AA(M),BB(LDB,N))
CALL &lt;name&gt;(M,N,AA,BB,LDB)</pre>
 </td>
</tr>
</tbody>
</table></div>
</div><div class="paramtext">Many NAG routines contain array parameters declared with the &#8216;assumed size&#8217; array dimension, and would be given as
<pre class="verbatim">INTEGER        A(*), B(LDB,*)</pre>
</div><div class="paramtext">However, the original declaration of an array in your calling program must always have dimensions, greater than or equal to the minimum value documented. The advantage of using allocatable arrays is that they can be dynamically allocated to be of a correct size not known at compile time.</div><div class="paramtext">Consult an expert or a textbook on Fortran if you have difficulty in calling NAG routines with array parameters.</div><h3 class="standard"><a class="sec" name="doc4" id="doc4"/>4.4&#160;&#160;Implementation-dependent Information</h3>
<div class="paramtext">In order to support all implementations of the Library, the Manual has adopted a convention of using <span class="bitalic">bold</span>
<span class="bitalic">italics</span> to distinguish terms which have different interpretations in different implementations.</div><div class="paramtext">One bold italicised term is <span class="bitalic">machine precision</span>, which denotes the relative precision to which real floating point numbers are stored in the computer, e.g., in an implementation with approximately 16 decimal digits of precision, <span class="bitalic">machine precision</span> has a value of approximately <m:math><m:msup><m:mn>10</m:mn><m:mn>-16</m:mn></m:msup></m:math>.</div><div class="paramtext">The precise value of <span class="bitalic">machine precision</span> is given by the routine <a class="rout" href="../X02/x02ajf.xml">X02AJF</a>.  Other routines in <a class="chap" href="../X02/x02conts.xml">Chapter X02</a> return the values of other implementation-dependent constants, such as the overflow threshold, or the largest representable integer.  Refer to the <a class="chapint" href="../X02/x02intro.xml">X02 Chapter Introduction</a> for more details.</div><div class="paramtext">The bold italicised term <span class="bitalic">block size</span> is used only in <a class="chap" href="../F07/f07conts.xml">Chapters F07</a> and <a class="chap" href="../F08/f08conts.xml">F08</a>.  It denotes the block size used by block algorithms in these chapters.  You only need to be aware of its value when it affects the amount of workspace to be supplied &#8211; see the parameters WORK and LWORK of the relevant routine documents and the Chapter Introduction.</div><div class="paramtext">In <a class="chap" href="../F01/f01conts.xml">Chapters F01</a>, <a class="chap" href="../F06/f06conts.xml">F06</a>, <a class="chap" href="../F07/f07conts.xml">F07</a>, <a class="chap" href="../F08/f08conts.xml">F08</a> and <a class="chap" href="../F16/f16conts.xml">F16</a>, alternate routine names are available for BLAS and LAPACK derived routines. For details of the alternate routine names please refer to the relevant Chapter Introduction.</div><div class="paramtext">For each implementation of the Library, a separate <b><a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a></b> is published.  This is a short document, revised at each mark.  At most installations it is available in machine-readable form.  It gives any necessary additional information which applies specifically to that implementation, in particular:
<ul class="listind"><li class="listind">the values returned by <a class="chap" href="../X02/x02conts.xml">Chapter X02</a> routines;</li><li class="listind">the default unit numbers for output (see <a class="sec" href="#inputoutput">Section 3.4</a>);</li><li class="listind">the meanings of the precision parameters nag_rp (<span class="bitalic">reduced precision</span>), nag_wp (<span class="bitalic">basic precision</span>) and nag_hp (<span class="bitalic">additional precision</span>).</li></ul>
</div><h3 class="standard"><a class="sec" name="doc5" id="doc5"/>4.5&#160;&#160;Example Programs and Results</h3>
<div class="paramtext">The <b>example program</b> in Section 9 of most routine documents illustrates a simple call of the routine.  The programs are designed so that they can be fairly easily modified, and so serve as the basis for a simple program to solve your problem.</div><div class="paramtext">For each implementation of the Library, NAG distributes the example programs in machine-readable form, with all necessary modifications already applied.  Many sites make the programs accessible to you in this form.  Generic forms of the programs, without implementation-specific modifications, may be obtained directly from the NAG <a class="url" href="http://www.nag.com">web site</a>.  The <a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a> for your implementation will mention any special changes which need to be made to the example programs.</div><div class="paramtext">Note that the results obtained from running the example programs may not be identical in all implementations, and may not agree exactly with the results in the Manual which were obtained from a double precision implementation (with approximately 16 digits of precision).</div><div class="paramtext">For many routine documents, a plot of the example program results is also provided.  In some cases the example program has been modified slightly to produce larger sets of results to give a more representative plot of the solution profile produced.</div><h2 class="standard"><a class="sec" name="support" id="support"/>5&#160;&#160;Support from NAG</h2>
<div class="paramtext"><b>NAG Response Centres</b></div><div class="paramtext">The NAG Response Centres are available for general enquiries from all users and also for technical queries from sites that subscribe to the support service.</div><div class="paramtext">The Response Centres are open during office hours, but contact is possible by fax, email and telephone (answering machine) at all times.  Please see the <a class="url" href="http://www.nag.co.uk/doc/inun/fl23.html">Users' Note</a> or the NAG <a class="url" href="http://www.nag.com">web site</a> for contact details.</div><div class="paramtext">When contacting one of the NAG Response Centres, it helps us to deal with your query quickly if you can quote your NAG user reference and NAG product code.</div><div class="paramtext"><b>NAG Web Site</b></div><div class="paramtext">The NAG <a class="url" href="http://www.nag.com">web site</a> is an information service providing items of interest to users and prospective users of NAG products and services.  The information is regularly updated and reviewed, and includes implementation availability, descriptions of products, downloadable software, case studies, industry articles and technical reports.  The NAG <a class="url" href="http://www.nag.com">web site</a> can be accessed via: <ul class="listind"><li class="listind"><a class="url" href="http://www.nag.co.uk">NAGUK</a></li><li class="listind"><a class="url" href="http://www.nag.com">NAG North America</a></li><li class="listind"><a class="url" href="http://www.nag-j.co.jp">NAG Japan</a></li><li class="listind"><a class="url" href="http://www.nag-gc.com">NAG Taiwan</a></li></ul></div><h2 class="standard"><a class="sec" name="further" id="further"/>6&#160;&#160;Background to NAG</h2>
<div class="paramtext">Various aspects of the design and development of the NAG Library, and NAG's technical policies and organisation are given in <a class="ref" href="#ref227">Ford (1982)</a>, <a class="ref" href="#ref228">Ford <span class="italic">et al.</span> (1979)</a>, <a class="ref" href="#ref229">Ford and Pool (1984)</a>, and <a class="ref" href="#ref230">Hague <span class="italic">et al.</span> (1982)</a>.</div><h2 class="standard"><a class="sec" name="references" id="references"/>7&#160;&#160;References</h2><div class="paramtext"><a name="ref226" id="ref226"/>ACM  (1960&#8211;1976)  Collected algorithms from ACM index by subject to algorithms </div>
<div class="paramtext"><a name="ref252" id="ref252"/>Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999)  <i>LAPACK Users' Guide</i> (3rd Edition) SIAM, Philadelphia <a class="url" href="http://www.netlib.org/lapack/lug">http://www.netlib.org/lapack/lug</a></div>
<div class="paramtext"><a name="ref546" id="ref546"/>ANSI  (1966)  USA standard Fortran <i>Publication X3.9</i> American National Standards Institute </div>
<div class="paramtext"><a name="ref232" id="ref232"/>ANSI  (1978)  American National Standard Fortran <i>Publication X3.9</i> American National Standards Institute </div>
<div class="paramtext"><a name="ref553" id="ref553"/>ANSI/IEEE  (1985)  IEEE standard for binary floating-point arithmetic <i>Std 754-1985</i> IEEE, New York </div>
<div class="paramtext"><a name="ref721" id="ref721"/>ANSI/IEEE POSIX  (1995)  <i>POSIX Standard Thread Library</i> ANSI/IEEE POSIX 1003.1c:1995 </div>
<div class="paramtext"><a name="ref767" id="ref767"/>Basic Linear Algebra Subprograms Technical (BLAST) Forum  (2001)  <i>Basic Linear Algebra Subprograms Technical (BLAST) Forum Standard</i> University of Tennessee, Knoxville, Tennessee <a class="url" href="http://www.netlib.org/blas/blast-forum/blas-report.pdf">http://www.netlib.org/blas/blast-forum/blas-report.pdf</a></div>
<div class="paramtext"><a name="ref763" id="ref763"/>Blackford L S, Demmel J, Dongarra J J, Duff I S, Hammarling S, Henry G, Heroux M, Kaufman L, Lumsdaine A, Petitet A, Pozo R, Remington K and Whaley R C (2002)  An updated set of <span class="italic">Basic Linear Algebra Subprograms (BLAS)</span> <i>ACM Trans. Math. Software</i> <b>28</b> 135&#8211;151 </div>
<div class="paramtext"><a name="ref227" id="ref227"/>Ford B (1982)  Transportable numerical software <i>Lecture Notes in Computer Science</i> <b>142</b> 128&#8211;140 Springer&#8211;Verlag </div>
<div class="paramtext"><a name="ref228" id="ref228"/>Ford B, Bentley J, Du Croz J J and Hague S J (1979)  The NAG Library &#8216;machine&#8217; <i>Softw. Pract. Exper.</i> <b>9 (1)</b> 65&#8211;72 </div>
<div class="paramtext"><a name="ref229" id="ref229"/>Ford B and Pool J C T (1984)  The evolving NAG Library service <i>Sources and Development of Mathematical Software</i> (ed W Cowell) 375&#8211;397 Prentice&#8211;Hall </div>
<div class="paramtext"><a name="ref230" id="ref230"/>Hague S J, Nugent S M and Ford B (1982)  Computer-based documentation for the NAG Library <i>Lecture Notes in Computer Science</i> <b>142</b> 91&#8211;127 Springer&#8211;Verlag </div>
<div class="paramtext"><a name="ref643" id="ref643"/>ISO  (1997)  ISO Fortran 95 programming language (ISO/IEC 1539&#8211;1:1997) </div>
<div class="paramtext"><a name="ref701" id="ref701"/>ISO/IEC  (1990)  Information technology &#8211; programming language C <i>Current C Language Standard</i> ISO/IEC 9899:1990 </div>
<div class="paramtext"><a name="ref702" id="ref702"/>Kernighan B W and Ritchie D M (1988)  <i>The C Programming Language</i> (2nd Edition) Prentice&#8211;Hall </div>
<div class="paramtext"><a name="ref836" id="ref836"/>OpenMP  <i>The OpenMP Specification for Parallel Programming</i> <a class="url" href="http://www.openmp.org">http://www.openmp.org</a></div>
<div class="paramtext"><a name="ref720" id="ref720"/>The BLAS Technical Forum Standard  (2001)   <i>http://www.netlib.org/blas/blast-forum</i> </div><hr/><div><a class="genint" href="../../pdf/GENINT/essint.pdf">Essential Introduction (PDF version)</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2011</a></div></body></html>