diff options
author | Gael Guennebaud <g.gael@free.fr> | 2010-01-22 10:15:41 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2010-01-22 10:15:41 +0100 |
commit | d40c110053c13692ffc0df25fca292d98996d496 (patch) | |
tree | bcd5aeb0665e47168bb5cb53e5e935da1614bb7d | |
parent | f1a025185a25e53eb1c4817141c0523cf48f70bc (diff) |
lot of cleaning:
- clean the *_PUBLIC_INTERFACE_*
- update Diagonal, ReturnByValue, ForceAlignedAccess, UnaryView, etc. to support array
- many other small stuff
33 files changed, 130 insertions, 249 deletions
diff --git a/Eigen/src/Array/Array.h b/Eigen/src/Array/Array.h index b8328417a..ceef71afd 100644 --- a/Eigen/src/Array/Array.h +++ b/Eigen/src/Array/Array.h @@ -38,7 +38,7 @@ class Array public: typedef DenseStorageBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Eigen::ArrayBase, _Options> Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(Array) + EIGEN_DENSE_PUBLIC_INTERFACE(Array) enum { Options = _Options }; typedef typename Base::PlainMatrixType PlainMatrixType; diff --git a/Eigen/src/Array/ArrayWrapper.h b/Eigen/src/Array/ArrayWrapper.h index b62d66d8c..9b7c83951 100644 --- a/Eigen/src/Array/ArrayWrapper.h +++ b/Eigen/src/Array/ArrayWrapper.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -46,7 +46,7 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> > { public: typedef ArrayBase<ArrayWrapper> Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) + EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) inline ArrayWrapper(const ExpressionType& matrix) : m_expression(matrix) {} @@ -127,7 +127,8 @@ template<typename ExpressionType> class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> > { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(MatrixWrapper) + typedef MatrixBase<MatrixWrapper<ExpressionType> > Base; + EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper); inline MatrixWrapper(const ExpressionType& matrix) : m_expression(matrix) {} diff --git a/Eigen/src/Array/Replicate.h b/Eigen/src/Array/Replicate.h index 3f87e09fe..0b1b58f1b 100644 --- a/Eigen/src/Array/Replicate.h +++ b/Eigen/src/Array/Replicate.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -66,7 +66,7 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate public: typedef typename MatrixType::template MakeBase< Replicate<MatrixType,RowFactor,ColFactor> >::Type Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(Replicate) + EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) template<typename OriginalMatrixType> inline explicit Replicate(const OriginalMatrixType& matrix) diff --git a/Eigen/src/Array/Reverse.h b/Eigen/src/Array/Reverse.h index 7d2c34816..c908e8d9c 100644 --- a/Eigen/src/Array/Reverse.h +++ b/Eigen/src/Array/Reverse.h @@ -3,7 +3,7 @@ // // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // Copyright (C) 2009 Ricard Marxer <email@ricardmarxer.com> -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -80,7 +80,7 @@ template<typename MatrixType, int Direction> class Reverse public: typedef typename MatrixType::template MakeBase< Reverse<MatrixType, Direction> >::Type Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(Reverse) + EIGEN_DENSE_PUBLIC_INTERFACE(Reverse) protected: enum { diff --git a/Eigen/src/Array/Select.h b/Eigen/src/Array/Select.h index b1fab69c9..38c1a716f 100644 --- a/Eigen/src/Array/Select.h +++ b/Eigen/src/Array/Select.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -69,7 +69,7 @@ class Select : ei_no_assignment_operator, public: typedef typename ThenMatrixType::template MakeBase< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::Type Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(Select) + EIGEN_DENSE_PUBLIC_INTERFACE(Select) Select(const ConditionMatrixType& conditionMatrix, const ThenMatrixType& thenMatrix, diff --git a/Eigen/src/Array/VectorwiseOp.h b/Eigen/src/Array/VectorwiseOp.h index eef554d8a..697a07d32 100644 --- a/Eigen/src/Array/VectorwiseOp.h +++ b/Eigen/src/Array/VectorwiseOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or @@ -80,7 +80,7 @@ class PartialReduxExpr : ei_no_assignment_operator, public: typedef typename MatrixType::template MakeBase< PartialReduxExpr<MatrixType, MemberOp, Direction> >::Type Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(PartialReduxExpr) + EIGEN_DENSE_PUBLIC_INTERFACE(PartialReduxExpr) typedef typename ei_traits<PartialReduxExpr>::MatrixTypeNested MatrixTypeNested; typedef typename ei_traits<PartialReduxExpr>::_MatrixTypeNested _MatrixTypeNested; diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index fa63d27dc..3b4234c22 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -86,7 +86,7 @@ template<typename MatrixType, int BlockRows, int BlockCols, int _DirectAccessSta public: typedef typename MatrixType::template MakeBase< Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(Block) + EIGEN_DENSE_PUBLIC_INTERFACE(Block) class InnerIterator; @@ -218,7 +218,7 @@ class Block<MatrixType,BlockRows,BlockCols,HasDirectAccess> public: typedef MapBase<Block, typename MatrixType::template MakeBase<Block>::Type> Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(Block) + EIGEN_DENSE_PUBLIC_INTERFACE(Block) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 990c553dd..9ed005dce 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -124,8 +124,11 @@ class CwiseBinaryOp : ei_no_assignment_operator, EIGEN_STRONG_INLINE int rows() const { return m_lhs.rows(); } EIGEN_STRONG_INLINE int cols() const { return m_lhs.cols(); } + /** \returns the left hand side nested expression */ const _LhsNested& lhs() const { return m_lhs; } + /** \returns the right hand side nested expression */ const _RhsNested& rhs() const { return m_rhs; } + /** \returns the functor representing the binary operation */ const BinaryOp& functor() const { return m_functor; } protected: @@ -138,11 +141,11 @@ template<typename BinaryOp, typename Lhs, typename Rhs> class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense> : public Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type { + typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived; public: - typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived; typedef typename Lhs::template MakeBase< CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) + EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const { diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 129d558b4..c5d5cd97c 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -60,7 +60,7 @@ class CwiseNullaryOp : ei_no_assignment_operator, public: typedef typename MatrixType::template MakeBase< CwiseNullaryOp<NullaryOp, MatrixType> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) + EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) CwiseNullaryOp(int rows, int cols, const NullaryOp& func = NullaryOp()) : m_rows(rows), m_cols(cols), m_functor(func) diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index 1abf0fffb..b51bd51af 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or @@ -74,16 +74,14 @@ class CwiseUnaryOp : ei_no_assignment_operator, EIGEN_STRONG_INLINE int rows() const { return m_matrix.rows(); } EIGEN_STRONG_INLINE int cols() const { return m_matrix.cols(); } - /** \internal used for introspection */ - const UnaryOp& _functor() const { return m_functor; } - - /** \internal used for introspection */ - const typename ei_cleantype<typename MatrixType::Nested>::type& - _expression() const { return m_matrix; } + /** \returns the functor representing the unary operation */ + const UnaryOp& functor() const { return m_functor; } + /** \returns the nested expression */ const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const { return m_matrix; } + /** \returns the nested expression */ typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() { return m_matrix.const_cast_derived(); } @@ -98,37 +96,33 @@ template<typename UnaryOp, typename MatrixType> class CwiseUnaryOpImpl<UnaryOp,MatrixType,Dense> : public MatrixType::template MakeBase< CwiseUnaryOp<UnaryOp, MatrixType> >::Type { - const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const - { return derived().nestedExpression(); } - typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() - { return derived().nestedExpression(); } + typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived; public: - typedef CwiseUnaryOp<UnaryOp, MatrixType> Derived; typedef typename MatrixType::template MakeBase< CwiseUnaryOp<UnaryOp, MatrixType> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const { - return derived()._functor()(nestedExpression().coeff(row, col)); + return derived().functor()(derived().nestedExpression().coeff(row, col)); } template<int LoadMode> EIGEN_STRONG_INLINE PacketScalar packet(int row, int col) const { - return derived()._functor().packetOp(nestedExpression().template packet<LoadMode>(row, col)); + return derived().functor().packetOp(derived().nestedExpression().template packet<LoadMode>(row, col)); } EIGEN_STRONG_INLINE const Scalar coeff(int index) const { - return derived()._functor()(nestedExpression().coeff(index)); + return derived().functor()(derived().nestedExpression().coeff(index)); } template<int LoadMode> EIGEN_STRONG_INLINE PacketScalar packet(int index) const { - return derived()._functor().packetOp(nestedExpression().template packet<LoadMode>(index)); + return derived().functor().packetOp(derived().nestedExpression().template packet<LoadMode>(index)); } }; diff --git a/Eigen/src/Core/CwiseUnaryView.h b/Eigen/src/Core/CwiseUnaryView.h index 2ff5d3d45..2198ed226 100644 --- a/Eigen/src/Core/CwiseUnaryView.h +++ b/Eigen/src/Core/CwiseUnaryView.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -72,12 +72,14 @@ class CwiseUnaryView : ei_no_assignment_operator, EIGEN_STRONG_INLINE int rows() const { return m_matrix.rows(); } EIGEN_STRONG_INLINE int cols() const { return m_matrix.cols(); } - /** \internal used for introspection */ - const ViewOp& _functor() const { return m_functor; } + /** \returns the functor representing unary operation */ + const ViewOp& functor() const { return m_functor; } + /** \returns the nested expression */ const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const { return m_matrix; } + /** \returns the nested expression */ typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() { return m_matrix.const_cast_derived(); } @@ -88,36 +90,34 @@ class CwiseUnaryView : ei_no_assignment_operator, }; template<typename ViewOp, typename MatrixType> -class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense> : public MatrixBase<CwiseUnaryView<ViewOp, MatrixType> > +class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense> + : public MatrixType::template MakeBase< CwiseUnaryView<ViewOp, MatrixType> >::Type { - const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const - { return derived().nestedExpression(); } - typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() - { return derived().nestedExpression(); } + typedef CwiseUnaryView<ViewOp, MatrixType> Derived; public: - typedef CwiseUnaryView<ViewOp, MatrixType> Derived; - EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) + typedef typename MatrixType::template MakeBase< CwiseUnaryView<ViewOp, MatrixType> >::Type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) EIGEN_STRONG_INLINE const Scalar coeff(int row, int col) const { - return derived()._functor()(nestedExpression().coeff(row, col)); + return derived().functor()(derived().nestedExpression().coeff(row, col)); } EIGEN_STRONG_INLINE const Scalar coeff(int index) const { - return derived()._functor()(nestedExpression().coeff(index)); + return derived().functor()(derived().nestedExpression().coeff(index)); } EIGEN_STRONG_INLINE Scalar& coeffRef(int row, int col) { - return derived()._functor()(nestedExpression().const_cast_derived().coeffRef(row, col)); + return derived().functor()(const_cast_derived().nestedExpression().coeffRef(row, col)); } EIGEN_STRONG_INLINE Scalar& coeffRef(int index) { - return derived()._functor()(nestedExpression().const_cast_derived().coeffRef(index)); + return derived().functor()(const_cast_derived().nestedExpression().coeffRef(index)); } }; diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index e07b02a51..8ea0f3ddf 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -2,7 +2,7 @@ // for linear algebra. // // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com> -// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h index 344dbca40..3720952cd 100644 --- a/Eigen/src/Core/Diagonal.h +++ b/Eigen/src/Core/Diagonal.h @@ -64,7 +64,7 @@ struct ei_traits<Diagonal<MatrixType,Index> > }; template<typename MatrixType, int Index> class Diagonal - : public MatrixBase<Diagonal<MatrixType, Index> > + : public MatrixType::template MakeBase< Diagonal<MatrixType,Index> >::Type { // some compilers may fail to optimize std::max etc in case of compile-time constants... EIGEN_STRONG_INLINE int absIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } @@ -73,7 +73,8 @@ template<typename MatrixType, int Index> class Diagonal public: - EIGEN_GENERIC_PUBLIC_INTERFACE(Diagonal) + typedef typename MatrixType::template MakeBase<Diagonal>::Type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) inline Diagonal(const MatrixType& matrix, int index = Index) : m_matrix(matrix), m_index(index) {} diff --git a/Eigen/src/Core/DiagonalProduct.h b/Eigen/src/Core/DiagonalProduct.h index 87068d9ba..868b4419a 100644 --- a/Eigen/src/Core/DiagonalProduct.h +++ b/Eigen/src/Core/DiagonalProduct.h @@ -48,7 +48,8 @@ class DiagonalProduct : ei_no_assignment_operator, { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(DiagonalProduct) + typedef MatrixBase<DiagonalProduct> Base; + EIGEN_DENSE_PUBLIC_INTERFACE(DiagonalProduct) inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal) : m_matrix(matrix), m_diagonal(diagonal) diff --git a/Eigen/src/Core/ForceAlignedAccess.h b/Eigen/src/Core/ForceAlignedAccess.h index b3fbb3c5c..927f43413 100644 --- a/Eigen/src/Core/ForceAlignedAccess.h +++ b/Eigen/src/Core/ForceAlignedAccess.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,11 +41,12 @@ struct ei_traits<ForceAlignedAccess<ExpressionType> > : public ei_traits<Express {}; template<typename ExpressionType> class ForceAlignedAccess - : public MatrixBase<ForceAlignedAccess<ExpressionType> > + : public ExpressionType::template MakeBase< ForceAlignedAccess<ExpressionType> >::Type { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(ForceAlignedAccess) + typedef typename ExpressionType::template MakeBase<ForceAlignedAccess<ExpressionType> >::Type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index f3939c09f..83688dbca 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -64,7 +64,7 @@ template<typename MatrixType, int Options> class Map public: typedef MapBase<Map,typename MatrixType::template MakeBase<Map>::Type> Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(Map) + EIGEN_DENSE_PUBLIC_INTERFACE(Map) inline int stride() const { return this->innerSize(); } diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index f309f8abd..6f194ffba 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -134,10 +134,10 @@ class Matrix * \sa DenseStorageBase */ typedef DenseStorageBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Eigen::MatrixBase, _Options> Base; - + enum { Options = _Options }; - _EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix) + EIGEN_DENSE_PUBLIC_INTERFACE(Matrix) typedef typename Base::PlainMatrixType PlainMatrixType; @@ -297,7 +297,7 @@ class Matrix } /** \brief Copy constructor for generic expressions. - * \sa MatrixBase::operator=(const AnyMatrixBase<OtherDerived>&) + * \sa MatrixBase::operator=(const AnyMatrixBase<OtherDerived>&) */ template<typename OtherDerived> EIGEN_STRONG_INLINE Matrix(const AnyMatrixBase<OtherDerived> &other) @@ -311,7 +311,7 @@ class Matrix } /** \internal - * \brief Override MatrixBase::swap() since for dynamic-sized matrices + * \brief Override MatrixBase::swap() since for dynamic-sized matrices * of same type it is enough to swap the data pointers. */ template<typename OtherDerived> diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h index 629dbe609..e7e164a16 100644 --- a/Eigen/src/Core/Minor.h +++ b/Eigen/src/Core/Minor.h @@ -64,7 +64,8 @@ template<typename MatrixType> class Minor { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(Minor) + typedef MatrixBase<Minor> Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Minor) inline Minor(const MatrixType& matrix, int row, int col) diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index 85a672779..d70ab1ecb 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h @@ -42,11 +42,12 @@ struct ei_traits<NestByValue<ExpressionType> > : public ei_traits<ExpressionType {}; template<typename ExpressionType> class NestByValue - : public MatrixBase<NestByValue<ExpressionType> > + : public ExpressionType::template MakeBase< NestByValue<ExpressionType> >::Type { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(NestByValue) + typedef typename ExpressionType::template MakeBase<NestByValue<ExpressionType> >::Type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} @@ -97,7 +98,7 @@ template<typename ExpressionType> class NestByValue { m_expression.const_cast_derived().template writePacket<LoadMode>(index, x); } - + operator const ExpressionType&() const { return m_expression; } protected: diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h index 1d19ef72a..44dd587d9 100644 --- a/Eigen/src/Core/ProductBase.h +++ b/Eigen/src/Core/ProductBase.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -56,7 +56,7 @@ struct ei_nested<ProductBase<Derived,Lhs,Rhs>, N, EvalType> #define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \ typedef ProductBase<Derived, Lhs, Rhs > Base; \ - _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ typedef typename Base::LhsNested LhsNested; \ typedef typename Base::_LhsNested _LhsNested; \ typedef typename Base::LhsBlasTraits LhsBlasTraits; \ @@ -75,7 +75,7 @@ class ProductBase : public MatrixBase<Derived> { public: typedef MatrixBase<Derived> Base; - _EIGEN_GENERIC_PUBLIC_INTERFACE(ProductBase) + EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase) typedef typename Lhs::Nested LhsNested; typedef typename ei_cleantype<LhsNested>::type _LhsNested; @@ -89,7 +89,6 @@ class ProductBase : public MatrixBase<Derived> typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; typedef typename ei_cleantype<ActualRhsType>::type _ActualRhsType; - using Base::derived; typedef typename Base::PlainMatrixType PlainMatrixType; ProductBase(const Lhs& lhs, const Rhs& rhs) diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index e35493236..0199d3740 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or @@ -57,12 +57,14 @@ struct ei_nested<ReturnByValue<Derived>, n, PlainMatrixType> typedef typename ei_traits<Derived>::ReturnMatrixType type; }; -template<typename Derived> - class ReturnByValue : public MatrixBase<ReturnByValue<Derived> > +template<typename Derived> class ReturnByValue + : public ei_traits<Derived>::ReturnMatrixType::template MakeBase<ReturnByValue<Derived> >::Type { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(ReturnByValue) typedef typename ei_traits<Derived>::ReturnMatrixType ReturnMatrixType; + typedef typename ReturnMatrixType::template MakeBase<ReturnByValue<Derived> >::Type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) + template<typename Dest> inline void evalTo(Dest& dst) const { static_cast<const Derived* const>(this)->evalTo(dst); } diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index df35d0ee9..7ae2e82a4 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -47,7 +47,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp public: typedef typename MatrixType::template MakeBase< SelfCwiseBinaryOp<BinaryOp, MatrixType> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp) + EIGEN_DENSE_PUBLIC_INTERFACE(SelfCwiseBinaryOp) typedef typename ei_packet_traits<Scalar>::type Packet; diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index 60b6fffc9..186268af0 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -40,7 +40,7 @@ template<typename ExpressionType> class SwapWrapper public: typedef typename ExpressionType::template MakeBase<SwapWrapper<ExpressionType> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper) + EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper) typedef typename ei_packet_traits<Scalar>::type Packet; inline SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {} diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 35b8b2ed3..1113792fd 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -2,6 +2,7 @@ // for linear algebra. // // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -71,13 +72,11 @@ template<typename MatrixType> class Transpose inline int rows() const { return m_matrix.cols(); } inline int cols() const { return m_matrix.rows(); } - /** \internal used for introspection */ - const typename ei_cleantype<typename MatrixType::Nested>::type& - _expression() const { return m_matrix; } - + /** \returns the nested expression */ const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const { return m_matrix; } + /** \returns the nested expression */ typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() { return m_matrix.const_cast_derived(); } @@ -89,65 +88,57 @@ template<typename MatrixType> class Transpose template<typename MatrixType> class TransposeImpl<MatrixType,Dense> : public MatrixType::template MakeBase<Transpose<MatrixType> >::Type { - const typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() const - { return derived().nestedExpression(); } - typename ei_cleantype<typename MatrixType::Nested>::type& nestedExpression() - { return derived().nestedExpression(); } - public: - //EIGEN_DENSE_PUBLpename IC_INTERFACE(TransposeImpl,MatrixBase<Transpose<MatrixType> >) typedef typename MatrixType::template MakeBase<Transpose<MatrixType> >::Type Base; - _EIGEN_DENSE_PUBLIC_INTERFACE(Transpose<MatrixType>) - -// EIGEN_EXPRESSION_IMPL_COMMON(MatrixBase<Transpose<MatrixType> >) + EIGEN_DENSE_PUBLIC_INTERFACE(Transpose<MatrixType>) - inline int stride() const { return nestedExpression().stride(); } - inline Scalar* data() { return nestedExpression().data(); } - inline const Scalar* data() const { return nestedExpression().data(); } + inline int stride() const { return derived().nestedExpression().stride(); } + inline Scalar* data() { return derived().nestedExpression().data(); } + inline const Scalar* data() const { return derived().nestedExpression().data(); } inline Scalar& coeffRef(int row, int col) { - return nestedExpression().const_cast_derived().coeffRef(col, row); + return const_cast_derived().nestedExpression().coeffRef(col, row); } inline Scalar& coeffRef(int index) { - return nestedExpression().const_cast_derived().coeffRef(index); + return const_cast_derived().nestedExpression().coeffRef(index); } inline const CoeffReturnType coeff(int row, int col) const { - return nestedExpression().coeff(col, row); + return derived().nestedExpression().coeff(col, row); } inline const CoeffReturnType coeff(int index) const { - return nestedExpression().coeff(index); + return derived().nestedExpression().coeff(index); } template<int LoadMode> inline const PacketScalar packet(int row, int col) const { - return nestedExpression().template packet<LoadMode>(col, row); + return derived().nestedExpression().template packet<LoadMode>(col, row); } template<int LoadMode> inline void writePacket(int row, int col, const PacketScalar& x) { - nestedExpression().const_cast_derived().template writePacket<LoadMode>(col, row, x); + const_cast_derived().nestedExpression().template writePacket<LoadMode>(col, row, x); } template<int LoadMode> inline const PacketScalar packet(int index) const { - return nestedExpression().template packet<LoadMode>(index); + return derived().nestedExpression().template packet<LoadMode>(index); } template<int LoadMode> inline void writePacket(int index, const PacketScalar& x) { - nestedExpression().const_cast_derived().template writePacket<LoadMode>(index, x); + const_cast_derived().nestedExpression().template writePacket<LoadMode>(index, x); } }; diff --git a/Eigen/src/Core/VectorBlock.h b/Eigen/src/Core/VectorBlock.h index 6dd8da938..cbf97aeb3 100644 --- a/Eigen/src/Core/VectorBlock.h +++ b/Eigen/src/Core/VectorBlock.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or @@ -75,7 +75,7 @@ template<typename VectorType, int Size> class VectorBlock IsColVector = ei_traits<VectorType>::ColsAtCompileTime==1 }; public: - _EIGEN_GENERIC_PUBLIC_INTERFACE(VectorBlock) + EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock) using Base::operator=; diff --git a/Eigen/src/Core/products/GeneralUnrolled.h b/Eigen/src/Core/products/GeneralUnrolled.h index f04c27a95..32aa3afe6 100644 --- a/Eigen/src/Core/products/GeneralUnrolled.h +++ b/Eigen/src/Core/products/GeneralUnrolled.h @@ -2,7 +2,7 @@ // for linear algebra. // // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -104,7 +104,8 @@ template<typename LhsNested, typename RhsNested> class GeneralProduct<LhsNested, { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(GeneralProduct) + typedef MatrixBase<GeneralProduct> Base; + EIGEN_DENSE_PUBLIC_INTERFACE(GeneralProduct) private: diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index 916a125e3..3777464dc 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -185,8 +185,8 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestedXpr> > IsComplex = NumTraits<Scalar>::IsComplex, NeedToConjugate = Base::NeedToConjugate ? 0 : IsComplex }; - static inline ExtractType extract(const XprType& x) { return Base::extract(x._expression()); } - static inline Scalar extractScalarFactor(const XprType& x) { return ei_conj(Base::extractScalarFactor(x._expression())); } + static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } + static inline Scalar extractScalarFactor(const XprType& x) { return ei_conj(Base::extractScalarFactor(x.nestedExpression())); } }; // pop scalar multiple @@ -197,9 +197,9 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> > typedef ei_blas_traits<NestedXpr> Base; typedef CwiseUnaryOp<ei_scalar_multiple_op<Scalar>, NestedXpr> XprType; typedef typename Base::ExtractType ExtractType; - static inline ExtractType extract(const XprType& x) { return Base::extract(x._expression()); } + static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } static inline Scalar extractScalarFactor(const XprType& x) - { return x._functor().m_other * Base::extractScalarFactor(x._expression()); } + { return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); } }; // pop opposite @@ -210,9 +210,9 @@ struct ei_blas_traits<CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> > typedef ei_blas_traits<NestedXpr> Base; typedef CwiseUnaryOp<ei_scalar_opposite_op<Scalar>, NestedXpr> XprType; typedef typename Base::ExtractType ExtractType; - static inline ExtractType extract(const XprType& x) { return Base::extract(x._expression()); } + static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } static inline Scalar extractScalarFactor(const XprType& x) - { return - Base::extractScalarFactor(x._expression()); } + { return - Base::extractScalarFactor(x.nestedExpression()); } }; // pop/push transpose @@ -232,8 +232,8 @@ struct ei_blas_traits<Transpose<NestedXpr> > enum { IsTransposed = Base::IsTransposed ? 0 : 1 }; - static inline const ExtractType extract(const XprType& x) { return Base::extract(x._expression()); } - static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x._expression()); } + static inline const ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); } + static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); } }; #endif // EIGEN_BLASUTIL_H diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 6e31f1580..dc1aa150b 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or @@ -281,49 +281,29 @@ using Eigen::ei_cos; * Just a side note. Commenting within defines works only by documenting * behind the object (via '!<'). Comments cannot be multi-line and thus * we have these extra long lines. What is confusing doxygen over here is -* that we use '\' and basically have a bunch of typedefs with their +* that we use '\' and basically have a bunch of typedefs with their * documentation in a single line. **/ -#define _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ +#define EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(Derived) \ typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \ typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \ - typedef typename Base::PacketScalar PacketScalar; \ typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \ typedef typename Eigen::ei_nested<Derived>::type Nested; \ enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \ ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \ - MaxRowsAtCompileTime = Eigen::ei_traits<Derived>::MaxRowsAtCompileTime, \ - MaxColsAtCompileTime = Eigen::ei_traits<Derived>::MaxColsAtCompileTime, \ Flags = Eigen::ei_traits<Derived>::Flags, \ CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \ SizeAtCompileTime = Base::SizeAtCompileTime, \ MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \ IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; -#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ - typedef Eigen::MatrixBase<Derived> Base; \ - _EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) -#define EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(Derived) \ - typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \ - typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \ - typedef typename Base::CoeffReturnType CoeffReturnType; \ - typedef typename Eigen::ei_nested<Derived>::type Nested; \ - enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \ - ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \ - Flags = Eigen::ei_traits<Derived>::Flags, \ - CoeffReadCost = Eigen::ei_traits<Derived>::CoeffReadCost, \ - SizeAtCompileTime = Base::SizeAtCompileTime, \ - MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \ - IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; - - -#define _EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ - typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \ - typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \ +#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ + typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \ + typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \ typedef typename Base::PacketScalar PacketScalar; \ - typedef typename Base::CoeffReturnType CoeffReturnType; \ + typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \ typedef typename Eigen::ei_nested<Derived>::type Nested; \ enum { RowsAtCompileTime = Eigen::ei_traits<Derived>::RowsAtCompileTime, \ ColsAtCompileTime = Eigen::ei_traits<Derived>::ColsAtCompileTime, \ @@ -334,11 +314,8 @@ using Eigen::ei_cos; SizeAtCompileTime = Base::SizeAtCompileTime, \ MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \ IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \ - using Base::derived; - -#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ - typedef Eigen::MatrixBase<Derived> Base; \ - _EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + using Base::derived; \ + using Base::const_cast_derived; #define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b) diff --git a/Eigen/src/Eigen2Support/Flagged.h b/Eigen/src/Eigen2Support/Flagged.h index bed110b64..470db1d7b 100644 --- a/Eigen/src/Eigen2Support/Flagged.h +++ b/Eigen/src/Eigen2Support/Flagged.h @@ -52,7 +52,8 @@ template<typename ExpressionType, unsigned int Added, unsigned int Removed> clas { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(Flagged) + typedef MatrixBase<Flagged> Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Flagged) typedef typename ei_meta_if<ei_must_nest_by_value<ExpressionType>::ret, ExpressionType, const ExpressionType&>::ret ExpressionTypeNested; typedef typename ExpressionType::InnerIterator InnerIterator; diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h index b0232e77c..76ca66c57 100644 --- a/Eigen/src/Geometry/Homogeneous.h +++ b/Eigen/src/Geometry/Homogeneous.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2009-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -70,7 +70,8 @@ template<typename MatrixType,int _Direction> class Homogeneous enum { Direction = _Direction }; - EIGEN_GENERIC_PUBLIC_INTERFACE(Homogeneous) + typedef MatrixBase<Homogeneous> Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Homogeneous) inline Homogeneous(const MatrixType& matrix) : m_matrix(matrix) diff --git a/Eigen/src/Sparse/SparseBlock.h b/Eigen/src/Sparse/SparseBlock.h index a8c1f9047..2e16856eb 100644 --- a/Eigen/src/Sparse/SparseBlock.h +++ b/Eigen/src/Sparse/SparseBlock.h @@ -1,8 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> -// Copyright (C) 2008 Daniel Gomez Ferro <dgomezferro@gmail.com> +// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -406,98 +405,4 @@ template<typename Derived> const SparseInnerVectorSet<Derived,Dynamic> SparseMatrixBase<Derived>::innerVectors(int outerStart, int outerSize) const { return SparseInnerVectorSet<Derived,Dynamic>(derived(), outerStart, outerSize); } -# if 0 -template<typename MatrixType, int BlockRows, int BlockCols, int PacketAccess> -class Block<MatrixType,BlockRows,BlockCols,PacketAccess,IsSparse> - : public SparseMatrixBase<Block<MatrixType,BlockRows,BlockCols,PacketAccess,IsSparse> > -{ -public: - - _EIGEN_GENERIC_PUBLIC_INTERFACE(Block, SparseMatrixBase<Block>) - class InnerIterator; - - /** Column or Row constructor - */ - inline Block(const MatrixType& matrix, int i) - : m_matrix(matrix), - // It is a row if and only if BlockRows==1 and BlockCols==MatrixType::ColsAtCompileTime, - // and it is a column if and only if BlockRows==MatrixType::RowsAtCompileTime and BlockCols==1, - // all other cases are invalid. - // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. - m_startRow( (BlockRows==1) && (BlockCols==MatrixType::ColsAtCompileTime) ? i : 0), - m_startCol( (BlockRows==MatrixType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), - m_blockRows(matrix.rows()), // if it is a row, then m_blockRows has a fixed-size of 1, so no pb to try to overwrite it - m_blockCols(matrix.cols()) // same for m_blockCols - { - ei_assert( (i>=0) && ( - ((BlockRows==1) && (BlockCols==MatrixType::ColsAtCompileTime) && i<matrix.rows()) - ||((BlockRows==MatrixType::RowsAtCompileTime) && (BlockCols==1) && i<matrix.cols()))); - } - - /** Fixed-size constructor - */ - inline Block(const MatrixType& matrix, int startRow, int startCol) - : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol), - m_blockRows(matrix.rows()), m_blockCols(matrix.cols()) - { - EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && RowsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE) - ei_assert(startRow >= 0 && BlockRows >= 1 && startRow + BlockRows <= matrix.rows() - && startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= matrix.cols()); - } - - /** Dynamic-size constructor - */ - inline Block(const MatrixType& matrix, - int startRow, int startCol, - int blockRows, int blockCols) - : m_matrix(matrix), m_startRow(startRow), m_startCol(startCol), - m_blockRows(blockRows), m_blockCols(blockCols) - { - ei_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) - && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - ei_assert(startRow >= 0 && blockRows >= 1 && startRow + blockRows <= matrix.rows() - && startCol >= 0 && blockCols >= 1 && startCol + blockCols <= matrix.cols()); - } - - inline int rows() const { return m_blockRows.value(); } - inline int cols() const { return m_blockCols.value(); } - - inline int stride(void) const { return m_matrix.stride(); } - - inline Scalar& coeffRef(int row, int col) - { - return m_matrix.const_cast_derived() - .coeffRef(row + m_startRow.value(), col + m_startCol.value()); - } - - inline const Scalar coeff(int row, int col) const - { - return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value()); - } - - inline Scalar& coeffRef(int index) - { - return m_matrix.const_cast_derived() - .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); - } - - inline const Scalar coeff(int index) const - { - return m_matrix - .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), - m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); - } - - protected: - - const typename MatrixType::Nested m_matrix; - const ei_int_if_dynamic<MatrixType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow; - const ei_int_if_dynamic<MatrixType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol; - const ei_int_if_dynamic<RowsAtCompileTime> m_blockRows; - const ei_int_if_dynamic<ColsAtCompileTime> m_blockCols; - -}; -#endif - #endif // EIGEN_SPARSE_BLOCK_H diff --git a/Eigen/src/Sparse/SparseCwiseUnaryOp.h b/Eigen/src/Sparse/SparseCwiseUnaryOp.h index eb2c99375..1d1e22c5c 100644 --- a/Eigen/src/Sparse/SparseCwiseUnaryOp.h +++ b/Eigen/src/Sparse/SparseCwiseUnaryOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -60,7 +60,7 @@ class CwiseUnaryOpImpl<UnaryOp,MatrixType,Sparse>::InnerIterator public: EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryOpImpl& unaryOp, int outer) - : m_iter(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived()._functor()) + : m_iter(unaryOp.derived().nestedExpression(),outer), m_functor(unaryOp.derived().functor()) {} EIGEN_STRONG_INLINE InnerIterator& operator++() @@ -101,7 +101,7 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Sparse>::InnerIterator public: EIGEN_STRONG_INLINE InnerIterator(const CwiseUnaryViewImpl& unaryView, int outer) - : m_iter(unaryView.derived().nestedExpression(),outer), m_functor(unaryView.derived()._functor()) + : m_iter(unaryView.derived().nestedExpression(),outer), m_functor(unaryView.derived().functor()) {} EIGEN_STRONG_INLINE InnerIterator& operator++() diff --git a/Eigen/src/Sparse/SparseProduct.h b/Eigen/src/Sparse/SparseProduct.h index 7aa81312e..a56bc7601 100644 --- a/Eigen/src/Sparse/SparseProduct.h +++ b/Eigen/src/Sparse/SparseProduct.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr> +// Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -93,7 +93,8 @@ class SparseProduct : ei_no_assignment_operator, { public: - EIGEN_GENERIC_PUBLIC_INTERFACE(SparseProduct) + typedef typename ei_traits<SparseProduct<LhsNested, RhsNested> >::Base Base; + EIGEN_DENSE_PUBLIC_INTERFACE(SparseProduct) private: |