<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Using AD Version of Atomic Function</title>
<meta name="description" id="description" content="Using AD Version of Atomic Function"/>
<meta name="keywords" id="keywords" content=" atomic use function "/>
<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='_atomic_afun_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="atomic_option.xml" target="_top">Prev</a>
</td><td><a href="atomic_forward.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>ADValued</option>
<option>atomic</option>
<option>atomic_base</option>
<option>atomic_afun</option>
</select>
</td>
<td>
<select onchange='choose_down3(this)'>
<option>ADValued-&gt;</option>
<option>Arithmetic</option>
<option>std_math_ad</option>
<option>MathOther</option>
<option>CondExp</option>
<option>Discrete</option>
<option>atomic</option>
</select>
</td>
<td>
<select onchange='choose_down2(this)'>
<option>atomic-&gt;</option>
<option>checkpoint</option>
<option>atomic_base</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>atomic_base-&gt;</option>
<option>atomic_ctor</option>
<option>atomic_option</option>
<option>atomic_afun</option>
<option>atomic_forward</option>
<option>atomic_reverse</option>
<option>atomic_for_sparse_jac</option>
<option>atomic_rev_sparse_jac</option>
<option>atomic_rev_sparse_hes</option>
<option>atomic_base_clear</option>
<option>atomic_get_started.cpp</option>
<option>atomic_norm_sq.cpp</option>
<option>atomic_reciprocal.cpp</option>
<option>atomic_tangent.cpp</option>
<option>atomic_mat_mul.cpp</option>
</select>
</td>
<td>atomic_afun</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>ADVector</option>
<option>afun</option>
<option>ax</option>
<option>ay</option>
<option>Examples</option>
</select>
</td>
</tr></table><br/>




<center><b><big><big>Using AD Version of Atomic Function</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>

<code><i><font color="black"><span style='white-space: nowrap'>afun</span></font></i><font color="blue"><span style='white-space: nowrap'>(</span></font><i><font color="black"><span style='white-space: nowrap'>ax</span></font></i><font color="blue"><span style='white-space: nowrap'>,&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>ay</span></font></i><font color="blue"><span style='white-space: nowrap'>)</span></font></code>


<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
Given 
<code><i><font color="black"><span style='white-space: nowrap'>ax</span></font></i></code>
,
this call computes the corresponding value of 
<code><i><font color="black"><span style='white-space: nowrap'>ay</span></font></i></code>
. 
If 
<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>
 operations are being recorded,
it enters the computation as an atomic operation in the recording;
see <a href="independent.xml#Start Recording" target="_top"><span style='white-space: nowrap'>start&#xA0;recording</span></a>
.

<br/>
<br/>
<b><big><a name="ADVector" id="ADVector">ADVector</a></big></b>
<br/>
The type 
<code><i><font color="black"><span style='white-space: nowrap'>ADVector</span></font></i></code>
 must be a
<a href="simplevector.xml" target="_top"><span style='white-space: nowrap'>simple&#xA0;vector&#xA0;class</span></a>
 with elements of 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>
; see <a href="atomic_ctor.xml#atomic_base.Base" target="_top"><span style='white-space: nowrap'>Base</span></a>
.

<br/>
<br/>
<b><big><a name="afun" id="afun">afun</a></big></b>
<br/>
is a <a href="atomic_ctor.xml#atomic_user" target="_top"><span style='white-space: nowrap'>atomic_user</span></a>
 object 
and this 
<code><i><font color="black"><span style='white-space: nowrap'>afun</span></font></i></code>
 function call is implemented by the
<a href="atomic_ctor.xml#atomic_base" target="_top"><span style='white-space: nowrap'>atomic_base</span></a>
 class. 

<br/>
<br/>
<b><big><a name="ax" id="ax">ax</a></big></b>
<br/>
This argument has prototype

<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'>ADVector</span></font></i><font color="blue"><span style='white-space: nowrap'>&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>ax</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size must be equal to 
<code><i><font color="black"><span style='white-space: nowrap'>n</span></font></i></code>
.
It specifies vector 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">&#x02208;</mo>
<msup><mi mathvariant='italic'>B</mi>
<mi mathvariant='italic'>n</mi>
</msup>
</mrow></math>

 
at which an 
<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>
 version of 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>y</mi>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>f</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">)</mo>
</mrow></math>

 is to be evaluated; see 
<a href="atomic_ctor.xml#atomic_base.Base" target="_top"><span style='white-space: nowrap'>Base</span></a>
.

<br/>
<br/>
<b><big><a name="ay" id="ay">ay</a></big></b>
<br/>
This argument has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>ADVector</span></font></i><font color="blue"><span style='white-space: nowrap'>&amp;&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>ay</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
and size must be equal to 
<code><i><font color="black"><span style='white-space: nowrap'>m</span></font></i></code>
.
The input values of its elements 
are not specified (must not matter).
Upon return, it is an 
<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>
 version of 

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>y</mi>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>f</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">)</mo>
</mrow></math>

.

<br/>
<br/>
<b><big><a name="Examples" id="Examples">Examples</a></big></b>
<br/>
The following files contain example uses of 
the AD version of atomic functions during recording:
<a href="atomic_get_started.cpp.xml#Use Atomic Function.Recording" target="_top"><span style='white-space: nowrap'>get_started.cpp</span></a>
,
<a href="atomic_norm_sq.cpp.xml#Use Atomic Function.Recording" target="_top"><span style='white-space: nowrap'>norm_sq.cpp</span></a>
,
<a href="atomic_reciprocal.cpp.xml#Use Atomic Function.Recording" target="_top"><span style='white-space: nowrap'>reciprocal.cpp</span></a>
,
<a href="atomic_tangent.cpp.xml#Use Atomic Function.Recording" target="_top"><span style='white-space: nowrap'>tangent.cpp</span></a>
,
<a href="atomic_mat_mul.cpp.xml#Use Atomic Function.Recording" target="_top"><span style='white-space: nowrap'>matrix_mul.cpp</span></a>
.


<hr/>Input File: cppad/local/atomic_base.hpp

</body>
</html>
