<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>EqualOpSeq: Example and Test</title>
<meta name="description" id="description" content="EqualOpSeq: Example and Test"/>
<meta name="keywords" id="keywords" content=" Equalopseq example test "/>
<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='_equal_op_seq.cpp_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="equalopseq.xml" target="_top">Prev</a>
</td><td><a href="vecad.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>BoolValued</option>
<option>EqualOpSeq</option>
<option>equal_op_seq.cpp</option>
</select>
</td>
<td>
<select onchange='choose_down3(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_down2(this)'>
<option>BoolValued-&gt;</option>
<option>Compare</option>
<option>NearEqualExt</option>
<option>BoolFun</option>
<option>ParVar</option>
<option>EqualOpSeq</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>EqualOpSeq-&gt;</option>
<option>equal_op_seq.cpp</option>
</select>
</td>
<td>equal_op_seq.cpp</td>
<td>Headings</td>
</tr></table><br/>



<center><b><big><big>EqualOpSeq: Example and Test</big></big></b></center>
<code><font color="blue"><pre style='display:inline'> 
# include &lt;cppad/cppad.hpp&gt;

bool EqualOpSeq(void)
{	bool ok = true;
	using CppAD::AD;
	using CppAD::EqualOpSeq;

	// domain space vector
	size_t n  = 1;
	double x0 = 1.;
	<a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(AD&lt;double&gt;) x(n);
	x[0]      = x0; 

	// declare independent variables and start tape recording
	CppAD::<a href="independent.xml" target="_top">Independent</a>(x);

	<a href="ad.xml" target="_top">AD</a>&lt;double&gt; a = 1. + x[0];  // this variable is 1 + x0
	<a href="ad.xml" target="_top">AD</a>&lt;double&gt; b = 2. * x[0];  // this variable is 2 * x0

	// both a and b are variables
	ok &amp;= (a == b);            // 1 + 1     == 2 * 1
	ok &amp;= ! EqualOpSeq(a, b);  // 1 + x[0]  != 2 * x[0] 

	// range space vector 
	size_t m = 1;
	<a href="testvector.xml" target="_top">CPPAD_TESTVECTOR</a>(AD&lt;double&gt;) y(m);
	y[0] = a;

	// both y[0] and a are variables
	EqualOpSeq(y[0], a);       // 2 * x[0] == 2 * x[0]

	// create f: x -&gt; y and stop tape recording
	CppAD::<a href="funconstruct.xml" target="_top">ADFun</a>&lt;double&gt; f(x, y); 

	// both a and b are parameters (after the creation of f above)
	ok &amp;= EqualOpSeq(a, b);    // 1 + 1 == 2 * 1

	return ok;
}

</pre>

</font></code>


<hr/>Input File: example/equal_op_seq.cpp

</body>
</html>
