Added Triangular expression to extract upper or lower (strictly or not)

part of a matrix. Triangular also provide an optimised method for forward
and backward substitution. Further optimizations regarding assignments and
products might come later.

Updated determinant() to take into account triangular matrices.

Started the QR module with a QR decompostion algorithm.
Help needed to build a QR algorithm (eigen solver) based on it.
This commit is contained in:
Gael Guennebaud
2008-04-26 18:26:05 +00:00
parent 62bf0bbd59
commit 4c92150676
21 changed files with 586 additions and 19 deletions

View File

@@ -71,7 +71,16 @@ template<typename Derived>
typename ei_traits<Derived>::Scalar MatrixBase<Derived>::determinant() const
{
assert(rows() == cols());
if(rows() <= 4) return ei_bruteforce_det(derived());
if (Derived::Flags & (NullLowerBit | NullUpperBit))
{
if (Derived::Flags & UnitDiagBit)
return 1;
else if (Derived::Flags & NullDiagBit)
return 0;
else
return derived().diagonal().redux(ei_scalar_product_op<Scalar>());
}
else if(rows() <= 4) return ei_bruteforce_det(derived());
else assert(false); // unimplemented for now
}

View File

@@ -98,7 +98,7 @@ template<typename MatrixType, bool CheckExistence> class Inverse : ei_no_assignm
protected:
bool m_exists;
typename MatrixType::Eval m_inverse;
MatrixType m_inverse;
};
template<typename MatrixType, bool CheckExistence>