10#ifndef EIGEN_DETERMINANT_H
11#define EIGEN_DETERMINANT_H
17template<
typename Derived>
18inline const typename Derived::Scalar bruteforce_det3_helper
19(
const MatrixBase<Derived>& matrix,
int a,
int b,
int c)
21 return matrix.coeff(0,a)
22 * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b));
25template<
typename Derived>
26const typename Derived::Scalar bruteforce_det4_helper
27(
const MatrixBase<Derived>& matrix,
int j,
int k,
int m,
int n)
29 return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1))
30 * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3));
33template<
typename Derived,
34 int DeterminantType = Derived::RowsAtCompileTime
39 if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0)
41 return m.partialPivLu().determinant();
57 return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1);
65 return bruteforce_det3_helper(m,0,1,2)
66 - bruteforce_det3_helper(m,1,0,2)
67 + bruteforce_det3_helper(m,2,0,1);
76 return bruteforce_det4_helper(m,0,1,2,3)
77 - bruteforce_det4_helper(m,0,2,1,3)
78 + bruteforce_det4_helper(m,0,3,1,2)
79 + bruteforce_det4_helper(m,1,2,0,3)
80 - bruteforce_det4_helper(m,1,3,0,2)
81 + bruteforce_det4_helper(m,2,3,0,1);
91template<
typename Derived>
94 eigen_assert(rows() == cols());
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Definition Determinant.h:36
Definition ForwardDeclarations.h:17