<?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>E04DGF/E04DGA : NAG Library, Mark 22</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="rout" href="../../pdf/E04/e04dgf.pdf">E04DGF/E04DGA (PDF version)</a></div><div><a class="chap" href="e04conts.xml">E04 Chapter Contents</a></div><div><a class="chapint" href="e04intro.xml">E04 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Routine Document<br/><br/>E04DGF/E04DGA</h1><div class="paramtext"><div class="header"><b>Note:</b>&#160; before using this routine, please read the Users' Note for your implementation to check the interpretation of <span class="bitalic">bold italicised</span> terms and other implementation-dependent details.</div></div> <div class="paramtext"><b>Note:</b> <span class="italic">this routine uses</span> <b>optional parameters</b> <span class="italic">to define choices in the problem specification and in the details of the algorithm. If you wish to use</span> default <span class="italic">settings for all of the optional parameters, you need only read <a class="sec" href="#purpose">Sections 1</a> to <a class="sec" href="#example">9</a> of this document. 
If, however, you wish to reset some or all of the settings please refer to 
<a class="sec" href="#algdetails">Section 10</a> for a detailed description of the algorithm and to 
<a class="sec" href="#optparams">Section 11</a> for a detailed description of the specification of the optional parameters</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="#purpose">1&#160;&#160;<b>Purpose</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocspecification');"><span class="htmltocplus" id="tocspecificationplus">+</span><span class="htmltocminus" id="tocspecificationminus">&#8722;</span></span>
<a class="htmltoc" href="#specification">2&#160;&#160;<b>Specification</b></a>
<div class="htmltocitem" id="tocspecification">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#routFspec">2.1&#160;&#160;<b>Specification for E04DGF</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#routAspec">2.2&#160;&#160;<b>Specification for E04DGA</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">3&#160;&#160;<b>Description</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">4&#160;&#160;<b>References</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">5&#160;&#160;<b>Parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">6&#160;&#160;<b>Error Indicators and Warnings</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">7&#160;&#160;<b>Accuracy</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocfcomments');"><span class="htmltocplus" id="tocfcommentsplus">+</span><span class="htmltocminus" id="tocfcommentsminus">&#8722;</span></span>
<a class="htmltoc" href="#fcomments">8&#160;&#160;<b>Further Comments</b></a>
<div class="htmltocitem" id="tocfcomments">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments1">8.1&#160;&#160;<b>Description of Printed Output</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocexample');"><span class="htmltocplus" id="tocexampleplus">+</span><span class="htmltocminus" id="tocexampleminus">&#8722;</span></span>
<a class="htmltoc" href="#example">9&#160;&#160;<b>Example</b></a>
<div class="htmltocitem" id="tocexample">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examtext">9.1&#160;&#160;<b>Program Text</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">9.2&#160;&#160;<b>Program Data</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">9.3&#160;&#160;<b>Program Results</b></a>
</div>
</div>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#algdetails">10&#160;&#160;<b>Algorithmic Details</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocoptparams');"><span class="htmltocplus" id="tocoptparamsplus">+</span><span class="htmltocminus" id="tocoptparamsminus">&#8722;</span></span>
<a class="htmltoc" href="#optparams">11&#160;&#160;<b>Optional Parameters</b></a>
<div class="htmltocitem" id="tocoptparams">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#op-checklist">11.1&#160;&#160;<b>Optional Parameter Checklist and Default Values</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#op-description">11.2&#160;&#160;<b>Description of the Optional Parameters</b></a>
</div>
</div>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>
<div class="paramtext">E04DGF/E04DGA minimizes an unconstrained nonlinear function of several variables using a pre-conditioned, limited memory quasi-Newton conjugate gradient method.  First derivatives (or an &#8216;acceptable&#8217; finite difference approximation to them) are required.  It is intended for use on large scale problems.</div>
<div class="paramtext">E04DGA is a version of E04DGF that has additional parameters in order to make it safe for use in multithreaded applications (see <a class="sec" href="#parameters">Section 5</a>).  The initialization routine <a class="rout" href="../E04/e04wbf.xml">E04WBF</a> <b>must</b> have been called before calling E04DGA.</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2><h3 class="standard"><a class="sec" name="routFspec" id="routFspec"/>2.1&#160;&#160;Specification for E04DGF</h3>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;E04DGF&#160;(</td><td class="tdfspec2"><a class="arg" href="#N">N</a>, <a class="arg" href="#OBJFUN">OBJFUN</a>, <a class="arg" href="#ITER">ITER</a>, <a class="arg" href="#OBJF">OBJF</a>, <a class="arg" href="#OBJGRD">OBJGRD</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#IWORK">IWORK</a>, <a class="arg" href="#WORK">WORK</a>, <a class="arg" href="#IUSER">IUSER</a>, <a class="arg" href="#RUSER">RUSER</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, ITER, IWORK(N+1), IUSER(*), IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">OBJF, OBJGRD(N), X(N), WORK(13*N), RUSER(*)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">OBJFUN</td></tr></table><h3 class="standard"><a class="sec" name="routAspec" id="routAspec"/>2.2&#160;&#160;Specification for E04DGA</h3>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;E04DGA&#160;(</td><td class="tdfspec2"><a class="arg" href="#N">N</a>, <a class="arg" href="#OBJFUN">OBJFUN</a>, <a class="arg" href="#ITER">ITER</a>, <a class="arg" href="#OBJF">OBJF</a>, <a class="arg" href="#OBJGRD">OBJGRD</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#IWORK">IWORK</a>, <a class="arg" href="#WORK">WORK</a>, <a class="arg" href="#IUSER">IUSER</a>, <a class="arg" href="#RUSER">RUSER</a>, <a class="arg" href="#LWSAV">LWSAV</a>, <a class="arg" href="#IWSAV">IWSAV</a>, <a class="arg" href="#RWSAV">RWSAV</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, ITER, IWORK(N+1), IUSER(*), IWSAV(610), IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">OBJF, OBJGRD(N), X(N), WORK(13*N), RUSER(*), RWSAV(475)</td></tr><tr><td class="tdfspec1">LOGICAL</td><td class="tdfspec2">LWSAV(120)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">OBJFUN</td></tr></table><div class="paramtext">Before calling E04DGA, or either of the option setting routines <a class="rout" href="../E04/e04djf.xml">E04DJA</a> or <a class="rout" href="../E04/e04dkf.xml">E04DKA</a>, routine <a class="rout" href="../E04/e04wbf.xml">E04WBF</a>
<b>must</b> be called.  The specification for <a class="rout" href="../E04/e04wbf.xml">E04WBF</a> is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;E04WBF&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04wbf.xml#RNAME">RNAME</a>, <a class="arg" href="../E04/e04wbf.xml#CWSAV">CWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#LCWSAV">LCWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#LWSAV">LWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#LLWSAV">LLWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#IWSAV">IWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#LIWSAV">LIWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#RWSAV">RWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#LRWSAV">LRWSAV</a>, <a class="arg" href="../E04/e04wbf.xml#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">LCWSAV, LLWSAV, IWSAV(LIWSAV), LIWSAV, LRWSAV, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">RWSAV(LRWSAV)</td></tr><tr><td class="tdfspec1">LOGICAL</td><td class="tdfspec2">LWSAV(LLWSAV)</td></tr><tr><td class="tdfspec1">CHARACTER*6</td><td class="tdfspec2">RNAME</td></tr><tr><td class="tdfspec1">CHARACTER*80</td><td class="tdfspec2">CWSAV(LCWSAV)</td></tr></table><div class="paramtext"><a class="rout" href="../E04/e04wbf.xml">E04WBF</a> should be called with 
<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="../E04/e04wbf.xml#RNAME"><m:mi mathcolor="#EE0000" mathvariant="bold">RNAME</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'E04DGA'</m:mtext></m:math>.  
<a class="arg" href="../E04/e04wbf.xml#LCWSAV">LCWSAV</a>, 
<a class="arg" href="../E04/e04wbf.xml#LLWSAV">LLWSAV</a>, 
<a class="arg" href="../E04/e04wbf.xml#LIWSAV">LIWSAV</a> and 
<a class="arg" href="../E04/e04wbf.xml#LRWSAV">LRWSAV</a>, the declared lengths of 
<a class="arg" href="../E04/e04wbf.xml#CWSAV">CWSAV</a>, 
<a class="arg" href="../E04/e04wbf.xml#LWSAV">LWSAV</a>, 
<a class="arg" href="../E04/e04wbf.xml#IWSAV">IWSAV</a> and 
<a class="arg" href="../E04/e04wbf.xml#RWSAV">RWSAV</a> respectively, must satisfy:
<ul class="listind"><li class="listind"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="../E04/e04wbf.xml#LCWSAV"><m:mi mathcolor="#EE0000" mathvariant="bold">LCWSAV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math></li><li class="listind"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="../E04/e04wbf.xml#LLWSAV"><m:mi mathcolor="#EE0000" mathvariant="bold">LLWSAV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>120</m:mn></m:math></li><li class="listind"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="../E04/e04wbf.xml#LIWSAV"><m:mi mathcolor="#EE0000" mathvariant="bold">LIWSAV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>610</m:mn></m:math></li><li class="listind"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="../E04/e04wbf.xml#LRWSAV"><m:mi mathcolor="#EE0000" mathvariant="bold">LRWSAV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>475</m:mn></m:math></li></ul>
</div><div class="paramtext">The contents of the arrays 
<a class="arg" href="../E04/e04wbf.xml#CWSAV">CWSAV</a>, 
<a class="arg" href="../E04/e04wbf.xml#LWSAV">LWSAV</a>, 
<a class="arg" href="../E04/e04wbf.xml#IWSAV">IWSAV</a> and 
<a class="arg" href="../E04/e04wbf.xml#RWSAV">RWSAV</a>
<b>must not</b> be altered between calling routines 
E04DGA, <a class="rout" href="../E04/e04djf.xml">E04DJA</a>, <a class="rout" href="../E04/e04dkf.xml">E04DKA</a> and <a class="rout" href="../E04/e04wbf.xml">E04WBF</a>.</div><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">E04DGF/E04DGA is designed to solve unconstrained minimization problems of the form

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:munder>
 <m:mi mathvariant="normal">minimize</m:mi>
 <m:mrow><m:mi>x</m:mi><m:mo>&#8712;</m:mo><m:msup><m:mi>R</m:mi><m:mi>n</m:mi></m:msup></m:mrow>
</m:munder><m:mspace width="0.25em"/>
<m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced><m:mtext>&#8195; subject to &#8195;</m:mtext><m:mrow><m:mo>-</m:mo><m:mi>&#8734;</m:mi></m:mrow><m:mo>&#8804;</m:mo><m:mi>x</m:mi><m:mo>&#8804;</m:mo><m:mi>&#8734;</m:mi><m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

where <m:math><m:mi>x</m:mi></m:math>&#160;is an <m:math><m:mi>n</m:mi></m:math>&#160;element vector.</div><div class="paramtext">You must supply an initial estimate of the solution.</div><div class="paramtext">For maximum reliability, it is preferable to provide all first partial derivatives.  If all of the derivatives cannot be provided, you are recommended to obtain approximate values (using finite differences) by calling <a class="rout" href="../E04/e04xaf.xml">E04XAF/E04XAA</a> from within <a class="arg" href="#OBJFUN">OBJFUN</a>.  This is illustrated in <a class="sec" href="../E04/e04djf.xml#example">Section 9</a> in E04DJF/E04DJA.</div><div class="paramtext">The method used by E04DGF/E04DGA is described in <a class="sec" href="#algdetails">Section 10</a>.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref078" id="ref078"/>Gill P E and Murray W (1979)  Conjugate-gradient methods for large-scale nonlinear optimization <i>Technical Report SOL 79-15</i> Department of Operations Research, Stanford University </div>
<div class="paramtext"><a name="ref079" id="ref079"/>Gill P E, Murray W and Wright M H (1981)  <i>Practical Optimization</i> Academic Press </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="N" id="N"/>1: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: 

<m:math><m:mi>n</m:mi></m:math>, the number of variables.</div>
<div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="OBJFUN" id="OBJFUN"/>2: &#160;&#160;&#8194; OBJFUN &#8211; SUBROUTINE, supplied by the user.<span class="pclass">External Procedure</span></dt><dd>
<div class="paramtext"><a class="arg" href="#OBJFUN">OBJFUN</a> must calculate the objective function <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;and possibly its gradient as well for a specified <m:math><m:mi>n</m:mi></m:math>&#160;element vector <m:math><m:mi>x</m:mi></m:math>.</div><div class="subprog">
<div class="paramtext">The specification of <a class="arg" href="#OBJFUN">OBJFUN</a> is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;OBJFUN&#160;(</td><td class="tdfspec2"><a class="arg" href="../E04/e04dgf.xml#OBJFUN_MODE">MODE</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_N">N</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_X">X</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_OBJF">OBJF</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_OBJGRD">OBJGRD</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_NSTATE">NSTATE</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_IUSER">IUSER</a>, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_RUSER">RUSER</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">MODE, N, NSTATE, IUSER(*)</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), OBJF, OBJGRD(N), RUSER(*)</td></tr></table>
<dl><dt class="paramhead"><a name="OBJFUN_MODE" id="OBJFUN_MODE"/>1: &#160;&#160;&#8194; MODE &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: indicates which values must be assigned during each call of <a class="arg" href="#OBJFUN">OBJFUN</a>.  Only the following values need be assigned: 

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math></dt>
<dd><a class="arg" href="../E04/e04dgf.xml#OBJFUN_OBJF">OBJF</a>.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math></dt>
<dd><a class="arg" href="../E04/e04dgf.xml#OBJFUN_OBJF">OBJF</a> and <a class="arg" href="../E04/e04dgf.xml#OBJFUN_OBJGRD">OBJGRD</a>.</dd></dl>
</div>
<div class="paramtext"><i>On exit</i>: may be set to a negative value if you wish to terminate the solution to the current problem, and in this case E04DGF/E04DGA will terminate with <a class="arg" href="#IFAIL">IFAIL</a> set to <a class="arg" href="../E04/e04dgf.xml#OBJFUN_MODE">MODE</a>.</div></dd><dt class="paramhead"><a name="OBJFUN_N" id="OBJFUN_N"/>2: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mi>n</m:mi></m:math>, the number of variables.</div></dd><dt class="paramhead"><a name="OBJFUN_X" id="OBJFUN_X"/>3: &#160;&#160;&#8194; X(<a class="arg" href="../E04/e04dgf.xml#OBJFUN_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mi>x</m:mi></m:math>, the vector of variables at which the objective function and its gradient are to be evaluated.</div></dd><dt class="paramhead"><a name="OBJFUN_OBJF" id="OBJFUN_OBJF"/>4: &#160;&#160;&#8194; OBJF &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the value of the objective function at <m:math><m:mi>x</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="OBJFUN_OBJGRD" id="OBJFUN_OBJGRD"/>5: &#160;&#160;&#8194; OBJGRD(<a class="arg" href="../E04/e04dgf.xml#OBJFUN_N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_OBJGRD"><m:mi mathcolor="#EE0000" mathvariant="bold">OBJGRD</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow></m:math>&#160;must contain the value of <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub></m:mrow>
 </m:mfrac>
</m:math>&#160;evaluated at <m:math><m:mi>x</m:mi></m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="OBJFUN_NSTATE" id="OBJFUN_NSTATE"/>6: &#160;&#160;&#8194; NSTATE &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: will be <m:math><m:mn>1</m:mn></m:math>&#160;on the first call of <a class="arg" href="#OBJFUN">OBJFUN</a> by E04DGF/E04DGA, and <m:math><m:mn>0</m:mn></m:math>&#160;for all subsequent calls.  Thus, you may wish to test, <a class="arg" href="../E04/e04dgf.xml#OBJFUN_NSTATE">NSTATE</a> within <a class="arg" href="#OBJFUN">OBJFUN</a> in order to perform certain calculations once only.  For example, you may read data or initialize COMMON blocksglobal variables when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_NSTATE"><m:mi mathcolor="#EE0000" mathvariant="bold">NSTATE</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>.</div></dd><dt class="paramhead"><a name="OBJFUN_IUSER" id="OBJFUN_IUSER"/>7: &#160;&#160;&#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dt class="multi-paramhead"><a name="OBJFUN_RUSER" id="OBJFUN_RUSER"/>8: &#160;&#160;&#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><a class="arg" href="#OBJFUN">OBJFUN</a> is called from E04DGF/E04DGA with the parameters <a class="arg" href="../E04/e04dgf.xml#OBJFUN_IUSER">IUSER</a> and <a class="arg" href="../E04/e04dgf.xml#OBJFUN_RUSER">RUSER</a> as supplied to E04DGF/E04DGA.  You are free to use arrays <a class="arg" href="../E04/e04dgf.xml#OBJFUN_IUSER">IUSER</a> and <a class="arg" href="../E04/e04dgf.xml#OBJFUN_RUSER">RUSER</a> to supply information to <a class="arg" href="#OBJFUN">OBJFUN</a> as an alternative to using 
COMMON. 

</div></dd></dl>
</div>
<div class="paramtext"><a class="arg" href="#OBJFUN">OBJFUN</a> must be declared as EXTERNAL in the (sub)program from which E04DGF/E04DGA is called. Parameters denoted as <span class="italic">Input</span>  must <b>not</b>  be changed by this procedure.</div>
<div class="paramtext"><b>Note:</b>&#160; <a class="arg" href="#OBJFUN">OBJFUN</a> should be tested separately before being used in conjunction with E04DGF/E04DGA.  See also the description of the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verify"><m:mi mathcolor="#800080;" mathvariant="bold">Verify</m:mi></m:maction></m:math>.</div>
</dd><dt class="paramhead"><a name="ITER" id="ITER"/>3: &#160;&#160;&#8194; ITER &#8211; INTEGER<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the total number of iterations performed.</div></dd><dt class="paramhead"><a name="OBJF" id="OBJF"/>4: &#160;&#160;&#8194; OBJF &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the value of the objective function at the final iterate.</div></dd><dt class="paramhead"><a name="OBJGRD" id="OBJGRD"/>5: &#160;&#160;&#8194; OBJGRD(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the gradient of the objective function at the final iterate (or its finite difference approximation).</div></dd><dt class="paramhead"><a name="X" id="X"/>6: &#160;&#160;&#8194; X(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: an initial estimate of the solution.</div>
<div class="paramtext"><i>On exit</i>: the final estimate of the solution.</div></dd><dt class="paramhead"><a name="IWORK" id="IWORK"/>7: &#160;&#160;&#8194; IWORK(<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>1</m:mn></m:math>) &#8211; INTEGER array<span class="pclass">Workspace</span></dt><dt class="multi-paramhead"><a name="WORK" id="WORK"/>8: &#160;&#160;&#8194; WORK(<m:math><m:mn>13</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Workspace</span></dt><dt class="paramhead"><a name="IUSER" id="IUSER"/>9: &#160;&#160;&#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#IUSER">IUSER</a>
must be at least
<m:math><m:mn>1</m:mn></m:math>.</div>
<div class="paramtext">This array is not used by E04DGF/E04DGA, but is passed directly to <a class="arg" href="#OBJFUN">OBJFUN</a> and may be used to supply information to <a class="arg" href="#OBJFUN">OBJFUN</a>.</div></dd><dt class="paramhead"><a name="RUSER" id="RUSER"/>10: &#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#RUSER">RUSER</a>
must be at least
<m:math><m:mn>1</m:mn></m:math>.</div>
<div class="paramtext">This array is not used by E04DGF/E04DGA, but is passed directly to <a class="arg" href="#OBJFUN">OBJFUN</a> and may be used to supply information to <a class="arg" href="#OBJFUN">OBJFUN</a>.</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>11: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> <span class="italic">for E04DGA, <a class="arg" href="#IFAIL">IFAIL</a> does not occur in this position in the parameter list.  See the additional parameters described below</span>.</div><div class="paramtext"><i>On entry</i>: <a class="arg" href="#IFAIL">IFAIL</a> must be set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>. If you are unfamiliar with this parameter you should refer to <a class="sec" href="../GENINT/essint.xml#library3">Section 3.3</a> in  the Essential Introduction for details.</div>
<div class="paramtext"><i>On exit</i>: <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;unless the routine detects an error (see <a class="sec" href="#errors">Section 6</a>).
<div class="paramtext">For environments where it might be inappropriate to halt program execution when an error is detected, the value <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is recommended.  If the output of error messages is undesirable, then the value <m:math><m:mn>1</m:mn></m:math>&#160;is recommended.  Otherwise, because for this routine the values of the output parameters may be useful even if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>&#8800;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;on exit, the recommended value is <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>.  <b>When the value <m:math><m:mrow><m:mo>-</m:mo><m:mn mathvariant="bold">1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is used it is essential to test the value of <a class="arg" href="#IFAIL">IFAIL</a> on exit.</b></div>
</div><div class="paramtext">E04DGF/E04DGA returns with <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;if the following three conditions are satisfied:
<table class="standard-90"><tr>
<td style="width:2.1em;" valign="baseline">(i)</td>
<td valign="top"><m:math><m:msub><m:mi>F</m:mi><m:mrow><m:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>-</m:mo><m:msub><m:mi>F</m:mi><m:mi>k</m:mi></m:msub><m:mo>&lt;</m:mo><m:msub><m:mi>&#964;</m:mi><m:mi>F</m:mi></m:msub><m:mfenced separators=""><m:mn>1</m:mn><m:mo>+</m:mo><m:mfenced open="|" close="|" separators=""><m:msub><m:mi>F</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:mfenced></m:math></td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(ii)</td>
<td valign="top"><m:math><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:msub><m:mi>x</m:mi><m:mrow><m:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:mfenced><m:mo>&lt;</m:mo><m:msqrt><m:msub><m:mi>&#964;</m:mi><m:mi>F</m:mi></m:msub></m:msqrt><m:mfenced separators=""><m:mn>1</m:mn><m:mo>+</m:mo><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:mfenced></m:math></td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(iii)</td>
<td valign="top"><m:math><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:msub><m:mi>g</m:mi><m:mi>k</m:mi></m:msub></m:mfenced><m:mo>&#8804;</m:mo><m:mroot><m:msub><m:mi>&#964;</m:mi><m:mi>F</m:mi></m:msub><m:mn>3</m:mn></m:mroot><m:mfenced separators=""><m:mn>1</m:mn><m:mo>+</m:mo><m:mfenced open="|" close="|" separators=""><m:msub><m:mi>F</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:mfenced></m:math>&#160;or <m:math><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:msub><m:mi>g</m:mi><m:mi>k</m:mi></m:msub></m:mfenced><m:mo>&lt;</m:mo><m:msub><m:mi>&#949;</m:mi><m:mi>A</m:mi></m:msub></m:math></td>
</tr></table>
</div>
<div class="paramtext">where <m:math><m:msub><m:mi>&#964;</m:mi><m:mi>F</m:mi></m:msub></m:math>&#160;is the value of the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_optimalitytolerance"><m:mi mathcolor="#800080;" mathvariant="bold">Optimality Tolerance</m:mi></m:maction></m:math>&#160;(<m:math><m:mtext>default value</m:mtext><m:mo>=</m:mo><m:msup><m:mi>&#949;</m:mi><m:mn>0.8</m:mn></m:msup></m:math>) and <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>A</m:mi></m:msub></m:math>&#160;is the absolute error associated with computing the objective function.</div>
<div class="paramtext">For a full discussion on termination criteria see Chapter 8 of <a class="ref" href="#ref079">Gill <span class="italic">et al.</span> (1981)</a>.</div>
</dd><dd class="note"><b>Note:</b> <span class="italic"> the following are additional parameters for specific use with E04DGA.  Users of E04DGF therefore need not read the remainder of this description</span>.</dd><dt class="paramhead"><a name="LWSAV" id="LWSAV"/>11: &#8194; LWSAV(<m:math><m:mn>120</m:mn></m:math>) &#8211; LOGICAL array<span class="pclass">Communication Array</span></dt><dt class="multi-paramhead"><a name="IWSAV" id="IWSAV"/>12: &#8194; IWSAV(<m:math><m:mn>610</m:mn></m:math>) &#8211; INTEGER array<span class="pclass">Communication Array</span></dt><dt class="multi-paramhead"><a name="RWSAV" id="RWSAV"/>13: &#8194; RWSAV(<m:math><m:mn>475</m:mn></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Communication Array</span></dt><dd><div class="paramtext">The arrays <a class="arg" href="#LWSAV">LWSAV</a>, <a class="arg" href="#IWSAV">IWSAV</a> and <a class="arg" href="#RWSAV">RWSAV</a> <b>must not</b> be altered between calls to any of the routines <a class="rout" href="../E04/e04dgf.xml">E04DGA</a>, <a class="rout" href="../E04/e04djf.xml">E04DJA</a>, <a class="rout" href="../E04/e04dkf.xml">E04DKA</a> or <a class="rout" href="../E04/e04wbf.xml">E04WBF</a>.</div></dd><dt class="paramhead"><a name="IFAIL2" id="IFAIL2"/>14: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><b>Note:</b> see the parameter description for <a class="arg" href="#IFAIL">IFAIL</a> above.</div></dd></dl><h2 class="standard"><a class="sec" name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
<div class="paramtext">If on entry <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">-1</m:mn></m:maction></m:math>, explanatory error messages are output on the current error message unit (as defined by <a class="rout" href="../X04/x04aaf.xml">X04AAF</a>).</div><div class="paramtext"><b>Note:</b> E04DGF/E04DGA may return useful information for one or more of the following detected errors or warnings.</div><div class="paramtext">Errors or warnings detected by the routine:</div>
<dl class="ifail">
<dt class="errorhead"><a name="IFlt0" id="IFlt0"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math></dt>
<dd>
<div class="paramtext">A negative value of <a class="arg" href="#IFAIL">IFAIL</a> indicates an exit from E04DGF/E04DGA because you set <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#OBJFUN_MODE"><m:mi mathcolor="#EE0000" mathvariant="bold">MODE</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;in <a class="arg" href="#OBJFUN">OBJFUN</a>.  The value of <a class="arg" href="#IFAIL">IFAIL</a> will be the same as your setting of <a class="arg" href="../E04/e04dgf.xml#OBJFUN_MODE">MODE</a>.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq1" id="IFeq1"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math></dt>
<dd><div class="paramtext">
Not used by this routine.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq2" id="IFeq2"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math></dt>
<dd><div class="paramtext">
Not used by this routine.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq3" id="IFeq3"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>3</m:mn></m:math></dt>
<dd>
<div class="paramtext">The limiting number of iterations (as determined by the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_iterationlimit"><m:mi mathcolor="#800080;" mathvariant="bold">Iteration Limit</m:mi></m:maction></m:math>&#160;(<m:math><m:mtext>default value</m:mtext><m:mo>=</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>50</m:mn><m:mo>,</m:mo><m:mrow><m:mn>5</m:mn><m:mi>n</m:mi></m:mrow></m:mfenced></m:mrow></m:math>) has been reached.</div>
<div class="paramtext">If the algorithm appears to be making satisfactory progress, then optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_iterationlimit"><m:mi mathcolor="#800080;" mathvariant="bold">Iteration Limit</m:mi></m:maction></m:math>&#160;may be too small.  If so, increase its value and rerun E04DGF/E04DGA.  If the algorithm seems to be making little or no progress, then you should check for incorrect gradients as described under <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq7"><m:mn mathcolor="#003399" mathvariant="bold">7</m:mn></m:maction></m:math>.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq4" id="IFeq4"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>4</m:mn></m:math></dt>
<dd>
<div class="paramtext">The computed upper bound on the step length taken during the linesearch was too small.  A rerun with an increased value of the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_maximumsteplength"><m:mi mathcolor="#800080;" mathvariant="bold">Maximum Step Length</m:mi></m:maction></m:math>&#160;(<m:math><m:mi>&#961;</m:mi></m:math>&#160;say) may be successful unless <m:math><m:mi>&#961;</m:mi><m:mo>&#8805;</m:mo><m:msup><m:mn>10</m:mn><m:mn>20</m:mn></m:msup></m:math>&#160;(the default value), in which case the current point cannot be improved upon.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq5" id="IFeq5"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>5</m:mn></m:math></dt>
<dd><div class="paramtext">
Not used by this routine.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq6" id="IFeq6"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>6</m:mn></m:math></dt>
<dd>
<div class="paramtext">The conditions for an acceptable solution (see parameter <a class="arg" href="#IFAIL">IFAIL</a> in <a class="sec" href="#parameters">Section 5</a>) have not all been met, but a lower point could not be found.</div>
<div class="paramtext">If <a class="arg" href="#OBJFUN">OBJFUN</a> computes the objective function and its gradient correctly, then this may occur because an overly stringent accuracy has been requested, i.e., the value of the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_optimalitytolerance"><m:mi mathcolor="#800080;" mathvariant="bold">Optimality Tolerance</m:mi></m:maction></m:math>&#160;(<m:math><m:mtext>default value</m:mtext><m:mo>=</m:mo><m:msup><m:mi>&#949;</m:mi><m:mn>0.8</m:mn></m:msup></m:math>) is too small or if <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub><m:mo>&#8771;</m:mo><m:mn>0</m:mn></m:math>.  In this case you should apply the three tests described under <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;to determine whether or not the final solution is acceptable.  For a discussion of attainable accuracy see <a class="ref" href="#ref079">Gill <span class="italic">et al.</span> (1981)</a>.</div>
<div class="paramtext">If many iterations have occurred in which essentially no progress has been made or E04DGF/E04DGA has failed to move from the initial point, <a class="arg" href="#OBJFUN">OBJFUN</a> may be incorrect.  You should refer to the comments below under <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFeq7"><m:mn mathcolor="#003399" mathvariant="bold">7</m:mn></m:maction></m:math>&#160;and check the gradients using the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verify"><m:mi mathcolor="#800080;" mathvariant="bold">Verify</m:mi></m:maction></m:math>&#160;(<m:math><m:mtext>default value</m:mtext><m:mo>=</m:mo><m:mn>0</m:mn></m:math>).  Unfortunately, there may be small errors in the objective gradients that cannot be detected by the verification process.  Finite-difference approximations to first derivatives are catastrophically affected by even small inaccuracies.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq7" id="IFeq7"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>7</m:mn></m:math></dt>
<dd>
<div class="paramtext">The user-supplied derivatives of the objective function appear to be incorrect.</div>
<div class="paramtext">Large errors were found in the derivatives of the objective function.  This value of <a class="arg" href="#IFAIL">IFAIL</a> will occur if the verification process indicated that at least one gradient element had no correct figures.  You should refer to the printed output to determine which elements are suspected to be in error.</div>
<div class="paramtext">As a first step, you should check that the code for the objective values is correct &#8211; for example, by computing the function at a point where the correct value is known.  However, care should be taken that the chosen point fully tests the evaluation of the function.  It is remarkable how often the values <m:math><m:mi>x</m:mi><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:mi>x</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;are used to test function evaluation procedures, and how often the special properties of these numbers make the test meaningless.</div>
<div class="paramtext">Special care should be used in this test if computation of the objective function involves subsidiary data communicated in COMMON storage.  Although the first evaluation of the function may be correct, subsequent calculations may be in error because some of the subsidiary data has accidentally been overwritten.</div>
<div class="paramtext">Errors in programming the function may be quite subtle in that the function value is &#8216;almost&#8217; correct.  For example, the function may not be accurate to full precision because of the inaccurate calculation of a subsidiary quantity, or the limited accuracy of data upon which the function depends.  A common error on machines where numerical calculations are usually performed in double precision is to include even one single precision constant in the calculation of the function; since some compilers do not convert such constants to double precision, half the correct figures may be lost by such a seemingly trivial error.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq8" id="IFeq8"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>8</m:mn></m:math></dt>
<dd>
<div class="paramtext">The gradient <m:math><m:mfenced separators=""><m:mi>g</m:mi><m:mo>=</m:mo><m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>F</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>x</m:mi></m:mrow>
 </m:mfrac></m:mfenced></m:math>&#160;at the starting point <m:math><m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;is &#8216;too small&#8217;.  More precisely, the value of <m:math>
 <m:mi>g</m:mi><m:msup><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub></m:mfenced><m:mi mathvariant="normal">T</m:mi></m:msup>
 <m:mi>g</m:mi><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub></m:mfenced>
</m:math>&#160;is less than <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub><m:mfenced open="|" close="|" separators=""><m:mn>1</m:mn><m:mo>+</m:mo><m:mi>F</m:mi><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub></m:mfenced></m:mfenced></m:math>, where <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;is the value of the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_functionprecision"><m:mi mathcolor="#800080;" mathvariant="bold">Function Precision</m:mi></m:maction></m:math>&#160;(<m:math><m:mtext>default value</m:mtext><m:mo>=</m:mo><m:msup><m:mi>&#949;</m:mi><m:mn>0.9</m:mn></m:msup></m:math>).</div>
<div class="paramtext">The problem should be rerun from a different starting point.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq9" id="IFeq9"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>9</m:mn></m:math></dt>
<dd><div class="paramtext">
An input parameter is invalid.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">On successful exit (<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>) the accuracy of the solution will be as defined by the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_optimalitytolerance"><m:mi mathcolor="#800080;" mathvariant="bold">Optimality Tolerance</m:mi></m:maction></m:math>&#160;(<m:math><m:mtext>default value</m:mtext><m:mo>=</m:mo><m:msup><m:mi>&#949;</m:mi><m:mn>0.8</m:mn></m:msup></m:math>).</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">To evaluate an &#8216;acceptable&#8217; set of finite difference intervals using <a class="rout" href="../E04/e04xaf.xml">E04XAF/E04XAA</a> requires <m:math><m:mn>2</m:mn></m:math>&#160;function evaluations per variable for a well-scaled problem and up to <m:math><m:mn>6</m:mn></m:math>&#160;function evaluations per variable for a badly scaled problem.</div><h3 class="standard"><a class="sec" name="fcomments1" id="fcomments1"/>8.1&#160;&#160;Description of Printed Output</h3>
<div class="paramtext">This section describes the intermediate printout and final printout produced by E04DGF/E04DGA.  You can control the level of printed output (see the description of the optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_printlevel"><m:mi mathcolor="#800080;" mathvariant="bold">Print Level</m:mi></m:maction></m:math>).  Note that the intermediate printout and final printout are produced only if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_printlevel"><m:mi mathcolor="#800080;" mathvariant="bold">Print Level</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>10</m:mn></m:math>&#160;(the default
for E04DGF, by default no output is produced by E04DGA).</div><div class="paramtext">The following line of summary output (<m:math><m:mtext/><m:mo>&lt;</m:mo><m:mn>80</m:mn></m:math>&#160;characters) is produced at every iteration.  In all cases, the values of the quantities are those in effect <span class="italic">on completion</span> of the given iteration.
<table class="standard-100"><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Itn</span></td>
<td valign="top">
is the iteration count.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Step</span></td>
<td valign="top">
is the step <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;taken along the computed search direction.  On reasonably well-behaved problems, the unit step (i.e., <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mn>1</m:mn></m:math>) will be taken as the solution is approached.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Nfun</span></td>
<td valign="top">
is the cumulated number of evaluations of the objective function needed for the linesearch.  Evaluations needed for the verification of the gradients by finite differences are not included.  <span class="mono">Nfun</span> is printed as a guide to the amount of work required for the linesearch.  E04DGF/E04DGA will perform at most <m:math><m:mn>11</m:mn></m:math>&#160;function evaluations per iteration.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Objective</span></td>
<td valign="top">
is the value of the objective function at <m:math><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:math>.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Norm G</span></td>
<td valign="top">
is the Euclidean norm of the gradient of the objective function at <m:math><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:math>.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Norm X</span></td>
<td valign="top">
is the Euclidean norm of <m:math><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:math>.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Norm (X(k-1)-X(k))</span></td>
<td valign="top">
is the Euclidean norm of <m:math><m:msub><m:mi>x</m:mi><m:mrow><m:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:math>.
</td>
</tr></table>
</div><div class="paramtext">The following describes the printout for each variable.
<table class="standard-100"><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Variable</span></td>
<td valign="top">
gives the name (<span class="mono">Varbl</span>) and index <m:math><m:mi>j</m:mi></m:math>, for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>&#160;of the variable.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Value</span></td>
<td valign="top">
is the value of the variable at the final iteration.
</td>
</tr><tr>
<td style="width:12.0em;" valign="baseline"><span class="mono">Gradient Value</span></td>
<td valign="top">
is the value of the gradient of the objective function with respect to the <m:math><m:mi>j</m:mi></m:math>th variable at the final iteration.
</td>
</tr></table>
</div><div class="paramtext">Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example finds a minimum of the function

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>F</m:mi><m:mo>=</m:mo><m:msup><m:mi>e</m:mi><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub></m:msup><m:mfenced separators=""><m:mn>4</m:mn><m:msubsup><m:mi>x</m:mi><m:mn>1</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:mn>2</m:mn><m:msubsup><m:mi>x</m:mi><m:mn>2</m:mn><m:mn>2</m:mn></m:msubsup><m:mo>+</m:mo><m:mn>4</m:mn><m:msub><m:mi>x</m:mi><m:mn>1</m:mn></m:msub><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>+</m:mo><m:mn>2</m:mn><m:msub><m:mi>x</m:mi><m:mn>2</m:mn></m:msub><m:mo>+</m:mo><m:mn>1</m:mn></m:mfenced><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

The initial point is

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub>
 <m:mo>=</m:mo>
 <m:msup><m:mfenced separators=""><m:mrow><m:mo>-</m:mo><m:mn>1.0</m:mn></m:mrow><m:mo>,</m:mo><m:mn>1.0</m:mn></m:mfenced><m:mi mathvariant="normal">T</m:mi></m:msup>
 <m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

and <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub></m:mfenced><m:mo>=</m:mo><m:mn>1.8394</m:mn></m:math>&#160;(to five figures).</div><div class="paramtext">The optimal solution is

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msup><m:mi>x</m:mi><m:mo>*</m:mo></m:msup>
 <m:mo>=</m:mo>
 <m:msup><m:mfenced separators=""><m:mn>0.5</m:mn><m:mo>,</m:mo><m:mrow><m:mo>-</m:mo><m:mn>1.0</m:mn></m:mrow></m:mfenced><m:mi mathvariant="normal">T</m:mi></m:msup>
 <m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

and <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:msup><m:mi>x</m:mi><m:mo>*</m:mo></m:msup></m:mfenced><m:mo>=</m:mo><m:mn>0</m:mn></m:math>.</div><div class="paramtext">The document for <a class="rout" href="../E04/e04djf.xml">E04DJF/E04DJA</a> includes an example program to solve the same problem using some of the optional parameters described in <a class="sec" href="#optparams">Section 11</a>.</div><h3 class="standard"><a class="sec" name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
<div class="paramtext"><b>Note:</b> <span class="italic">the following programs illustrate the use of E04DGF and E04DGA</span>.</div><p><a class="verbatimref" href="../../examples/source/e04dgfe.f">Program Text (e04dgfe.f)</a></p><p><a class="verbatimref" href="../../examples/source/e04dgae.f">Program Text (e04dgae.f)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<p><a class="verbatimref" href="../../examples/data/e04dgfe.d">Program&#160;Data (e04dgfe.d)</a></p><p><a class="verbatimref" href="../../examples/data/e04dgae.d">Program&#160;Data (e04dgae.d)</a></p><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/e04dgfe.r">Program Results (e04dgfe.r)</a></p><p><a class="verbatimref" href="../../examples/baseresults/e04dgae.r">Program Results (e04dgae.r)</a></p>
<div class="paramtext"><b>Note:</b> <span class="italic">the remainder of this document is intended for more advanced users.  <a class="sec" href="#algdetails">Section 10</a> contains a detailed description of the algorithm which may be needed in order to understand <a class="sec" href="#optparams">Section 11</a>.  <a class="sec" href="#optparams">Section 11</a> describes the optional parameters which may be set by calls to <a class="rout" href="../E04/e04djf.xml">E04DJF/E04DJA</a> and/or <a class="rout" href="../E04/e04dkf.xml">E04DKF/E04DKA</a></span>.</div><h2 class="standard"><a class="sec" name="algdetails" id="algdetails"/>10&#160;&#160;Algorithmic Details</h2>
<div class="paramtext">This section contains a description of the method used by E04DGF/E04DGA.</div><div class="paramtext">E04DGF/E04DGA uses a pre-conditioned conjugate gradient method and is based upon algorithm PLMA as described in Section 4.8.3 of <a class="ref" href="#ref078">Gill and Murray (1979)</a> and <a class="ref" href="#ref079">Gill <span class="italic">et al.</span> (1981)</a>.</div><div class="paramtext">The algorithm proceeds as follows:</div><div class="paramtext">Let <m:math><m:msub><m:mi>x</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;be a given starting point and let <m:math><m:mi>k</m:mi></m:math>&#160;denote the current iteration, starting with <m:math><m:mi>k</m:mi><m:mo>=</m:mo><m:mn>0</m:mn></m:math>.  The iteration requires <m:math><m:msub><m:mi>g</m:mi><m:mi>k</m:mi></m:msub></m:math>, the gradient vector evaluated at <m:math><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub></m:math>, the <m:math><m:mi>k</m:mi></m:math>th estimate of the minimum.  At each iteration a vector <m:math><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;(known as the direction of search) is computed and the new estimate <m:math><m:msub><m:mi>x</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:math>&#160;is given by <m:math><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub><m:mo>+</m:mo><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;where <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;(the step length) minimizes the function <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub><m:mo>+</m:mo><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:math>&#160;with respect to the scalar <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub></m:math>.  A choice of initial step <m:math><m:msub><m:mi>&#945;</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;is taken as

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>&#945;</m:mi><m:mn>0</m:mn></m:msub>
 <m:mo>=</m:mo>
 <m:mrow><m:mi>min</m:mi><m:mspace width="0.125em"/><m:mfenced separators="" open="{" close="}"><m:mn>1</m:mn><m:mo>,</m:mo><m:mrow>
    <m:mn>2</m:mn>
    <m:mo>&#215;</m:mo>
    <m:mfenced open="|" close="|" separators=""><m:msub><m:mi>F</m:mi><m:mi>k</m:mi></m:msub><m:mo>-</m:mo><m:msub><m:mi>F</m:mi><m:mi mathvariant="normal">est</m:mi></m:msub></m:mfenced>
    <m:mo>/</m:mo>
    <m:msubsup><m:mi>g</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
    <m:msub><m:mi>g</m:mi><m:mi>k</m:mi></m:msub>
   </m:mrow></m:mfenced></m:mrow>
</m:math></td><td class="formula2"/></tr></table></div>

where <m:math><m:msub><m:mi>F</m:mi><m:mi mathvariant="normal">est</m:mi></m:msub></m:math>&#160;is a user-supplied estimate of the function value at the solution.  If <m:math><m:msub><m:mi>F</m:mi><m:mi mathvariant="normal">est</m:mi></m:msub></m:math>&#160;is not specified, the software always chooses the unit step length for <m:math><m:msub><m:mi>&#945;</m:mi><m:mn>0</m:mn></m:msub></m:math>.  Subsequent step length estimates are computed using cubic interpolation with safeguards.</div><div class="paramtext">A quasi-Newton method can be used to compute the search direction <m:math><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;by updating the inverse of the approximate Hessian <m:math><m:mfenced separators=""><m:msub><m:mi>H</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:math>&#160;and computing

<div class="formula-eqn"><a name="eqn1" id="eqn1"/><table class="formula-eqn"><tr><td class="formula-eqn"><m:math display="block">
<m:msub><m:mi>p</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>=</m:mo><m:mo>-</m:mo><m:msub><m:mi>H</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mtext>.</m:mtext>
</m:math></td><td class="formula-eqn2">
      (1)
     </td></tr></table></div>

The updating formula for the approximate inverse is given by

<div class="formula-eqn"><a name="eqn2" id="eqn2"/><table class="formula-eqn"><tr><td class="formula-eqn"><m:math display="block">
 <m:msub><m:mi>H</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
 <m:mo>=</m:mo>
 <m:msub><m:mi>H</m:mi><m:mi>k</m:mi></m:msub>
 <m:mo>-</m:mo>
 <m:mfrac>
  <m:mn>1</m:mn>
  <m:mrow>
   <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
   <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
  </m:mrow>
 </m:mfrac>
 <m:mfenced separators="">
  <m:msub><m:mi>H</m:mi><m:mi>k</m:mi></m:msub>
  <m:msub><m:mi>y</m:mi><m:mi>k</m:mi></m:msub>
  <m:msubsup><m:mi>s</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
  <m:mo>+</m:mo>
  <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
  <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
  <m:msub><m:mi>H</m:mi><m:mi>k</m:mi></m:msub>
 </m:mfenced>
 <m:mo>+</m:mo>
 <m:mfrac>
  <m:mn>1</m:mn>
  <m:mrow>
   <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
   <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
  </m:mrow>
 </m:mfrac>
 <m:mfenced separators="">
  <m:mn>1</m:mn>
  <m:mo>+</m:mo>
  <m:mfrac>
   <m:mrow>
    <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
    <m:msub><m:mi>H</m:mi><m:mi>k</m:mi></m:msub>
    <m:msub><m:mi>y</m:mi><m:mi>k</m:mi></m:msub>
   </m:mrow>
   <m:mrow>
    <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
    <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
   </m:mrow>
  </m:mfrac>
 </m:mfenced>
 <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
 <m:msubsup><m:mi>s</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
 <m:mtext>,</m:mtext>
</m:math></td><td class="formula-eqn2">
      (2)
     </td></tr></table></div>

where <m:math><m:msub><m:mi>y</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>-</m:mo><m:msub><m:mi>g</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:msub><m:mi>x</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>-</m:mo><m:msub><m:mi>x</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:msub><m:mi>&#945;</m:mi><m:mi>k</m:mi></m:msub><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:math>.</div><div class="paramtext">The method used to obtain the search direction is based upon computing <m:math><m:msub><m:mi>p</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:math>&#160;as <m:math><m:mrow><m:mo>-</m:mo><m:msub><m:mi>H</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:mrow><m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:math>&#160;where <m:math><m:msub><m:mi>H</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:math>&#160;is a matrix obtained by updating the identity matrix with a limited number of quasi-Newton corrections.  The storage of an <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;matrix is avoided by storing only the vectors that define the rank two corrections &#8211; hence the term &#8216;limited-memory&#8217; quasi-Newton method.  The precise method depends upon the number of updating vectors stored.  For example, the direction obtained with the &#8216;one-step&#8217; limited memory update is given by <a class="eqn" href="#eqn1">(1)</a> using <a class="eqn" href="#eqn2">(2)</a> with <m:math><m:msub><m:mi>H</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;equal to the identity matrix, viz.

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>p</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
 <m:mo>=</m:mo>
 <m:mo>-</m:mo>
 <m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
 <m:mo>+</m:mo>
 <m:mfrac>
  <m:mn>1</m:mn>
  <m:mrow>
   <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
   <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
  </m:mrow>
 </m:mfrac>
 <m:mfenced separators="">
  <m:msubsup><m:mi>s</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
  <m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
  <m:msub><m:mi>y</m:mi><m:mi>k</m:mi></m:msub>
  <m:mo>+</m:mo>
  <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
  <m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
  <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
 </m:mfenced>
 <m:mo>-</m:mo>
 <m:mfrac>
  <m:mrow>
   <m:msubsup><m:mi>s</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
   <m:msub><m:mi>g</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub>
  </m:mrow>
  <m:mrow>
   <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
   <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
  </m:mrow>
 </m:mfrac>
 <m:mfenced separators="">
  <m:mn>1</m:mn>
  <m:mo>+</m:mo>
  <m:mfrac>
   <m:mrow>
    <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
    <m:msub><m:mi>y</m:mi><m:mi>k</m:mi></m:msub>
   </m:mrow>
   <m:mrow>
    <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
    <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
   </m:mrow>
  </m:mfrac>
 </m:mfenced>
 <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
 <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

Using a limited-memory quasi-Newton formula, such as the one above, guarantees <m:math><m:msub><m:mi>p</m:mi><m:mrow><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:msub></m:math>&#160;to be a descent direction if all the inner products <m:math>
 <m:msubsup><m:mi>y</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
 <m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub>
</m:math>&#160;are positive for all vectors <m:math><m:msub><m:mi>y</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>s</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;used in the updating formula.</div><h2 class="standard"><a class="sec" name="optparams" id="optparams"/>11&#160;&#160;Optional Parameters</h2>
<div class="paramtext">Several optional parameters in E04DGF/E04DGA define choices in the problem specification or the algorithm logic.  In order to reduce the number of formal parameters of E04DGF/E04DGA these optional parameters have associated <span class="italic">default values</span> that are appropriate for most problems.  Therefore, you need only specify those optional parameters whose values are to be different from their default values.</div><div class="paramtext">The remainder of this section can be skipped if you wish to use the default values for <span class="italic">all</span> optional parameters.  A complete list of optional parameters and their default values is given in <a class="sec" href="#op-checklist">Section 11.1</a>.</div><div class="paramtext">Optional parameters may be specified by calling one, or both, of the routines <a class="rout" href="../E04/e04djf.xml">E04DJF/E04DJA</a> and <a class="rout" href="../E04/e04dkf.xml">E04DKF/E04DKA</a> before a call to E04DGF/E04DGA.</div><div class="paramtext"><a class="rout" href="../E04/e04djf.xml">E04DJF/E04DJA</a> reads options from an external options file, with <span class="mono">Begin</span> and <span class="mono">End</span> as the first and last lines respectively and each intermediate line defining a single optional parameter.  For example,
<pre class="verbatim">
Begin
   Print Level = 1
End
</pre>
</div><div class="paramtext">The call
<pre class="verbatim">
 CALL E04DJF (IOPTNS, INFORM)
</pre>
can then be used to read the file on unit <a class="arg" href="../E04/e04djf.xml#IOPTNS">IOPTNS</a>. <a class="arg" href="../E04/e04djf.xml#INFORM">INFORM</a> will be zero on successful exit.  <a class="rout" href="../E04/e04djf.xml">E04DJF/E04DJA</a> should be consulted for a full description of this method of supplying optional parameters.</div><div class="paramtext"><a class="rout" href="../E04/e04dkf.xml">E04DKF/E04DKA</a> can be called to supply options directly, one call being necessary for each optional parameter.  For example,
<pre class="verbatim">
 CALL E04DKF ('Print Level = 1')
</pre><a class="rout" href="../E04/e04dkf.xml">E04DKF/E04DKA</a> should be consulted for a full description of this method of supplying optional parameters.</div><div class="paramtext">All optional parameters not specified by you are set to their default values.  Optional parameters specified by you are unaltered by E04DGF/E04DGA (unless they define invalid values) and so remain in effect for subsequent calls unless altered by you.</div><h3 class="standard"><a class="sec" name="op-checklist" id="op-checklist"/>11.1&#160;&#160;Optional Parameter Checklist and Default Values</h3>
<div class="paramtext">
The following list gives the valid options.  For each option, we give the keyword, any essential optional qualifiers and the default value.  A definition for each option can be found in <a class="sec" href="#op-description">Section 11.2</a>, where the minimum abbreviation of each keyword is underlined (if no characters of an optional qualifier are underlined, the qualifier may be omitted), the letter <span class="italic">a</span> denotes a phrase (character string) that qualifies an option, the letters <m:math><m:mi>i</m:mi></m:math>&#160;and <m:math><m:mi>r</m:mi></m:math>&#160;denote INTEGER and <span class="bitalic">double precision</span> values required with certain options, the number <m:math><m:mi>&#949;</m:mi></m:math>&#160;is a generic notation for <span class="bitalic">machine precision</span> (see <a class="rout" href="../X02/x02ajf.xml">X02AJF</a>), and <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;denotes the relative precision of the objective function.</div><div class="left-tablediv"><table class="optparam"><tbody>
<tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><b>Optional Parameter</b></td><td class="libdoc" valign="top" align="left"><b>Default&#160;Value</b></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_defaults">Defaults</a></td>
<td class="libdoc" valign="top" align="left">&#160;</td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_est-opt-fun-value">Estimated Optimal Function Value</a></td>
<td class="libdoc" valign="top" align="left">&#160;</td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_functionprecision">Function Precision</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:msup><m:mi>&#949;</m:mi><m:mn>0.9</m:mn></m:msup></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_iterationlimit">Iteration Limit</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>50</m:mn><m:mo>,</m:mo><m:mrow><m:mn>5</m:mn><m:mi>n</m:mi></m:mrow></m:mfenced></m:mrow></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_iters">Iters</a></td>
<td class="libdoc" valign="top" align="left"/>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_itn">Itns</a></td>
<td class="libdoc" valign="top" align="left"/>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_linesearchtolerance">Linesearch Tolerance</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mn>0.9</m:mn></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_list">List</a></td>
<td class="libdoc" valign="top" align="left">Default for <m:math><m:mi mathvariant="normal">E04DGF</m:mi><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_list"><m:mi mathcolor="#800080;" mathvariant="bold">List</m:mi></m:maction></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_maximumsteplength">Maximum Step Length</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:msup><m:mn>10</m:mn><m:mn>20</m:mn></m:msup></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_nolist">Nolist</a></td>
<td class="libdoc" valign="top" align="left">Default for <m:math><m:mi mathvariant="normal">E04DGA</m:mi><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_nolist"><m:mi mathcolor="#800080;" mathvariant="bold">Nolist</m:mi></m:maction></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_optimalitytolerance">Optimality Tolerance</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:msubsup><m:mi>&#949;</m:mi><m:mi>R</m:mi><m:mn>0.8</m:mn></m:msubsup></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_printlevel">Print Level</a></td>
<td class="libdoc" valign="top" align="left">Default for E04DGF
<m:math><m:mtext/><m:mo>=</m:mo><m:mn>10</m:mn></m:math><br/>
Default for E04DGA
<m:math><m:mtext/><m:mo>=</m:mo><m:mn>0</m:mn></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_start-obj-check-var">Start Objective Check at Variable</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mn>1</m:mn></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_stop-obj-check-var">Stop Objective Check at Variable</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mi>n</m:mi></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_verify">Verify</a></td>
<td class="libdoc" valign="top" align="left"/>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_verifygradients">Verify Gradients</a></td>
<td class="libdoc" valign="top" align="left"/>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_verifylevel">Verify Level</a></td>
<td class="libdoc" valign="top" align="left">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mn>0</m:mn></m:math></td>
</tr><tr>
<td class="libdoc" valign="top" align="left" style="width:19.5em;"><a class="optparam" href="../E04/e04dgf.xml#optparam_verifyobj-gradients">Verify Objective Gradients</a></td>
<td class="libdoc" valign="top" align="left"/>
</tr>
</tbody>
</table></div><h3 class="standard"><a class="sec" name="op-description" id="op-description"/>11.2&#160;&#160;Description of the Optional Parameters</h3><table class="optparam"><tr><td class="optparam-left"><a name="optparam_defaults" id="defaults"/><b><span class="u">Defaults</span></b></td><td class="optparam-center"/><td class="optparam-right"/></tr></table><div class="paramtext">This special keyword may be used to reset all optional parameters to their default values.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_est-opt-fun-value" id="est-opt-fun-value"/><b><span class="u">Es</span>timated Optimal Function Value</b></td><td class="optparam-center"><i>r</i></td><td class="optparam-right"/></tr></table><div class="paramtext">This value of <m:math><m:mi>r</m:mi></m:math>&#160;specifies the user-supplied guess of the optimum objective function value <m:math><m:msub><m:mi>F</m:mi><m:mi mathvariant="normal">est</m:mi></m:msub></m:math>.  This value is used to calculate an initial step length <m:math><m:msub><m:mi>&#945;</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;(see <a class="sec" href="#algdetails">Section 10</a>).  If the value of <m:math><m:mi>r</m:mi></m:math>&#160;is not specified (the default), then this has the effect of setting <m:math><m:msub><m:mi>&#945;</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;to unity.  It should be noted that for badly scaled functions a unit step along the steepest descent direction will often compute the objective function at very large values of <m:math><m:mi>x</m:mi></m:math>.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_functionprecision" id="functionprecision"/><b><span class="u">F</span>unction Precision</b></td><td class="optparam-center"><i>r</i></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:msup><m:mi>&#949;</m:mi><m:mn>0.9</m:mn></m:msup></m:math></td></tr></table><div class="paramtext">The parameter defines <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>, which is intended to be a measure of the accuracy with which the problem function <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;can be computed.  If <m:math><m:mi>r</m:mi><m:mo>&lt;</m:mo><m:mi>&#949;</m:mi></m:math>&#160;or <m:math><m:mi>r</m:mi><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>, the default value is used.</div>
<div class="paramtext">The value of <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;should reflect the relative precision of <m:math><m:mn>1</m:mn><m:mo>+</m:mo><m:mfenced open="|" close="|" separators=""><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mfenced></m:math>; i.e., <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;acts as a relative precision when <m:math><m:mfenced open="|" close="|" separators=""><m:mi>F</m:mi></m:mfenced></m:math>&#160;is large, and as an absolute precision when <m:math><m:mfenced open="|" close="|" separators=""><m:mi>F</m:mi></m:mfenced></m:math>&#160;is small.  For example, if <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;is typically of order <m:math><m:mn>1000</m:mn></m:math>&#160;and the first six significant digits are known to be correct, an appropriate value for <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;would be <m:math><m:msup><m:mn>10</m:mn><m:mrow><m:mo>-</m:mo><m:mn>6</m:mn></m:mrow></m:msup></m:math>.  In contrast, if <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>&#160;is typically of order <m:math><m:msup><m:mn>10</m:mn><m:mrow><m:mo>-</m:mo><m:mn>4</m:mn></m:mrow></m:msup></m:math>&#160;and the first six significant digits are known to be correct, an appropriate value for <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;would be <m:math><m:msup><m:mn>10</m:mn><m:mrow><m:mo>-</m:mo><m:mn>10</m:mn></m:mrow></m:msup></m:math>.  The choice of <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;can be quite complicated for badly scaled problems; see Chapter 8 of <a class="ref" href="#ref079">Gill <span class="italic">et al.</span> (1981)</a> for a discussion of scaling techniques.  The default value is appropriate for most simple functions that are computed with full accuracy.  However when the accuracy of the computed function values is known to be significantly worse than full precision, the value of <m:math><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;should be large enough so that no attempt will be made to distinguish between function values that differ by less than the error inherent in the calculation.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_iterationlimit" id="iterationlimit"/><b><span class="u">It</span>eration Limit</b></td><td class="optparam-center"><i>i</i></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>50</m:mn><m:mo>,</m:mo><m:mrow><m:mn>5</m:mn><m:mi>n</m:mi></m:mrow></m:mfenced></m:mrow></m:math></td></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_iters" id="iters"/><b><span class="u">Iters</span></b></td><td class="optparam-center"/><td class="optparam-right"/></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_itn" id="itn"/><b><span class="u">Itns</span></b></td><td class="optparam-center"/><td class="optparam-right"/></tr></table><div class="paramtext">The value of <m:math><m:mi>i</m:mi></m:math>&#160;specifies the maximum number of iterations allowed before termination.  If <m:math><m:mi>i</m:mi><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>, the default value is used.</div>
<div class="paramtext">Problems whose Hessian matrices at the solution contain sets of clustered eigenvalues are likely to be minimized in significantly fewer than <m:math><m:mi>n</m:mi></m:math>&#160;iterations.  Problems without this property may require anything between <m:math><m:mi>n</m:mi></m:math>&#160;and <m:math><m:mn>5</m:mn><m:mi>n</m:mi></m:math>&#160;iterations, with approximately <m:math><m:mn>2</m:mn><m:mi>n</m:mi></m:math>&#160;iterations being a common figure for moderately difficult problems.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_linesearchtolerance" id="linesearchtolerance"/><b><span class="u">Lin</span>esearch Tolerance</b></td><td class="optparam-center"><i>r</i></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mn>0.9</m:mn></m:math></td></tr></table><div class="paramtext">The value <m:math><m:mi>r</m:mi></m:math>&#160;controls the accuracy with which the step <m:math><m:mi>&#945;</m:mi></m:math>&#160;taken during each iteration approximates a minimum of the function along the search direction (the smaller the value of <m:math><m:mi>r</m:mi></m:math>, the more accurate the linesearch).  The default value <m:math><m:mi>r</m:mi><m:mo>=</m:mo><m:mn>0.9</m:mn></m:math>&#160;requests an inaccurate search, and is appropriate for most problems.  A more accurate search may be appropriate when it is desirable to reduce the number of iterations &#8211; for example, if the objective function is cheap to evaluate.  If <m:math><m:mi>r</m:mi><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:mi>r</m:mi><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>, the default value is used.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_list" id="list"/><b><span class="u">List</span></b></td><td class="optparam-center"/><td class="optparam-right">Default for <m:math><m:mi mathvariant="normal">E04DGF</m:mi><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_list"><m:mi mathcolor="#800080;" mathvariant="bold">List</m:mi></m:maction></m:math></td></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_nolist" id="nolist"/><b><span class="u">Nolist</span></b></td><td class="optparam-center"/><td class="optparam-right">Default for <m:math><m:mi mathvariant="normal">E04DGA</m:mi><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_nolist"><m:mi mathcolor="#800080;" mathvariant="bold">Nolist</m:mi></m:maction></m:math></td></tr></table><div class="paramtext">Normally each optional parameter specification is printed as it is supplied.  Optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_nolist"><m:mi mathcolor="#800080;" mathvariant="bold">Nolist</m:mi></m:maction></m:math>&#160;may be used to suppress the printing and optional parameter <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_list"><m:mi mathcolor="#800080;" mathvariant="bold">List</m:mi></m:maction></m:math>&#160;may be used to restore printing.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_maximumsteplength" id="maximumsteplength"/><b><span class="u">M</span>aximum Step Length</b></td><td class="optparam-center"><i>r</i></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:msup><m:mn>10</m:mn><m:mn>20</m:mn></m:msup></m:math></td></tr></table><div class="paramtext">If <m:math><m:mi>r</m:mi><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math>, the maximum allowable step length for the linesearch is taken as <m:math><m:mrow><m:mi>min</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mfrac><m:mn>1</m:mn><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="../X02/x02amf.xml#X02AMF"><m:mi mathcolor="#5555FF" mathvariant="bold">X02AMF</m:mi></m:maction><m:mfenced separators=""/></m:mrow></m:mfrac><m:mo>,</m:mo><m:mfrac><m:mi>r</m:mi><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:msub><m:mi>p</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:mfrac></m:mfenced></m:mrow> </m:math>.  If <m:math><m:mi>r</m:mi><m:mo>&#8804;</m:mo><m:mn>0</m:mn></m:math>, the default value is used.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_optimalitytolerance" id="optimalitytolerance"/><b><span class="u">O</span>ptimality Tolerance</b></td><td class="optparam-center"><i>r</i></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:msubsup><m:mi>&#949;</m:mi><m:mi>R</m:mi><m:mn>0.8</m:mn></m:msubsup></m:math></td></tr></table><div class="paramtext">The parameter <m:math><m:mi>r</m:mi></m:math>&#160;specifies the accuracy to which you wish the final iterate to approximate a solution of the problem.  Broadly speaking, <m:math><m:mi>r</m:mi></m:math>&#160;indicates the number of correct figures desired in the objective function at the solution.  For example, if <m:math><m:mi>r</m:mi></m:math>&#160;is <m:math><m:msup><m:mn>10</m:mn><m:mrow><m:mo>-</m:mo><m:mn>6</m:mn></m:mrow></m:msup></m:math>&#160;and termination occurs with <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;(see <a class="sec" href="#parameters">Section 5</a>), then the final point satisfies the termination criteria, where <m:math><m:msub><m:mi>&#964;</m:mi><m:mi>F</m:mi></m:msub></m:math>&#160;represents <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_optimalitytolerance"><m:mi mathcolor="#800080;" mathvariant="bold">Optimality Tolerance</m:mi></m:maction></m:math>.  If <m:math><m:mi>r</m:mi><m:mo>&lt;</m:mo><m:msub><m:mi>&#949;</m:mi><m:mi>r</m:mi></m:msub></m:math>&#160;or <m:math><m:mi>r</m:mi><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>, the default value is used.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_printlevel" id="printlevel"/><b><span class="u">P</span>rint Level</b></td><td class="optparam-center"><i>i</i></td><td class="optparam-right">Default for E04DGF
<m:math><m:mtext/><m:mo>=</m:mo><m:mn>10</m:mn></m:math><br/>
Default for E04DGA
<m:math><m:mtext/><m:mo>=</m:mo><m:mn>0</m:mn></m:math></td></tr></table><div class="paramtext">The value <m:math><m:mi>i</m:mi></m:math>&#160;controls the amount of printout produced by E04DGF/E04DGA, as indicated below.  A detailed description of the printout is given in <a class="sec" href="#fcomments1">Section 8.1</a> (summary output at each iteration and the final solution).
<div class="left-tablediv"><table class="frame-none"> 
 
 
<tbody>
<tr> 
<td class="libdoc" valign="top" align="center"><b><m:math><m:mi>i</m:mi></m:math></b></td> 
<td class="libdoc" valign="top" align="center"><b>Output</b></td> 
</tr><tr> 
<td class="libdoc" valign="top" align="center"><m:math><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>0</m:mn></m:math></td>
<td class="libdoc" valign="top" align="left">No output.</td>
</tr><tr>
<td class="libdoc" valign="top" align="center"><m:math><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>1</m:mn></m:math></td>
<td class="libdoc" valign="top" align="left">The final solution only.</td>
</tr><tr>
<td class="libdoc" valign="top" align="center"><m:math><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>5</m:mn></m:math></td>
<td class="libdoc" valign="top" align="left">One line of summary output (<m:math><m:mtext/><m:mo>&lt;</m:mo><m:mn>80</m:mn></m:math>&#160;characters; see <a class="sec" href="#fcomments1">Section 8.1</a>) for each iteration (no printout of the final solution).</td>
</tr><tr>
<td class="libdoc" valign="top" align="center"><m:math><m:mn>10</m:mn></m:math></td>
<td class="libdoc" valign="top" align="left">The final solution and one line of summary output for each iteration.</td>
</tr>
</tbody>
</table></div>
</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_start-obj-check-var" id="start-obj-check-var"/><b><span class="u">Sta</span>rt Objective Check at Variable</b></td><td class="optparam-center"><i>i</i><sub>1</sub></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mn>1</m:mn></m:math></td></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_stop-obj-check-var" id="stop-obj-check-var"/><b><span class="u">Sto</span>p Objective Check at Variable</b></td><td class="optparam-center"><i>i</i><sub>2</sub></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mi>n</m:mi></m:math></td></tr></table><div class="paramtext">These keywords take effect only if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verifylevel"><m:mi mathcolor="#800080;" mathvariant="bold">Verify Level</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math>.  They may be used to control the verification of gradient elements computed by <a class="arg" href="#OBJFUN">OBJFUN</a>.  For example, if the first <m:math><m:mn>30</m:mn></m:math>&#160;elements of the objective gradient appeared to be correct in an earlier run, so that only element <m:math><m:mn>31</m:mn></m:math>&#160;remains questionable, it is reasonable to specify <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_start-obj-check-var"><m:mi mathcolor="#800080;" mathvariant="bold">Start Objective Check at Variable</m:mi></m:maction><m:mo>=</m:mo><m:mn>31</m:mn></m:math>.  If the first <m:math><m:mn>30</m:mn></m:math>&#160;variables appear linearly in the objective, so that the corresponding gradient elements are constant, the above choice would also be appropriate.</div>
<div class="paramtext">If <m:math><m:msub><m:mi>i</m:mi><m:mn>1</m:mn></m:msub><m:mo>&#8804;</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:msub><m:mi>i</m:mi><m:mn>1</m:mn></m:msub><m:mo>&gt;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:mrow><m:mi>min</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mi>n</m:mi><m:mo>,</m:mo><m:msub><m:mi>i</m:mi><m:mn>2</m:mn></m:msub></m:mfenced></m:mrow></m:mfenced></m:mrow></m:math>, the default value is used.  If <m:math><m:msub><m:mi>i</m:mi><m:mn>2</m:mn></m:msub><m:mo>&#8804;</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:msub><m:mi>i</m:mi><m:mn>2</m:mn></m:msub><m:mo>&gt;</m:mo><m:mi>n</m:mi></m:math>, the default value is used.</div><table class="optparam"><tr><td class="optparam-left"><a name="optparam_verifylevel" id="verifylevel"/><b><span class="u">V</span>erify <span class="u">L</span>evel</b></td><td class="optparam-center"><i>i</i></td><td class="optparam-right">Default <m:math><m:mtext/><m:mo>=</m:mo><m:mn>0</m:mn></m:math></td></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_verify" id="verify"/><b><span class="u">V</span>erify</b></td><td class="optparam-center"/><td class="optparam-right"/></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_verifygradients" id="verifygradients"/><b><span class="u">V</span>erify <span class="u">G</span>radients</b></td><td class="optparam-center"/><td class="optparam-right"/></tr></table>
<table class="multi-optparam"><tr><td class="optparam-left"><a name="optparam_verifyobj-gradients" id="verifyobj-gradients"/><b><span class="u">V</span>erify <span class="u">O</span>bjective Gradients</b></td><td class="optparam-center"/><td class="optparam-right"/></tr></table><div class="paramtext">These keywords refer to finite-difference checks on the gradient elements computed by <a class="arg" href="#OBJFUN">OBJFUN</a>.  Gradients are verified at the user-supplied initial estimate of the solution.  The possible choices for <m:math><m:mi>i</m:mi></m:math>&#160;are as follows: 
<div class="left-tablediv"><table class="frame-none"> 
 
 
<tbody> 
<tr> 
<td class="libdoc" valign="top" align="center"><b><m:math><m:mi>i</m:mi></m:math></b></td> 
<td class="libdoc" valign="top" align="center"><b>Meaning</b></td> 
</tr><tr> 
<td class="libdoc" valign="top" align="center"><m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math></td>
<td class="libdoc" valign="top" align="left">No checks are performed.</td>
</tr><tr>
<td class="libdoc" valign="top" align="center"><m:math><m:mphantom><m:mo>-</m:mo></m:mphantom><m:mn>0</m:mn></m:math></td>
<td class="libdoc" valign="top" align="left">Only a &#8216;cheap&#8217; test will be performed, requiring one call to <a class="arg" href="#OBJFUN">OBJFUN</a>.</td>
</tr><tr>
<td class="libdoc" valign="top" align="center"><m:math><m:mphantom><m:mo>-</m:mo></m:mphantom><m:mn>1</m:mn></m:math></td>
<td class="libdoc" valign="top" align="left">In addition to the &#8216;cheap&#8217; test, individual gradient elements will also be checked using a reliable (but more expensive) test.</td>
</tr>
</tbody>
</table></div>
</div>
<div class="paramtext">For example, the objective gradient will be verified if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verify"><m:mi mathcolor="#800080;" mathvariant="bold">Verify</m:mi></m:maction></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verify"><m:mi mathcolor="#800080;" mathvariant="bold">Verify</m:mi></m:maction><m:mo>=</m:mo><m:mi mathvariant="normal">Yes</m:mi></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verifygradients"><m:mi mathcolor="#800080;" mathvariant="bold">Verify Gradients</m:mi></m:maction></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verifyobj-gradients"><m:mi mathcolor="#800080;" mathvariant="bold">Verify Objective Gradients</m:mi></m:maction></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#optparam_verifylevel"><m:mi mathcolor="#800080;" mathvariant="bold">Verify Level</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;is specified.</div><hr/><div><a class="rout" href="../../pdf/E04/e04dgf.pdf">E04DGF/E04DGA (PDF version)</a></div><div><a class="chap" href="e04conts.xml">E04 Chapter Contents</a></div><div><a class="chapint" href="e04intro.xml">E04 Chapter Introduction</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. 2009</a></div></body></html>
