add selfadjointView from a trinagularView

This commit is contained in:
Gael Guennebaud
2009-07-31 17:35:55 +02:00
parent 2796bcabb1
commit 18429156a1
2 changed files with 36 additions and 50 deletions

View File

@@ -156,7 +156,9 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
typedef typename ei_traits<TriangularView>::Scalar Scalar;
typedef _MatrixType MatrixType;
typedef typename MatrixType::PlainMatrixType PlainMatrixType;
typedef typename MatrixType::Nested MatrixTypeNested;
typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
enum {
Mode = _Mode,
TransposeMode = (Mode & UpperTriangularBit ? LowerTriangularBit : 0)
@@ -286,6 +288,17 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
void solveInPlace(const MatrixBase<OtherDerived>& other) const
{ return solveInPlace<OnTheLeft>(other); }
const SelfAdjointView<_MatrixTypeNested,Mode> selfadjointView() const
{
EIGEN_STATIC_ASSERT((Mode&UnitDiagBit)==0,PROGRAMMING_ERROR);
return SelfAdjointView<_MatrixTypeNested,Mode>(m_matrix);
}
SelfAdjointView<_MatrixTypeNested,Mode> selfadjointView()
{
EIGEN_STATIC_ASSERT((Mode&UnitDiagBit)==0,PROGRAMMING_ERROR);
return SelfAdjointView<_MatrixTypeNested,Mode>(m_matrix);
}
template<typename OtherDerived>
void swap(const TriangularBase<OtherDerived>& other)
{
@@ -300,7 +313,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
protected:
const typename MatrixType::Nested m_matrix;
const MatrixTypeNested m_matrix;
};
/***************************************************************************
@@ -562,6 +575,10 @@ void TriangularBase<Derived>::evalToDenseLazy(MatrixBase<DenseDerived> &other) c
>::run(other.derived(), derived()._expression());
}
/***************************************************************************
* Implementation of TriangularView methods
***************************************************************************/
/***************************************************************************
* Implementation of MatrixBase methods
***************************************************************************/