aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/Matrix.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-06-28 21:27:37 +0200
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-06-28 21:27:37 +0200
commit6809f7b1cdb3da897b996b72bb7f3c9dd4c26921 (patch)
tree390185a19c0d4aee90a9eb055897a69381c94962 /Eigen/src/Core/Matrix.h
parentfc9000f23ed5d9c902e2153a5008d9a24adf930c (diff)
new implementation of diagonal matrices and diagonal matrix expressions
Diffstat (limited to 'Eigen/src/Core/Matrix.h')
-rw-r--r--Eigen/src/Core/Matrix.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h
index e099ba1e7..8cf5bc64b 100644
--- a/Eigen/src/Core/Matrix.h
+++ b/Eigen/src/Core/Matrix.h
@@ -124,6 +124,7 @@ class Matrix
{
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix)
+
enum { Options = _Options };
friend class Eigen::Map<Matrix, Unaligned>;
typedef class Eigen::Map<Matrix, Unaligned> UnalignedMapType;
@@ -335,11 +336,11 @@ class Matrix
EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue<OtherDerived,OtherEvalType>& func)
{ return Base::operator=(func); }
- EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=)
- EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=)
- EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=)
- EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, /=)
-
+ using Base::operator +=;
+ using Base::operator -=;
+ using Base::operator *=;
+ using Base::operator /=;
+
/** Default constructor.
*
* For fixed-size matrices, does nothing.
@@ -438,6 +439,22 @@ class Matrix
{ other.evalTo(*this); }
/** Destructor */
inline ~Matrix() {}
+
+
+ template<typename DiagonalDerived>
+ EIGEN_STRONG_INLINE Matrix& operator=(const DiagonalBase<DiagonalDerived> &other)
+ {
+ resize(other.diagonal().size(), other.diagonal().size());
+ Base::operator=(other);
+ return *this;
+ }
+
+ template<typename DiagonalDerived>
+ EIGEN_STRONG_INLINE Matrix(const DiagonalBase<DiagonalDerived> &other)
+ : m_storage(other.diagonal().size() * other.diagonal().size(), other.diagonal().size(), other.diagonal().size())
+ {
+ *this = other;
+ }
/** Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the
* data pointers.