diff options
author | 2010-04-23 11:36:22 -0400 | |
---|---|---|
committer | 2010-04-23 11:36:22 -0400 | |
commit | a16ba80bfa492f68cc699979ccda63519d782421 (patch) | |
tree | f8d792401539e56e776d67904bc57104742efc41 /Eigen | |
parent | 58e7297859f4a454218e94d346e4839961d30409 (diff) |
* remove ei_block_direct_access_status
* remove HasDirectAccess / NoDirectAccess constants
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Array/Array.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/Block.h | 14 | ||||
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 11 | ||||
-rw-r--r-- | Eigen/src/Core/Matrix.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/Product.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/Transpose.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/util/BlasUtil.h | 12 | ||||
-rw-r--r-- | Eigen/src/Core/util/Constants.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/util/ForwardDeclarations.h | 9 |
9 files changed, 25 insertions, 33 deletions
diff --git a/Eigen/src/Array/Array.h b/Eigen/src/Array/Array.h index 8d5fb66a6..e9fabcc73 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> > Base; + typedef DenseStorageBase<Array> Base; EIGEN_DENSE_PUBLIC_INTERFACE(Array) enum { Options = _Options }; diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index f339a301d..c02e45074 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -57,8 +57,8 @@ * * \sa DenseBase::block(int,int,int,int), DenseBase::block(int,int), class VectorBlock */ -template<typename XprType, int BlockRows, int BlockCols, int _DirectAccessStatus> -struct ei_traits<Block<XprType, BlockRows, BlockCols, _DirectAccessStatus> > : ei_traits<XprType> +template<typename XprType, int BlockRows, int BlockCols, bool HasDirectAccess> +struct ei_traits<Block<XprType, BlockRows, BlockCols, HasDirectAccess> > : ei_traits<XprType> { typedef typename ei_traits<XprType>::Scalar Scalar; typedef typename ei_traits<XprType>::StorageKind StorageKind; @@ -99,12 +99,12 @@ struct ei_traits<Block<XprType, BlockRows, BlockCols, _DirectAccessStatus> > : e }; }; -template<typename XprType, int BlockRows, int BlockCols, int _DirectAccessStatus> class Block - : public ei_dense_xpr_base<Block<XprType, BlockRows, BlockCols, _DirectAccessStatus> >::type +template<typename XprType, int BlockRows, int BlockCols, bool HasDirectAccess> class Block + : public ei_dense_xpr_base<Block<XprType, BlockRows, BlockCols, HasDirectAccess> >::type { public: - typedef typename XprType::template MakeBase< Block<XprType, BlockRows, BlockCols, _DirectAccessStatus> >::Type Base; + typedef typename XprType::template MakeBase<Block>::Type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Block) class InnerIterator; @@ -230,8 +230,8 @@ template<typename XprType, int BlockRows, int BlockCols, int _DirectAccessStatus /** \internal */ template<typename XprType, int BlockRows, int BlockCols> -class Block<XprType,BlockRows,BlockCols,HasDirectAccess> - : public MapBase<Block<XprType, BlockRows, BlockCols,HasDirectAccess> > +class Block<XprType,BlockRows,BlockCols,true> + : public MapBase<Block<XprType, BlockRows, BlockCols,true> > { public: diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index e93518dae..200d3087c 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com> +// Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1@gmail.com> // Copyright (C) 2008-2010 Gael Guennebaud <g.gael@free.fr> // // Eigen is free software; you can redistribute it and/or @@ -26,12 +26,7 @@ #ifndef EIGEN_DENSEBASE_H #define EIGEN_DENSEBASE_H -template<typename Derived> struct ei_has_direct_access -{ - enum { ret = (ei_traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 }; -}; - -template<typename Derived, bool _HasDirectAccess = ei_has_direct_access<Derived>::ret> +template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret> struct ei_inner_stride_at_compile_time { enum { ret = ei_traits<Derived>::InnerStrideAtCompileTime }; @@ -43,7 +38,7 @@ struct ei_inner_stride_at_compile_time<Derived, false> enum { ret = 0 }; }; -template<typename Derived, bool _HasDirectAccess = ei_has_direct_access<Derived>::ret> +template<typename Derived, bool HasDirectAccess = ei_has_direct_access<Derived>::ret> struct ei_outer_stride_at_compile_time { enum { ret = ei_traits<Derived>::OuterStrideAtCompileTime }; diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 76547f9e2..c61a3f3f5 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -136,7 +136,7 @@ class Matrix /** \brief Base class typedef. * \sa DenseStorageBase */ - typedef DenseStorageBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > Base; + typedef DenseStorageBase<Matrix> Base; enum { Options = _Options }; diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 3e6fbf065..791fddda9 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -285,7 +285,7 @@ class GeneralProduct<Lhs, Rhs, GemvProduct> { ei_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols()); ei_gemv_selector<Side,(int(MatrixType::Flags)&RowMajorBit) ? RowMajor : ColMajor, - bool(ei_blas_traits<MatrixType>::ActualAccess)>::run(*this, dst, alpha); + bool(ei_blas_traits<MatrixType>::HasUsableDirectAccess)>::run(*this, dst, alpha); } }; diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index c786b1b64..6cb86426a 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -87,7 +87,7 @@ template<typename MatrixType> class Transpose const typename MatrixType::Nested m_matrix; }; -template<typename MatrixType, bool _HasDirectAccess = ei_has_direct_access<MatrixType>::ret> +template<typename MatrixType, bool HasDirectAccess = ei_has_direct_access<MatrixType>::ret> struct ei_TransposeImpl_base { typedef typename ei_dense_xpr_base<Transpose<MatrixType> >::type type; diff --git a/Eigen/src/Core/util/BlasUtil.h b/Eigen/src/Core/util/BlasUtil.h index 43c49670b..0fe6d2911 100644 --- a/Eigen/src/Core/util/BlasUtil.h +++ b/Eigen/src/Core/util/BlasUtil.h @@ -158,14 +158,14 @@ template<typename XprType> struct ei_blas_traits IsComplex = NumTraits<Scalar>::IsComplex, IsTransposed = false, NeedToConjugate = false, - ActualAccess = ( (int(XprType::Flags)&DirectAccessBit) + HasUsableDirectAccess = ( (int(XprType::Flags)&DirectAccessBit) && ( /* Uncomment this when the low-level matrix-vector product functions support strided vectors bool(XprType::IsVectorAtCompileTime) || */ int(ei_inner_stride_at_compile_time<XprType>::ret) == 1) - ) ? HasDirectAccess : NoDirectAccess + ) ? 1 : 0 }; - typedef typename ei_meta_if<int(ActualAccess)==HasDirectAccess, + typedef typename ei_meta_if<bool(HasUsableDirectAccess), ExtractType, typename _ExtractType::PlainObject >::ret DirectLinearAccessType; @@ -226,7 +226,7 @@ struct ei_blas_traits<Transpose<NestedXpr> > typedef Transpose<NestedXpr> XprType; typedef Transpose<typename Base::_ExtractType> ExtractType; typedef Transpose<typename Base::_ExtractType> _ExtractType; - typedef typename ei_meta_if<int(Base::ActualAccess)==HasDirectAccess, + typedef typename ei_meta_if<bool(Base::HasUsableDirectAccess), ExtractType, typename ExtractType::PlainObject >::ret DirectLinearAccessType; @@ -237,7 +237,7 @@ struct ei_blas_traits<Transpose<NestedXpr> > static inline Scalar extractScalarFactor(const XprType& x) { return Base::extractScalarFactor(x.nestedExpression()); } }; -template<typename T, int Access=ei_blas_traits<T>::ActualAccess> +template<typename T, bool HasUsableDirectAccess=ei_blas_traits<T>::HasUsableDirectAccess> struct ei_extract_data_selector { static const typename T::Scalar* run(const T& m) { @@ -246,7 +246,7 @@ struct ei_extract_data_selector { }; template<typename T> -struct ei_extract_data_selector<T,NoDirectAccess> { +struct ei_extract_data_selector<T,false> { static typename T::Scalar* run(const T&) { return 0; } }; diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h index 023ef3852..a586f2a5d 100644 --- a/Eigen/src/Core/util/Constants.h +++ b/Eigen/src/Core/util/Constants.h @@ -241,9 +241,7 @@ namespace { enum { IsDense = 0, - IsSparse, - NoDirectAccess = 0, - HasDirectAccess = DirectAccessBit + IsSparse }; enum TransformTraits { diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index faee3be8e..e384ba2df 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -49,17 +49,16 @@ template<typename ExpressionType> class NestByValue; template<typename ExpressionType> class ForceAlignedAccess; template<typename ExpressionType> class SwapWrapper; -// MSVC has a big bug: when the expression ei_traits<MatrixType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess +// MSVC has a big bug: when the expression ei_traits<MatrixType>::Flags&DirectAccessBit ? 1 : 0 // is used as default template parameter value here, it gets mis-evaluated as just ei_traits<MatrixType>::Flags // Moreover, adding brackets tends to give compilation errors with MSVC. // Solution: defer that to a helper struct. -template<typename XprType> -struct ei_block_direct_access_status +template<typename Derived> struct ei_has_direct_access { - enum { ret = ei_traits<XprType>::Flags&DirectAccessBit ? HasDirectAccess : NoDirectAccess }; + enum { ret = (ei_traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 }; }; template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, - int _DirectAccessStatus = ei_block_direct_access_status<XprType>::ret> class Block; + bool HasDirectAccess = ei_has_direct_access<XprType>::ret> class Block; template<typename MatrixType, int Size=Dynamic> class VectorBlock; template<typename MatrixType> class Transpose; |