fix several const qualifier issues: double ones, meaningless ones, some missing ones, etc.

(note that const qualifiers are set by internall::nested)
This commit is contained in:
Gael Guennebaud 2012-02-03 23:18:26 +01:00
parent bc7b251cd9
commit fe85b7ebc6
55 changed files with 151 additions and 141 deletions

View File

@ -419,16 +419,16 @@ template<> struct ldlt_inplace<Upper>
template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower> template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower>
{ {
typedef TriangularView<MatrixType, UnitLower> MatrixL; typedef TriangularView<const MatrixType, UnitLower> MatrixL;
typedef TriangularView<typename MatrixType::AdjointReturnType, UnitUpper> MatrixU; typedef TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m; } static inline MatrixL getL(const MatrixType& m) { return m; }
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); } static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
}; };
template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper> template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
{ {
typedef TriangularView<typename MatrixType::AdjointReturnType, UnitLower> MatrixL; typedef TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
typedef TriangularView<MatrixType, UnitUpper> MatrixU; typedef TriangularView<const MatrixType, UnitUpper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); } static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); }
static inline MatrixU getU(const MatrixType& m) { return m; } static inline MatrixU getU(const MatrixType& m) { return m; }
}; };

View File

@ -357,8 +357,8 @@ template<typename Scalar> struct llt_inplace<Scalar, Upper>
template<typename MatrixType> struct LLT_Traits<MatrixType,Lower> template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
{ {
typedef TriangularView<MatrixType, Lower> MatrixL; typedef TriangularView<const MatrixType, Lower> MatrixL;
typedef TriangularView<typename MatrixType::AdjointReturnType, Upper> MatrixU; typedef TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m; } static inline MatrixL getL(const MatrixType& m) { return m; }
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); } static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
static bool inplace_decomposition(MatrixType& m) static bool inplace_decomposition(MatrixType& m)
@ -367,8 +367,8 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
template<typename MatrixType> struct LLT_Traits<MatrixType,Upper> template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
{ {
typedef TriangularView<typename MatrixType::AdjointReturnType, Lower> MatrixL; typedef TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL;
typedef TriangularView<MatrixType, Upper> MatrixU; typedef TriangularView<const MatrixType, Upper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); } static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); }
static inline MatrixU getU(const MatrixType& m) { return m; } static inline MatrixU getU(const MatrixType& m) { return m; }
static bool inplace_decomposition(MatrixType& m) static bool inplace_decomposition(MatrixType& m)

View File

@ -159,7 +159,7 @@ template<typename Derived> class ArrayBase
/** \returns an \link MatrixBase Matrix \endlink expression of this array /** \returns an \link MatrixBase Matrix \endlink expression of this array
* \sa MatrixBase::array() */ * \sa MatrixBase::array() */
MatrixWrapper<Derived> matrix() { return derived(); } MatrixWrapper<Derived> matrix() { return derived(); }
const MatrixWrapper<Derived> matrix() const { return derived(); } const MatrixWrapper<const Derived> matrix() const { return derived(); }
// template<typename Dest> // template<typename Dest>
// inline void evalTo(Dest& dst) const { dst = matrix(); } // inline void evalTo(Dest& dst) const { dst = matrix(); }

View File

@ -61,7 +61,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
typedef typename internal::nested<ExpressionType>::type NestedExpressionType; typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} inline ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {}
inline Index rows() const { return m_expression.rows(); } inline Index rows() const { return m_expression.rows(); }
inline Index cols() const { return m_expression.cols(); } inline Index cols() const { return m_expression.cols(); }
@ -71,7 +71,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
inline const Scalar* data() const { return m_expression.data(); } inline const Scalar* data() const { return m_expression.data(); }
inline const CoeffReturnType coeff(Index row, Index col) const inline CoeffReturnType coeff(Index row, Index col) const
{ {
return m_expression.coeff(row, col); return m_expression.coeff(row, col);
} }
@ -86,7 +86,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
return m_expression.const_cast_derived().coeffRef(row, col); return m_expression.const_cast_derived().coeffRef(row, col);
} }
inline const CoeffReturnType coeff(Index index) const inline CoeffReturnType coeff(Index index) const
{ {
return m_expression.coeff(index); return m_expression.coeff(index);
} }
@ -135,7 +135,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
} }
protected: protected:
const NestedExpressionType m_expression; NestedExpressionType m_expression;
}; };
/** \class MatrixWrapper /** \class MatrixWrapper
@ -174,7 +174,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
typedef typename internal::nested<ExpressionType>::type NestedExpressionType; typedef typename internal::nested<ExpressionType>::type NestedExpressionType;
inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
inline Index rows() const { return m_expression.rows(); } inline Index rows() const { return m_expression.rows(); }
inline Index cols() const { return m_expression.cols(); } inline Index cols() const { return m_expression.cols(); }
@ -184,7 +184,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
inline const Scalar* data() const { return m_expression.data(); } inline const Scalar* data() const { return m_expression.data(); }
inline const CoeffReturnType coeff(Index row, Index col) const inline CoeffReturnType coeff(Index row, Index col) const
{ {
return m_expression.coeff(row, col); return m_expression.coeff(row, col);
} }
@ -199,7 +199,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
return m_expression.derived().coeffRef(row, col); return m_expression.derived().coeffRef(row, col);
} }
inline const CoeffReturnType coeff(Index index) const inline CoeffReturnType coeff(Index index) const
{ {
return m_expression.coeff(index); return m_expression.coeff(index);
} }
@ -245,7 +245,7 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
} }
protected: protected:
const NestedExpressionType m_expression; NestedExpressionType m_expression;
}; };
#endif // EIGEN_ARRAYWRAPPER_H #endif // EIGEN_ARRAYWRAPPER_H

View File

@ -361,7 +361,7 @@ class Block<XprType,BlockRows,BlockCols, InnerPanel,true>
: m_xpr.innerStride(); : m_xpr.innerStride();
} }
const typename XprType::Nested m_xpr; typename XprType::Nested m_xpr;
int m_outerStride; int m_outerStride;
}; };

View File

@ -167,8 +167,8 @@ class CwiseBinaryOp : internal::no_assignment_operator,
const BinaryOp& functor() const { return m_functor; } const BinaryOp& functor() const { return m_functor; }
protected: protected:
const LhsNested m_lhs; LhsNested m_lhs;
const RhsNested m_rhs; RhsNested m_rhs;
const BinaryOp m_functor; const BinaryOp m_functor;
}; };

View File

@ -95,7 +95,7 @@ class CwiseUnaryOp : internal::no_assignment_operator,
nestedExpression() { return m_xpr.const_cast_derived(); } nestedExpression() { return m_xpr.const_cast_derived(); }
protected: protected:
const typename XprType::Nested m_xpr; typename XprType::Nested m_xpr;
const UnaryOp m_functor; const UnaryOp m_functor;
}; };

View File

@ -97,7 +97,7 @@ class CwiseUnaryView : internal::no_assignment_operator,
protected: protected:
// FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC // FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC
const typename internal::nested<MatrixType>::type m_matrix; typename internal::nested<MatrixType>::type m_matrix;
ViewOp m_functor; ViewOp m_functor;
}; };

View File

@ -376,12 +376,13 @@ template<typename Derived> class DenseBase
inline Derived& operator*=(const Scalar& other); inline Derived& operator*=(const Scalar& other);
inline Derived& operator/=(const Scalar& other); inline Derived& operator/=(const Scalar& other);
typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
/** \returns the matrix or vector obtained by evaluating this expression. /** \returns the matrix or vector obtained by evaluating this expression.
* *
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns * Notice that in the case of a plain matrix or vector (not an expression) this function just returns
* a const reference, in order to avoid a useless copy. * a const reference, in order to avoid a useless copy.
*/ */
EIGEN_STRONG_INLINE const typename internal::eval<Derived>::type eval() const EIGEN_STRONG_INLINE EvalReturnType eval() const
{ {
// Even though MSVC does not honor strong inlining when the return type // Even though MSVC does not honor strong inlining when the return type
// is a dynamic matrix, we desperately need strong inlining for fixed // is a dynamic matrix, we desperately need strong inlining for fixed

View File

@ -2,6 +2,7 @@
// for linear algebra. // for linear algebra.
// //
// Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1@gmail.com> // Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
// //
// Eigen is free software; you can redistribute it and/or // Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
@ -154,7 +155,7 @@ template<typename MatrixType, int DiagIndex> class Diagonal
} }
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
const internal::variable_if_dynamic<Index, DiagIndex> m_index; const internal::variable_if_dynamic<Index, DiagIndex> m_index;
private: private:

View File

@ -72,7 +72,7 @@ class DiagonalBase : public EigenBase<Derived>
const DiagonalProduct<MatrixDerived, Derived, OnTheLeft> const DiagonalProduct<MatrixDerived, Derived, OnTheLeft>
operator*(const MatrixBase<MatrixDerived> &matrix) const; operator*(const MatrixBase<MatrixDerived> &matrix) const;
inline const DiagonalWrapper<CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> > inline const DiagonalWrapper<const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const DiagonalVectorType> >
inverse() const inverse() const
{ {
return diagonal().cwiseInverse(); return diagonal().cwiseInverse();
@ -251,13 +251,13 @@ class DiagonalWrapper
#endif #endif
/** Constructor from expression of diagonal coefficients to wrap. */ /** Constructor from expression of diagonal coefficients to wrap. */
inline DiagonalWrapper(const DiagonalVectorType& diagonal) : m_diagonal(diagonal) {} inline DiagonalWrapper(DiagonalVectorType& diagonal) : m_diagonal(diagonal) {}
/** \returns a const reference to the wrapped expression of diagonal coefficients. */ /** \returns a const reference to the wrapped expression of diagonal coefficients. */
const DiagonalVectorType& diagonal() const { return m_diagonal; } const DiagonalVectorType& diagonal() const { return m_diagonal; }
protected: protected:
const typename DiagonalVectorType::Nested m_diagonal; typename DiagonalVectorType::Nested m_diagonal;
}; };
/** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients /** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients

View File

@ -107,8 +107,8 @@ class DiagonalProduct : internal::no_assignment_operator,
m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id)); m_diagonal.diagonal().template packet<DiagonalVectorPacketLoadMode>(id));
} }
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
const typename DiagonalType::Nested m_diagonal; typename DiagonalType::Nested m_diagonal;
}; };
/** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal.

View File

@ -35,8 +35,8 @@ struct isApprox_selector
static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec) static bool run(const Derived& x, const OtherDerived& y, typename Derived::RealScalar prec)
{ {
using std::min; using std::min;
const typename internal::nested<Derived,2>::type nested(x); typename internal::nested<Derived,2>::type nested(x);
const typename internal::nested<OtherDerived,2>::type otherNested(y); typename internal::nested<OtherDerived,2>::type otherNested(y);
return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum());
} }
}; };

View File

@ -410,8 +410,8 @@ template<> struct gemv_selector<OnTheRight,ColMajor,true>
typedef typename ProductType::RhsBlasTraits RhsBlasTraits; typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest; typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
const ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs()); ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs());
const ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs()); ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs());
ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
* RhsBlasTraits::extractScalarFactor(prod.rhs()); * RhsBlasTraits::extractScalarFactor(prod.rhs());
@ -452,7 +452,7 @@ template<> struct gemv_selector<OnTheRight,ColMajor,true>
general_matrix_vector_product general_matrix_vector_product
<Index,LhsScalar,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run( <Index,LhsScalar,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
actualLhs.rows(), actualLhs.cols(), actualLhs.rows(), actualLhs.cols(),
&actualLhs.coeffRef(0,0), actualLhs.outerStride(), actualLhs.data(), actualLhs.outerStride(),
actualRhs.data(), actualRhs.innerStride(), actualRhs.data(), actualRhs.innerStride(),
actualDestPtr, 1, actualDestPtr, 1,
compatibleAlpha); compatibleAlpha);
@ -511,9 +511,9 @@ template<> struct gemv_selector<OnTheRight,RowMajor,true>
general_matrix_vector_product general_matrix_vector_product
<Index,LhsScalar,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run( <Index,LhsScalar,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsBlasTraits::NeedToConjugate>::run(
actualLhs.rows(), actualLhs.cols(), actualLhs.rows(), actualLhs.cols(),
&actualLhs.coeffRef(0,0), actualLhs.outerStride(), actualLhs.data(), actualLhs.outerStride(),
actualRhsPtr, 1, actualRhsPtr, 1,
&dest.coeffRef(0,0), dest.innerStride(), dest.data(), dest.innerStride(),
actualAlpha); actualAlpha);
} }
}; };
@ -558,7 +558,7 @@ template<> struct gemv_selector<OnTheRight,RowMajor,false>
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherDerived> template<typename OtherDerived>
inline const typename ProductReturnType<Derived,OtherDerived>::Type inline const typename ProductReturnType<Derived, OtherDerived>::Type
MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
{ {
// A note regarding the function declaration: In MSVC, this function will sometimes // A note regarding the function declaration: In MSVC, this function will sometimes

View File

@ -171,7 +171,7 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat&
return s; return s;
} }
const typename Derived::Nested m = _m; typename Derived::Nested m = _m;
typedef typename Derived::Scalar Scalar; typedef typename Derived::Scalar Scalar;
typedef typename Derived::Index Index; typedef typename Derived::Index Index;

View File

@ -330,7 +330,7 @@ template<typename Derived> class MatrixBase
/** \returns an \link ArrayBase Array \endlink expression of this matrix /** \returns an \link ArrayBase Array \endlink expression of this matrix
* \sa ArrayBase::matrix() */ * \sa ArrayBase::matrix() */
ArrayWrapper<Derived> array() { return derived(); } ArrayWrapper<Derived> array() { return derived(); }
const ArrayWrapper<Derived> array() const { return derived(); } const ArrayWrapper<const Derived> array() const { return derived(); }
/////////// LU module /////////// /////////// LU module ///////////

View File

@ -511,7 +511,7 @@ class PermutationWrapper : public PermutationBase<PermutationWrapper<_IndicesTyp
protected: protected:
const typename IndicesType::Nested m_indices; typename IndicesType::Nested m_indices;
}; };
/** \returns the matrix with the permutation applied to the columns. /** \returns the matrix with the permutation applied to the columns.
@ -608,7 +608,7 @@ struct permut_matrix_product_retval
protected: protected:
const PermutationType& m_permutation; const PermutationType& m_permutation;
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
}; };
/* Template partial specialization for transposed/inverse permutations */ /* Template partial specialization for transposed/inverse permutations */

View File

@ -179,8 +179,8 @@ class ProductBase : public MatrixBase<Derived>
protected: protected:
const LhsNested m_lhs; LhsNested m_lhs;
const RhsNested m_rhs; RhsNested m_rhs;
mutable PlainObject m_result; mutable PlainObject m_result;
}; };

View File

@ -128,7 +128,7 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
} }
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor; const internal::variable_if_dynamic<Index, RowFactor> m_rowFactor;
const internal::variable_if_dynamic<Index, ColFactor> m_colFactor; const internal::variable_if_dynamic<Index, ColFactor> m_colFactor;
}; };

View File

@ -190,7 +190,7 @@ template<typename MatrixType, int Direction> class Reverse
} }
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
}; };
/** \returns an expression of the reverse of *this. /** \returns an expression of the reverse of *this.

View File

@ -117,9 +117,9 @@ class Select : internal::no_assignment_operator,
} }
protected: protected:
const typename ConditionMatrixType::Nested m_condition; typename ConditionMatrixType::Nested m_condition;
const typename ThenMatrixType::Nested m_then; typename ThenMatrixType::Nested m_then;
const typename ElseMatrixType::Nested m_else; typename ElseMatrixType::Nested m_else;
}; };

View File

@ -82,7 +82,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
}; };
typedef typename MatrixType::PlainObject PlainObject; typedef typename MatrixType::PlainObject PlainObject;
inline SelfAdjointView(const MatrixType& matrix) : m_matrix(matrix) inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix)
{} {}
inline Index rows() const { return m_matrix.rows(); } inline Index rows() const { return m_matrix.rows(); }
@ -199,7 +199,7 @@ template<typename MatrixType, unsigned int UpLo> class SelfAdjointView
#endif #endif
protected: protected:
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
}; };

View File

@ -100,7 +100,7 @@ struct triangular_solver_selector<Lhs,Rhs,Side,Mode,NoUnrolling,Dynamic>
typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType; typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType;
static void run(const Lhs& lhs, Rhs& rhs) static void run(const Lhs& lhs, Rhs& rhs)
{ {
const ActualLhsType actualLhs = LhsProductTraits::extract(lhs); typename internal::add_const_on_value_type<ActualLhsType>::type actualLhs = LhsProductTraits::extract(lhs);
triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,(int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor, triangular_solve_matrix<Scalar,Index,Side,Mode,LhsProductTraits::NeedToConjugate,(int(Lhs::Flags) & RowMajorBit) ? RowMajor : ColMajor,
(Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor> (Rhs::Flags&RowMajorBit) ? RowMajor : ColMajor>
::run(lhs.rows(), Side==OnTheLeft? rhs.cols() : rhs.rows(), &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride()); ::run(lhs.rows(), Side==OnTheLeft? rhs.cols() : rhs.rows(), &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride());
@ -255,7 +255,7 @@ template<int Side, typename TriangularType, typename Rhs> struct triangular_solv
protected: protected:
const TriangularType& m_triangularMatrix; const TriangularType& m_triangularMatrix;
const typename Rhs::Nested m_rhs; typename Rhs::Nested m_rhs;
}; };
} // namespace internal } // namespace internal

View File

@ -52,6 +52,15 @@ template<typename ExpressionType> class SwapWrapper
inline Index cols() const { return m_expression.cols(); } inline Index cols() const { return m_expression.cols(); }
inline Index outerStride() const { return m_expression.outerStride(); } inline Index outerStride() const { return m_expression.outerStride(); }
inline Index innerStride() const { return m_expression.innerStride(); } inline Index innerStride() const { return m_expression.innerStride(); }
typedef typename internal::conditional<
internal::is_lvalue<ExpressionType>::value,
Scalar,
const Scalar
>::type ScalarWithConstIfNotLvalue;
inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
inline const Scalar* data() const { return m_expression.data(); }
inline Scalar& coeffRef(Index row, Index col) inline Scalar& coeffRef(Index row, Index col)
{ {

View File

@ -91,7 +91,7 @@ template<typename MatrixType> class Transpose
nestedExpression() { return m_matrix.const_cast_derived(); } nestedExpression() { return m_matrix.const_cast_derived(); }
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
}; };
namespace internal { namespace internal {
@ -152,12 +152,12 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Dense>
return derived().nestedExpression().coeffRef(index); return derived().nestedExpression().coeffRef(index);
} }
inline const CoeffReturnType coeff(Index row, Index col) const inline CoeffReturnType coeff(Index row, Index col) const
{ {
return derived().nestedExpression().coeff(col, row); return derived().nestedExpression().coeff(col, row);
} }
inline const CoeffReturnType coeff(Index index) const inline CoeffReturnType coeff(Index index) const
{ {
return derived().nestedExpression().coeff(index); return derived().nestedExpression().coeff(index);
} }

View File

@ -404,7 +404,7 @@ struct transposition_matrix_product_retval
protected: protected:
const TranspositionType& m_transpositions; const TranspositionType& m_transpositions;
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
}; };
} // end namespace internal } // end namespace internal

View File

@ -273,11 +273,8 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
inline const TriangularView<MatrixConjugateReturnType,Mode> conjugate() const inline const TriangularView<MatrixConjugateReturnType,Mode> conjugate() const
{ return m_matrix.conjugate(); } { return m_matrix.conjugate(); }
/** \sa MatrixBase::adjoint() */
inline TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> adjoint()
{ return m_matrix.adjoint(); }
/** \sa MatrixBase::adjoint() const */ /** \sa MatrixBase::adjoint() const */
inline const TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> adjoint() const inline const TriangularView<const typename MatrixType::AdjointReturnType,TransposeMode> adjoint() const
{ return m_matrix.adjoint(); } { return m_matrix.adjoint(); }
/** \sa MatrixBase::transpose() */ /** \sa MatrixBase::transpose() */
@ -288,11 +285,13 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
} }
/** \sa MatrixBase::transpose() const */ /** \sa MatrixBase::transpose() const */
inline const TriangularView<Transpose<MatrixType>,TransposeMode> transpose() const inline const TriangularView<Transpose<MatrixType>,TransposeMode> transpose() const
{ return m_matrix.transpose(); } {
return m_matrix.transpose();
}
/** Efficient triangular matrix times vector/matrix product */ /** Efficient triangular matrix times vector/matrix product */
template<typename OtherDerived> template<typename OtherDerived>
TriangularProduct<Mode,true,MatrixType,false,OtherDerived,OtherDerived::IsVectorAtCompileTime> TriangularProduct<Mode,true,MatrixType,false,OtherDerived, OtherDerived::IsVectorAtCompileTime>
operator*(const MatrixBase<OtherDerived>& rhs) const operator*(const MatrixBase<OtherDerived>& rhs) const
{ {
return TriangularProduct return TriangularProduct
@ -375,7 +374,8 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
template<typename OtherDerived> template<typename OtherDerived>
void swap(MatrixBase<OtherDerived> const & other) void swap(MatrixBase<OtherDerived> const & other)
{ {
TriangularView<SwapWrapper<MatrixType>,Mode>(const_cast<MatrixType&>(m_matrix)).lazyAssign(other.derived()); SwapWrapper<MatrixType> swaper(const_cast<MatrixType&>(m_matrix));
TriangularView<SwapWrapper<MatrixType>,Mode>(swaper).lazyAssign(other.derived());
} }
Scalar determinant() const Scalar determinant() const
@ -433,7 +433,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
template<typename ProductDerived, typename Lhs, typename Rhs> template<typename ProductDerived, typename Lhs, typename Rhs>
EIGEN_STRONG_INLINE TriangularView& assignProduct(const ProductBase<ProductDerived, Lhs,Rhs>& prod, const Scalar& alpha); EIGEN_STRONG_INLINE TriangularView& assignProduct(const ProductBase<ProductDerived, Lhs,Rhs>& prod, const Scalar& alpha);
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
}; };
/*************************************************************************** /***************************************************************************

View File

@ -110,7 +110,7 @@ class PartialReduxExpr : internal::no_assignment_operator,
} }
protected: protected:
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
const MemberOp m_functor; const MemberOp m_functor;
}; };

View File

@ -224,8 +224,8 @@ class CoeffBasedProduct
{ return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); } { return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); }
protected: protected:
const LhsNested m_lhs; typename internal::add_const_on_value_type<LhsNested>::type m_lhs;
const RhsNested m_rhs; typename internal::add_const_on_value_type<RhsNested>::type m_rhs;
mutable PlainObject m_result; mutable PlainObject m_result;
}; };

View File

@ -412,8 +412,8 @@ class GeneralProduct<Lhs, Rhs, GemmProduct>
{ {
eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs); typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs); typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs) Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs); * RhsBlasTraits::extractScalarFactor(m_rhs);

View File

@ -201,13 +201,13 @@ TriangularView<MatrixType,UpLo>& TriangularView<MatrixType,UpLo>::assignProduct(
typedef internal::blas_traits<Lhs> LhsBlasTraits; typedef internal::blas_traits<Lhs> LhsBlasTraits;
typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs; typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhs;
typedef typename internal::remove_all<ActualLhs>::type _ActualLhs; typedef typename internal::remove_all<ActualLhs>::type _ActualLhs;
const ActualLhs actualLhs = LhsBlasTraits::extract(prod.lhs()); typename internal::add_const_on_value_type<ActualLhs>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
typedef typename internal::remove_all<typename ProductDerived::RhsNested>::type Rhs; typedef typename internal::remove_all<typename ProductDerived::RhsNested>::type Rhs;
typedef internal::blas_traits<Rhs> RhsBlasTraits; typedef internal::blas_traits<Rhs> RhsBlasTraits;
typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs; typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhs;
typedef typename internal::remove_all<ActualRhs>::type _ActualRhs; typedef typename internal::remove_all<ActualRhs>::type _ActualRhs;
const ActualRhs actualRhs = RhsBlasTraits::extract(prod.rhs()); typename internal::add_const_on_value_type<ActualRhs>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
typename ProductDerived::Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived()); typename ProductDerived::Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs().derived()) * RhsBlasTraits::extractScalarFactor(prod.rhs().derived());

View File

@ -400,8 +400,8 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,RhsMode,false>
{ {
eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols()); eigen_assert(dst.rows()==m_lhs.rows() && dst.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs); typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs); typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs) Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs); * RhsBlasTraits::extractScalarFactor(m_rhs);

View File

@ -201,8 +201,8 @@ struct SelfadjointProductMatrix<Lhs,LhsMode,false,Rhs,0,true>
eigen_assert(dest.rows()==m_lhs.rows() && dest.cols()==m_rhs.cols()); eigen_assert(dest.rows()==m_lhs.rows() && dest.cols()==m_rhs.cols());
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs); typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs); typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs) Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs); * RhsBlasTraits::extractScalarFactor(m_rhs);

View File

@ -72,7 +72,7 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,true>
typedef internal::blas_traits<OtherType> OtherBlasTraits; typedef internal::blas_traits<OtherType> OtherBlasTraits;
typedef typename OtherBlasTraits::DirectLinearAccessType ActualOtherType; typedef typename OtherBlasTraits::DirectLinearAccessType ActualOtherType;
typedef typename internal::remove_all<ActualOtherType>::type _ActualOtherType; typedef typename internal::remove_all<ActualOtherType>::type _ActualOtherType;
const ActualOtherType actualOther = OtherBlasTraits::extract(other.derived()); typename internal::add_const_on_value_type<ActualOtherType>::type actualOther = OtherBlasTraits::extract(other.derived());
Scalar actualAlpha = alpha * OtherBlasTraits::extractScalarFactor(other.derived()); Scalar actualAlpha = alpha * OtherBlasTraits::extractScalarFactor(other.derived());
@ -105,7 +105,7 @@ struct selfadjoint_product_selector<MatrixType,OtherType,UpLo,false>
typedef internal::blas_traits<OtherType> OtherBlasTraits; typedef internal::blas_traits<OtherType> OtherBlasTraits;
typedef typename OtherBlasTraits::DirectLinearAccessType ActualOtherType; typedef typename OtherBlasTraits::DirectLinearAccessType ActualOtherType;
typedef typename internal::remove_all<ActualOtherType>::type _ActualOtherType; typedef typename internal::remove_all<ActualOtherType>::type _ActualOtherType;
const ActualOtherType actualOther = OtherBlasTraits::extract(other.derived()); typename internal::add_const_on_value_type<ActualOtherType>::type actualOther = OtherBlasTraits::extract(other.derived());
Scalar actualAlpha = alpha * OtherBlasTraits::extractScalarFactor(other.derived()); Scalar actualAlpha = alpha * OtherBlasTraits::extractScalarFactor(other.derived());

View File

@ -76,12 +76,12 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
typedef internal::blas_traits<DerivedU> UBlasTraits; typedef internal::blas_traits<DerivedU> UBlasTraits;
typedef typename UBlasTraits::DirectLinearAccessType ActualUType; typedef typename UBlasTraits::DirectLinearAccessType ActualUType;
typedef typename internal::remove_all<ActualUType>::type _ActualUType; typedef typename internal::remove_all<ActualUType>::type _ActualUType;
const ActualUType actualU = UBlasTraits::extract(u.derived()); typename internal::add_const_on_value_type<ActualUType>::type actualU = UBlasTraits::extract(u.derived());
typedef internal::blas_traits<DerivedV> VBlasTraits; typedef internal::blas_traits<DerivedV> VBlasTraits;
typedef typename VBlasTraits::DirectLinearAccessType ActualVType; typedef typename VBlasTraits::DirectLinearAccessType ActualVType;
typedef typename internal::remove_all<ActualVType>::type _ActualVType; typedef typename internal::remove_all<ActualVType>::type _ActualVType;
const ActualVType actualV = VBlasTraits::extract(v.derived()); typename internal::add_const_on_value_type<ActualVType>::type actualV = VBlasTraits::extract(v.derived());
// If MatrixType is row major, then we use the routine for lower triangular in the upper triangular case and // If MatrixType is row major, then we use the routine for lower triangular in the upper triangular case and
// vice versa, and take the complex conjugate of all coefficients and vector entries. // vice versa, and take the complex conjugate of all coefficients and vector entries.

View File

@ -378,8 +378,8 @@ struct TriangularProduct<Mode,LhsIsTriangular,Lhs,false,Rhs,false>
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
{ {
const ActualLhsType lhs = LhsBlasTraits::extract(m_lhs); typename internal::add_const_on_value_type<ActualLhsType>::type lhs = LhsBlasTraits::extract(m_lhs);
const ActualRhsType rhs = RhsBlasTraits::extract(m_rhs); typename internal::add_const_on_value_type<ActualRhsType>::type rhs = RhsBlasTraits::extract(m_rhs);
Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs) Scalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(m_lhs)
* RhsBlasTraits::extractScalarFactor(m_rhs); * RhsBlasTraits::extractScalarFactor(m_rhs);

View File

@ -232,8 +232,8 @@ template<> struct trmv_selector<ColMajor>
typedef typename ProductType::RhsBlasTraits RhsBlasTraits; typedef typename ProductType::RhsBlasTraits RhsBlasTraits;
typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest; typedef Map<Matrix<ResScalar,Dynamic,1>, Aligned> MappedDest;
const ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs()); typename internal::add_const_on_value_type<ActualLhsType>::type actualLhs = LhsBlasTraits::extract(prod.lhs());
const ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs()); typename internal::add_const_on_value_type<ActualRhsType>::type actualRhs = RhsBlasTraits::extract(prod.rhs());
ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs())
* RhsBlasTraits::extractScalarFactor(prod.rhs()); * RhsBlasTraits::extractScalarFactor(prod.rhs());

View File

@ -175,7 +175,7 @@ template<typename XprType> struct blas_traits
ExtractType, ExtractType,
typename _ExtractType::PlainObject typename _ExtractType::PlainObject
>::type DirectLinearAccessType; >::type DirectLinearAccessType;
static inline const ExtractType extract(const XprType& x) { return x; } static inline ExtractType extract(const XprType& x) { return x; }
static inline const Scalar extractScalarFactor(const XprType&) { return Scalar(1); } static inline const Scalar extractScalarFactor(const XprType&) { return Scalar(1); }
}; };
@ -192,7 +192,7 @@ struct blas_traits<CwiseUnaryOp<scalar_conjugate_op<Scalar>, NestedXpr> >
IsComplex = NumTraits<Scalar>::IsComplex, IsComplex = NumTraits<Scalar>::IsComplex,
NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex
}; };
static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x) { return conj(Base::extractScalarFactor(x.nestedExpression())); } static inline Scalar extractScalarFactor(const XprType& x) { return conj(Base::extractScalarFactor(x.nestedExpression())); }
}; };
@ -204,7 +204,7 @@ struct blas_traits<CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> >
typedef blas_traits<NestedXpr> Base; typedef blas_traits<NestedXpr> Base;
typedef CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> XprType; typedef CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType; typedef typename Base::ExtractType ExtractType;
static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x) static inline Scalar extractScalarFactor(const XprType& x)
{ return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); } { return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); }
}; };
@ -217,7 +217,7 @@ struct blas_traits<CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> >
typedef blas_traits<NestedXpr> Base; typedef blas_traits<NestedXpr> Base;
typedef CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> XprType; typedef CwiseUnaryOp<scalar_opposite_op<Scalar>, NestedXpr> XprType;
typedef typename Base::ExtractType ExtractType; typedef typename Base::ExtractType ExtractType;
static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x) static inline Scalar extractScalarFactor(const XprType& x)
{ return - Base::extractScalarFactor(x.nestedExpression()); } { return - Base::extractScalarFactor(x.nestedExpression()); }
}; };
@ -239,7 +239,7 @@ struct blas_traits<Transpose<NestedXpr> >
enum { enum {
IsTransposed = Base::IsTransposed ? 0 : 1 IsTransposed = Base::IsTransposed ? 0 : 1
}; };
static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); } static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); }
}; };
@ -252,7 +252,7 @@ template<typename T, bool HasUsableDirectAccess=blas_traits<T>::HasUsableDirectA
struct extract_data_selector { struct extract_data_selector {
static const typename T::Scalar* run(const T& m) static const typename T::Scalar* run(const T& m)
{ {
return const_cast<typename T::Scalar*>(&blas_traits<T>::extract(m).coeffRef(0,0)); // FIXME this should be .data() return blas_traits<T>::extract(m).data();
} }
}; };

View File

@ -260,30 +260,27 @@ template<typename T> struct plain_matrix_type_row_major
// we should be able to get rid of this one too // we should be able to get rid of this one too
template<typename T> struct must_nest_by_value { enum { ret = false }; }; template<typename T> struct must_nest_by_value { enum { ret = false }; };
template<class T> /** \internal The reference selector for template expressions. The idea is that we don't
struct is_reference * need to use references for expressions since they are light weight proxy
{ * objects which should generate no copying overhead. */
enum { ret = false };
};
template<class T>
struct is_reference<T&>
{
enum { ret = true };
};
/**
* \internal The reference selector for template expressions. The idea is that we don't
* need to use references for expressions since they are light weight proxy
* objects which should generate no copying overhead.
**/
template <typename T> template <typename T>
struct ref_selector struct ref_selector
{ {
typedef typename conditional< typedef typename conditional<
bool(traits<T>::Flags & NestByRefBit), bool(traits<T>::Flags & NestByRefBit),
T const&, T const&,
T const T
>::type type;
};
/** \internal Adds the const qualifier on the value-type of T2 if and only if T1 is a const type */
template<typename T1, typename T2>
struct transfer_constness
{
typedef typename conditional<
bool(internal::is_const<T1>::value),
typename internal::add_const_on_value_type<T2>::type,
T2
>::type type; >::type type;
}; };
@ -297,6 +294,8 @@ struct ref_selector
* \param T the type of the expression being nested * \param T the type of the expression being nested
* \param n the number of coefficient accesses in the nested expression for each coefficient access in the bigger expression. * \param n the number of coefficient accesses in the nested expression for each coefficient access in the bigger expression.
* *
* Note that if no evaluation occur, then the constness of T is preserved.
*
* Example. Suppose that a, b, and c are of type Matrix3d. The user forms the expression a*(b+c). * Example. Suppose that a, b, and c are of type Matrix3d. The user forms the expression a*(b+c).
* b+c is an expression "sum of matrices", which we will denote by S. In order to determine how to nest it, * b+c is an expression "sum of matrices", which we will denote by S. In order to determine how to nest it,
* the Product expression uses: nested<S, 3>::ret, which turns out to be Matrix3d because the internal logic of * the Product expression uses: nested<S, 3>::ret, which turns out to be Matrix3d because the internal logic of

View File

@ -97,13 +97,13 @@ template<typename _MatrixType> class Tridiagonalization
typedef internal::TridiagonalizationMatrixTReturnType<MatrixTypeRealView> MatrixTReturnType; typedef internal::TridiagonalizationMatrixTReturnType<MatrixTypeRealView> MatrixTReturnType;
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
const typename Diagonal<const MatrixType>::RealReturnType, typename internal::add_const_on_value_type<typename Diagonal<const MatrixType>::RealReturnType>::type,
const Diagonal<const MatrixType> const Diagonal<const MatrixType>
>::type DiagonalReturnType; >::type DiagonalReturnType;
typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
const typename Diagonal< typename internal::add_const_on_value_type<typename Diagonal<
Block<const MatrixType,SizeMinusOne,SizeMinusOne> >::RealReturnType, Block<const MatrixType,SizeMinusOne,SizeMinusOne> >::RealReturnType>::type,
const Diagonal< const Diagonal<
Block<const MatrixType,SizeMinusOne,SizeMinusOne> > Block<const MatrixType,SizeMinusOne,SizeMinusOne> >
>::type SubDiagonalReturnType; >::type SubDiagonalReturnType;
@ -560,7 +560,7 @@ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
Index cols() const { return m_matrix.cols(); } Index cols() const { return m_matrix.cols(); }
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
}; };
} // end namespace internal } // end namespace internal

View File

@ -190,7 +190,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
template<typename Derived> template<typename Derived>
inline bool contains(const MatrixBase<Derived>& a_p) const inline bool contains(const MatrixBase<Derived>& a_p) const
{ {
const typename internal::nested<Derived,2>::type p(a_p.derived()); typename internal::nested<Derived,2>::type p(a_p.derived());
return (m_min.array()<=p.array()).all() && (p.array()<=m_max.array()).all(); return (m_min.array()<=p.array()).all() && (p.array()<=m_max.array()).all();
} }
@ -202,7 +202,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
template<typename Derived> template<typename Derived>
inline AlignedBox& extend(const MatrixBase<Derived>& a_p) inline AlignedBox& extend(const MatrixBase<Derived>& a_p)
{ {
const typename internal::nested<Derived,2>::type p(a_p.derived()); typename internal::nested<Derived,2>::type p(a_p.derived());
m_min = m_min.cwiseMin(p); m_min = m_min.cwiseMin(p);
m_max = m_max.cwiseMax(p); m_max = m_max.cwiseMax(p);
return *this; return *this;

View File

@ -121,7 +121,7 @@ template<typename MatrixType,int _Direction> class Homogeneous
} }
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
}; };
/** \geometry_module /** \geometry_module
@ -216,8 +216,8 @@ template<typename Scalar, int Dim, int Mode,int Options>
struct take_matrix_for_product<Transform<Scalar, Dim, Mode, Options> > struct take_matrix_for_product<Transform<Scalar, Dim, Mode, Options> >
{ {
typedef Transform<Scalar, Dim, Mode, Options> TransformType; typedef Transform<Scalar, Dim, Mode, Options> TransformType;
typedef typename TransformType::ConstAffinePart type; typedef typename internal::add_const<typename TransformType::ConstAffinePart>::type type;
static const type run (const TransformType& x) { return x.affine(); } static type run (const TransformType& x) { return x.affine(); }
}; };
template<typename Scalar, int Dim, int Options> template<typename Scalar, int Dim, int Options>
@ -270,8 +270,8 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
.template replicate<MatrixType::ColsAtCompileTime>(m_rhs.cols()); .template replicate<MatrixType::ColsAtCompileTime>(m_rhs.cols());
} }
const typename LhsMatrixTypeCleaned::Nested m_lhs; typename LhsMatrixTypeCleaned::Nested m_lhs;
const typename MatrixType::Nested m_rhs; typename MatrixType::Nested m_rhs;
}; };
template<typename MatrixType,typename Rhs> template<typename MatrixType,typename Rhs>
@ -309,8 +309,8 @@ struct homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
.template replicate<MatrixType::RowsAtCompileTime>(m_lhs.rows()); .template replicate<MatrixType::RowsAtCompileTime>(m_lhs.rows());
} }
const typename MatrixType::Nested m_lhs; typename MatrixType::Nested m_lhs;
const typename Rhs::Nested m_rhs; typename Rhs::Nested m_rhs;
}; };
} // end namespace internal } // end namespace internal

View File

@ -43,8 +43,8 @@ MatrixBase<Derived>::cross(const MatrixBase<OtherDerived>& other) const
// Note that there is no need for an expression here since the compiler // Note that there is no need for an expression here since the compiler
// optimize such a small temporary very well (even within a complex expression) // optimize such a small temporary very well (even within a complex expression)
const typename internal::nested<Derived,2>::type lhs(derived()); typename internal::nested<Derived,2>::type lhs(derived());
const typename internal::nested<OtherDerived,2>::type rhs(other.derived()); typename internal::nested<OtherDerived,2>::type rhs(other.derived());
return typename cross_product_return_type<OtherDerived>::type( return typename cross_product_return_type<OtherDerived>::type(
internal::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)), internal::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)),
internal::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)), internal::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)),

View File

@ -64,7 +64,7 @@ void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vec
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize> T(nbVecs,nbVecs); Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize> T(nbVecs,nbVecs);
make_block_householder_triangular_factor(T, vectors, hCoeffs); make_block_householder_triangular_factor(T, vectors, hCoeffs);
const TriangularView<VectorsType, UnitLower>& V(vectors); const TriangularView<const VectorsType, UnitLower>& V(vectors);
// A -= V T V^* A // A -= V T V^* A
Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,0, Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,0,

View File

@ -286,7 +286,7 @@ struct inverse_impl : public ReturnByValue<inverse_impl<MatrixType> >
typedef typename MatrixType::Index Index; typedef typename MatrixType::Index Index;
typedef typename internal::eval<MatrixType>::type MatrixTypeNested; typedef typename internal::eval<MatrixType>::type MatrixTypeNested;
typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned; typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
inverse_impl(const MatrixType& matrix) inverse_impl(const MatrixType& matrix)
: m_matrix(matrix) : m_matrix(matrix)

View File

@ -150,7 +150,7 @@ void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, Permutation
elen[i] = 0; // Ek of node i is empty elen[i] = 0; // Ek of node i is empty
degree[i] = len[i]; // degree of node i degree[i] = len[i]; // degree of node i
} }
mark = cs_wclear<Index>(0, 0, w, n); /* clear w */ mark = internal::cs_wclear<Index>(0, 0, w, n); /* clear w */
elen[n] = -2; /* n is a dead element */ elen[n] = -2; /* n is a dead element */
Cp[n] = -1; /* n is a root of assembly tree */ Cp[n] = -1; /* n is a root of assembly tree */
w[n] = 0; /* n is a dead element */ w[n] = 0; /* n is a dead element */
@ -265,7 +265,7 @@ void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, Permutation
elen[k] = -2; /* k is now an element */ elen[k] = -2; /* k is now an element */
/* --- Find set differences ----------------------------------------- */ /* --- Find set differences ----------------------------------------- */
mark = cs_wclear<Index>(mark, lemax, w, n); /* clear w if necessary */ mark = internal::cs_wclear<Index>(mark, lemax, w, n); /* clear w if necessary */
for(pk = pk1; pk < pk2; pk++) /* scan 1: find |Le\Lk| */ for(pk = pk1; pk < pk2; pk++) /* scan 1: find |Le\Lk| */
{ {
i = Ci[pk]; i = Ci[pk];
@ -348,7 +348,7 @@ void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, Permutation
} /* scan2 is done */ } /* scan2 is done */
degree[k] = dk; /* finalize |Lk| */ degree[k] = dk; /* finalize |Lk| */
lemax = std::max<Index>(lemax, dk); lemax = std::max<Index>(lemax, dk);
mark = cs_wclear<Index>(mark+lemax, lemax, w, n); /* clear w */ mark = internal::cs_wclear<Index>(mark+lemax, lemax, w, n); /* clear w */
/* --- Supernode detection ------------------------------------------ */ /* --- Supernode detection ------------------------------------------ */
for(pk = pk1; pk < pk2; pk++) for(pk = pk1; pk < pk2; pk++)
@ -434,7 +434,7 @@ void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, Permutation
} }
for(k = 0, i = 0; i <= n; i++) /* postorder the assembly tree */ for(k = 0, i = 0; i <= n; i++) /* postorder the assembly tree */
{ {
if(Cp[i] == -1) k = cs_tdfs<Index>(i, k, head, next, perm.indices().data(), w); if(Cp[i] == -1) k = internal::cs_tdfs<Index>(i, k, head, next, perm.indices().data(), w);
} }
perm.indices().conservativeResize(n); perm.indices().conservativeResize(n);

View File

@ -577,9 +577,9 @@ public:
Index cols() const { return m_qr.rows(); } Index cols() const { return m_qr.rows(); }
protected: protected:
const typename MatrixType::Nested m_qr; typename MatrixType::Nested m_qr;
const typename HCoeffsType::Nested m_hCoeffs; typename HCoeffsType::Nested m_hCoeffs;
const typename IntColVectorType::Nested m_rowsTranspositions; typename IntColVectorType::Nested m_rowsTranspositions;
}; };
} // end namespace internal } // end namespace internal

View File

@ -267,7 +267,7 @@ class SparseInnerVectorSet<SparseMatrix<_Scalar, _Options, _Index>, Size>
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
Index m_outerStart; Index m_outerStart;
const internal::variable_if_dynamic<Index, Size> m_outerSize; const internal::variable_if_dynamic<Index, Size> m_outerSize;

View File

@ -255,7 +255,7 @@ class sparse_cwise_binary_op_inner_iterator_selector<scalar_product_op<T>, Lhs,
EIGEN_STRONG_INLINE operator bool() const { return m_lhsIter; } EIGEN_STRONG_INLINE operator bool() const { return m_lhsIter; }
protected: protected:
const RhsNested m_rhs; RhsNested m_rhs;
LhsIterator m_lhsIter; LhsIterator m_lhsIter;
const BinaryFunc m_functor; const BinaryFunc m_functor;
const Index m_outer; const Index m_outer;

View File

@ -38,11 +38,11 @@ struct SparseSparseProductReturnType
typedef typename internal::conditional<TransposeLhs, typedef typename internal::conditional<TransposeLhs,
SparseMatrix<Scalar,0>, SparseMatrix<Scalar,0>,
const typename internal::nested<Lhs,Rhs::RowsAtCompileTime>::type>::type LhsNested; typename internal::nested<Lhs,Rhs::RowsAtCompileTime>::type>::type LhsNested;
typedef typename internal::conditional<TransposeRhs, typedef typename internal::conditional<TransposeRhs,
SparseMatrix<Scalar,0>, SparseMatrix<Scalar,0>,
const typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type>::type RhsNested; typename internal::nested<Rhs,Lhs::RowsAtCompileTime>::type>::type RhsNested;
typedef SparseSparseProduct<LhsNested, RhsNested> Type; typedef SparseSparseProduct<LhsNested, RhsNested> Type;
}; };

View File

@ -145,7 +145,7 @@ template<typename MatrixType, unsigned int UpLo> class SparseSelfAdjointView
protected: protected:
const typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;
mutable VectorI m_countPerRow; mutable VectorI m_countPerRow;
mutable VectorI m_countPerCol; mutable VectorI m_countPerCol;
}; };
@ -448,7 +448,7 @@ class SparseSymmetricPermutationProduct
} }
protected: protected:
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
const Perm& m_perm; const Perm& m_perm;
}; };

View File

@ -70,7 +70,7 @@ template<typename MatrixType, int Mode> class SparseTriangularView
template<typename OtherDerived> void solveInPlace(SparseMatrixBase<OtherDerived>& other) const; template<typename OtherDerived> void solveInPlace(SparseMatrixBase<OtherDerived>& other) const;
protected: protected:
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
}; };
template<typename MatrixType, int Mode> template<typename MatrixType, int Mode>

View File

@ -61,7 +61,7 @@ public:
inline Index outerSize() const { return m_matrix.outerSize(); } inline Index outerSize() const { return m_matrix.outerSize(); }
protected: protected:
const MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
Scalar m_reference; Scalar m_reference;
typename NumTraits<Scalar>::Real m_epsilon; typename NumTraits<Scalar>::Real m_epsilon;
}; };

View File

@ -66,7 +66,7 @@ template<typename _DecompositionType, typename Rhs> struct solve_retval_base
protected: protected:
const DecompositionType& m_dec; const DecompositionType& m_dec;
const typename Rhs::Nested m_rhs; typename Rhs::Nested m_rhs;
}; };
} // end namespace internal } // end namespace internal

View File

@ -61,7 +61,7 @@ template<typename _DecompositionType, typename Rhs> struct sparse_solve_retval_b
protected: protected:
const DecompositionType& m_dec; const DecompositionType& m_dec;
const typename Rhs::Nested m_rhs; typename Rhs::Nested m_rhs;
}; };
#define EIGEN_MAKE_SPARSE_SOLVE_HELPERS(DecompositionType,Rhs) \ #define EIGEN_MAKE_SPARSE_SOLVE_HELPERS(DecompositionType,Rhs) \