diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index d9f7ee531..f9f893fb4 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -56,17 +56,19 @@ * * \sa MatrixBase::block(int,int,int,int), MatrixBase::block(int,int), class VectorBlock */ -template class Block - : public MatrixBase > +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + +template class Block + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; /** Fixed-size constructor */ @@ -143,16 +145,16 @@ template -Block MatrixBase +template +Block MatrixBase ::block(int startRow, int startCol, int blockRows, int blockCols) { return Block(asArg(), startRow, startCol, blockRows, blockCols); } /** This is the const version of block(int,int,int,int). */ -template -const Block MatrixBase +template +const Block MatrixBase ::block(int startRow, int startCol, int blockRows, int blockCols) const { return Block(asArg(), startRow, startCol, blockRows, blockCols); @@ -174,8 +176,8 @@ const Block MatrixBase * * \sa class Block, block(int) */ -template -Block MatrixBase +template +Block MatrixBase ::block(int start, int size) { assert(Traits::IsVectorAtCompileTime); @@ -186,8 +188,8 @@ Block MatrixBase } /** This is the const version of block(int,int).*/ -template -const Block MatrixBase +template +const Block MatrixBase ::block(int start, int size) const { assert(Traits::IsVectorAtCompileTime); @@ -212,8 +214,8 @@ const Block MatrixBase * * \sa class Block, block(int,int) */ -template -Block MatrixBase +template +Block MatrixBase ::start(int size) { assert(Traits::IsVectorAtCompileTime); @@ -223,8 +225,8 @@ Block MatrixBase } /** This is the const version of start(int).*/ -template -const Block MatrixBase +template +const Block MatrixBase ::start(int size) const { assert(Traits::IsVectorAtCompileTime); @@ -248,8 +250,8 @@ const Block MatrixBase * * \sa class Block, block(int,int) */ -template -Block MatrixBase +template +Block MatrixBase ::end(int size) { assert(Traits::IsVectorAtCompileTime); @@ -261,8 +263,8 @@ Block MatrixBase } /** This is the const version of end(int).*/ -template -const Block MatrixBase +template +const Block MatrixBase ::end(int size) const { assert(Traits::IsVectorAtCompileTime); @@ -289,8 +291,8 @@ const Block MatrixBase * * \sa class Block, block(int,int,int,int) */ -template -Block MatrixBase +template +Block MatrixBase ::corner(CornerType type, int cRows, int cCols) { if(type == TopLeft) @@ -304,8 +306,8 @@ Block MatrixBase } /** This is the const version of corner(CornerType, int, int).*/ -template -const Block MatrixBase +template +const Block MatrixBase ::corner(CornerType type, int cRows, int cCols) const { if(type == TopLeft) @@ -334,18 +336,18 @@ const Block MatrixBase * * \sa class Block, block(int,int,int,int) */ -template +template template -Block MatrixBase +Block MatrixBase ::block(int startRow, int startCol) { return Block(asArg(), startRow, startCol); } /** This is the const version of block<>(int, int). */ -template +template template -const Block MatrixBase +const Block MatrixBase ::block(int startRow, int startCol) const { return Block(asArg(), startRow, startCol); diff --git a/Eigen/src/Core/Coeffs.h b/Eigen/src/Core/Coeffs.h index c7a438ff0..6ee45c260 100644 --- a/Eigen/src/Core/Coeffs.h +++ b/Eigen/src/Core/Coeffs.h @@ -39,8 +39,8 @@ * * \sa operator()(int,int) const, coeffRef(int,int), coeff(int) const */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::coeff(int row, int col) const { eigen_internal_assert(row >= 0 && row < rows() @@ -52,8 +52,8 @@ Scalar MatrixBase * * \sa operator()(int,int), operator[](int) const */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::operator()(int row, int col) const { assert(row >= 0 && row < rows() @@ -75,8 +75,8 @@ Scalar MatrixBase * * \sa operator()(int,int), coeff(int, int) const, coeffRef(int) */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::coeffRef(int row, int col) { eigen_internal_assert(row >= 0 && row < rows() @@ -88,8 +88,8 @@ Scalar& MatrixBase * * \sa operator()(int,int) const, operator[](int) */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::operator()(int row, int col) { assert(row >= 0 && row < rows() @@ -111,8 +111,8 @@ Scalar& MatrixBase * * \sa operator[](int) const, coeffRef(int), coeff(int,int) const */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::coeff(int index) const { eigen_internal_assert(Traits::IsVectorAtCompileTime); @@ -135,8 +135,8 @@ Scalar MatrixBase * \sa operator[](int), operator()(int,int) const, x() const, y() const, * z() const, w() const */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::operator[](int index) const { assert(Traits::IsVectorAtCompileTime); @@ -166,8 +166,8 @@ Scalar MatrixBase * * \sa operator[](int), coeff(int) const, coeffRef(int,int) */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::coeffRef(int index) { eigen_internal_assert(Traits::IsVectorAtCompileTime); @@ -189,8 +189,8 @@ Scalar& MatrixBase * * \sa operator[](int) const, operator()(int,int), x(), y(), z(), w() */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::operator[](int index) { assert(Traits::IsVectorAtCompileTime); @@ -207,43 +207,43 @@ Scalar& MatrixBase } /** equivalent to operator[](0). \only_for_vectors */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::x() const { return (*this)[0]; } /** equivalent to operator[](1). \only_for_vectors */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::y() const { return (*this)[1]; } /** equivalent to operator[](2). \only_for_vectors */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::z() const { return (*this)[2]; } /** equivalent to operator[](3). \only_for_vectors */ -template -Scalar MatrixBase +template +typename Scalar::Type MatrixBase ::w() const { return (*this)[3]; } /** equivalent to operator[](0). \only_for_vectors */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::x() { return (*this)[0]; } /** equivalent to operator[](1). \only_for_vectors */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::y() { return (*this)[1]; } /** equivalent to operator[](2). \only_for_vectors */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::z() { return (*this)[2]; } /** equivalent to operator[](3). \only_for_vectors */ -template -Scalar& MatrixBase +template +typename Scalar::Type& MatrixBase ::w() { return (*this)[3]; } #endif // EIGEN_COEFFS_H diff --git a/Eigen/src/Core/Column.h b/Eigen/src/Core/Column.h index d9aec6c42..7eee89d91 100644 --- a/Eigen/src/Core/Column.h +++ b/Eigen/src/Core/Column.h @@ -45,15 +45,19 @@ * * \sa MatrixBase::col() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Column - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; Column(const MatRef& matrix, int col) : m_matrix(matrix), m_col(col) @@ -96,17 +100,17 @@ template class Column * Output: \verbinclude MatrixBase_col.out * * \sa row(), class Column */ -template +template Column -MatrixBase::col(int i) +MatrixBase::col(int i) { return Column(asArg(), i); } /** This is the const version of col(). */ -template +template const Column -MatrixBase::col(int i) const +MatrixBase::col(int i) const { return Column(asArg(), i); } diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index ba64f3f40..b7de3b3aa 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -29,8 +29,8 @@ /** \internal * Helper class to define the MatrixBase::operator<< */ -template -struct MatrixBase::CommaInitializer +template +struct MatrixBase::CommaInitializer { CommaInitializer(Derived& mat, const Scalar& s) : m_matrix(mat), m_row(0), m_col(1), m_currentBlockRows(1) @@ -39,7 +39,7 @@ struct MatrixBase::CommaInitializer } template - CommaInitializer(Derived& mat, const MatrixBase& other) + CommaInitializer(Derived& mat, const MatrixBase& other) : m_matrix(mat), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) { m_matrix.block(0, 0, other.rows(), other.cols()) = other; @@ -60,7 +60,7 @@ struct MatrixBase::CommaInitializer } template - CommaInitializer& operator,(const MatrixBase& other) + CommaInitializer& operator,(const MatrixBase& other) { if (m_col==m_matrix.cols()) { @@ -94,15 +94,16 @@ struct MatrixBase::CommaInitializer * Example: \include MatrixBase_set.cpp * Output: \verbinclude MatrixBase_set.out */ -template -typename MatrixBase::CommaInitializer MatrixBase::operator<< (const Scalar& s) +template +typename MatrixBase::CommaInitializer MatrixBase::operator<< (const Scalar& s) { - return CommaInitializer(*static_cast(this), s); + return CommaInitializer(*static_cast(this), s); } -template +template template -typename MatrixBase::CommaInitializer MatrixBase::operator<< (const MatrixBase& other) +typename MatrixBase::CommaInitializer +MatrixBase::operator<<(const MatrixBase& other) { return CommaInitializer(*static_cast(this), other); } diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 9d3dd695c..5314eb793 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -46,19 +46,21 @@ * * \sa class ScalarProductOp, class ScalarQuotientOp */ +template +struct Scalar > +{ typedef typename ei_result_of::type Type; }; + template class CwiseBinaryOp : NoOperatorEquals, - public MatrixBase< - typename ei_result_of::type, - CwiseBinaryOp > + public MatrixBase > { public: - typedef typename ei_result_of::type Scalar; + typedef typename Scalar::Type Scalar; typedef typename Lhs::AsArg LhsRef; typedef typename Rhs::AsArg RhsRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; CwiseBinaryOp(const LhsRef& lhs, const RhsRef& rhs, const BinaryOp& func = BinaryOp()) : m_lhs(lhs), m_rhs(rhs), m_functor(func) @@ -131,9 +133,9 @@ struct ScalarQuotientOp EIGEN_EMPTY_STRUCT { * * \sa class CwiseBinaryOp, MatrixBase::operator-=() */ -template +template const CwiseBinaryOp -operator-(const MatrixBase &mat1, const MatrixBase &mat2) +operator-(const MatrixBase &mat1, const MatrixBase &mat2) { return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); } @@ -142,10 +144,10 @@ operator-(const MatrixBase &mat1, const MatrixBase +template template Derived & -MatrixBase::operator-=(const MatrixBase &other) +MatrixBase::operator-=(const MatrixBase &other) { return *this = *this - other; } @@ -157,9 +159,9 @@ MatrixBase::operator-=(const MatrixBase & * * \sa class CwiseBinaryOp, MatrixBase::operator+=() */ -template +template const CwiseBinaryOp -operator+(const MatrixBase &mat1, const MatrixBase &mat2) +operator+(const MatrixBase &mat1, const MatrixBase &mat2) { return CwiseBinaryOp(mat1.asArg(), mat2.asArg()); } @@ -168,10 +170,10 @@ operator+(const MatrixBase &mat1, const MatrixBase +template template Derived & -MatrixBase::operator+=(const MatrixBase& other) +MatrixBase::operator+=(const MatrixBase& other) { return *this = *this + other; } @@ -181,10 +183,10 @@ MatrixBase::operator+=(const MatrixBase& * * \sa class CwiseBinaryOp */ -template +template template const CwiseBinaryOp -MatrixBase::cwiseProduct(const MatrixBase &other) const +MatrixBase::cwiseProduct(const MatrixBase &other) const { return CwiseBinaryOp(asArg(), other.asArg()); } @@ -194,10 +196,10 @@ MatrixBase::cwiseProduct(const MatrixBase * * \sa class CwiseBinaryOp */ -template +template template const CwiseBinaryOp -MatrixBase::cwiseQuotient(const MatrixBase &other) const +MatrixBase::cwiseQuotient(const MatrixBase &other) const { return CwiseBinaryOp(asArg(), other.asArg()); } @@ -210,10 +212,10 @@ MatrixBase::cwiseQuotient(const MatrixBase +template template const CwiseBinaryOp -MatrixBase::cwise(const MatrixBase &other, const CustomBinaryOp& func) const +MatrixBase::cwise(const MatrixBase &other, const CustomBinaryOp& func) const { return CwiseBinaryOp(asArg(), other.asArg(), func); } diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index 51a037f24..55ff7e170 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -39,18 +39,20 @@ * * \sa class CwiseBinaryOp */ +template +struct Scalar > +{ typedef typename ei_result_of::type Type; }; + template class CwiseUnaryOp : NoOperatorEquals, - public MatrixBase< - typename ei_result_of::type, - CwiseUnaryOp > + public MatrixBase > { public: typedef typename ei_result_of::type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; CwiseUnaryOp(const MatRef& mat, const UnaryOp& func = UnaryOp()) : m_matrix(mat), m_functor(func) {} @@ -97,18 +99,18 @@ struct ScalarAbsOp EIGEN_EMPTY_STRUCT { /** \returns an expression of the opposite of \c *this */ -template +template const CwiseUnaryOp -MatrixBase::operator-() const +MatrixBase::operator-() const { return CwiseUnaryOp(asArg()); } /** \returns an expression of the opposite of \c *this */ -template +template const CwiseUnaryOp -MatrixBase::cwiseAbs() const +MatrixBase::cwiseAbs() const { return CwiseUnaryOp(asArg()); } @@ -124,10 +126,10 @@ MatrixBase::cwiseAbs() const * * \sa class CwiseUnaryOp, class CwiseBinarOp, MatrixBase::operator-, MatrixBase::cwiseAbs */ -template +template template const CwiseUnaryOp -MatrixBase::cwise(const CustomUnaryOp& func) const +MatrixBase::cwise(const CustomUnaryOp& func) const { return CwiseUnaryOp(asArg(), func); } @@ -145,9 +147,9 @@ struct ScalarConjugateOp EIGEN_EMPTY_STRUCT { /** \returns an expression of the complex conjugate of *this. * * \sa adjoint() */ -template +template const CwiseUnaryOp -MatrixBase::conjugate() const +MatrixBase::conjugate() const { return CwiseUnaryOp(asArg()); } @@ -173,10 +175,10 @@ struct ScalarCastOp EIGEN_EMPTY_STRUCT { * * \sa class CwiseUnaryOp, class ScalarCastOp */ -template +template template const CwiseUnaryOp, Derived> -MatrixBase::cast() const +MatrixBase::cast() const { return CwiseUnaryOp, Derived>(asArg()); } @@ -195,34 +197,35 @@ struct ScalarMultipleOp { }; /** \relates MatrixBase \sa class ScalarMultipleOp */ -template -const CwiseUnaryOp, Derived> -MatrixBase::operator*(const Scalar& scalar) const +template +const CwiseUnaryOp::Type>, Derived> +MatrixBase::operator*(const Scalar& scalar) const { return CwiseUnaryOp, Derived>(asArg(), ScalarMultipleOp(scalar)); } /** \relates MatrixBase \sa class ScalarMultipleOp */ -template -const CwiseUnaryOp, Derived> -MatrixBase::operator/(const Scalar& scalar) const +template +const CwiseUnaryOp::Type>, Derived> +MatrixBase::operator/(const Scalar& scalar) const { assert(NumTraits::HasFloatingPoint); - return CwiseUnaryOp, Derived>(asArg(), ScalarMultipleOp(static_cast(1) / scalar)); + return CwiseUnaryOp, Derived> + (asArg(), ScalarMultipleOp(static_cast(1) / scalar)); } /** \sa ScalarMultipleOp */ -template +template Derived& -MatrixBase::operator*=(const Scalar& other) +MatrixBase::operator*=(const Scalar& other) { return *this = *this * other; } /** \sa ScalarMultipleOp */ -template +template Derived& -MatrixBase::operator/=(const Scalar& other) +MatrixBase::operator/=(const Scalar& other) { return *this = *this / other; } diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h index 58c6e3ed8..a03241e65 100644 --- a/Eigen/src/Core/DiagonalCoeffs.h +++ b/Eigen/src/Core/DiagonalCoeffs.h @@ -37,15 +37,19 @@ * * \sa MatrixBase::diagonal() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class DiagonalCoeffs - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; DiagonalCoeffs(const MatRef& matrix) : m_matrix(matrix) {} @@ -87,17 +91,17 @@ template class DiagonalCoeffs * Output: \verbinclude MatrixBase_diagonal.out * * \sa class DiagonalCoeffs */ -template +template DiagonalCoeffs -MatrixBase::diagonal() +MatrixBase::diagonal() { return DiagonalCoeffs(asArg()); } /** This is the const version of diagonal(). */ -template +template const DiagonalCoeffs -MatrixBase::diagonal() const +MatrixBase::diagonal() const { return DiagonalCoeffs(asArg()); } diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 90683e6bc..6b4e0b17a 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -38,17 +38,20 @@ * * \sa MatrixBase::diagonal(const OtherDerived&) */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class DiagonalMatrix : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: - typedef typename CoeffsVectorType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename CoeffsVectorType::AsArg CoeffsVecRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; DiagonalMatrix(const CoeffsVecRef& coeffs) : m_coeffs(coeffs) { @@ -86,9 +89,9 @@ class DiagonalMatrix : NoOperatorEquals, * * \sa class DiagonalMatrix, isDiagonal() **/ -template +template const DiagonalMatrix -MatrixBase::asDiagonal() const +MatrixBase::asDiagonal() const { return DiagonalMatrix(asArg()); } @@ -101,8 +104,8 @@ MatrixBase::asDiagonal() const * * \sa asDiagonal() */ -template -bool MatrixBase::isDiagonal +template +bool MatrixBase::isDiagonal (typename NumTraits::Real prec) const { if(cols() != rows()) return false; diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index d2ce1803a..03764ba34 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -67,9 +67,10 @@ struct DotUnroller * * \sa norm2(), norm() */ -template +template template -Scalar MatrixBase::dot(const MatrixBase& other) const +typename Scalar::Type +MatrixBase::dot(const MatrixBase& other) const { assert(Traits::IsVectorAtCompileTime && OtherDerived::Traits::IsVectorAtCompileTime @@ -80,7 +81,7 @@ Scalar MatrixBase::dot(const MatrixBase& && Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT) DotUnroller > + Derived, MatrixBase > ::run(*static_cast(this), other, res); else { @@ -97,8 +98,8 @@ Scalar MatrixBase::dot(const MatrixBase& * * \sa dot(), norm() */ -template -typename NumTraits::Real MatrixBase::norm2() const +template +typename NumTraits::Type>::Real MatrixBase::norm2() const { return ei_real(dot(*this)); } @@ -109,8 +110,8 @@ typename NumTraits::Real MatrixBase::norm2() const * * \sa dot(), norm2() */ -template -typename NumTraits::Real MatrixBase::norm() const +template +typename NumTraits::Type>::Real MatrixBase::norm() const { return ei_sqrt(norm2()); } @@ -121,9 +122,9 @@ typename NumTraits::Real MatrixBase::norm() const * * \sa norm() */ -template -const CwiseUnaryOp, Derived> -MatrixBase::normalized() const +template +const CwiseUnaryOp::Type>, Derived> +MatrixBase::normalized() const { return (*this) / norm(); } @@ -134,11 +135,10 @@ MatrixBase::normalized() const * Example: \include MatrixBase_isOrtho_vector.cpp * Output: \verbinclude MatrixBase_isOrtho_vector.out */ -template +template template -bool MatrixBase::isOrtho -(const MatrixBase& other, - typename NumTraits::Real prec) const +bool MatrixBase::isOrtho +(const MatrixBase& other, RealScalar prec) const { return ei_abs2(dot(other)) <= prec * prec * norm2() * other.norm2(); } @@ -154,9 +154,8 @@ bool MatrixBase::isOrtho * Example: \include MatrixBase_isOrtho_matrix.cpp * Output: \verbinclude MatrixBase_isOrtho_matrix.out */ -template -bool MatrixBase::isOrtho -(typename NumTraits::Real prec) const +template +bool MatrixBase::isOrtho(RealScalar prec) const { for(int i = 0; i < cols(); i++) { diff --git a/Eigen/src/Core/Eval.h b/Eigen/src/Core/Eval.h index aea34850a..85a9d0aa0 100644 --- a/Eigen/src/Core/Eval.h +++ b/Eigen/src/Core/Eval.h @@ -44,6 +44,10 @@ * * \sa MatrixBase::eval() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Eval : NoOperatorEquals, public Matrix< typename ExpressionType::Scalar, ExpressionType::Traits::RowsAtCompileTime, @@ -53,7 +57,7 @@ template class Eval : NoOperatorEquals, ExpressionType::Traits::MaxColsAtCompileTime> { public: - typedef typename ExpressionType::Scalar Scalar; + typedef typename Scalar::Type Scalar; /** The actual matrix type to evaluate to. This type can be used independently * of the rest of this class to get the actual matrix type to evaluate and store @@ -86,8 +90,8 @@ template class Eval : NoOperatorEquals, * Output: \verbinclude MatrixBase_eval.out * * \sa class Eval */ -template -const Eval MatrixBase::eval() const +template +const Eval MatrixBase::eval() const { return Eval(*static_cast(this)); } diff --git a/Eigen/src/Core/EvalOMP.h b/Eigen/src/Core/EvalOMP.h index 01f78b0c8..7bc006d17 100644 --- a/Eigen/src/Core/EvalOMP.h +++ b/Eigen/src/Core/EvalOMP.h @@ -109,8 +109,8 @@ template class EvalOMP : NoOperatorEquals, * * \sa class EvalOMP, eval() */ -template -const EvalOMP MatrixBase::evalOMP() const +template +const EvalOMP MatrixBase::evalOMP() const { return EvalOMP(*static_cast(this)); } diff --git a/Eigen/src/Core/ForwardDeclarations.h b/Eigen/src/Core/ForwardDeclarations.h index dce88336e..5bed1f154 100644 --- a/Eigen/src/Core/ForwardDeclarations.h +++ b/Eigen/src/Core/ForwardDeclarations.h @@ -25,6 +25,8 @@ #ifndef EIGEN_FORWARDDECLARATIONS_H #define EIGEN_FORWARDDECLARATIONS_H +template struct Scalar; + template class Matrix; template class MatrixRef; template class Row; diff --git a/Eigen/src/Core/Fuzzy.h b/Eigen/src/Core/Fuzzy.h index 0d401a9a1..a7a276328 100644 --- a/Eigen/src/Core/Fuzzy.h +++ b/Eigen/src/Core/Fuzzy.h @@ -41,9 +41,9 @@ * * \sa ei_isMuchSmallerThan(const RealScalar&, RealScalar) const */ -template +template template -bool MatrixBase::isApprox( +bool MatrixBase::isApprox( const OtherDerived& other, typename NumTraits::Real prec ) const @@ -71,10 +71,10 @@ bool MatrixBase::isApprox( * \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f] * For matrices, the comparison is done on all columns. * - * \sa isApprox(), isMuchSmallerThan(const MatrixBase&, RealScalar) const + * \sa isApprox(), isMuchSmallerThan(const MatrixBase&, RealScalar) const */ -template -bool MatrixBase::isMuchSmallerThan( +template +bool MatrixBase::isMuchSmallerThan( const typename NumTraits::Real& other, typename NumTraits::Real prec ) const @@ -102,10 +102,10 @@ bool MatrixBase::isMuchSmallerThan( * * \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const */ -template +template template -bool MatrixBase::isMuchSmallerThan( - const MatrixBase& other, +bool MatrixBase::isMuchSmallerThan( + const MatrixBase& other, typename NumTraits::Real prec ) const { diff --git a/Eigen/src/Core/IO.h b/Eigen/src/Core/IO.h index a02f2bcb7..db384b024 100644 --- a/Eigen/src/Core/IO.h +++ b/Eigen/src/Core/IO.h @@ -29,10 +29,10 @@ * * Outputs the matrix, laid out as an array as usual, to the given stream. */ -template +template std::ostream & operator << ( std::ostream & s, - const MatrixBase & m ) + const MatrixBase & m ) { for( int i = 0; i < m.rows(); i++ ) { diff --git a/Eigen/src/Core/Identity.h b/Eigen/src/Core/Identity.h index 5fd854850..38c8d0d32 100644 --- a/Eigen/src/Core/Identity.h +++ b/Eigen/src/Core/Identity.h @@ -31,14 +31,18 @@ * * \sa MatrixBase::identity(), MatrixBase::identity(int,int), MatrixBase::setIdentity() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Identity : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + typedef typename Scalar::Type Scalar; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; Identity(int rows, int cols) : m_rows(rows), m_cols(cols) { @@ -84,8 +88,8 @@ template class Identity : NoOperatorEquals, * * \sa identity(), setIdentity(), isIdentity() */ -template -const Identity MatrixBase::identity(int rows, int cols) +template +const Identity MatrixBase::identity(int rows, int cols) { return Identity(rows, cols); } @@ -100,8 +104,8 @@ const Identity MatrixBase::identity(int rows, int cols * * \sa identity(int,int), setIdentity(), isIdentity() */ -template -const Identity MatrixBase::identity() +template +const Identity MatrixBase::identity() { return Identity(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime); } @@ -115,8 +119,8 @@ const Identity MatrixBase::identity() * * \sa class Identity, identity(), identity(int,int), setIdentity() */ -template -bool MatrixBase::isIdentity +template +bool MatrixBase::isIdentity (typename NumTraits::Real prec) const { for(int j = 0; j < cols(); j++) @@ -145,8 +149,8 @@ bool MatrixBase::isIdentity * * \sa class Identity, identity(), identity(int,int), isIdentity() */ -template -Derived& MatrixBase::setIdentity() +template +Derived& MatrixBase::setIdentity() { return *this = Identity(rows(), cols()); } diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index ce46dd81c..634a17165 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -38,14 +38,18 @@ * * \sa Matrix::map() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Map - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + typedef typename Scalar::Type Scalar; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; private: enum { diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 474b55eab..68ccef1b1 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -71,20 +71,24 @@ * * Note that most of the API is in the base class MatrixBase. */ +template +struct Scalar > +{ typedef _Scalar Type; }; + template -class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, - _StorageOrder, _MaxRows, _MaxCols> > +class Matrix : public MatrixBase > { public: - friend class MatrixBase<_Scalar, Matrix>; - friend class MatrixBase<_Scalar, Matrix>::Traits; + friend class MatrixBase; + friend class MatrixBase::Traits; friend class Map; - typedef MatrixBase<_Scalar, Matrix> Base; - typedef _Scalar Scalar; - typedef MatrixRef AsArg; + typedef MatrixBase Base; + typedef typename Scalar::Type Scalar; + typedef MatrixRef AsArg; friend class MatrixRef; private: @@ -150,7 +154,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, * row-vectors remain row-vectors and vectors remain vectors. */ template - Matrix& operator=(const MatrixBase& other) + Matrix& operator=(const MatrixBase& other) { if(RowsAtCompileTime == 1) { @@ -275,7 +279,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, /** Constructor copying the value of the expression \a other */ template - Matrix(const MatrixBase& other) + Matrix(const MatrixBase& other) : m_storage(other.rows() * other.cols(), other.rows(), other.cols()) { *this = other; diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index ccec292f6..57ef46560 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -32,9 +32,6 @@ * This class is the base that is inherited by all matrix, vector, and expression * types. Most of the Eigen API is contained in this class. * - * \param Scalar is the type of the coefficients. Recall that Eigen allows - * only the following types for \a Scalar: \c int, \c float, \c double, - * \c std::complex, \c std::complex. * \param Derived is the derived type, e.g. a matrix type, or an expression, etc. * * When writing a function taking Eigen objects as argument, if you want your function @@ -43,8 +40,8 @@ * a matrix, vector, or expression \a x, prints the first row of \a x. * * \code - template - void printFirstRow(const Eigen::MatrixBase& x) + template + void printFirstRow(const Eigen::MatrixBase& x) { cout << x.row(0) << endl; } @@ -52,12 +49,14 @@ * * \nosubgrouping */ -template class MatrixBase +template class MatrixBase { struct CommaInitializer; public: + typedef typename Scalar::Type Scalar; + /** \brief Some traits provided by the Derived type. * * Grouping these in a nested subclass is what was needed for ICC compatibility. */ @@ -170,7 +169,7 @@ template class MatrixBase /** Copies \a other into *this. \returns a reference to *this. */ template - Derived& operator=(const MatrixBase& other); + Derived& operator=(const MatrixBase& other); /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) @@ -183,7 +182,7 @@ template class MatrixBase CommaInitializer operator<< (const Scalar& s); template - CommaInitializer operator<< (const MatrixBase& other); + CommaInitializer operator<< (const MatrixBase& other); /** swaps *this with the expression \a other. * @@ -192,7 +191,7 @@ template class MatrixBase * of course. TODO: get rid of const here. */ template - void swap(const MatrixBase& other); + void swap(const MatrixBase& other); /// \name sub-matrices //@{ @@ -252,7 +251,7 @@ template class MatrixBase Scalar trace() const; template - Scalar dot(const MatrixBase& other) const; + Scalar dot(const MatrixBase& other) const; RealScalar norm2() const; RealScalar norm() const; //@} @@ -282,7 +281,7 @@ template class MatrixBase bool isDiagonal(RealScalar prec = precision()) const; template - bool isOrtho(const MatrixBase& other, + bool isOrtho(const MatrixBase& other, RealScalar prec = precision()) const; bool isOrtho(RealScalar prec = precision()) const; @@ -292,7 +291,7 @@ template class MatrixBase bool isMuchSmallerThan(const RealScalar& other, RealScalar prec = precision()) const; template - bool isMuchSmallerThan(const MatrixBase& other, + bool isMuchSmallerThan(const MatrixBase& other, RealScalar prec = precision()) const; //@} @@ -301,11 +300,11 @@ template class MatrixBase const CwiseUnaryOp operator-() const; template - Derived& operator+=(const MatrixBase& other); + Derived& operator+=(const MatrixBase& other); template - Derived& operator-=(const MatrixBase& other); + Derived& operator-=(const MatrixBase& other); template - Derived& operator*=(const MatrixBase& other); + Derived& operator*=(const MatrixBase& other); Derived& operator*=(const Scalar& other); Derived& operator/=(const Scalar& other); @@ -319,17 +318,17 @@ template class MatrixBase template const Product - lazyProduct(const MatrixBase& other) const EIGEN_ALWAYS_INLINE; + lazyProduct(const MatrixBase& other) const EIGEN_ALWAYS_INLINE; const CwiseUnaryOp cwiseAbs() const; template const CwiseBinaryOp - cwiseProduct(const MatrixBase &other) const; + cwiseProduct(const MatrixBase &other) const; template const CwiseBinaryOp - cwiseQuotient(const MatrixBase &other) const; + cwiseQuotient(const MatrixBase &other) const; //@} /// \name coefficient accessors @@ -366,7 +365,7 @@ template class MatrixBase template const CwiseBinaryOp - cwise(const MatrixBase &other, const CustomBinaryOp& func = CustomBinaryOp()) const; + cwise(const MatrixBase &other, const CustomBinaryOp& func = CustomBinaryOp()) const; //@} /** puts in *row and *col the location of the coefficient of *this diff --git a/Eigen/src/Core/MatrixRef.h b/Eigen/src/Core/MatrixRef.h index 0c5c9f632..5d3100d22 100644 --- a/Eigen/src/Core/MatrixRef.h +++ b/Eigen/src/Core/MatrixRef.h @@ -25,14 +25,18 @@ #ifndef EIGEN_MATRIXREF_H #define EIGEN_MATRIXREF_H +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class MatrixRef - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + typedef typename Scalar::Type Scalar; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; MatrixRef(const MatrixType& matrix) : m_matrix(matrix) {} ~MatrixRef() {} diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h index 8da9e9051..faab9c8ae 100644 --- a/Eigen/src/Core/Minor.h +++ b/Eigen/src/Core/Minor.h @@ -37,15 +37,19 @@ * * \sa MatrixBase::minor() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Minor - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; Minor(const MatRef& matrix, int row, int col) @@ -97,17 +101,17 @@ template class Minor * * \sa class Minor */ -template +template Minor -MatrixBase::minor(int row, int col) +MatrixBase::minor(int row, int col) { return Minor(asArg(), row, col); } /** This is the const version of minor(). */ -template +template const Minor -MatrixBase::minor(int row, int col) const +MatrixBase::minor(int row, int col) const { return Minor(asArg(), row, col); } diff --git a/Eigen/src/Core/Ones.h b/Eigen/src/Core/Ones.h index 91b77cd9f..b77542d98 100644 --- a/Eigen/src/Core/Ones.h +++ b/Eigen/src/Core/Ones.h @@ -32,14 +32,18 @@ * \sa MatrixBase::ones(), MatrixBase::ones(int), MatrixBase::ones(int,int), * MatrixBase::setOnes(), MatrixBase::isOnes() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Ones : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + typedef typename Scalar::Type Scalar; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; private: enum { @@ -86,8 +90,8 @@ template class Ones : NoOperatorEquals, * * \sa ones(), ones(int), isOnes(), class Ones */ -template -const Ones MatrixBase::ones(int rows, int cols) +template +const Ones MatrixBase::ones(int rows, int cols) { return Ones(rows, cols); } @@ -108,8 +112,8 @@ const Ones MatrixBase::ones(int rows, int cols) * * \sa ones(), ones(int,int), isOnes(), class Ones */ -template -const Ones MatrixBase::ones(int size) +template +const Ones MatrixBase::ones(int size) { assert(Traits::IsVectorAtCompileTime); if(Traits::RowsAtCompileTime == 1) return Ones(1, size); @@ -126,8 +130,8 @@ const Ones MatrixBase::ones(int size) * * \sa ones(int), ones(int,int), isOnes(), class Ones */ -template -const Ones MatrixBase::ones() +template +const Ones MatrixBase::ones() { return Ones(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime); } @@ -140,8 +144,8 @@ const Ones MatrixBase::ones() * * \sa class Ones, ones() */ -template -bool MatrixBase::isOnes +template +bool MatrixBase::isOnes (typename NumTraits::Real prec) const { for(int j = 0; j < cols(); j++) @@ -158,8 +162,8 @@ bool MatrixBase::isOnes * * \sa class Ones, ones() */ -template -Derived& MatrixBase::setOnes() +template +Derived& MatrixBase::setOnes() { return *this = Ones(rows(), cols()); } diff --git a/Eigen/src/Core/OperatorEquals.h b/Eigen/src/Core/OperatorEquals.h index bc1450127..ebad3fdfa 100644 --- a/Eigen/src/Core/OperatorEquals.h +++ b/Eigen/src/Core/OperatorEquals.h @@ -97,10 +97,10 @@ struct VectorOperatorEqualsUnroller static void run(Derived1 &, const Derived2 &) {} }; -template +template template -Derived& MatrixBase - ::operator=(const MatrixBase& other) +Derived& MatrixBase + ::operator=(const MatrixBase& other) { if(Traits::IsVectorAtCompileTime && OtherDerived::Traits::IsVectorAtCompileTime) // copying a vector expression into a vector diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 4d2db51bd..56ea4b338 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -72,16 +72,20 @@ struct ProductUnroller * * \sa class Sum, class Difference */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Product : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: - typedef typename Lhs::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename Lhs::AsArg LhsRef; typedef typename Rhs::AsArg RhsRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; Product(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) @@ -134,10 +138,10 @@ template class Product : NoOperatorEquals, * * \sa class Product */ -template +template template const Product -MatrixBase::lazyProduct(const MatrixBase &other) const +MatrixBase::lazyProduct(const MatrixBase &other) const { return Product(asArg(), other.asArg()); } @@ -152,9 +156,9 @@ MatrixBase::lazyProduct(const MatrixBase * * \sa MatrixBase::lazyProduct(), MatrixBase::operator*=(const MatrixBase&) */ -template +template const Eval > -operator*(const MatrixBase &mat1, const MatrixBase &mat2) +operator*(const MatrixBase &mat1, const MatrixBase &mat2) { return mat1.lazyProduct(mat2).eval(); } @@ -163,10 +167,10 @@ operator*(const MatrixBase &mat1, const MatrixBase +template template Derived & -MatrixBase::operator*=(const MatrixBase &other) +MatrixBase::operator*=(const MatrixBase &other) { return *this = *this * other; } diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h index 394e6c3b0..364b8f4ed 100644 --- a/Eigen/src/Core/Random.h +++ b/Eigen/src/Core/Random.h @@ -32,14 +32,18 @@ * \sa MatrixBase::random(), MatrixBase::random(int), MatrixBase::random(int,int), * MatrixBase::setRandom() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Random : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; private: enum { @@ -86,9 +90,9 @@ template class Random : NoOperatorEquals, * * \sa ei_random(), ei_random(int) */ -template +template const Eval > -MatrixBase::random(int rows, int cols) +MatrixBase::random(int rows, int cols) { return Random(rows, cols).eval(); } @@ -109,9 +113,9 @@ MatrixBase::random(int rows, int cols) * * \sa ei_random(), ei_random(int,int) */ -template +template const Eval > -MatrixBase::random(int size) +MatrixBase::random(int size) { assert(Traits::IsVectorAtCompileTime); if(Traits::RowsAtCompileTime == 1) return Random(1, size).eval(); @@ -129,9 +133,9 @@ MatrixBase::random(int size) * * \sa ei_random(int), ei_random(int,int) */ -template +template const Eval > -MatrixBase::random() +MatrixBase::random() { return Random(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime).eval(); } @@ -143,8 +147,8 @@ MatrixBase::random() * * \sa class Random, ei_random() */ -template -Derived& MatrixBase::setRandom() +template +Derived& MatrixBase::setRandom() { return *this = Random(rows(), cols()); } diff --git a/Eigen/src/Core/Row.h b/Eigen/src/Core/Row.h index b9d245ea7..3a50297d3 100644 --- a/Eigen/src/Core/Row.h +++ b/Eigen/src/Core/Row.h @@ -45,15 +45,19 @@ * * \sa MatrixBase::row() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Row - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; Row(const MatRef& matrix, int row) : m_matrix(matrix), m_row(row) @@ -61,12 +65,6 @@ template class Row assert(row >= 0 && row < matrix.rows()); } - template - Row& operator=(const MatrixBase& other) - { - return MatrixBase >::operator=(other); - } - EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row) private: @@ -103,17 +101,17 @@ template class Row * Output: \verbinclude MatrixBase_row.out * * \sa col(), class Row */ -template +template Row -MatrixBase::row(int i) +MatrixBase::row(int i) { return Row(asArg(), i); } /** This is the const version of row(). */ -template +template const Row -MatrixBase::row(int i) const +MatrixBase::row(int i) const { return Row(asArg(), i); } diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index 3a0a387b0..c7a1199fa 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -25,11 +25,11 @@ #ifndef EIGEN_SWAP_H #define EIGEN_SWAP_H -template +template template -void MatrixBase::swap(const MatrixBase& other) +void MatrixBase::swap(const MatrixBase& other) { - MatrixBase *_other = const_cast*>(&other); + MatrixBase *_other = const_cast*>(&other); if(Traits::SizeAtCompileTime == Dynamic) { Scalar tmp; diff --git a/Eigen/src/Core/Trace.h b/Eigen/src/Core/Trace.h index ff080c595..728b4faf3 100644 --- a/Eigen/src/Core/Trace.h +++ b/Eigen/src/Core/Trace.h @@ -56,8 +56,9 @@ template struct TraceUnroller /** \returns the trace of *this, which must be a square matrix. * * \sa diagonal() */ -template -Scalar MatrixBase::trace() const +template +typename Scalar::Type +MatrixBase::trace() const { assert(rows() == cols()); Scalar res; diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 8948f7dac..648b8b677 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -37,15 +37,19 @@ * * \sa MatrixBase::transpose(), MatrixBase::adjoint() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Transpose - : public MatrixBase > + : public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; + typedef typename Scalar::Type Scalar; typedef typename MatrixType::AsArg MatRef; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; Transpose(const MatRef& matrix) : m_matrix(matrix) {} @@ -83,17 +87,17 @@ template class Transpose * Output: \verbinclude MatrixBase_transpose.out * * \sa adjoint(), class DiagonalCoeffs */ -template +template Transpose -MatrixBase::transpose() +MatrixBase::transpose() { return Transpose(asArg()); } /** This is the const version of transpose(). \sa adjoint() */ -template +template const Transpose -MatrixBase::transpose() const +MatrixBase::transpose() const { return Transpose(asArg()); } @@ -104,9 +108,9 @@ MatrixBase::transpose() const * Output: \verbinclude MatrixBase_adjoint.out * * \sa transpose(), conjugate(), class Transpose, class ScalarConjugateOp */ -template +template const Transpose > -MatrixBase::adjoint() const +MatrixBase::adjoint() const { return conjugate().transpose(); } diff --git a/Eigen/src/Core/Util.h b/Eigen/src/Core/Util.h index 872df2cb5..aceb98d8a 100644 --- a/Eigen/src/Core/Util.h +++ b/Eigen/src/Core/Util.h @@ -81,8 +81,8 @@ using Eigen::MatrixBase; #endif #define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ -template \ -Derived& operator Op(const MatrixBase& other) \ +template \ +Derived& operator Op(const MatrixBase& other) \ { \ return Base::operator Op(other); \ } \ diff --git a/Eigen/src/Core/Zero.h b/Eigen/src/Core/Zero.h index abfb65db7..92fb36edd 100644 --- a/Eigen/src/Core/Zero.h +++ b/Eigen/src/Core/Zero.h @@ -32,14 +32,18 @@ * \sa MatrixBase::zero(), MatrixBase::zero(int), MatrixBase::zero(int,int), * MatrixBase::setZero(), MatrixBase::isZero() */ +template +struct Scalar > +{ typedef typename Scalar::Type Type; }; + template class Zero : NoOperatorEquals, - public MatrixBase > + public MatrixBase > { public: - typedef typename MatrixType::Scalar Scalar; - friend class MatrixBase; - friend class MatrixBase::Traits; - typedef MatrixBase Base; + typedef typename Scalar::Type Scalar; + friend class MatrixBase; + friend class MatrixBase::Traits; + typedef MatrixBase Base; private: enum { @@ -86,8 +90,8 @@ template class Zero : NoOperatorEquals, * * \sa zero(), zero(int) */ -template -const Zero MatrixBase::zero(int rows, int cols) +template +const Zero MatrixBase::zero(int rows, int cols) { return Zero(rows, cols); } @@ -108,8 +112,8 @@ const Zero MatrixBase::zero(int rows, int cols) * * \sa zero(), zero(int,int) */ -template -const Zero MatrixBase::zero(int size) +template +const Zero MatrixBase::zero(int size) { assert(Traits::IsVectorAtCompileTime); if(Traits::RowsAtCompileTime == 1) return Zero(1, size); @@ -126,8 +130,8 @@ const Zero MatrixBase::zero(int size) * * \sa zero(int), zero(int,int) */ -template -const Zero MatrixBase::zero() +template +const Zero MatrixBase::zero() { return Zero(Traits::RowsAtCompileTime, Traits::ColsAtCompileTime); } @@ -140,8 +144,8 @@ const Zero MatrixBase::zero() * * \sa class Zero, zero() */ -template -bool MatrixBase::isZero +template +bool MatrixBase::isZero (typename NumTraits::Real prec) const { for(int j = 0; j < cols(); j++) @@ -158,8 +162,8 @@ bool MatrixBase::isZero * * \sa class Zero, zero() */ -template -Derived& MatrixBase::setZero() +template +Derived& MatrixBase::setZero() { return *this = Zero(rows(), cols()); } diff --git a/doc/Mainpage.dox b/doc/Mainpage.dox index 115cb2eeb..b82e60c60 100644 --- a/doc/Mainpage.dox +++ b/doc/Mainpage.dox @@ -71,7 +71,7 @@ The To-do wiki for Eigen is here: