<?xml version='1.0'?> <?xml-stylesheet type='text/xsl' href='pmathml.xsl'?> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>Comparison Changes During Zero Order Forward Mode</title> <meta name="description" id="description" content="Comparison Changes During Zero Order Forward Mode"/> <meta name="keywords" id="keywords" content=" Adfun Comparechange zero order forward Ndebug "/> <style type='text/css'> body { color : black } body { background-color : white } A:link { color : blue } A:visited { color : purple } A:active { color : purple } </style> <script type='text/javascript' language='JavaScript' src='_comparechange_xml.js'> </script> </head> <body> <table><tr> <td> <a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a> </td> <td><a href="size_taylor.xml" target="_top">Prev</a> </td><td><a href="comparechange.cpp.xml" target="_top">Next</a> </td><td> <select onchange='choose_across0(this)'> <option>Index-></option> <option>contents</option> <option>reference</option> <option>index</option> <option>search</option> <option>external</option> </select> </td> <td> <select onchange='choose_up0(this)'> <option>Up-></option> <option>CppAD</option> <option>ADFun</option> <option>FunEval</option> <option>Forward</option> <option>CompareChange</option> </select> </td> <td> <select onchange='choose_down3(this)'> <option>ADFun-></option> <option>Independent</option> <option>FunConstruct</option> <option>Dependent</option> <option>abort_recording</option> <option>seq_property</option> <option>FunEval</option> <option>Drivers</option> <option>FunCheck</option> <option>omp_max_thread</option> <option>optimize</option> <option>FunDeprecated</option> </select> </td> <td> <select onchange='choose_down2(this)'> <option>FunEval-></option> <option>Forward</option> <option>Reverse</option> <option>Sparse</option> </select> </td> <td> <select onchange='choose_down1(this)'> <option>Forward-></option> <option>ForwardZero</option> <option>ForwardOne</option> <option>ForwardAny</option> <option>size_taylor</option> <option>CompareChange</option> <option>capacity_taylor</option> <option>Forward.cpp</option> </select> </td> <td> <select onchange='choose_down0(this)'> <option>CompareChange-></option> <option>CompareChange.cpp</option> </select> </td> <td> <select onchange='choose_current0(this)'> <option>Headings-></option> <option>Syntax</option> <option>Purpose</option> <option>f</option> <option>c</option> <option>Discussion</option> <option>Restrictions</option> <option>Example</option> </select> </td> </tr></table><br/> <center><b><big><big>Comparison Changes During Zero Order Forward Mode</big></big></b></center> <br/> <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b> <br/> <code><font color="blue"></font></code><i><span style='white-space: nowrap'>c</span></i><code><font color="blue"><span style='white-space: nowrap'> = </span></font></code><i><span style='white-space: nowrap'>f</span></i><code><font color="blue"><span style='white-space: nowrap'>.CompareChange()</span></font></code> <code><span style='white-space: nowrap'><br/> </span></code><b>See Also</b> <a href="funcheck.xml" target="_top"><span style='white-space: nowrap'>FunCheck</span></a> <br/> <br/> <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b> <br/> We use <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow> <mi mathvariant='italic'>F</mi> <mo stretchy="false">:</mo> <msup><mi mathvariant='italic'>B</mi> <mi mathvariant='italic'>n</mi> </msup> <mo stretchy="false">→</mo> <msup><mi mathvariant='italic'>B</mi> <mi mathvariant='italic'>m</mi> </msup> </mrow></math> to denote the <a href="glossary.xml#AD Function" target="_top"><span style='white-space: nowrap'>AD function</span></a> corresponding to <i>f</i>. This function may be not agree with the algorithm that was used to create the corresponding AD of <i>Base</i> <a href="glossary.xml#Operation.Sequence" target="_top"><span style='white-space: nowrap'>operation sequence</span></a> because of changes in AD <a href="compare.xml" target="_top"><span style='white-space: nowrap'>comparison</span></a> results. The <code><font color="blue">CompareChange</font></code> function can be used to detect these changes. <br/> <br/> <b><big><a name="f" id="f">f</a></big></b> <br/> The object <i>f</i> has prototype <code><font color="blue"><span style='white-space: nowrap'><br/>      const ADFun<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>> </span></font></code><i><span style='white-space: nowrap'>f</span></i><code><font color="blue"><span style='white-space: nowrap'><br/> </span></font></code><br/> <b><big><a name="c" id="c">c</a></big></b> <br/> The result <i>c</i> has prototype <code><font color="blue"><span style='white-space: nowrap'><br/>      size_t </span></font></code><i><span style='white-space: nowrap'>c</span></i><code><font color="blue"><span style='white-space: nowrap'><br/> </span></font></code>It is the number of <code><font color="blue"><span style='white-space: nowrap'>AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>></span></font></code> <a href="compare.xml" target="_top"><span style='white-space: nowrap'>comparison</span></a> operations, corresponding to the previous call to <a href="forward.xml" target="_top"><span style='white-space: nowrap'>Forward</span></a> <code><font color="blue"><span style='white-space: nowrap'><br/>      </span></font></code><i><span style='white-space: nowrap'>f</span></i><code><font color="blue"><span style='white-space: nowrap'>.Forward(0, </span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'>)<br/> </span></font></code>that have a different result from when <i>F</i> was created by taping an algorithm. <br/> <br/> <b><big><a name="Discussion" id="Discussion">Discussion</a></big></b> <br/> If <i>c</i> is not zero, the boolean values resulting from some of the <a href="compare.xml" target="_top"><span style='white-space: nowrap'>comparison operations</span></a> corresponding to <i>x</i> are different from when the AD of <i>Base</i> <a href="glossary.xml#Operation.Sequence" target="_top"><span style='white-space: nowrap'>operation sequence</span></a> was created. In this case, you may want to re-tape the algorithm with the <a href="glossary.xml#Tape.Independent Variable" target="_top"><span style='white-space: nowrap'>independent variables</span></a> equal to the values in <i>x</i> (so AD operation sequence properly represents the algorithm for this value of independent variables). On the other hand, re-taping the AD operation sequence usually takes significantly more time than evaluation using <a href="forwardzero.xml" target="_top"><span style='white-space: nowrap'>ForwardZero</span></a> . If the functions values have not changed (see <a href="funcheck.xml" target="_top"><span style='white-space: nowrap'>FunCheck</span></a> ) it may not be worth re-taping a new AD operation sequence. <br/> <br/> <b><big><a name="Restrictions" id="Restrictions">Restrictions</a></big></b> <br/> Computation of this function requires extra operations in the tape. If <code><font color="blue">NDEBUG</font></code> is defined, of if a tape <a href="optimize.xml" target="_top"><span style='white-space: nowrap'>optimization</span></a> has been preformed, these operations are not included in the tape and the value of <code><i><font color="black"><span style='white-space: nowrap'>c</span></font></i></code> is always zero (and does not correspond to the actual number of comparison changes). <br/> <br/> <b><big><a name="Example" id="Example">Example</a></big></b> <br/> The file <a href="comparechange.cpp.xml" target="_top"><span style='white-space: nowrap'>CompareChange.cpp</span></a> contains an example and test of this operation. They return true if they succeed and false otherwise. <hr/>Input File: omh/forward.omh </body> </html>