From 8eab9fb87e2bcb3d9bce50c588e88fb6d500bfb5 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 4 Jan 2010 19:00:16 +0100 Subject: [PATCH] port VectorwiseOp and Swap to the novel mechanisms, and various cleanning --- Eigen/src/Array/ArrayBase.h | 63 ++++----------------------- Eigen/src/Array/VectorwiseOp.h | 68 +++++++++++++++--------------- Eigen/src/Core/DenseBase.h | 41 +++--------------- Eigen/src/Core/MatrixBase.h | 53 +++-------------------- Eigen/src/Core/SelfCwiseBinaryOp.h | 27 +++++++++++- Eigen/src/Core/Swap.h | 7 +-- Eigen/src/Sparse/CoreIterators.h | 4 +- 7 files changed, 88 insertions(+), 175 deletions(-) diff --git a/Eigen/src/Array/ArrayBase.h b/Eigen/src/Array/ArrayBase.h index ccc8b8373..1ec2a3516 100644 --- a/Eigen/src/Array/ArrayBase.h +++ b/Eigen/src/Array/ArrayBase.h @@ -35,17 +35,17 @@ template class MatrixWrapper; * * An array is similar to a dense vector or matrix. While matrices are mathematical * objects with well defined linear algebra operators, an array is just a collection - * of scalar values arranged in a one or two dimensionnal fashion. The main consequence, - * is that all operations applied to an array are performed coefficient wise. Furthermore, - * arays support scalar math functions of the c++ standard library, and convenient + * of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, + * all operations applied to an array are performed coefficient wise. Furthermore, + * arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient * constructors allowing to easily write generic code working for both scalar values * and arrays. * * This class is the base that is inherited by all array expression types. * - * \param Derived is the derived type, e.g. an array type, or an expression, etc. + * \param Derived is the derived type, e.g., an array or an expression type. * - * \sa class ArrayBase + * \sa class MatrixBase */ template class ArrayBase : public DenseBase @@ -60,8 +60,6 @@ template class ArrayBase using ei_special_scalar_op_base::Scalar, typename NumTraits::Scalar>::Real>::operator*; - class InnerIterator; - typedef typename ei_traits::Scalar Scalar; typedef typename ei_packet_traits::type PacketScalar; @@ -126,11 +124,6 @@ template class ArrayBase # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS - - /** Copies \a other into *this. \returns a reference to *this. */ -// template -// Derived& operator=(const ArrayBase& other); - /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ @@ -139,14 +132,6 @@ template class ArrayBase return ei_assign_selector::run(derived(), other.derived()); } -#ifndef EIGEN_PARSED_BY_DOXYGEN - /** Copies \a other into *this without evaluating other. \returns a reference to *this. */ -// template -// Derived& lazyAssign(const ArrayBase& other); -// template -// Derived& lazyAssign(const MatrixBase& other); -#endif // not EIGEN_PARSED_BY_DOXYGEN - Derived& operator+=(const Scalar& scalar) { return *this = derived() + scalar; } Derived& operator-=(const Scalar& scalar) @@ -168,46 +153,16 @@ template class ArrayBase inline bool operator!=(const ArrayBase& other) const { return cwiseNotEqual(other).all(); } - - /** \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 - * a const reference, in order to avoid a useless copy. - */ -// EIGEN_STRONG_INLINE const typename ei_eval::type eval() const -// { return typename ei_eval::type(derived()); } - -// template -// void swap(ArrayBase EIGEN_REF_TO_TEMPORARY other); - - -// const VectorwiseOp rowwise() const; -// VectorwiseOp rowwise(); -// const VectorwiseOp colwise() const; -// VectorwiseOp colwise(); - - - public: MatrixWrapper asMatrix() { return derived(); } const MatrixWrapper asMatrix() const { return derived(); } - template - inline void evalTo(Dest& dst) const { dst = asMatrix(); } +// template +// inline void evalTo(Dest& dst) const { dst = asMatrix(); } protected: - /** Default constructor. Do nothing. */ - ArrayBase() - { - /* Just checks for self-consistency of the flags. - * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down - */ -#ifdef EIGEN_INTERNAL_DEBUGGING - EIGEN_STATIC_ASSERT(ei_are_flags_consistent::ret, - INVALID_MATRIXBASE_TEMPLATE_PARAMETERS) -#endif - } - + ArrayBase() : Base() {} + private: explicit ArrayBase(int); ArrayBase(int,int); diff --git a/Eigen/src/Array/VectorwiseOp.h b/Eigen/src/Array/VectorwiseOp.h index 05dd69789..c0944fc42 100644 --- a/Eigen/src/Array/VectorwiseOp.h +++ b/Eigen/src/Array/VectorwiseOp.h @@ -119,7 +119,7 @@ class PartialReduxExpr : ei_no_assignment_operator, template struct Cost \ { enum { value = COST }; }; \ template \ - inline ResultType operator()(const MatrixBase& mat) const \ + inline ResultType operator()(const DenseBase& mat) const \ { return mat.MEMBER(); } \ } @@ -148,7 +148,7 @@ struct ei_member_redux { { enum { value = (Size-1) * ei_functor_traits::Cost }; }; ei_member_redux(const BinaryOp func) : m_functor(func) {} template - inline result_type operator()(const MatrixBase& mat) const + inline result_type operator()(const DenseBase& mat) const { return mat.redux(m_functor); } const BinaryOp m_functor; }; @@ -163,13 +163,13 @@ struct ei_member_redux { * \param Direction indicates the direction of the redux (Vertical or Horizontal) * * This class represents a pseudo expression with partial reduction features. - * It is the return type of MatrixBase::colwise() and MatrixBase::rowwise() + * It is the return type of DenseBase::colwise() and DenseBase::rowwise() * and most of the time this is the only way it is used. * * Example: \include MatrixBase_colwise.cpp * Output: \verbinclude MatrixBase_colwise.out * - * \sa MatrixBase::colwise(), MatrixBase::rowwise(), class PartialReduxExpr + * \sa DenseBase::colwise(), DenseBase::rowwise(), class PartialReduxExpr */ template class VectorwiseOp { @@ -227,7 +227,7 @@ template class VectorwiseOp * Replicates a vector to match the size of \c *this */ template typename ExtendedType::Type - extendedTo(const MatrixBase& other) const + extendedTo(const DenseBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); return typename ExtendedType::Type @@ -248,7 +248,7 @@ template class VectorwiseOp * The template parameter \a BinaryOp is the type of the functor * of the custom redux operator. Note that func must be an associative operator. * - * \sa class VectorwiseOp, MatrixBase::colwise(), MatrixBase::rowwise() + * \sa class VectorwiseOp, DenseBase::colwise(), DenseBase::rowwise() */ template const typename ReduxReturnType::Type @@ -261,7 +261,7 @@ template class VectorwiseOp * Example: \include PartialRedux_minCoeff.cpp * Output: \verbinclude PartialRedux_minCoeff.out * - * \sa MatrixBase::minCoeff() */ + * \sa DenseBase::minCoeff() */ const typename ReturnType::Type minCoeff() const { return _expression(); } @@ -271,7 +271,7 @@ template class VectorwiseOp * Example: \include PartialRedux_maxCoeff.cpp * Output: \verbinclude PartialRedux_maxCoeff.out * - * \sa MatrixBase::maxCoeff() */ + * \sa DenseBase::maxCoeff() */ const typename ReturnType::Type maxCoeff() const { return _expression(); } @@ -281,7 +281,7 @@ template class VectorwiseOp * Example: \include PartialRedux_squaredNorm.cpp * Output: \verbinclude PartialRedux_squaredNorm.out * - * \sa MatrixBase::squaredNorm() */ + * \sa DenseBase::squaredNorm() */ const typename ReturnType::Type squaredNorm() const { return _expression(); } @@ -291,7 +291,7 @@ template class VectorwiseOp * Example: \include PartialRedux_norm.cpp * Output: \verbinclude PartialRedux_norm.out * - * \sa MatrixBase::norm() */ + * \sa DenseBase::norm() */ const typename ReturnType::Type norm() const { return _expression(); } @@ -300,7 +300,7 @@ template class VectorwiseOp * of each column (or row) of the referenced expression, using * blue's algorithm. * - * \sa MatrixBase::blueNorm() */ + * \sa DenseBase::blueNorm() */ const typename ReturnType::Type blueNorm() const { return _expression(); } @@ -309,7 +309,7 @@ template class VectorwiseOp * of each column (or row) of the referenced expression, avoiding * underflow and overflow. * - * \sa MatrixBase::stableNorm() */ + * \sa DenseBase::stableNorm() */ const typename ReturnType::Type stableNorm() const { return _expression(); } @@ -318,7 +318,7 @@ template class VectorwiseOp * of each column (or row) of the referenced expression, avoiding * underflow and overflow using a concatenation of hypot() calls. * - * \sa MatrixBase::hypotNorm() */ + * \sa DenseBase::hypotNorm() */ const typename ReturnType::Type hypotNorm() const { return _expression(); } @@ -328,28 +328,28 @@ template class VectorwiseOp * Example: \include PartialRedux_sum.cpp * Output: \verbinclude PartialRedux_sum.out * - * \sa MatrixBase::sum() */ + * \sa DenseBase::sum() */ const typename ReturnType::Type sum() const { return _expression(); } /** \returns a row (or column) vector expression of the mean * of each column (or row) of the referenced expression. * - * \sa MatrixBase::mean() */ + * \sa DenseBase::mean() */ const typename ReturnType::Type mean() const { return _expression(); } /** \returns a row (or column) vector expression representing * whether \b all coefficients of each respective column (or row) are \c true. * - * \sa MatrixBase::all() */ + * \sa DenseBase::all() */ const typename ReturnType::Type all() const { return _expression(); } /** \returns a row (or column) vector expression representing * whether \b at \b least one coefficient of each respective column (or row) is \c true. * - * \sa MatrixBase::any() */ + * \sa DenseBase::any() */ const typename ReturnType::Type any() const { return _expression(); } @@ -359,7 +359,7 @@ template class VectorwiseOp * Example: \include PartialRedux_count.cpp * Output: \verbinclude PartialRedux_count.out * - * \sa MatrixBase::count() */ + * \sa DenseBase::count() */ const PartialReduxExpr, Direction> count() const { return _expression(); } @@ -369,7 +369,7 @@ template class VectorwiseOp * Example: \include PartialRedux_prod.cpp * Output: \verbinclude PartialRedux_prod.out * - * \sa MatrixBase::prod() */ + * \sa DenseBase::prod() */ const typename ReturnType::Type prod() const { return _expression(); } @@ -380,7 +380,7 @@ template class VectorwiseOp * Example: \include PartialRedux_reverse.cpp * Output: \verbinclude PartialRedux_reverse.out * - * \sa MatrixBase::reverse() */ + * \sa DenseBase::reverse() */ const Reverse reverse() const { return Reverse( _expression() ); } @@ -393,7 +393,7 @@ template class VectorwiseOp * Example: \include DirectionWise_replicate.cpp * Output: \verbinclude DirectionWise_replicate.out * - * \sa VectorwiseOp::replicate(int), MatrixBase::replicate(), class Replicate + * \sa VectorwiseOp::replicate(int), DenseBase::replicate(), class Replicate */ // NOTE implemented here because of sunstudio's compilation errors template const Replicate @@ -407,7 +407,7 @@ template class VectorwiseOp /** Copies the vector \a other to each subvector of \c *this */ template - ExpressionType& operator=(const MatrixBase& other) + ExpressionType& operator=(const DenseBase& other) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) //ei_assert((m_matrix.isNull()) == (other.isNull())); FIXME @@ -418,21 +418,21 @@ template class VectorwiseOp /** Adds the vector \a other to each subvector of \c *this */ template - ExpressionType& operator+=(const MatrixBase& other) + ExpressionType& operator+=(const DenseBase& other) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) for(int j=0; j(m_matrix); } /** Substracts the vector \a other to each subvector of \c *this */ template - ExpressionType& operator-=(const MatrixBase& other) + ExpressionType& operator-=(const DenseBase& other) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) for(int j=0; j(m_matrix); } @@ -441,10 +441,10 @@ template class VectorwiseOp CwiseBinaryOp, ExpressionType, typename ExtendedType::Type> - operator+(const MatrixBase& other) const + operator+(const DenseBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); - return m_matrix + extendedTo(other); + return m_matrix + extendedTo(other.derived()); } /** Returns the expression of the difference between each subvector of \c *this and the vector \a other */ @@ -452,10 +452,10 @@ template class VectorwiseOp CwiseBinaryOp, ExpressionType, typename ExtendedType::Type> - operator-(const MatrixBase& other) const + operator-(const DenseBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); - return m_matrix - extendedTo(other); + return m_matrix - extendedTo(other.derived()); } /////////// Geometry module /////////// @@ -505,7 +505,7 @@ template class VectorwiseOp */ template inline const VectorwiseOp -MatrixBase::colwise() const +DenseBase::colwise() const { return derived(); } @@ -518,7 +518,7 @@ MatrixBase::colwise() const */ template inline VectorwiseOp -MatrixBase::colwise() +DenseBase::colwise() { return derived(); } @@ -534,7 +534,7 @@ MatrixBase::colwise() */ template inline const VectorwiseOp -MatrixBase::rowwise() const +DenseBase::rowwise() const { return derived(); } @@ -547,7 +547,7 @@ MatrixBase::rowwise() const */ template inline VectorwiseOp -MatrixBase::rowwise() +DenseBase::rowwise() { return derived(); } diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index a7e74b81d..d47cc8876 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -30,16 +30,17 @@ * * \brief Base class for all dense matrices, vectors, and arrays * - * This class is the base that is inherited by all dense objects (matrix, vector, arrays, and expression - * types). The common Eigen API for dense object is contained in this class. + * This class is the base that is inherited by all dense objects (matrix, vector, arrays, + * and related expression types). The common Eigen API for dense objects is contained in this class. * - * \param Derived is the derived type, e.g. a matrix type, or an expression, etc. + * \param Derived is the derived type, e.g., a matrix type or an expression. */ template class DenseBase #ifndef EIGEN_PARSED_BY_DOXYGEN -// : public AnyMatrixBase : public ei_special_scalar_op_base::Scalar, typename NumTraits::Scalar>::Real> +#else + : public AnyMatrixBase #endif // not EIGEN_PARSED_BY_DOXYGEN { public: @@ -266,11 +267,6 @@ template class DenseBase template void writePacket(int index, const PacketScalar& x); - template - Derived& operator+=(const DenseBase& other); - template - Derived& operator-=(const DenseBase& other); - Eigen::Transpose transpose(); const Eigen::Transpose transpose() const; void transposeInPlace(); @@ -385,31 +381,8 @@ template class DenseBase bool isZero(RealScalar prec = dummy_precision()) const; bool isOnes(RealScalar prec = dummy_precision()) const; - // FIXME - EIGEN_STRONG_INLINE Derived& operator*=(const Scalar& other) - { - SelfCwiseBinaryOp, Derived> tmp(derived()); - typedef typename Derived::PlainMatrixType PlainMatrixType; - tmp = PlainMatrixType::Constant(rows(),cols(),other); - return derived(); - } - EIGEN_STRONG_INLINE Derived& operator/=(const Scalar& other) - { - SelfCwiseBinaryOp::HasFloatingPoint,ei_scalar_product_op,ei_scalar_quotient_op >::ret, Derived> tmp(derived()); - typedef typename Derived::PlainMatrixType PlainMatrixType; - tmp = PlainMatrixType::Constant(rows(),cols(), NumTraits::HasFloatingPoint ? Scalar(1)/other : other); - return derived(); - } - - // FIXME -// template -// inline bool operator==(const DenseBase& other) const -// { return cwiseEqual(other).all(); } -// -// template -// inline bool operator!=(const DenseBase& other) const -// { return cwiseNotEqual(other).all(); } - + inline Derived& operator*=(const Scalar& other); + inline Derived& operator/=(const Scalar& other); /** \returns the matrix or vector obtained by evaluating this expression. * diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index f7b32a650..8f9949b43 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -30,9 +30,9 @@ * * \brief Base class for all dense matrices, vectors, and expressions * - * 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. Other important classes for - * the Eigen API are Matrix, Cwise, and VectorwiseOp. + * This class is the base that is inherited by all matrix, vector, and related expression + * types. Most of the Eigen API is contained in this class, and its base classes. Other important + * classes for the Eigen API are Matrix, and VectorwiseOp. * * Note that some methods are defined in the \ref Array_Module array module. * @@ -61,10 +61,6 @@ template class MatrixBase /** Construct the base class type for the derived class OtherDerived */ template struct MakeBase { typedef MatrixBase Type; }; -// using DenseBase::operator*; - - class InnerIterator; - typedef typename ei_traits::Scalar Scalar; typedef typename ei_packet_traits::type PacketScalar; @@ -89,6 +85,7 @@ template class MatrixBase using Base::coeff; using Base::coeffRef; using Base::lazyAssign; + using Base::eval; using Base::operator=; using Base::operator+=; using Base::operator-=; @@ -96,6 +93,8 @@ template class MatrixBase using Base::operator/=; typedef typename Base::CoeffReturnType CoeffReturnType; + typedef typename Base::RowXpr RowXpr; + typedef typename Base::ColXpr ColXpr; #endif // not EIGEN_PARSED_BY_DOXYGEN @@ -132,13 +131,6 @@ template class MatrixBase ei_traits::MaxRowsAtCompileTime, ei_traits::MaxColsAtCompileTime > PlainMatrixType; - /** \internal the column-major plain matrix type corresponding to this expression. Note that is not necessarily - * exactly the return type of eval(): in the case of plain matrices, the return type of eval() is a const - * reference to a matrix, not a matrix! - * The only difference from PlainMatrixType is that PlainMatrixType_ColMajor is guaranteed to be column-major. - */ -// typedef typename ei_plain_matrix_type::type PlainMatrixType_ColMajor; - /** \internal Represents a matrix with all coefficients equal to one another*/ typedef CwiseNullaryOp,Derived> ConstantReturnType; @@ -149,10 +141,6 @@ template class MatrixBase >::ret AdjointReturnType; /** \internal the return type of MatrixBase::eigenvalues() */ typedef Matrix::Scalar>::Real, ei_traits::ColsAtCompileTime, 1> EigenvaluesReturnType; - /** \internal expression tyepe of a column */ - typedef Block::RowsAtCompileTime, 1> ColXpr; - /** \internal expression tyepe of a column */ - typedef Block::ColsAtCompileTime> RowXpr; /** \internal the return type of identity */ typedef CwiseNullaryOp,Derived> IdentityReturnType; /** \internal the return type of unit vectors */ @@ -286,18 +274,6 @@ template class MatrixBase inline bool operator!=(const MatrixBase& other) const { return cwiseNotEqual(other).all(); } - - /** \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 - * a const reference, in order to avoid a useless copy. - */ - EIGEN_STRONG_INLINE const typename ei_eval::type eval() const - { return typename ei_eval::type(derived()); } - - template - void swap(MatrixBase EIGEN_REF_TO_TEMPORARY other); - NoAlias noalias(); inline const NestByValue nestByValue() const; @@ -311,11 +287,6 @@ template class MatrixBase /////////// Array module /////////// - const VectorwiseOp rowwise() const; - VectorwiseOp rowwise(); - const VectorwiseOp colwise() const; - VectorwiseOp colwise(); - template RealScalar lpNorm() const; ArrayWrapper array() { return derived(); } @@ -435,17 +406,7 @@ template class MatrixBase #endif protected: - /** Default constructor. Do nothing. */ - MatrixBase() - { - /* Just checks for self-consistency of the flags. - * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down - */ -#ifdef EIGEN_INTERNAL_DEBUGGING - EIGEN_STATIC_ASSERT(ei_are_flags_consistent::ret, - INVALID_MATRIXBASE_TEMPLATE_PARAMETERS) -#endif - } + MatrixBase() : Base() {} private: explicit MatrixBase(int); diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index ad5dc819b..55bd93f9e 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -30,12 +30,18 @@ * \internal * * \brief Internal helper class for optimizing operators like +=, -= + * + * This is a pseudo expression class re-implementing the copyCoeff/copyPacket + * method to directly performs a +=/-= operations in an optimal way. In particular, + * this allows to make sure that the input/output data are loaded only once using + * aligned packet loads. + * + * \sa class SwapWrapper for a similar trick. */ template struct ei_traits > : ei_traits {}; template class SelfCwiseBinaryOp - //: public MatrixBase > : public MatrixType::template MakeBase< SelfCwiseBinaryOp >::Type { public: @@ -43,7 +49,6 @@ template class SelfCwiseBinaryOp typedef typename MatrixType::template MakeBase< SelfCwiseBinaryOp >::Type Base; _EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp) -// EIGEN_GENERIC_PUBLIC_INTERFACE(SelfCwiseBinaryOp) typedef typename ei_packet_traits::type Packet; using Base::operator=; @@ -114,4 +119,22 @@ template class SelfCwiseBinaryOp SelfCwiseBinaryOp& operator=(const SelfCwiseBinaryOp&); }; +template +inline Derived& DenseBase::operator*=(const Scalar& other) +{ + SelfCwiseBinaryOp, Derived> tmp(derived()); + typedef typename Derived::PlainMatrixType PlainMatrixType; + tmp = PlainMatrixType::Constant(rows(),cols(),other); + return derived(); +} + +template +inline Derived& DenseBase::operator/=(const Scalar& other) +{ + SelfCwiseBinaryOp::HasFloatingPoint,ei_scalar_product_op,ei_scalar_quotient_op >::ret, Derived> tmp(derived()); + typedef typename Derived::PlainMatrixType PlainMatrixType; + tmp = PlainMatrixType::Constant(rows(),cols(), NumTraits::HasFloatingPoint ? Scalar(1)/other : other); + return derived(); +} + #endif // EIGEN_SELFCWISEBINARYOP_H diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index 010d8bb8b..60b6fffc9 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -35,11 +35,12 @@ template struct ei_traits > : ei_traits {}; template class SwapWrapper - : public MatrixBase > + : public ExpressionType::template MakeBase >::Type { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(SwapWrapper) + typedef typename ExpressionType::template MakeBase >::Type Base; + _EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper) typedef typename ei_packet_traits::type Packet; inline SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {} @@ -117,7 +118,7 @@ template class SwapWrapper */ template template -void MatrixBase::swap(MatrixBase EIGEN_REF_TO_TEMPORARY other) +void DenseBase::swap(DenseBase EIGEN_REF_TO_TEMPORARY other) { (SwapWrapper(derived())).lazyAssign(other); } diff --git a/Eigen/src/Sparse/CoreIterators.h b/Eigen/src/Sparse/CoreIterators.h index 1789b4f45..69780456d 100644 --- a/Eigen/src/Sparse/CoreIterators.h +++ b/Eigen/src/Sparse/CoreIterators.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2008-2010 Gael Guennebaud // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -35,7 +35,7 @@ */ // generic version for dense matrix and expressions -template class MatrixBase::InnerIterator +template class DenseBase::InnerIterator { typedef typename Derived::Scalar Scalar; enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit };