<?xml version='1.0'?>
<html xmlns='http://www.w3.org/1999/xhtml'
      xmlns:math='http://www.w3.org/1998/Math/MathML'
>
<head>
<title>Check Gradient of Determinant of 3 by 3 matrix</title>
<meta name="description" id="description" content="Check Gradient of Determinant of 3 by 3 matrix"/>
<meta name="keywords" id="keywords" content=" det_grad_33 determinant check correct "/>
<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='_det_grad_33_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="det_33.hpp.xml" target="_top">Prev</a>
</td><td><a href="det_grad_33.hpp.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>speed</option>
<option>speed_utility</option>
<option>det_grad_33</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>speed-&gt;</option>
<option>speed_main</option>
<option>speed_utility</option>
<option>speed_double</option>
<option>speed_adolc</option>
<option>speed_cppad</option>
<option>speed_fadbad</option>
<option>speed_sacado</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>speed_utility-&gt;</option>
<option>det_by_lu</option>
<option>det_of_minor</option>
<option>det_by_minor</option>
<option>det_33</option>
<option>det_grad_33</option>
<option>mat_sum_sq</option>
<option>ode_evaluate</option>
<option>sparse_jac_fun</option>
<option>sparse_hes_fun</option>
<option>uniform_01</option>
</select>
</td>
<td>
<select onchange='choose_down0(this)'>
<option>det_grad_33-&gt;</option>
<option>det_grad_33.hpp</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>Syntax</option>
<option>Purpose</option>
<option>Inclusion</option>
<option>x</option>
<option>g</option>
<option>Vector</option>
<option>ok</option>
<option>Source Code</option>
</select>
</td>
</tr></table><br/>



<center><b><big><big>Check Gradient of Determinant of 3 by 3 matrix</big></big></b></center>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>

<code><font color="blue"><span style='white-space: nowrap'>#&#xA0;include&#xA0;&lt;cppad/speed/det_grad_33.hpp&gt;<br/>
</span></font></code>

<code><i><font color="black"><span style='white-space: nowrap'>ok</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;=&#xA0;det_grad_33(</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'>g</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/>
This routine can be used to check a method for computing the 
gradient of the determinant of a matrix.

<br/>
<br/>
<b><big><a name="Inclusion" id="Inclusion">Inclusion</a></big></b>
<br/>
The template function <code><font color="blue">det_grad_33</font></code> is defined in the <code><font color="blue">CppAD</font></code>
namespace by including 
the file <code><font color="blue">cppad/speed/det_grad_33.hpp</font></code> 
(relative to the CppAD distribution directory).
It is only intended for example and testing purposes, 
so it is not automatically included by
<a href="cppad.xml" target="_top"><span style='white-space: nowrap'>cppad.hpp</span></a>
.

<br/>
<br/>
<b><big><a name="x" id="x">x</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>x</span></font></i></code>
 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'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;</span></font><i><font color="black"><span style='white-space: nowrap'>x</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
.
It contains the elements of the matrix 
<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow>
<mi mathvariant='italic'>X</mi>
</mrow></math>

 in row major order; i.e.,

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<msub><mi mathvariant='italic'>X</mi>
<mrow><mi mathvariant='italic'>i</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>j</mi>
</mrow>
</msub>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>x</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>i</mi>
<mo stretchy="false">*</mo>
<mn>3</mn>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">]</mo>
</mrow></math>

<br/>
<b><big><a name="g" id="g">g</a></big></b>
<br/>
The argument 
<code><i><font color="black"><span style='white-space: nowrap'>g</span></font></i></code>
 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'>Vector</span></font></i><font color="blue"><span style='white-space: nowrap'>&#xA0;&amp;</span></font><i><font color="black"><span style='white-space: nowrap'>g</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
.
It contains the elements of the gradient of

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

 in row major order; i.e.,

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>
<mfrac><mrow><mo stretchy="false">&#x02202;</mo>
<mi>det</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">)</mo>
</mrow>
<mrow><mo stretchy="false">&#x02202;</mo>
<mi mathvariant='italic'>X</mi>
<mo stretchy="false">(</mo>
<mi mathvariant='italic'>i</mi>
<mo stretchy="false">,</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">)</mo>
</mrow>
</mfrac>
<mo stretchy="false">=</mo>
<mi mathvariant='italic'>g</mi>
<mo stretchy="false">[</mo>
<mi mathvariant='italic'>i</mi>
<mo stretchy="false">*</mo>
<mn>3</mn>
<mo stretchy="false">+</mo>
<mi mathvariant='italic'>j</mi>
<mo stretchy="false">]</mo>
</mrow></math>

<br/>
<b><big><a name="Vector" id="Vector">Vector</a></big></b>
<br/>
If 
<code><i><font color="black"><span style='white-space: nowrap'>y</span></font></i></code>
 is a 
<code><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i></code>
 object, 
it must support the syntax

<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'>y</span></font></i><font color="blue"><span style='white-space: nowrap'>[</span></font><i><font color="black"><span style='white-space: nowrap'>i</span></font></i><font color="blue"><span style='white-space: nowrap'>]<br/>
</span></font></code>
where 
<code><i><font color="black"><span style='white-space: nowrap'>i</span></font></i></code>
 has type <code><font color="blue">size_t</font></code> with value less than 9.
This must return a <code><font color="blue">double</font></code> value corresponding to the <i>i</i>-th
element of the vector 
<code><i><font color="black"><span style='white-space: nowrap'>y</span></font></i></code>
.
This is the only requirement of the type 
<code><i><font color="black"><span style='white-space: nowrap'>Vector</span></font></i></code>
.

<br/>
<br/>
<b><big><a name="ok" id="ok">ok</a></big></b>
<br/>
The return value 
<code><i><font color="black"><span style='white-space: nowrap'>ok</span></font></i></code>
 has prototype

<code><font color="blue"><span style='white-space: nowrap'><br/>
&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;bool&#xA0;</span></font><i><font color="black"><span style='white-space: nowrap'>ok</span></font></i><font color="blue"><span style='white-space: nowrap'><br/>
</span></font></code>
It is true, if the gradient 
<code><i><font color="black"><span style='white-space: nowrap'>g</span></font></i></code>
 
passes the test and false otherwise.



<br/>
<br/>
<b><big><a name="Source Code" id="Source Code">Source Code</a></big></b>
<br/>
The file 
<a href="det_grad_33.hpp.xml" target="_top"><span style='white-space: nowrap'>det_grad_33.hpp</span></a>

contains the source code for this template function.


<hr/>Input File: cppad/speed/det_grad_33.hpp

</body>
</html>
