\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
det_33.hpp¶
View page sourceSource: det_33¶
#
ifndef CPPAD_DET_33_HPP
#
define CPPAD_DET_33_HPP
# include <cppad/utility/near_equal.hpp>
namespace CppAD {
template <class Vector>
bool det_33(const Vector &x, const Vector &d)
{ bool ok = true;
double eps99 = 99.0 * std::numeric_limits<double>::epsilon();
// use expansion by minors to compute the determinant by hand
double check = 0.;
check += x[0] * ( x[4] * x[8] - x[5] * x[7] );
check -= x[1] * ( x[3] * x[8] - x[5] * x[6] );
check += x[2] * ( x[3] * x[7] - x[4] * x[6] );
ok &= CppAD::NearEqual(check, d[0], eps99, eps99);
return ok;
}
}
# endif