aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-01-28 13:04:23 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2011-01-28 13:04:23 -0500
commita1f5ea8954bfe1818a42a5ffcc5cd40fe5878a97 (patch)
treee132c1e799d9415764e02b96de11251556cac967 /Eigen
parente001db2a15e5b66c84cc9d3f59238f12dac7a09d (diff)
make eigen2 cholesky test pass
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Cholesky/LDLT.h16
-rw-r--r--Eigen/src/Cholesky/LLT.h11
-rw-r--r--Eigen/src/Core/DiagonalMatrix.h1
-rw-r--r--Eigen/src/Core/PlainObjectBase.h1
-rw-r--r--Eigen/src/Core/TriangularMatrix.h25
5 files changed, 42 insertions, 12 deletions
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h
index 635fb1586..5e2352caa 100644
--- a/Eigen/src/Cholesky/LDLT.h
+++ b/Eigen/src/Cholesky/LDLT.h
@@ -142,6 +142,13 @@ template<typename _MatrixType, int _UpLo> class LDLT
eigen_assert(m_isInitialized && "LDLT is not initialized.");
return m_sign == 1;
}
+
+ #ifdef EIGEN2_SUPPORT
+ inline bool isPositiveDefinite() const
+ {
+ return isPositive();
+ }
+ #endif
/** \returns true if the matrix is negative (semidefinite) */
inline bool isNegative(void) const
@@ -166,6 +173,15 @@ template<typename _MatrixType, int _UpLo> class LDLT
return internal::solve_retval<LDLT, Rhs>(*this, b.derived());
}
+ #ifdef EIGEN2_SUPPORT
+ template<typename OtherDerived, typename ResultType>
+ bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
+ {
+ *result = this->solve(b);
+ return true;
+ }
+ #endif
+
template<typename Derived>
bool solveInPlace(MatrixBase<Derived> &bAndX) const;
diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h
index 53a0543fe..a8fc525e8 100644
--- a/Eigen/src/Cholesky/LLT.h
+++ b/Eigen/src/Cholesky/LLT.h
@@ -135,6 +135,17 @@ template<typename _MatrixType, int _UpLo> class LLT
return internal::solve_retval<LLT, Rhs>(*this, b.derived());
}
+ #ifdef EIGEN2_SUPPORT
+ template<typename OtherDerived, typename ResultType>
+ bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const
+ {
+ *result = this->solve(b);
+ return true;
+ }
+
+ bool isPositiveDefinite() const { return true; }
+ #endif
+
template<typename Derived>
void solveInPlace(MatrixBase<Derived> &bAndX) const;
diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h
index 405839ae3..f41a74bfa 100644
--- a/Eigen/src/Core/DiagonalMatrix.h
+++ b/Eigen/src/Core/DiagonalMatrix.h
@@ -46,6 +46,7 @@ class DiagonalBase : public EigenBase<Derived>
};
typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime> DenseMatrixType;
+ typedef DenseMatrixType DenseType;
typedef DiagonalMatrix<Scalar,DiagonalVectorType::SizeAtCompileTime,DiagonalVectorType::MaxSizeAtCompileTime> PlainObject;
inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h
index 21c740829..666ce7743 100644
--- a/Eigen/src/Core/PlainObjectBase.h
+++ b/Eigen/src/Core/PlainObjectBase.h
@@ -56,6 +56,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
+ typedef Derived DenseType;
using Base::RowsAtCompileTime;
using Base::ColsAtCompileTime;
diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h
index 40dd2e4bc..eb82538dd 100644
--- a/Eigen/src/Core/TriangularMatrix.h
+++ b/Eigen/src/Core/TriangularMatrix.h
@@ -49,6 +49,7 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
typedef typename internal::traits<Derived>::StorageKind StorageKind;
typedef typename internal::traits<Derived>::Index Index;
typedef typename internal::traits<Derived>::DenseMatrixType DenseMatrixType;
+ typedef DenseMatrixType DenseType;
inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); }
@@ -170,6 +171,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
typedef _MatrixType MatrixType;
typedef typename internal::traits<TriangularView>::DenseMatrixType DenseMatrixType;
+ typedef DenseMatrixType PlainObject;
protected:
typedef typename internal::traits<TriangularView>::MatrixTypeNested MatrixTypeNested;
@@ -300,24 +302,24 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
<Mode,false,OtherDerived,OtherDerived::IsVectorAtCompileTime,MatrixType,false>
(lhs.derived(),rhs.m_matrix);
}
-
+
#ifdef EIGEN2_SUPPORT
-
- template<typename OtherMatrixType>
+ template<typename OtherDerived>
struct eigen2_product_return_type
{
typedef typename TriangularView<MatrixType,Mode>::DenseMatrixType DenseMatrixType;
- typedef typename TriangularView<OtherMatrixType,Mode>::DenseMatrixType OtherDenseMatrixType;
- typedef typename ProductReturnType<DenseMatrixType, OtherDenseMatrixType>::Type ProdRetType;
+ typedef typename OtherDerived::PlainObject::DenseType OtherPlainObject;
+ typedef typename ProductReturnType<DenseMatrixType, OtherPlainObject>::Type ProdRetType;
typedef typename ProdRetType::PlainObject type;
};
- template<typename OtherMatrixType>
- const typename eigen2_product_return_type<OtherMatrixType>::type
- operator*(const TriangularView<OtherMatrixType, Mode>& rhs) const
+ template<typename OtherDerived>
+ const typename eigen2_product_return_type<OtherDerived>::type
+ operator*(const EigenBase<OtherDerived>& rhs) const
{
- return this->toDenseMatrix() * rhs.toDenseMatrix();
+ typename OtherDerived::PlainObject::DenseType rhsPlainObject;
+ rhs.evalTo(rhsPlainObject);
+ return this->toDenseMatrix() * rhsPlainObject;
}
-
template<typename OtherMatrixType>
bool isApprox(const TriangularView<OtherMatrixType, Mode>& other, typename NumTraits<Scalar>::Real precision = NumTraits<Scalar>::dummy_precision()) const
{
@@ -328,7 +330,6 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
{
return this->toDenseMatrix().isApprox(other, precision);
}
-
#endif // EIGEN2_SUPPORT
template<int Side, typename OtherDerived>
@@ -694,7 +695,7 @@ void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
&& DenseDerived::SizeAtCompileTime * internal::traits<Derived>::CoeffReadCost / 2
<= EIGEN_UNROLLING_LIMIT
};
- eigen_assert(this->rows() == other.rows() && this->cols() == other.cols());
+ other.derived().resize(this->rows(), this->cols());
internal::triangular_assignment_selector
<DenseDerived, typename internal::traits<Derived>::MatrixTypeNestedCleaned, Derived::Mode,