Codebase list cppad / upstream/2015.00.00.7 doc / base_ordered.xml
upstream/2015.00.00.7

Tree @upstream/2015.00.00.7 (Download .tar.gz)

base_ordered.xml @upstream/2015.00.00.7raw · history · blame

<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Base Type Requirements for Ordered Comparisons</title>
<meta http-equiv='Content-Type' content='text/html' charset='utf-8'/>
<meta name="description" id="description" content="Base Type Requirements for Ordered Comparisons"/>
<meta name="keywords" id="keywords" content=" base type requirements for ordered comparisons purpose not "/>
<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='_base_ordered_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="base_identical.xml" target="_top">Prev</a>
</td><td><a href="base_std_math.xml" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</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-&gt;</option>
<option>CppAD</option>
<option>AD</option>
<option>base_require</option>
<option>base_ordered</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>CppAD-&gt;</option>
<option>Install</option>
<option>Introduction</option>
<option>AD</option>
<option>ADFun</option>
<option>preprocessor</option>
<option>multi_thread</option>
<option>library</option>
<option>ipopt_solve</option>
<option>Example</option>
<option>speed</option>
<option>Appendix</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>AD-&gt;</option>
<option>ad_ctor</option>
<option>ad_assign</option>
<option>Convert</option>
<option>ADValued</option>
<option>BoolValued</option>
<option>VecAD</option>
<option>base_require</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>base_require-&gt;</option>
<option>base_member</option>
<option>base_cond_exp</option>
<option>base_identical</option>
<option>base_ordered</option>
<option>base_std_math</option>
<option>base_example</option>
</select>
</td>
<td>base_ordered</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Purpose</option>
<option>Ordered Type</option>
<option>Not Ordered</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>Base Type Requirements for Ordered Comparisons</big></big></b></center>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
The following operations 
(in the CppAD namespace) are required to use the type

<code><font color="blue"><span style='white-space: nowrap'>AD&lt;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&gt;</span></font></code>
:

<table><tr><td align='left'  valign='top'>

<b>Syntax</b> </td><td align='left'  valign='top'>
 <b>Result</b>
</td></tr><tr><td align='left'  valign='top'>


<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;GreaterThanZero(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
   <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code>
	</td><td align='left'  valign='top'>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&gt;</mo>
<mn>0</mn>
</mrow></math>


</td></tr><tr><td align='left'  valign='top'>


<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;GreaterThanOrZero(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
 <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code>
	</td><td align='left'  valign='top'>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&#x02265;</mo>
<mn>0</mn>
</mrow></math>


</td></tr><tr><td align='left'  valign='top'>


<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;LessThanZero(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
      <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code>
	</td><td align='left'  valign='top'>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&lt;</mo>
<mn>0</mn>
</mrow></math>


</td></tr><tr><td align='left'  valign='top'>


<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;LessThanOrZero(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
    <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code>
	</td><td align='left'  valign='top'>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&#x02264;</mo>
<mn>0</mn>
</mrow></math>


</td></tr><tr><td align='left'  valign='top'>


<code><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;abs_geq(</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>y</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>
      <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code>
	</td><td align='left'  valign='top'>
 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mo stretchy="false">|</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">|</mo>
<mo stretchy="false">&#x02265;</mo>
<mo stretchy="false">|</mo>
<mi mathvariant='italic'>y</mi>
<mo stretchy="false">|</mo>
</mrow></math>

.
</td></tr>
</table>
where the arguments and return value have the prototypes

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>y</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;bool&#xA0;&#xA0;</span></font><i><font color="black"></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>b</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
<br/>
<b><big><a name="Ordered Type" id="Ordered Type">Ordered Type</a></big></b>
<br/>
If the type 
<code><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i></code>
 supports ordered operations,
these functions should have their corresponding definitions.
For example,

<code><font color="blue"><span style='white-space: nowrap'><br/>
namespace&#xA0;CppAD&#xA0;{<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;inline&#xA0;bool&#xA0;GreaterThanZero(const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;x)<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;{&#xA0;&#xA0;&#xA0;&#xA0;return&#xA0;(x&#xA0;&gt;&#xA0;0);<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}<br/>
}<br/>
</span></font></code>
The other functions would replace <code><font color="blue">&gt;</font></code> by the corresponding operator.
For example, see
<a href="base_alloc.hpp.xml#Ordered" target="_top"><span style='white-space: nowrap'>base_alloc</span></a>
.


<br/>
<br/>
<b><big><a name="Not Ordered" id="Not Ordered">Not Ordered</a></big></b>
<br/>
If the type 
<code><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i></code>
 does not support ordering,
one might (but need not) define <code><font color="blue">GreaterThanZero</font></code> as follows:

<code><font color="blue"><span style='white-space: nowrap'><br/>
namespace&#xA0;CppAD&#xA0;{<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;inline&#xA0;bool&#xA0;GreaterThanZero(const&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;x)<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;{&#xA0;&#xA0;&#xA0;&#xA0;//&#xA0;attempt&#xA0;to&#xA0;use&#xA0;GreaterThanZero&#xA0;with&#xA0;a&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>Base</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;argument<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;assert(0);<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;return&#xA0;x;<br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}<br/>
}<br/>
</span></font></code>
The other functions would have the corresponding definition.
For example, see
<a href="base_complex.hpp.xml#Ordered" target="_top"><span style='white-space: nowrap'>complex&#xA0;Ordered</span></a>
.


<hr/>Input File: omh/base_ordered.omh

</body>
</html>