mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-11-27 06:30:28 +08:00
add support for determinant on empty matrix
This commit is contained in:
parent
78d3c54631
commit
cac147ba10
@ -47,6 +47,8 @@ template<typename Derived,
|
||||
{
|
||||
static inline typename ei_traits<Derived>::Scalar run(const Derived& m)
|
||||
{
|
||||
if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0)
|
||||
return typename ei_traits<Derived>::Scalar(1);
|
||||
return m.partialPivLu().determinant();
|
||||
}
|
||||
};
|
||||
|
@ -61,6 +61,9 @@ template<typename MatrixType> void determinant(const MatrixType& m)
|
||||
m2 = m1;
|
||||
m2.row(i) *= x;
|
||||
VERIFY_IS_APPROX(m2.determinant(), m1.determinant() * x);
|
||||
|
||||
// check empty matrix
|
||||
VERIFY_IS_APPROX(m2.block(0,0,0,0).determinant(), Scalar(1));
|
||||
}
|
||||
|
||||
void test_determinant()
|
||||
|
Loading…
Reference in New Issue
Block a user