Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 39da2e642be5eb48375f19991c31eb2c > files > 483

cppad-doc-20100101.4-1.fc14.noarch.rpm

<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='pmathml.xsl'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Source: det_of_minor</title>
<meta name="description" id="description" content="Source: det_of_minor"/>
<meta name="keywords" id="keywords" content=" det_of_minor source "/>
<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_of_minor.hpp_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_of_minor.cpp.xml" target="_top">Prev</a>
</td><td><a href="det_by_minor.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>Appendix</option>
<option>speed</option>
<option>speed_utility</option>
<option>det_of_minor</option>
<option>det_of_minor.hpp</option>
</select>
</td>
<td>
<select onchange='choose_down3(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_down2(this)'>
<option>speed_utility-&gt;</option>
<option>uniform_01</option>
<option>det_of_minor</option>
<option>det_by_minor</option>
<option>det_by_lu</option>
<option>det_33</option>
<option>det_grad_33</option>
<option>ode_evaluate</option>
<option>sparse_evaluate</option>
</select>
</td>
<td>
<select onchange='choose_down1(this)'>
<option>det_of_minor-&gt;</option>
<option>det_of_minor.cpp</option>
<option>det_of_minor.hpp</option>
</select>
</td>
<td>det_of_minor.hpp</td>
<td>Headings</td>
</tr></table><br/>



<center><b><big><big>Source: det_of_minor</big></big></b></center>
<code><font color="blue"># ifndef CPPAD_DET_OF_MINOR_INCLUDED 
<code><span style='white-space: nowrap'><br/>
</span></code># define CPPAD_DET_OF_MINOR_INCLUDED

<pre style='display:inline'> 
namespace CppAD { // BEGIN CppAD namespace
template &lt;class Scalar&gt; 
Scalar det_of_minor( 
	const std::vector&lt;Scalar&gt;&amp; a  , 
	size_t                     m  , 
	size_t                     n  , 
	std::vector&lt;size_t&gt;&amp;       r  , 
	std::vector&lt;size_t&gt;&amp;       c  )
{	
	const size_t R0 = r[m]; // R(0)
	size_t       Cj = c[m]; // C(j)    (case j = 0)
	size_t       Cj1 = m;   // C(j-1)  (case j = 0)

	// check for 1 by 1 case
	if( n == 1 ) return a[ R0 * m + Cj ];

	// initialize determinant of the minor M
	Scalar detM;
	detM = 0;

	// initialize sign of factor for next sub-minor
	int s = 1;

	// remove row with index 0 in M from all the sub-minors of M
	r[m] = r[R0];

	// for each column of M
	for(size_t j = 0; j &lt; n; j++)
	{	// element with index (0,j) in the minor M
		Scalar M0j = a[ R0 * m + Cj ];

		// remove column wht index j in M to form next sub-minor S of M
		c[Cj1] = c[Cj];

		// compute determinant of the current sub-minor S
		Scalar detS = det_of_minor(a, m, n - 1, r, c);

		// restore column Cj to representaion of M as a minor of A
		c[Cj1] = Cj;

		// include this sub-minor term in the summation
		if( s &gt; 0 )
			detM = detM + M0j * detS;
		else	detM = detM - M0j * detS;

		// advance to next column of M
		Cj1 = Cj;
		Cj  = c[Cj];
		s   = - s;		
	}

	// restore row zero to the minor representation for M
	r[m] = R0;

	// return the determinant of the minor M
	return detM;
}
} // END CppAD namespace</pre>

# endif
</font></code>


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

</body>
</html>