25 #ifndef EIGEN_DETERMINANT_H
26 #define EIGEN_DETERMINANT_H
32 template<
typename Derived>
36 return matrix.coeff(0,a)
37 * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b));
40 template<
typename Derived>
44 return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1))
45 * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3));
48 template<
typename Derived,
49 int DeterminantType = Derived::RowsAtCompileTime
50 >
struct determinant_impl
54 if(Derived::ColsAtCompileTime==
Dynamic && m.rows()==0)
56 return m.partialPivLu().determinant();
60 template<
typename Derived>
struct determinant_impl<Derived, 1>
68 template<
typename Derived>
struct determinant_impl<Derived, 2>
72 return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1);
76 template<
typename Derived>
struct determinant_impl<Derived, 3>
86 template<
typename Derived>
struct determinant_impl<Derived, 4>
106 template<
typename Derived>
109 assert(rows() == cols());
110 typedef typename internal::nested<Derived,Base::RowsAtCompileTime>::type Nested;
111 return internal::determinant_impl<typename internal::remove_all<Nested>::type>::run(derived());
116 #endif // EIGEN_DETERMINANT_H