diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/Block.h | 2 | ||||
-rw-r--r-- | src/internal/Matrix.h | 7 | ||||
-rw-r--r-- | src/internal/MatrixOps.h | 6 | ||||
-rw-r--r-- | src/internal/MatrixRef.h | 2 | ||||
-rw-r--r-- | src/internal/Minor.h | 2 | ||||
-rw-r--r-- | src/internal/RowAndCol.h | 4 | ||||
-rw-r--r-- | src/internal/ScalarOps.h | 52 | ||||
-rw-r--r-- | src/internal/Util.h | 10 |
8 files changed, 49 insertions, 36 deletions
diff --git a/src/internal/Block.h b/src/internal/Block.h index cd4422887..9be1d165c 100644 --- a/src/internal/Block.h +++ b/src/internal/Block.h @@ -54,7 +54,7 @@ template<typename MatrixType> class MatrixBlock : m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow), m_startCol(other.m_startCol), m_endCol(other.m_endCol) {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixBlock) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixBlock) private: const Ref& _ref() const { return *this; } diff --git a/src/internal/Matrix.h b/src/internal/Matrix.h index 15042beed..c07aa2d08 100644 --- a/src/internal/Matrix.h +++ b/src/internal/Matrix.h @@ -84,8 +84,8 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, return Base::operator=(other); } - INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=) - INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=) + EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=) + EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=) explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} template<typename OtherDerived> @@ -124,6 +124,9 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<int>, ci) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf) EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd) +#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_TYPEDEFS + } // namespace Eigen #include "MatrixOps.h" diff --git a/src/internal/MatrixOps.h b/src/internal/MatrixOps.h index 5697588ac..4a4e2ca98 100644 --- a/src/internal/MatrixOps.h +++ b/src/internal/MatrixOps.h @@ -50,7 +50,7 @@ template<typename Lhs, typename Rhs> class MatrixSum MatrixSum(const MatrixSum& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixSum) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixSum) private: @@ -90,7 +90,7 @@ template<typename Lhs, typename Rhs> class MatrixDifference MatrixDifference(const MatrixDifference& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixDifference) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixDifference) private: const Ref& _ref() const { return *this; } @@ -129,7 +129,7 @@ template<typename Lhs, typename Rhs> class MatrixProduct MatrixProduct(const MatrixProduct& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixProduct) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixProduct) private: const Ref& _ref() const { return *this; } diff --git a/src/internal/MatrixRef.h b/src/internal/MatrixRef.h index d074adf2e..71545aba3 100644 --- a/src/internal/MatrixRef.h +++ b/src/internal/MatrixRef.h @@ -40,7 +40,7 @@ template<typename MatrixType> class MatrixRef MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {} ~MatrixRef() {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixRef) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef) private: int _rows() const { return m_matrix.rows(); } diff --git a/src/internal/Minor.h b/src/internal/Minor.h index c7ddd5de3..627dbf723 100644 --- a/src/internal/Minor.h +++ b/src/internal/Minor.h @@ -50,7 +50,7 @@ template<typename MatrixType> class MatrixMinor MatrixMinor(const MatrixMinor& other) : m_matrix(other.m_matrix), m_row(other.m_row), m_col(other.m_col) {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixMinor) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixMinor) private: const Ref& _ref() const { return *this; } diff --git a/src/internal/RowAndCol.h b/src/internal/RowAndCol.h index c8e9eb46d..b99d70766 100644 --- a/src/internal/RowAndCol.h +++ b/src/internal/RowAndCol.h @@ -55,7 +55,7 @@ template<typename MatrixType> class MatrixRow return EigenBase<Scalar, MatrixRow<MatrixType> >::operator=(other); } - INHERIT_ASSIGNMENT_OPERATORS(MatrixRow) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRow) private: const Ref& _ref() const { return *this; } @@ -103,7 +103,7 @@ template<typename MatrixType> class MatrixCol MatrixCol(const MatrixCol& other) : m_matrix(other.m_matrix), m_col(other.m_col) {} - INHERIT_ASSIGNMENT_OPERATORS(MatrixCol) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixCol) private: const Ref& _ref() const { return *this; } diff --git a/src/internal/ScalarOps.h b/src/internal/ScalarOps.h index ecfebcaf3..41325fd75 100644 --- a/src/internal/ScalarOps.h +++ b/src/internal/ScalarOps.h @@ -46,7 +46,7 @@ template<typename MatrixType> class ScalarProduct ScalarProduct(const ScalarProduct& other) : m_matrix(other.m_matrix), m_scalar(other.m_scalar) {} - INHERIT_ASSIGNMENT_OPERATORS(ScalarProduct) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ScalarProduct) private: const Ref& _ref() const { return *this; } @@ -63,29 +63,39 @@ template<typename MatrixType> class ScalarProduct const Scalar m_scalar; }; -template<typename Scalar, typename Derived> -ScalarProduct<Derived> -operator*(const EigenBase<Scalar, Derived>& matrix, - Scalar scalar) -{ - return ScalarProduct<Derived>(matrix.ref(), scalar); +#define EIGEN_MAKE_SCALAR_OPS(OtherScalar) \ +template<typename Scalar, typename Derived> \ +ScalarProduct<Derived> \ +operator*(const EigenBase<Scalar, Derived>& matrix, \ + OtherScalar scalar) \ +{ \ + return ScalarProduct<Derived>(matrix.ref(), scalar); \ +} \ + \ +template<typename Scalar, typename Derived> \ +ScalarProduct<Derived> \ +operator*(OtherScalar scalar, \ + const EigenBase<Scalar, Derived>& matrix) \ +{ \ + return ScalarProduct<Derived>(matrix.ref(), scalar); \ +} \ + \ +template<typename Scalar, typename Derived> \ +ScalarProduct<Derived> \ +operator/(const EigenBase<Scalar, Derived>& matrix, \ + OtherScalar scalar) \ +{ \ + return matrix * (static_cast<typename Derived::Scalar>(1) / scalar); \ } -template<typename Scalar, typename Derived> -ScalarProduct<Derived> -operator*(Scalar scalar, - const EigenBase<Scalar, Derived>& matrix) -{ - return ScalarProduct<Derived>(matrix.ref(), scalar); -} +EIGEN_MAKE_SCALAR_OPS(int) +EIGEN_MAKE_SCALAR_OPS(float) +EIGEN_MAKE_SCALAR_OPS(double) +EIGEN_MAKE_SCALAR_OPS(std::complex<int>) +EIGEN_MAKE_SCALAR_OPS(std::complex<float>) +EIGEN_MAKE_SCALAR_OPS(std::complex<double>) -template<typename Scalar, typename Derived> -ScalarProduct<Derived> -operator/(const EigenBase<Scalar, Derived>& matrix, - Scalar scalar) -{ - return matrix * (static_cast<typename Derived::Scalar>(1) / scalar); -} +#undef EIGEN_MAKE_SCALAR_OPS } // namespace Eigen diff --git a/src/internal/Util.h b/src/internal/Util.h index 9bba7297e..0469d82a9 100644 --- a/src/internal/Util.h +++ b/src/internal/Util.h @@ -75,7 +75,7 @@ const int DynamicSize = -1; #define EIGEN_UNUSED(x) (void)x -#define INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ +#define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ template<typename OtherScalar, typename OtherDerived> \ Derived& operator Op(const EigenBase<OtherScalar, OtherDerived>& other) \ { \ @@ -86,10 +86,10 @@ Derived& operator Op(const Derived& other) \ return EigenBase<Scalar, Derived>::operator Op(other); \ } -#define INHERIT_ASSIGNMENT_OPERATORS(Derived) \ -INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \ -INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \ -INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) +#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ +EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, =) \ +EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, +=) \ +EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) } // namespace Eigen |