Revert "Adds EIGEN_CONSTEXPR and EIGEN_NOEXCEPT to rows(), cols(), innerStride(), outerStride(), and size()"

This reverts commit 6cbb3038ac48cb5fe17eba4dfbf26e3e798041f1 because it
breaks clang-10 builds on x86 and aarch64 when C++11 is enabled.
This commit is contained in:
David Tellenbach 2021-03-05 13:16:43 +01:00
parent 6cbb3038ac
commit 5f0b4a4010
60 changed files with 846 additions and 856 deletions

View File

@ -246,8 +246,8 @@ template<typename _MatrixType, int _UpLo> class LDLT
*/ */
const LDLT& adjoint() const { return *this; }; const LDLT& adjoint() const { return *this; };
EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.cols(); }
/** \brief Reports whether previous computation was successful. /** \brief Reports whether previous computation was successful.
* *

View File

@ -199,10 +199,10 @@ template<typename _MatrixType, int _UpLo> class LLT
* This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as:
* \code x = decomposition.adjoint().solve(b) \endcode * \code x = decomposition.adjoint().solve(b) \endcode
*/ */
const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; }; const LLT& adjoint() const { return *this; };
inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } inline Index rows() const { return m_matrix.rows(); }
inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } inline Index cols() const { return m_matrix.cols(); }
template<typename VectorType> template<typename VectorType>
LLT & rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); LLT & rankUpdate(const VectorType& vec, const RealScalar& sigma = 1);

View File

@ -117,7 +117,7 @@ class Array
{ {
return Base::_set(other); return Base::_set(other);
} }
/** Default constructor. /** Default constructor.
* *
* For fixed-size matrices, does nothing. * For fixed-size matrices, does nothing.
@ -177,24 +177,24 @@ class Array
: Base(a0, a1, a2, a3, args...) {} : Base(a0, a1, a2, a3, args...) {}
/** \brief Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 /** \brief Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11
* *
* In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients:
* *
* Example: \include Array_initializer_list_23_cxx11.cpp * Example: \include Array_initializer_list_23_cxx11.cpp
* Output: \verbinclude Array_initializer_list_23_cxx11.out * Output: \verbinclude Array_initializer_list_23_cxx11.out
* *
* Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered.
* *
* In the case of a compile-time column 1D array, implicit transposition from a single row is allowed. * In the case of a compile-time column 1D array, implicit transposition from a single row is allowed.
* Therefore <code> Array<int,Dynamic,1>{{1,2,3,4,5}}</code> is legal and the more verbose syntax * Therefore <code> Array<int,Dynamic,1>{{1,2,3,4,5}}</code> is legal and the more verbose syntax
* <code>Array<int,Dynamic,1>{{1},{2},{3},{4},{5}}</code> can be avoided: * <code>Array<int,Dynamic,1>{{1},{2},{3},{4},{5}}</code> can be avoided:
* *
* Example: \include Array_initializer_list_vector_cxx11.cpp * Example: \include Array_initializer_list_vector_cxx11.cpp
* Output: \verbinclude Array_initializer_list_vector_cxx11.out * Output: \verbinclude Array_initializer_list_vector_cxx11.out
* *
* In the case of fixed-sized arrays, the initializer list sizes must exactly match the array sizes, * In the case of fixed-sized arrays, the initializer list sizes must exactly match the array sizes,
* and implicit transposition is allowed for compile-time 1D arrays only. * and implicit transposition is allowed for compile-time 1D arrays only.
* *
* \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)
*/ */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
@ -241,7 +241,7 @@ class Array
/** constructs an initialized 2D vector with given coefficients /** constructs an initialized 2D vector with given coefficients
* \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */
Array(const Scalar& val0, const Scalar& val1); Array(const Scalar& val0, const Scalar& val1);
#endif // end EIGEN_PARSED_BY_DOXYGEN #endif // end EIGEN_PARSED_BY_DOXYGEN
/** constructs an initialized 3D vector with given coefficients /** constructs an initialized 3D vector with given coefficients
* \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)
@ -288,10 +288,8 @@ class Array
: Base(other.derived()) : Base(other.derived())
{ } { }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index innerStride() const { return 1; }
inline Index innerStride() const EIGEN_NOEXCEPT{ return 1; } EIGEN_DEVICE_FUNC inline Index outerStride() const { return this->innerSize(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); }
#ifdef EIGEN_ARRAY_PLUGIN #ifdef EIGEN_ARRAY_PLUGIN
#include EIGEN_ARRAY_PLUGIN #include EIGEN_ARRAY_PLUGIN
@ -324,7 +322,7 @@ class Array
* template parameter, i.e.: * template parameter, i.e.:
* - `ArrayRowsCols<Type>` where `Rows` and `Cols` can be \c 2,\c 3,\c 4, or \c X for fixed or dynamic size. * - `ArrayRowsCols<Type>` where `Rows` and `Cols` can be \c 2,\c 3,\c 4, or \c X for fixed or dynamic size.
* - `ArraySize<Type>` where `Size` can be \c 2,\c 3,\c 4 or \c X for fixed or dynamic size 1D arrays. * - `ArraySize<Type>` where `Size` can be \c 2,\c 3,\c 4 or \c X for fixed or dynamic size 1D arrays.
* *
* \sa class Array * \sa class Array
*/ */
@ -369,7 +367,7 @@ using Array##SizeSuffix##SizeSuffix = Array<Type, Size, Size>; \
/** \ingroup arraytypedefs */ \ /** \ingroup arraytypedefs */ \
/** \brief \cpp11 */ \ /** \brief \cpp11 */ \
template <typename Type> \ template <typename Type> \
using Array##SizeSuffix = Array<Type, Size, 1>; using Array##SizeSuffix = Array<Type, Size, 1>;
#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Size) \ #define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Size) \
/** \ingroup arraytypedefs */ \ /** \ingroup arraytypedefs */ \
@ -393,7 +391,7 @@ EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(4)
#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS #undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS
#endif // EIGEN_HAS_CXX11 #endif // EIGEN_HAS_CXX11
#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ #define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \
using Eigen::Matrix##SizeSuffix##TypeSuffix; \ using Eigen::Matrix##SizeSuffix##TypeSuffix; \
using Eigen::Vector##SizeSuffix##TypeSuffix; \ using Eigen::Vector##SizeSuffix##TypeSuffix; \

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_ARRAYWRAPPER_H #ifndef EIGEN_ARRAYWRAPPER_H
#define EIGEN_ARRAYWRAPPER_H #define EIGEN_ARRAYWRAPPER_H
namespace Eigen { namespace Eigen {
/** \class ArrayWrapper /** \class ArrayWrapper
* \ingroup Core_Module * \ingroup Core_Module
@ -60,14 +60,14 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } inline Index rows() const { return m_expression.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } inline Index cols() const { return m_expression.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } inline Index outerStride() const { return m_expression.outerStride(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } inline Index innerStride() const { return m_expression.innerStride(); }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
@ -91,8 +91,8 @@ class ArrayWrapper : public ArrayBase<ArrayWrapper<ExpressionType> >
inline void evalTo(Dest& dst) const { dst = m_expression; } inline void evalTo(Dest& dst) const { dst = m_expression; }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
const typename internal::remove_all<NestedExpressionType>::type& const typename internal::remove_all<NestedExpressionType>::type&
nestedExpression() const nestedExpression() const
{ {
return m_expression; return m_expression;
} }
@ -158,14 +158,14 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {} explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } inline Index rows() const { return m_expression.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } inline Index cols() const { return m_expression.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } inline Index outerStride() const { return m_expression.outerStride(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } inline Index innerStride() const { return m_expression.innerStride(); }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); }
@ -185,8 +185,8 @@ class MatrixWrapper : public MatrixBase<MatrixWrapper<ExpressionType> >
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
const typename internal::remove_all<NestedExpressionType>::type& const typename internal::remove_all<NestedExpressionType>::type&
nestedExpression() const nestedExpression() const
{ {
return m_expression; return m_expression;
} }

View File

@ -638,15 +638,15 @@ public:
#endif #endif
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { return m_dstExpr.size(); } EIGEN_DEVICE_FUNC Index size() const { return m_dstExpr.size(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const EIGEN_NOEXCEPT { return m_dstExpr.innerSize(); } EIGEN_DEVICE_FUNC Index innerSize() const { return m_dstExpr.innerSize(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const EIGEN_NOEXCEPT { return m_dstExpr.outerSize(); } EIGEN_DEVICE_FUNC Index outerSize() const { return m_dstExpr.outerSize(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dstExpr.rows(); } EIGEN_DEVICE_FUNC Index rows() const { return m_dstExpr.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_dstExpr.cols(); } EIGEN_DEVICE_FUNC Index cols() const { return m_dstExpr.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT { return m_dstExpr.outerStride(); } EIGEN_DEVICE_FUNC Index outerStride() const { return m_dstExpr.outerStride(); }
EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() EIGEN_NOEXCEPT { return m_dst; } EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() { return m_dst; }
EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const EIGEN_NOEXCEPT { return m_src; } EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const { return m_src; }
/// Assign src(row,col) to dst(row,col) through the assignment functor. /// Assign src(row,col) to dst(row,col) through the assignment functor.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col) EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col)

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_BANDMATRIX_H #ifndef EIGEN_BANDMATRIX_H
#define EIGEN_BANDMATRIX_H #define EIGEN_BANDMATRIX_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
@ -45,7 +45,7 @@ class BandMatrixBase : public EigenBase<Derived>
}; };
public: public:
using Base::derived; using Base::derived;
using Base::rows; using Base::rows;
using Base::cols; using Base::cols;
@ -55,10 +55,10 @@ class BandMatrixBase : public EigenBase<Derived>
/** \returns the number of sub diagonals */ /** \returns the number of sub diagonals */
inline Index subs() const { return derived().subs(); } inline Index subs() const { return derived().subs(); }
/** \returns an expression of the underlying coefficient matrix */ /** \returns an expression of the underlying coefficient matrix */
inline const CoefficientsType& coeffs() const { return derived().coeffs(); } inline const CoefficientsType& coeffs() const { return derived().coeffs(); }
/** \returns an expression of the underlying coefficient matrix */ /** \returns an expression of the underlying coefficient matrix */
inline CoefficientsType& coeffs() { return derived().coeffs(); } inline CoefficientsType& coeffs() { return derived().coeffs(); }
@ -130,7 +130,7 @@ class BandMatrixBase : public EigenBase<Derived>
eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers()));
return Block<const CoefficientsType,1,Dynamic>(coeffs(), supers()-i, std::max<Index>(0,i), 1, diagonalLength(i)); return Block<const CoefficientsType,1,Dynamic>(coeffs(), supers()-i, std::max<Index>(0,i), 1, diagonalLength(i));
} }
template<typename Dest> inline void evalTo(Dest& dst) const template<typename Dest> inline void evalTo(Dest& dst) const
{ {
dst.resize(rows(),cols()); dst.resize(rows(),cols());
@ -211,16 +211,16 @@ class BandMatrix : public BandMatrixBase<BandMatrix<_Scalar,Rows,Cols,Supers,Sub
} }
/** \returns the number of columns */ /** \returns the number of columns */
inline EIGEN_CONSTEXPR Index rows() const { return m_rows.value(); } inline Index rows() const { return m_rows.value(); }
/** \returns the number of rows */ /** \returns the number of rows */
inline EIGEN_CONSTEXPR Index cols() const { return m_coeffs.cols(); } inline Index cols() const { return m_coeffs.cols(); }
/** \returns the number of super diagonals */ /** \returns the number of super diagonals */
inline EIGEN_CONSTEXPR Index supers() const { return m_supers.value(); } inline Index supers() const { return m_supers.value(); }
/** \returns the number of sub diagonals */ /** \returns the number of sub diagonals */
inline EIGEN_CONSTEXPR Index subs() const { return m_subs.value(); } inline Index subs() const { return m_subs.value(); }
inline const CoefficientsType& coeffs() const { return m_coeffs; } inline const CoefficientsType& coeffs() const { return m_coeffs; }
inline CoefficientsType& coeffs() { return m_coeffs; } inline CoefficientsType& coeffs() { return m_coeffs; }
@ -275,16 +275,16 @@ class BandMatrixWrapper : public BandMatrixBase<BandMatrixWrapper<_CoefficientsT
} }
/** \returns the number of columns */ /** \returns the number of columns */
inline EIGEN_CONSTEXPR Index rows() const { return m_rows.value(); } inline Index rows() const { return m_rows.value(); }
/** \returns the number of rows */ /** \returns the number of rows */
inline EIGEN_CONSTEXPR Index cols() const { return m_coeffs.cols(); } inline Index cols() const { return m_coeffs.cols(); }
/** \returns the number of super diagonals */ /** \returns the number of super diagonals */
inline EIGEN_CONSTEXPR Index supers() const { return m_supers.value(); } inline Index supers() const { return m_supers.value(); }
/** \returns the number of sub diagonals */ /** \returns the number of sub diagonals */
inline EIGEN_CONSTEXPR Index subs() const { return m_subs.value(); } inline Index subs() const { return m_subs.value(); }
inline const CoefficientsType& coeffs() const { return m_coeffs; } inline const CoefficientsType& coeffs() const { return m_coeffs; }

View File

@ -11,7 +11,7 @@
#ifndef EIGEN_BLOCK_H #ifndef EIGEN_BLOCK_H
#define EIGEN_BLOCK_H #define EIGEN_BLOCK_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel> template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
@ -52,7 +52,7 @@ struct traits<Block<XprType, BlockRows, BlockCols, InnerPanel> > : traits<XprTyp
FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0,
Flags = (traits<XprType>::Flags & (DirectAccessBit | (InnerPanel?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit, Flags = (traits<XprType>::Flags & (DirectAccessBit | (InnerPanel?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit,
// FIXME DirectAccessBit should not be handled by expressions // FIXME DirectAccessBit should not be handled by expressions
// //
// Alignment is needed by MapBase's assertions // Alignment is needed by MapBase's assertions
// We can sefely set it to false here. Internal alignment errors will be detected by an eigen_internal_assert in the respective evaluator // We can sefely set it to false here. Internal alignment errors will be detected by an eigen_internal_assert in the respective evaluator
Alignment = 0 Alignment = 0
@ -61,7 +61,7 @@ struct traits<Block<XprType, BlockRows, BlockCols, InnerPanel> > : traits<XprTyp
template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, bool InnerPanel = false, template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, bool InnerPanel = false,
bool HasDirectAccess = internal::has_direct_access<XprType>::ret> class BlockImpl_dense; bool HasDirectAccess = internal::has_direct_access<XprType>::ret> class BlockImpl_dense;
} // end namespace internal } // end namespace internal
template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, typename StorageKind> class BlockImpl; template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, typename StorageKind> class BlockImpl;
@ -109,9 +109,9 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel> class
typedef Impl Base; typedef Impl Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(Block) EIGEN_GENERIC_PUBLIC_INTERFACE(Block)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
typedef typename internal::remove_all<XprType>::type NestedExpression; typedef typename internal::remove_all<XprType>::type NestedExpression;
/** Column or Row constructor /** Column or Row constructor
*/ */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
@ -147,7 +147,7 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel> class
&& startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols); && startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols);
} }
}; };
// The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense // The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense
// that must be specialized for direct and non-direct access... // that must be specialized for direct and non-direct access...
template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel> template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
@ -296,23 +296,23 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel, bool H
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const typename internal::remove_all<XprTypeNested>::type& nestedExpression() const const typename internal::remove_all<XprTypeNested>::type& nestedExpression() const
{ {
return m_xpr; return m_xpr;
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
XprType& nestedExpression() { return m_xpr; } XprType& nestedExpression() { return m_xpr; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
StorageIndex startRow() const EIGEN_NOEXCEPT StorageIndex startRow() const
{ {
return m_startRow.value(); return m_startRow.value();
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
StorageIndex startCol() const EIGEN_NOEXCEPT StorageIndex startCol() const
{ {
return m_startCol.value(); return m_startCol.value();
} }
protected: protected:
@ -344,7 +344,7 @@ class BlockImpl_dense<XprType,BlockRows,BlockCols, InnerPanel,true>
*/ */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
BlockImpl_dense(XprType& xpr, Index i) BlockImpl_dense(XprType& xpr, Index i)
: Base(xpr.data() + i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor)) : Base(xpr.data() + i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor))
|| ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride()), || ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride()),
BlockRows==1 ? 1 : xpr.rows(), BlockRows==1 ? 1 : xpr.rows(),
BlockCols==1 ? 1 : xpr.cols()), BlockCols==1 ? 1 : xpr.cols()),
@ -378,17 +378,17 @@ class BlockImpl_dense<XprType,BlockRows,BlockCols, InnerPanel,true>
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const typename internal::remove_all<XprTypeNested>::type& nestedExpression() const EIGEN_NOEXCEPT const typename internal::remove_all<XprTypeNested>::type& nestedExpression() const
{ {
return m_xpr; return m_xpr;
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
XprType& nestedExpression() { return m_xpr; } XprType& nestedExpression() { return m_xpr; }
/** \sa MapBase::innerStride() */ /** \sa MapBase::innerStride() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index innerStride() const EIGEN_NOEXCEPT Index innerStride() const
{ {
return internal::traits<BlockType>::HasSameStorageOrderAsXprType return internal::traits<BlockType>::HasSameStorageOrderAsXprType
? m_xpr.innerStride() ? m_xpr.innerStride()
@ -396,19 +396,23 @@ class BlockImpl_dense<XprType,BlockRows,BlockCols, InnerPanel,true>
} }
/** \sa MapBase::outerStride() */ /** \sa MapBase::outerStride() */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index outerStride() const EIGEN_NOEXCEPT Index outerStride() const
{ {
return internal::traits<BlockType>::HasSameStorageOrderAsXprType return m_outerStride;
? m_xpr.outerStride()
: m_xpr.innerStride();
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
StorageIndex startRow() const EIGEN_NOEXCEPT { return m_startRow.value(); } StorageIndex startRow() const
{
return m_startRow.value();
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
StorageIndex startCol() const EIGEN_NOEXCEPT { return m_startCol.value(); } StorageIndex startCol() const
{
return m_startCol.value();
}
#ifndef __SUNPRO_CC #ifndef __SUNPRO_CC
// FIXME sunstudio is not friendly with the above friend... // FIXME sunstudio is not friendly with the above friend...

View File

@ -14,7 +14,7 @@
#define EIGEN_COREEVALUATORS_H #define EIGEN_COREEVALUATORS_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
// This class returns the evaluator kind from the expression storage kind. // This class returns the evaluator kind from the expression storage kind.
@ -63,8 +63,8 @@ template< typename T,
template< typename T, template< typename T,
typename Kind = typename evaluator_traits<typename T::NestedExpression>::Kind, typename Kind = typename evaluator_traits<typename T::NestedExpression>::Kind,
typename Scalar = typename T::Scalar> struct unary_evaluator; typename Scalar = typename T::Scalar> struct unary_evaluator;
// evaluator_traits<T> contains traits for evaluator<T> // evaluator_traits<T> contains traits for evaluator<T>
template<typename T> template<typename T>
struct evaluator_traits_base struct evaluator_traits_base
@ -111,7 +111,7 @@ struct evaluator_base
{ {
// TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices. // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices.
typedef traits<ExpressionType> ExpressionTraits; typedef traits<ExpressionType> ExpressionTraits;
enum { enum {
Alignment = 0 Alignment = 0
}; };
@ -143,8 +143,8 @@ public:
#endif #endif
eigen_internal_assert(outerStride==OuterStride); eigen_internal_assert(outerStride==OuterStride);
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index outerStride() const EIGEN_NOEXCEPT { return OuterStride; } Index outerStride() const { return OuterStride; }
const Scalar *data; const Scalar *data;
}; };
@ -172,7 +172,7 @@ struct evaluator<PlainObjectBase<Derived> >
IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime, IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime,
RowsAtCompileTime = PlainObjectType::RowsAtCompileTime, RowsAtCompileTime = PlainObjectType::RowsAtCompileTime,
ColsAtCompileTime = PlainObjectType::ColsAtCompileTime, ColsAtCompileTime = PlainObjectType::ColsAtCompileTime,
CoeffReadCost = NumTraits<Scalar>::ReadCost, CoeffReadCost = NumTraits<Scalar>::ReadCost,
Flags = traits<Derived>::EvaluatorFlags, Flags = traits<Derived>::EvaluatorFlags,
Alignment = traits<Derived>::Alignment Alignment = traits<Derived>::Alignment
@ -274,13 +274,13 @@ struct evaluator<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
: evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > > : evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > >
{ {
typedef Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> XprType; typedef Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> XprType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
evaluator() {} evaluator() {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit evaluator(const XprType& m) explicit evaluator(const XprType& m)
: evaluator<PlainObjectBase<XprType> >(m) : evaluator<PlainObjectBase<XprType> >(m)
{ } { }
}; };
@ -292,10 +292,10 @@ struct evaluator<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
evaluator() {} evaluator() {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit evaluator(const XprType& m) explicit evaluator(const XprType& m)
: evaluator<PlainObjectBase<XprType> >(m) : evaluator<PlainObjectBase<XprType> >(m)
{ } { }
}; };
@ -306,9 +306,9 @@ struct unary_evaluator<Transpose<ArgType>, IndexBased>
: evaluator_base<Transpose<ArgType> > : evaluator_base<Transpose<ArgType> >
{ {
typedef Transpose<ArgType> XprType; typedef Transpose<ArgType> XprType;
enum { enum {
CoeffReadCost = evaluator<ArgType>::CoeffReadCost, CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
Flags = evaluator<ArgType>::Flags ^ RowMajorBit, Flags = evaluator<ArgType>::Flags ^ RowMajorBit,
Alignment = evaluator<ArgType>::Alignment Alignment = evaluator<ArgType>::Alignment
}; };
@ -499,10 +499,10 @@ struct evaluator<CwiseNullaryOp<NullaryOp,PlainObjectType> >
{ {
typedef CwiseNullaryOp<NullaryOp,PlainObjectType> XprType; typedef CwiseNullaryOp<NullaryOp,PlainObjectType> XprType;
typedef typename internal::remove_all<PlainObjectType>::type PlainObjectTypeCleaned; typedef typename internal::remove_all<PlainObjectType>::type PlainObjectTypeCleaned;
enum { enum {
CoeffReadCost = internal::functor_traits<NullaryOp>::Cost, CoeffReadCost = internal::functor_traits<NullaryOp>::Cost,
Flags = (evaluator<PlainObjectTypeCleaned>::Flags Flags = (evaluator<PlainObjectTypeCleaned>::Flags
& ( HereditaryBits & ( HereditaryBits
| (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0) | (functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0)
@ -559,10 +559,10 @@ struct unary_evaluator<CwiseUnaryOp<UnaryOp, ArgType>, IndexBased >
: evaluator_base<CwiseUnaryOp<UnaryOp, ArgType> > : evaluator_base<CwiseUnaryOp<UnaryOp, ArgType> >
{ {
typedef CwiseUnaryOp<UnaryOp, ArgType> XprType; typedef CwiseUnaryOp<UnaryOp, ArgType> XprType;
enum { enum {
CoeffReadCost = evaluator<ArgType>::CoeffReadCost + functor_traits<UnaryOp>::Cost, CoeffReadCost = evaluator<ArgType>::CoeffReadCost + functor_traits<UnaryOp>::Cost,
Flags = evaluator<ArgType>::Flags Flags = evaluator<ArgType>::Flags
& (HereditaryBits | LinearAccessBit | (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)), & (HereditaryBits | LinearAccessBit | (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
Alignment = evaluator<ArgType>::Alignment Alignment = evaluator<ArgType>::Alignment
@ -628,7 +628,7 @@ struct evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> >
{ {
typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType; typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType;
typedef ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > Base; typedef ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > Base;
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {}
}; };
@ -637,10 +637,10 @@ struct ternary_evaluator<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3>, IndexBased
: evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> > : evaluator_base<CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> >
{ {
typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType; typedef CwiseTernaryOp<TernaryOp, Arg1, Arg2, Arg3> XprType;
enum { enum {
CoeffReadCost = evaluator<Arg1>::CoeffReadCost + evaluator<Arg2>::CoeffReadCost + evaluator<Arg3>::CoeffReadCost + functor_traits<TernaryOp>::Cost, CoeffReadCost = evaluator<Arg1>::CoeffReadCost + evaluator<Arg2>::CoeffReadCost + evaluator<Arg3>::CoeffReadCost + functor_traits<TernaryOp>::Cost,
Arg1Flags = evaluator<Arg1>::Flags, Arg1Flags = evaluator<Arg1>::Flags,
Arg2Flags = evaluator<Arg2>::Flags, Arg2Flags = evaluator<Arg2>::Flags,
Arg3Flags = evaluator<Arg3>::Flags, Arg3Flags = evaluator<Arg3>::Flags,
@ -723,7 +723,7 @@ struct evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
{ {
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType; typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
typedef binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > Base; typedef binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > Base;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit evaluator(const XprType& xpr) : Base(xpr) {} explicit evaluator(const XprType& xpr) : Base(xpr) {}
}; };
@ -733,10 +733,10 @@ struct binary_evaluator<CwiseBinaryOp<BinaryOp, Lhs, Rhs>, IndexBased, IndexBase
: evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > : evaluator_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
{ {
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType; typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> XprType;
enum { enum {
CoeffReadCost = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + functor_traits<BinaryOp>::Cost, CoeffReadCost = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + functor_traits<BinaryOp>::Cost,
LhsFlags = evaluator<Lhs>::Flags, LhsFlags = evaluator<Lhs>::Flags,
RhsFlags = evaluator<Rhs>::Flags, RhsFlags = evaluator<Rhs>::Flags,
SameType = is_same<typename Lhs::Scalar,typename Rhs::Scalar>::value, SameType = is_same<typename Lhs::Scalar,typename Rhs::Scalar>::value,
@ -813,12 +813,12 @@ struct unary_evaluator<CwiseUnaryView<UnaryOp, ArgType>, IndexBased>
: evaluator_base<CwiseUnaryView<UnaryOp, ArgType> > : evaluator_base<CwiseUnaryView<UnaryOp, ArgType> >
{ {
typedef CwiseUnaryView<UnaryOp, ArgType> XprType; typedef CwiseUnaryView<UnaryOp, ArgType> XprType;
enum { enum {
CoeffReadCost = evaluator<ArgType>::CoeffReadCost + functor_traits<UnaryOp>::Cost, CoeffReadCost = evaluator<ArgType>::CoeffReadCost + functor_traits<UnaryOp>::Cost,
Flags = (evaluator<ArgType>::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)), Flags = (evaluator<ArgType>::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)),
Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost... Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost...
}; };
@ -884,7 +884,7 @@ struct mapbase_evaluator : evaluator_base<Derived>
typedef typename XprType::PointerType PointerType; typedef typename XprType::PointerType PointerType;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
enum { enum {
IsRowMajor = XprType::RowsAtCompileTime, IsRowMajor = XprType::RowsAtCompileTime,
ColsAtCompileTime = XprType::ColsAtCompileTime, ColsAtCompileTime = XprType::ColsAtCompileTime,
@ -956,21 +956,17 @@ struct mapbase_evaluator : evaluator_base<Derived>
internal::pstoret<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.value(), x); internal::pstoret<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.value(), x);
} }
protected: protected:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rowStride() const EIGEN_NOEXCEPT { Index rowStride() const { return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value(); }
return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value(); EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
} Index colStride() const { return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
Index colStride() const EIGEN_NOEXCEPT {
return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value();
}
PointerType m_data; PointerType m_data;
const internal::variable_if_dynamic<Index, XprType::InnerStrideAtCompileTime> m_innerStride; const internal::variable_if_dynamic<Index, XprType::InnerStrideAtCompileTime> m_innerStride;
const internal::variable_if_dynamic<Index, XprType::OuterStrideAtCompileTime> m_outerStride; const internal::variable_if_dynamic<Index, XprType::OuterStrideAtCompileTime> m_outerStride;
}; };
template<typename PlainObjectType, int MapOptions, typename StrideType> template<typename PlainObjectType, int MapOptions, typename StrideType>
struct evaluator<Map<PlainObjectType, MapOptions, StrideType> > struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
: public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType> : public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType>
{ {
@ -978,7 +974,7 @@ struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
// TODO: should check for smaller packet types once we can handle multi-sized packet types // TODO: should check for smaller packet types once we can handle multi-sized packet types
typedef typename packet_traits<Scalar>::type PacketScalar; typedef typename packet_traits<Scalar>::type PacketScalar;
enum { enum {
InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
? int(PlainObjectType::InnerStrideAtCompileTime) ? int(PlainObjectType::InnerStrideAtCompileTime)
@ -990,27 +986,27 @@ struct evaluator<Map<PlainObjectType, MapOptions, StrideType> >
HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
HasNoStride = HasNoInnerStride && HasNoOuterStride, HasNoStride = HasNoInnerStride && HasNoOuterStride,
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit), PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit),
LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit), LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit),
Flags = int( evaluator<PlainObjectType>::Flags) & (LinearAccessMask&PacketAccessMask), Flags = int( evaluator<PlainObjectType>::Flags) & (LinearAccessMask&PacketAccessMask),
Alignment = int(MapOptions)&int(AlignedMask) Alignment = int(MapOptions)&int(AlignedMask)
}; };
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map)
: mapbase_evaluator<XprType, PlainObjectType>(map) : mapbase_evaluator<XprType, PlainObjectType>(map)
{ } { }
}; };
// -------------------- Ref -------------------- // -------------------- Ref --------------------
template<typename PlainObjectType, int RefOptions, typename StrideType> template<typename PlainObjectType, int RefOptions, typename StrideType>
struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> > struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> >
: public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType> : public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType>
{ {
typedef Ref<PlainObjectType, RefOptions, StrideType> XprType; typedef Ref<PlainObjectType, RefOptions, StrideType> XprType;
enum { enum {
Flags = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Flags, Flags = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Flags,
Alignment = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Alignment Alignment = evaluator<Map<PlainObjectType, RefOptions, StrideType> >::Alignment
@ -1018,7 +1014,7 @@ struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit evaluator(const XprType& ref) explicit evaluator(const XprType& ref)
: mapbase_evaluator<XprType, PlainObjectType>(ref) : mapbase_evaluator<XprType, PlainObjectType>(ref)
{ } { }
}; };
@ -1026,8 +1022,8 @@ struct evaluator<Ref<PlainObjectType, RefOptions, StrideType> >
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel, template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel,
bool HasDirectAccess = internal::has_direct_access<ArgType>::ret> struct block_evaluator; bool HasDirectAccess = internal::has_direct_access<ArgType>::ret> struct block_evaluator;
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel> template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> > struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
: block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel> : block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel>
{ {
@ -1035,15 +1031,15 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
// TODO: should check for smaller packet types once we can handle multi-sized packet types // TODO: should check for smaller packet types once we can handle multi-sized packet types
typedef typename packet_traits<Scalar>::type PacketScalar; typedef typename packet_traits<Scalar>::type PacketScalar;
enum { enum {
CoeffReadCost = evaluator<ArgType>::CoeffReadCost, CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
RowsAtCompileTime = traits<XprType>::RowsAtCompileTime, RowsAtCompileTime = traits<XprType>::RowsAtCompileTime,
ColsAtCompileTime = traits<XprType>::ColsAtCompileTime, ColsAtCompileTime = traits<XprType>::ColsAtCompileTime,
MaxRowsAtCompileTime = traits<XprType>::MaxRowsAtCompileTime, MaxRowsAtCompileTime = traits<XprType>::MaxRowsAtCompileTime,
MaxColsAtCompileTime = traits<XprType>::MaxColsAtCompileTime, MaxColsAtCompileTime = traits<XprType>::MaxColsAtCompileTime,
ArgTypeIsRowMajor = (int(evaluator<ArgType>::Flags)&RowMajorBit) != 0, ArgTypeIsRowMajor = (int(evaluator<ArgType>::Flags)&RowMajorBit) != 0,
IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1 IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1
: (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0
@ -1057,14 +1053,14 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
? int(outer_stride_at_compile_time<ArgType>::ret) ? int(outer_stride_at_compile_time<ArgType>::ret)
: int(inner_stride_at_compile_time<ArgType>::ret), : int(inner_stride_at_compile_time<ArgType>::ret),
MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0, MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0,
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator<ArgType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0, FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator<ArgType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0,
FlagsRowMajorBit = XprType::Flags&RowMajorBit, FlagsRowMajorBit = XprType::Flags&RowMajorBit,
Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) | Flags0 = evaluator<ArgType>::Flags & ( (HereditaryBits & ~RowMajorBit) |
DirectAccessBit | DirectAccessBit |
MaskPacketAccessBit), MaskPacketAccessBit),
Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit, Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit,
PacketAlignment = unpacket_traits<PacketScalar>::alignment, PacketAlignment = unpacket_traits<PacketScalar>::alignment,
Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic)
&& (OuterStrideAtCompileTime!=0) && (OuterStrideAtCompileTime!=0)
@ -1088,7 +1084,7 @@ struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /*HasDirectAcc
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit block_evaluator(const XprType& block) explicit block_evaluator(const XprType& block)
: unary_evaluator<XprType>(block) : unary_evaluator<XprType>(block)
{} {}
}; };
@ -1100,12 +1096,12 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit unary_evaluator(const XprType& block) explicit unary_evaluator(const XprType& block)
: m_argImpl(block.nestedExpression()), : m_argImpl(block.nestedExpression()),
m_startRow(block.startRow()), m_startRow(block.startRow()),
m_startCol(block.startCol()), m_startCol(block.startCol()),
m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0) m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0)
{ } { }
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
@ -1113,13 +1109,13 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
RowsAtCompileTime = XprType::RowsAtCompileTime, RowsAtCompileTime = XprType::RowsAtCompileTime,
ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor)==int(ArgType::IsRowMajor)) && bool(evaluator<ArgType>::Flags&LinearAccessBit) ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor)==int(ArgType::IsRowMajor)) && bool(evaluator<ArgType>::Flags&LinearAccessBit)
}; };
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index row, Index col) const CoeffReturnType coeff(Index row, Index col) const
{ {
return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col); return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col);
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index index) const CoeffReturnType coeff(Index index) const
{ {
@ -1128,44 +1124,44 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Scalar& coeffRef(Index row, Index col) Scalar& coeffRef(Index row, Index col)
{ {
return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col); return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col);
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Scalar& coeffRef(Index index) Scalar& coeffRef(Index index)
{ {
return linear_coeffRef_impl(index, bool_constant<ForwardLinearAccess>()); return linear_coeffRef_impl(index, bool_constant<ForwardLinearAccess>());
} }
template<int LoadMode, typename PacketType> template<int LoadMode, typename PacketType>
EIGEN_STRONG_INLINE EIGEN_STRONG_INLINE
PacketType packet(Index row, Index col) const PacketType packet(Index row, Index col) const
{ {
return m_argImpl.template packet<LoadMode,PacketType>(m_startRow.value() + row, m_startCol.value() + col); return m_argImpl.template packet<LoadMode,PacketType>(m_startRow.value() + row, m_startCol.value() + col);
} }
template<int LoadMode, typename PacketType> template<int LoadMode, typename PacketType>
EIGEN_STRONG_INLINE EIGEN_STRONG_INLINE
PacketType packet(Index index) const PacketType packet(Index index) const
{ {
if (ForwardLinearAccess) if (ForwardLinearAccess)
return m_argImpl.template packet<LoadMode,PacketType>(m_linear_offset.value() + index); return m_argImpl.template packet<LoadMode,PacketType>(m_linear_offset.value() + index);
else else
return packet<LoadMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index, return packet<LoadMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0); RowsAtCompileTime == 1 ? index : 0);
} }
template<int StoreMode, typename PacketType> template<int StoreMode, typename PacketType>
EIGEN_STRONG_INLINE EIGEN_STRONG_INLINE
void writePacket(Index row, Index col, const PacketType& x) void writePacket(Index row, Index col, const PacketType& x)
{ {
return m_argImpl.template writePacket<StoreMode,PacketType>(m_startRow.value() + row, m_startCol.value() + col, x); return m_argImpl.template writePacket<StoreMode,PacketType>(m_startRow.value() + row, m_startCol.value() + col, x);
} }
template<int StoreMode, typename PacketType> template<int StoreMode, typename PacketType>
EIGEN_STRONG_INLINE EIGEN_STRONG_INLINE
void writePacket(Index index, const PacketType& x) void writePacket(Index index, const PacketType& x)
{ {
if (ForwardLinearAccess) if (ForwardLinearAccess)
return m_argImpl.template writePacket<StoreMode,PacketType>(m_linear_offset.value() + index, x); return m_argImpl.template writePacket<StoreMode,PacketType>(m_linear_offset.value() + index, x);
@ -1174,12 +1170,12 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
RowsAtCompileTime == 1 ? index : 0, RowsAtCompileTime == 1 ? index : 0,
x); x);
} }
protected: protected:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const CoeffReturnType linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const
{ {
return m_argImpl.coeff(m_linear_offset.value() + index); return m_argImpl.coeff(m_linear_offset.value() + index);
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const CoeffReturnType linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const
@ -1190,7 +1186,7 @@ protected:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Scalar& linear_coeffRef_impl(Index index, internal::true_type /* ForwardLinearAccess */) Scalar& linear_coeffRef_impl(Index index, internal::true_type /* ForwardLinearAccess */)
{ {
return m_argImpl.coeffRef(m_linear_offset.value() + index); return m_argImpl.coeffRef(m_linear_offset.value() + index);
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Scalar& linear_coeffRef_impl(Index index, internal::false_type /* not ForwardLinearAccess */) Scalar& linear_coeffRef_impl(Index index, internal::false_type /* not ForwardLinearAccess */)
@ -1204,10 +1200,10 @@ protected:
const variable_if_dynamic<Index, ForwardLinearAccess ? Dynamic : 0> m_linear_offset; const variable_if_dynamic<Index, ForwardLinearAccess ? Dynamic : 0> m_linear_offset;
}; };
// TODO: This evaluator does not actually use the child evaluator; // TODO: This evaluator does not actually use the child evaluator;
// all action is via the data() as returned by the Block expression. // all action is via the data() as returned by the Block expression.
template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel> template<typename ArgType, int BlockRows, int BlockCols, bool InnerPanel>
struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAccess */ true> struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAccess */ true>
: mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, : mapbase_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>,
typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject> typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject>
@ -1217,7 +1213,7 @@ struct block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel, /* HasDirectAc
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit block_evaluator(const XprType& block) explicit block_evaluator(const XprType& block)
: mapbase_evaluator<XprType, typename XprType::PlainObject>(block) : mapbase_evaluator<XprType, typename XprType::PlainObject>(block)
{ {
// TODO: for the 3.3 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime // TODO: for the 3.3 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime
eigen_assert(((internal::UIntPtr(block.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator<XprType>::Alignment)) == 0) && "data is not aligned"); eigen_assert(((internal::UIntPtr(block.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator<XprType>::Alignment)) == 0) && "data is not aligned");
@ -1240,7 +1236,7 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
evaluator<ElseMatrixType>::CoeffReadCost), evaluator<ElseMatrixType>::CoeffReadCost),
Flags = (unsigned int)evaluator<ThenMatrixType>::Flags & evaluator<ElseMatrixType>::Flags & HereditaryBits, Flags = (unsigned int)evaluator<ThenMatrixType>::Flags & evaluator<ElseMatrixType>::Flags & HereditaryBits,
Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<ThenMatrixType>::Alignment, evaluator<ElseMatrixType>::Alignment) Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<ThenMatrixType>::Alignment, evaluator<ElseMatrixType>::Alignment)
}; };
@ -1252,7 +1248,7 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
{ {
EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
} }
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
@ -1272,7 +1268,7 @@ struct evaluator<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
else else
return m_elseImpl.coeff(index); return m_elseImpl.coeff(index);
} }
protected: protected:
evaluator<ConditionMatrixType> m_conditionImpl; evaluator<ConditionMatrixType> m_conditionImpl;
evaluator<ThenMatrixType> m_thenImpl; evaluator<ThenMatrixType> m_thenImpl;
@ -1282,7 +1278,7 @@ protected:
// -------------------- Replicate -------------------- // -------------------- Replicate --------------------
template<typename ArgType, int RowFactor, int ColFactor> template<typename ArgType, int RowFactor, int ColFactor>
struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> > struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
: evaluator_base<Replicate<ArgType, RowFactor, ColFactor> > : evaluator_base<Replicate<ArgType, RowFactor, ColFactor> >
{ {
@ -1293,12 +1289,12 @@ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
}; };
typedef typename internal::nested_eval<ArgType,Factor>::type ArgTypeNested; typedef typename internal::nested_eval<ArgType,Factor>::type ArgTypeNested;
typedef typename internal::remove_all<ArgTypeNested>::type ArgTypeNestedCleaned; typedef typename internal::remove_all<ArgTypeNested>::type ArgTypeNestedCleaned;
enum { enum {
CoeffReadCost = evaluator<ArgTypeNestedCleaned>::CoeffReadCost, CoeffReadCost = evaluator<ArgTypeNestedCleaned>::CoeffReadCost,
LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0, LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0,
Flags = (evaluator<ArgTypeNestedCleaned>::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits<XprType>::Flags & RowMajorBit), Flags = (evaluator<ArgTypeNestedCleaned>::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits<XprType>::Flags & RowMajorBit),
Alignment = evaluator<ArgTypeNestedCleaned>::Alignment Alignment = evaluator<ArgTypeNestedCleaned>::Alignment
}; };
@ -1309,7 +1305,7 @@ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
m_rows(replicate.nestedExpression().rows()), m_rows(replicate.nestedExpression().rows()),
m_cols(replicate.nestedExpression().cols()) m_cols(replicate.nestedExpression().cols())
{} {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index row, Index col) const CoeffReturnType coeff(Index row, Index col) const
{ {
@ -1320,10 +1316,10 @@ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
const Index actual_col = internal::traits<XprType>::ColsAtCompileTime==1 ? 0 const Index actual_col = internal::traits<XprType>::ColsAtCompileTime==1 ? 0
: ColFactor==1 ? col : ColFactor==1 ? col
: col % m_cols.value(); : col % m_cols.value();
return m_argImpl.coeff(actual_row, actual_col); return m_argImpl.coeff(actual_row, actual_col);
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index index) const CoeffReturnType coeff(Index index) const
{ {
@ -1331,7 +1327,7 @@ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
const Index actual_index = internal::traits<XprType>::RowsAtCompileTime==1 const Index actual_index = internal::traits<XprType>::RowsAtCompileTime==1
? (ColFactor==1 ? index : index%m_cols.value()) ? (ColFactor==1 ? index : index%m_cols.value())
: (RowFactor==1 ? index : index%m_rows.value()); : (RowFactor==1 ? index : index%m_rows.value());
return m_argImpl.coeff(actual_index); return m_argImpl.coeff(actual_index);
} }
@ -1348,7 +1344,7 @@ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
return m_argImpl.template packet<LoadMode,PacketType>(actual_row, actual_col); return m_argImpl.template packet<LoadMode,PacketType>(actual_row, actual_col);
} }
template<int LoadMode, typename PacketType> template<int LoadMode, typename PacketType>
EIGEN_STRONG_INLINE EIGEN_STRONG_INLINE
PacketType packet(Index index) const PacketType packet(Index index) const
@ -1359,7 +1355,7 @@ struct unary_evaluator<Replicate<ArgType, RowFactor, ColFactor> >
return m_argImpl.template packet<LoadMode,PacketType>(actual_index); return m_argImpl.template packet<LoadMode,PacketType>(actual_index);
} }
protected: protected:
const ArgTypeNested m_arg; const ArgTypeNested m_arg;
evaluator<ArgTypeNestedCleaned> m_argImpl; evaluator<ArgTypeNestedCleaned> m_argImpl;
@ -1491,9 +1487,9 @@ struct unary_evaluator<Reverse<ArgType, Direction> >
ReversePacket = (Direction == BothDirections) ReversePacket = (Direction == BothDirections)
|| ((Direction == Vertical) && IsColMajor) || ((Direction == Vertical) && IsColMajor)
|| ((Direction == Horizontal) && IsRowMajor), || ((Direction == Horizontal) && IsRowMajor),
CoeffReadCost = evaluator<ArgType>::CoeffReadCost, CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
// let's enable LinearAccess only with vectorization because of the product overhead // let's enable LinearAccess only with vectorization because of the product overhead
// FIXME enable DirectAccess with negative strides? // FIXME enable DirectAccess with negative strides?
Flags0 = evaluator<ArgType>::Flags, Flags0 = evaluator<ArgType>::Flags,
@ -1502,7 +1498,7 @@ struct unary_evaluator<Reverse<ArgType, Direction> >
? LinearAccessBit : 0, ? LinearAccessBit : 0,
Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess), Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess),
Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f. Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f.
}; };
@ -1512,7 +1508,7 @@ struct unary_evaluator<Reverse<ArgType, Direction> >
m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1), m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1),
m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1)
{ } { }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index row, Index col) const CoeffReturnType coeff(Index row, Index col) const
{ {
@ -1587,7 +1583,7 @@ struct unary_evaluator<Reverse<ArgType, Direction> >
m_argImpl.template writePacket<LoadMode> m_argImpl.template writePacket<LoadMode>
(m_rows.value() * m_cols.value() - index - PacketSize, preverse(x)); (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x));
} }
protected: protected:
evaluator<ArgType> m_argImpl; evaluator<ArgType> m_argImpl;
@ -1605,12 +1601,12 @@ struct evaluator<Diagonal<ArgType, DiagIndex> >
: evaluator_base<Diagonal<ArgType, DiagIndex> > : evaluator_base<Diagonal<ArgType, DiagIndex> >
{ {
typedef Diagonal<ArgType, DiagIndex> XprType; typedef Diagonal<ArgType, DiagIndex> XprType;
enum { enum {
CoeffReadCost = evaluator<ArgType>::CoeffReadCost, CoeffReadCost = evaluator<ArgType>::CoeffReadCost,
Flags = (unsigned int)(evaluator<ArgType>::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit, Flags = (unsigned int)(evaluator<ArgType>::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit,
Alignment = 0 Alignment = 0
}; };
@ -1619,7 +1615,7 @@ struct evaluator<Diagonal<ArgType, DiagIndex> >
: m_argImpl(diagonal.nestedExpression()), : m_argImpl(diagonal.nestedExpression()),
m_index(diagonal.index()) m_index(diagonal.index())
{ } { }
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
@ -1652,10 +1648,8 @@ protected:
const internal::variable_if_dynamicindex<Index, XprType::DiagIndex> m_index; const internal::variable_if_dynamicindex<Index, XprType::DiagIndex> m_index;
private: private:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); }
Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; }
}; };
@ -1679,25 +1673,25 @@ class EvalToTemp
: public dense_xpr_base<EvalToTemp<ArgType> >::type : public dense_xpr_base<EvalToTemp<ArgType> >::type
{ {
public: public:
typedef typename dense_xpr_base<EvalToTemp>::type Base; typedef typename dense_xpr_base<EvalToTemp>::type Base;
EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp) EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp)
explicit EvalToTemp(const ArgType& arg) explicit EvalToTemp(const ArgType& arg)
: m_arg(arg) : m_arg(arg)
{ } { }
const ArgType& arg() const const ArgType& arg() const
{ {
return m_arg; return m_arg;
} }
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT Index rows() const
{ {
return m_arg.rows(); return m_arg.rows();
} }
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT Index cols() const
{ {
return m_arg.cols(); return m_arg.cols();
} }
@ -1705,7 +1699,7 @@ class EvalToTemp
private: private:
const ArgType& m_arg; const ArgType& m_arg;
}; };
template<typename ArgType> template<typename ArgType>
struct evaluator<EvalToTemp<ArgType> > struct evaluator<EvalToTemp<ArgType> >
: public evaluator<typename ArgType::PlainObject> : public evaluator<typename ArgType::PlainObject>
@ -1713,7 +1707,7 @@ struct evaluator<EvalToTemp<ArgType> >
typedef EvalToTemp<ArgType> XprType; typedef EvalToTemp<ArgType> XprType;
typedef typename ArgType::PlainObject PlainObject; typedef typename ArgType::PlainObject PlainObject;
typedef evaluator<PlainObject> Base; typedef evaluator<PlainObject> Base;
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr)
: m_result(xpr.arg()) : m_result(xpr.arg())
{ {

View File

@ -74,7 +74,7 @@ class CwiseBinaryOpImpl;
* \sa MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp * \sa MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp
*/ */
template<typename BinaryOp, typename LhsType, typename RhsType> template<typename BinaryOp, typename LhsType, typename RhsType>
class CwiseBinaryOp : class CwiseBinaryOp :
public CwiseBinaryOpImpl< public CwiseBinaryOpImpl<
BinaryOp, LhsType, RhsType, BinaryOp, LhsType, RhsType,
typename internal::cwise_promote_storage_type<typename internal::traits<LhsType>::StorageKind, typename internal::cwise_promote_storage_type<typename internal::traits<LhsType>::StorageKind,
@ -83,7 +83,7 @@ class CwiseBinaryOp :
internal::no_assignment_operator internal::no_assignment_operator
{ {
public: public:
typedef typename internal::remove_all<BinaryOp>::type Functor; typedef typename internal::remove_all<BinaryOp>::type Functor;
typedef typename internal::remove_all<LhsType>::type Lhs; typedef typename internal::remove_all<LhsType>::type Lhs;
typedef typename internal::remove_all<RhsType>::type Rhs; typedef typename internal::remove_all<RhsType>::type Rhs;
@ -116,15 +116,21 @@ class CwiseBinaryOp :
eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols());
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rows() const EIGEN_NOEXCEPT { Index rows() const {
// return the fixed size type if available to enable compile time optimizations // return the fixed size type if available to enable compile time optimizations
return internal::traits<typename internal::remove_all<LhsNested>::type>::RowsAtCompileTime==Dynamic ? m_rhs.rows() : m_lhs.rows(); if (internal::traits<typename internal::remove_all<LhsNested>::type>::RowsAtCompileTime==Dynamic)
return m_rhs.rows();
else
return m_lhs.rows();
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index cols() const EIGEN_NOEXCEPT { Index cols() const {
// return the fixed size type if available to enable compile time optimizations // return the fixed size type if available to enable compile time optimizations
return internal::traits<typename internal::remove_all<LhsNested>::type>::ColsAtCompileTime==Dynamic ? m_rhs.cols() : m_lhs.cols(); if (internal::traits<typename internal::remove_all<LhsNested>::type>::ColsAtCompileTime==Dynamic)
return m_rhs.cols();
else
return m_lhs.cols();
} }
/** \returns the left hand side nested expression */ /** \returns the left hand side nested expression */

View File

@ -74,10 +74,10 @@ class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp
&& (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index rows() const { return m_rows.value(); } EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index cols() const { return m_cols.value(); } EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); }
/** \returns the functor representing the nullary operation */ /** \returns the functor representing the nullary operation */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
@ -131,7 +131,7 @@ DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& f
* *
* Here is an example with C++11 random generators: \include random_cpp11.cpp * Here is an example with C++11 random generators: \include random_cpp11.cpp
* Output: \verbinclude random_cpp11.out * Output: \verbinclude random_cpp11.out
* *
* \sa class CwiseNullaryOp * \sa class CwiseNullaryOp
*/ */
template<typename Derived> template<typename Derived>

View File

@ -11,7 +11,7 @@
#ifndef EIGEN_CWISE_UNARY_OP_H #ifndef EIGEN_CWISE_UNARY_OP_H
#define EIGEN_CWISE_UNARY_OP_H #define EIGEN_CWISE_UNARY_OP_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<typename UnaryOp, typename XprType> template<typename UnaryOp, typename XprType>
@ -24,7 +24,7 @@ struct traits<CwiseUnaryOp<UnaryOp, XprType> >
typedef typename XprType::Nested XprTypeNested; typedef typename XprType::Nested XprTypeNested;
typedef typename remove_reference<XprTypeNested>::type _XprTypeNested; typedef typename remove_reference<XprTypeNested>::type _XprTypeNested;
enum { enum {
Flags = _XprTypeNested::Flags & RowMajorBit Flags = _XprTypeNested::Flags & RowMajorBit
}; };
}; };
} }
@ -65,10 +65,10 @@ class CwiseUnaryOp : public CwiseUnaryOpImpl<UnaryOp, XprType, typename internal
explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
: m_xpr(xpr), m_functor(func) {} : m_xpr(xpr), m_functor(func) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rows() const EIGEN_NOEXCEPT { return m_xpr.rows(); } Index rows() const { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index cols() const EIGEN_NOEXCEPT { return m_xpr.cols(); } Index cols() const { return m_xpr.cols(); }
/** \returns the functor representing the unary operation */ /** \returns the functor representing the unary operation */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE

View File

@ -69,10 +69,8 @@ class CwiseUnaryView : public CwiseUnaryViewImpl<ViewOp, MatrixType, typename in
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); }
Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }
/** \returns the functor representing unary operation */ /** \returns the functor representing unary operation */
EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; } EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; }
@ -110,16 +108,16 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
EIGEN_DENSE_PUBLIC_INTERFACE(Derived) EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl)
EIGEN_DEVICE_FUNC inline Scalar* data() { return &(this->coeffRef(0)); } EIGEN_DEVICE_FUNC inline Scalar* data() { return &(this->coeffRef(0)); }
EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(this->coeff(0)); } EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(this->coeff(0)); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const EIGEN_DEVICE_FUNC inline Index innerStride() const
{ {
return derived().nestedExpression().innerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar); return derived().nestedExpression().innerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar);
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const EIGEN_DEVICE_FUNC inline Index outerStride() const
{ {
return derived().nestedExpression().outerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar); return derived().nestedExpression().outerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar);
} }

View File

@ -14,7 +14,7 @@
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. // The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type.
// This dummy function simply aims at checking that at compile time. // This dummy function simply aims at checking that at compile time.
static inline void check_DenseIndex_is_signed() { static inline void check_DenseIndex_is_signed() {
@ -22,7 +22,7 @@ static inline void check_DenseIndex_is_signed() {
} }
} // end namespace internal } // end namespace internal
/** \class DenseBase /** \class DenseBase
* \ingroup Core_Module * \ingroup Core_Module
* *
@ -64,12 +64,12 @@ template<typename Derived> class DenseBase
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. */ /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. */
typedef typename internal::traits<Derived>::Scalar Scalar; typedef typename internal::traits<Derived>::Scalar Scalar;
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.
* *
* It is an alias for the Scalar type */ * It is an alias for the Scalar type */
typedef Scalar value_type; typedef Scalar value_type;
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base; typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
@ -158,7 +158,7 @@ template<typename Derived> class DenseBase
* a row-vector (if there is only one row). */ * a row-vector (if there is only one row). */
NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2, NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2,
/**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, /**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors,
* and 2 for matrices. * and 2 for matrices.
*/ */
@ -175,11 +175,11 @@ template<typename Derived> class DenseBase
InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret, InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
}; };
typedef typename internal::find_best_packet<Scalar,SizeAtCompileTime>::type PacketScalar; typedef typename internal::find_best_packet<Scalar,SizeAtCompileTime>::type PacketScalar;
enum { IsPlainObjectBase = 0 }; enum { IsPlainObjectBase = 0 };
/** The plain matrix type corresponding to this expression. /** The plain matrix type corresponding to this expression.
* \sa PlainObject */ * \sa PlainObject */
typedef Matrix<typename internal::traits<Derived>::Scalar, typedef Matrix<typename internal::traits<Derived>::Scalar,
@ -189,7 +189,7 @@ template<typename Derived> class DenseBase
internal::traits<Derived>::MaxRowsAtCompileTime, internal::traits<Derived>::MaxRowsAtCompileTime,
internal::traits<Derived>::MaxColsAtCompileTime internal::traits<Derived>::MaxColsAtCompileTime
> PlainMatrix; > PlainMatrix;
/** The plain array type corresponding to this expression. /** The plain array type corresponding to this expression.
* \sa PlainObject */ * \sa PlainObject */
typedef Array<typename internal::traits<Derived>::Scalar, typedef Array<typename internal::traits<Derived>::Scalar,
@ -211,7 +211,7 @@ template<typename Derived> class DenseBase
/** \returns the number of nonzero coefficients which is in practice the number /** \returns the number of nonzero coefficients which is in practice the number
* of stored coefficients. */ * of stored coefficients. */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index nonZeros() const { return size(); } inline Index nonZeros() const { return size(); }
/** \returns the outer size. /** \returns the outer size.
@ -219,7 +219,7 @@ template<typename Derived> class DenseBase
* \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension
* with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a
* column-major matrix, and the number of rows for a row-major matrix. */ * column-major matrix, and the number of rows for a row-major matrix. */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index outerSize() const Index outerSize() const
{ {
return IsVectorAtCompileTime ? 1 return IsVectorAtCompileTime ? 1
@ -229,9 +229,9 @@ template<typename Derived> class DenseBase
/** \returns the inner size. /** \returns the inner size.
* *
* \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension
* with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a
* column-major matrix, and the number of columns for a row-major matrix. */ * column-major matrix, and the number of columns for a row-major matrix. */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index innerSize() const Index innerSize() const
{ {
return IsVectorAtCompileTime ? this->size() return IsVectorAtCompileTime ? this->size()
@ -411,7 +411,7 @@ template<typename Derived> class DenseBase
// size types on MSVC. // size types on MSVC.
return typename internal::eval<Derived>::type(derived()); return typename internal::eval<Derived>::type(derived());
} }
/** swaps *this with the expression \a other. /** swaps *this with the expression \a other.
* *
*/ */

View File

@ -27,7 +27,7 @@ template<typename T> struct add_const_on_value_type_if_arithmetic
* *
* This class defines the \c operator() \c const function and friends, which can be used to read specific * This class defines the \c operator() \c const function and friends, which can be used to read specific
* entries of a matrix or array. * entries of a matrix or array.
* *
* \sa DenseCoeffsBase<Derived, WriteAccessors>, DenseCoeffsBase<Derived, DirectAccessors>, * \sa DenseCoeffsBase<Derived, WriteAccessors>, DenseCoeffsBase<Derived, DirectAccessors>,
* \ref TopicClassHierarchy * \ref TopicClassHierarchy
*/ */
@ -295,7 +295,7 @@ class DenseCoeffsBase<Derived,ReadOnlyAccessors> : public EigenBase<Derived>
* This class defines the non-const \c operator() function and friends, which can be used to write specific * This class defines the non-const \c operator() function and friends, which can be used to write specific
* entries of a matrix or array. This class inherits DenseCoeffsBase<Derived, ReadOnlyAccessors> which * entries of a matrix or array. This class inherits DenseCoeffsBase<Derived, ReadOnlyAccessors> which
* defines the const variant for reading specific entries. * defines the const variant for reading specific entries.
* *
* \sa DenseCoeffsBase<Derived, DirectAccessors>, \ref TopicClassHierarchy * \sa DenseCoeffsBase<Derived, DirectAccessors>, \ref TopicClassHierarchy
*/ */
template<typename Derived> template<typename Derived>
@ -495,7 +495,7 @@ class DenseCoeffsBase<Derived, DirectAccessors> : public DenseCoeffsBase<Derived
* *
* \sa outerStride(), rowStride(), colStride() * \sa outerStride(), rowStride(), colStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const inline Index innerStride() const
{ {
return derived().innerStride(); return derived().innerStride();
@ -506,14 +506,14 @@ class DenseCoeffsBase<Derived, DirectAccessors> : public DenseCoeffsBase<Derived
* *
* \sa innerStride(), rowStride(), colStride() * \sa innerStride(), rowStride(), colStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const inline Index outerStride() const
{ {
return derived().outerStride(); return derived().outerStride();
} }
// FIXME shall we remove it ? // FIXME shall we remove it ?
EIGEN_CONSTEXPR inline Index stride() const inline Index stride() const
{ {
return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
} }
@ -522,7 +522,7 @@ class DenseCoeffsBase<Derived, DirectAccessors> : public DenseCoeffsBase<Derived
* *
* \sa innerStride(), outerStride(), colStride() * \sa innerStride(), outerStride(), colStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rowStride() const inline Index rowStride() const
{ {
return Derived::IsRowMajor ? outerStride() : innerStride(); return Derived::IsRowMajor ? outerStride() : innerStride();
@ -532,7 +532,7 @@ class DenseCoeffsBase<Derived, DirectAccessors> : public DenseCoeffsBase<Derived
* *
* \sa innerStride(), outerStride(), rowStride() * \sa innerStride(), outerStride(), rowStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index colStride() const inline Index colStride() const
{ {
return Derived::IsRowMajor ? innerStride() : outerStride(); return Derived::IsRowMajor ? innerStride() : outerStride();
@ -570,8 +570,8 @@ class DenseCoeffsBase<Derived, DirectWriteAccessors>
* *
* \sa outerStride(), rowStride(), colStride() * \sa outerStride(), rowStride(), colStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const EIGEN_NOEXCEPT inline Index innerStride() const
{ {
return derived().innerStride(); return derived().innerStride();
} }
@ -581,14 +581,14 @@ class DenseCoeffsBase<Derived, DirectWriteAccessors>
* *
* \sa innerStride(), rowStride(), colStride() * \sa innerStride(), rowStride(), colStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const EIGEN_NOEXCEPT inline Index outerStride() const
{ {
return derived().outerStride(); return derived().outerStride();
} }
// FIXME shall we remove it ? // FIXME shall we remove it ?
EIGEN_CONSTEXPR inline Index stride() const EIGEN_NOEXCEPT inline Index stride() const
{ {
return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); return Derived::IsVectorAtCompileTime ? innerStride() : outerStride();
} }
@ -597,8 +597,8 @@ class DenseCoeffsBase<Derived, DirectWriteAccessors>
* *
* \sa innerStride(), outerStride(), colStride() * \sa innerStride(), outerStride(), colStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rowStride() const EIGEN_NOEXCEPT inline Index rowStride() const
{ {
return Derived::IsRowMajor ? outerStride() : innerStride(); return Derived::IsRowMajor ? outerStride() : innerStride();
} }
@ -607,8 +607,8 @@ class DenseCoeffsBase<Derived, DirectWriteAccessors>
* *
* \sa innerStride(), outerStride(), rowStride() * \sa innerStride(), outerStride(), rowStride()
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index colStride() const EIGEN_NOEXCEPT inline Index colStride() const
{ {
return Derived::IsRowMajor ? innerStride() : outerStride(); return Derived::IsRowMajor ? innerStride() : outerStride();
} }
@ -619,7 +619,7 @@ namespace internal {
template<int Alignment, typename Derived, bool JustReturnZero> template<int Alignment, typename Derived, bool JustReturnZero>
struct first_aligned_impl struct first_aligned_impl
{ {
static EIGEN_CONSTEXPR inline Index run(const Derived&) EIGEN_NOEXCEPT static inline Index run(const Derived&)
{ return 0; } { return 0; }
}; };

View File

@ -47,20 +47,20 @@ struct plain_array
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array() plain_array()
{ {
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array(constructor_without_unaligned_array_assert) plain_array(constructor_without_unaligned_array_assert)
{ {
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
}; };
#if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) #if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
#elif EIGEN_GNUC_AT_LEAST(4,7) #elif EIGEN_GNUC_AT_LEAST(4,7)
// GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned. // GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned.
// See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900 // See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900
// Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined: // Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined:
@ -85,15 +85,15 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 8>
EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size]; EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size];
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array() plain_array()
{ {
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7); EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7);
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array(constructor_without_unaligned_array_assert) plain_array(constructor_without_unaligned_array_assert)
{ {
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
}; };
@ -104,15 +104,15 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 16>
EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size]; EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size];
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array() plain_array()
{ {
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15); EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15);
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array(constructor_without_unaligned_array_assert) plain_array(constructor_without_unaligned_array_assert)
{ {
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
}; };
@ -123,15 +123,15 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 32>
EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size]; EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size];
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array() plain_array()
{ {
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31); EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31);
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array(constructor_without_unaligned_array_assert) plain_array(constructor_without_unaligned_array_assert)
{ {
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
}; };
@ -142,15 +142,15 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 64>
EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size]; EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size];
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array() plain_array()
{ {
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63); EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63);
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
plain_array(constructor_without_unaligned_array_assert) plain_array(constructor_without_unaligned_array_assert)
{ {
check_static_allocation_size<T,Size>(); check_static_allocation_size<T,Size>();
} }
}; };
@ -190,15 +190,15 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
: m_data(internal::constructor_without_unaligned_array_assert()) {} : m_data(internal::constructor_without_unaligned_array_assert()) {}
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
DenseStorage(const DenseStorage& other) : m_data(other.m_data) { DenseStorage(const DenseStorage& other) : m_data(other.m_data) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size)
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
DenseStorage& operator=(const DenseStorage& other) DenseStorage& operator=(const DenseStorage& other)
{ {
if (this != &other) m_data = other.m_data; if (this != &other) m_data = other.m_data;
return *this; return *this;
} }
#if EIGEN_HAS_RVALUE_REFERENCES #if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
@ -222,8 +222,8 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { EIGEN_DEVICE_FUNC void swap(DenseStorage& other) {
numext::swap(m_data, other.m_data); numext::swap(m_data, other.m_data);
} }
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;}
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return _Cols;} EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;}
EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {}
EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {}
EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; }
@ -240,8 +240,8 @@ template<typename T, int _Rows, int _Cols, int _Options> class DenseStorage<T, 0
EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) { return *this; } EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) { return *this; }
EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {} EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {}
EIGEN_DEVICE_FUNC void swap(DenseStorage& ) {} EIGEN_DEVICE_FUNC void swap(DenseStorage& ) {}
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;}
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return _Cols;} EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;}
EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {}
EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {}
EIGEN_DEVICE_FUNC const T *data() const { return 0; } EIGEN_DEVICE_FUNC const T *data() const { return 0; }
@ -269,15 +269,15 @@ template<typename T, int Size, int _Options> class DenseStorage<T, Size, Dynamic
EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
: m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {} EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {}
EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other)
{ {
if (this != &other) if (this != &other)
{ {
m_data = other.m_data; m_data = other.m_data;
m_rows = other.m_rows; m_rows = other.m_rows;
m_cols = other.m_cols; m_cols = other.m_cols;
} }
return *this; return *this;
} }
EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols) : m_rows(rows), m_cols(cols) {} EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols) : m_rows(rows), m_cols(cols) {}
EIGEN_DEVICE_FUNC void swap(DenseStorage& other) EIGEN_DEVICE_FUNC void swap(DenseStorage& other)
@ -304,14 +304,14 @@ template<typename T, int Size, int _Cols, int _Options> class DenseStorage<T, Si
EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
: m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {} EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {}
EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other)
{ {
if (this != &other) if (this != &other)
{ {
m_data = other.m_data; m_data = other.m_data;
m_rows = other.m_rows; m_rows = other.m_rows;
} }
return *this; return *this;
} }
EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index) : m_rows(rows) {} EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index) : m_rows(rows) {}
EIGEN_DEVICE_FUNC void swap(DenseStorage& other) EIGEN_DEVICE_FUNC void swap(DenseStorage& other)
@ -319,8 +319,8 @@ template<typename T, int Size, int _Cols, int _Options> class DenseStorage<T, Si
numext::swap(m_data,other.m_data); numext::swap(m_data,other.m_data);
numext::swap(m_rows,other.m_rows); numext::swap(m_rows,other.m_rows);
} }
EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} EIGEN_DEVICE_FUNC Index rows(void) const {return m_rows;}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) const EIGEN_NOEXCEPT {return _Cols;} EIGEN_DEVICE_FUNC Index cols(void) const {return _Cols;}
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index) { m_rows = rows; } EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index) { m_rows = rows; }
EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index) { m_rows = rows; } EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index) { m_rows = rows; }
EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; }
@ -351,8 +351,8 @@ template<typename T, int Size, int _Rows, int _Options> class DenseStorage<T, Si
numext::swap(m_data,other.m_data); numext::swap(m_data,other.m_data);
numext::swap(m_cols,other.m_cols); numext::swap(m_cols,other.m_cols);
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) const EIGEN_NOEXCEPT {return _Rows;} EIGEN_DEVICE_FUNC Index rows(void) const {return _Rows;}
EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} EIGEN_DEVICE_FUNC Index cols(void) const {return m_cols;}
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index cols) { m_cols = cols; } EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC void resize(Index, Index, Index cols) { m_cols = cols; } EIGEN_DEVICE_FUNC void resize(Index, Index, Index cols) { m_cols = cols; }
EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; }
@ -419,8 +419,8 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
numext::swap(m_rows,other.m_rows); numext::swap(m_rows,other.m_rows);
numext::swap(m_cols,other.m_cols); numext::swap(m_cols,other.m_cols);
} }
EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} EIGEN_DEVICE_FUNC Index rows(void) const {return m_rows;}
EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} EIGEN_DEVICE_FUNC Index cols(void) const {return m_cols;}
void conservativeResize(Index size, Index rows, Index cols) void conservativeResize(Index size, Index rows, Index cols)
{ {
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols); m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols);
@ -474,7 +474,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
this->swap(tmp); this->swap(tmp);
} }
return *this; return *this;
} }
#if EIGEN_HAS_RVALUE_REFERENCES #if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
@ -497,8 +497,8 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
numext::swap(m_data,other.m_data); numext::swap(m_data,other.m_data);
numext::swap(m_cols,other.m_cols); numext::swap(m_cols,other.m_cols);
} }
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;}
EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} EIGEN_DEVICE_FUNC Index cols(void) const {return m_cols;}
EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols) EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols)
{ {
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols); m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
@ -550,7 +550,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
this->swap(tmp); this->swap(tmp);
} }
return *this; return *this;
} }
#if EIGEN_HAS_RVALUE_REFERENCES #if EIGEN_HAS_RVALUE_REFERENCES
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
@ -573,8 +573,8 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
numext::swap(m_data,other.m_data); numext::swap(m_data,other.m_data);
numext::swap(m_rows,other.m_rows); numext::swap(m_rows,other.m_rows);
} }
EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} EIGEN_DEVICE_FUNC Index rows(void) const {return m_rows;}
EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) {return _Cols;} EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;}
void conservativeResize(Index size, Index rows, Index) void conservativeResize(Index size, Index rows, Index)
{ {
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols); m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);

View File

@ -11,7 +11,7 @@
#ifndef EIGEN_DIAGONAL_H #ifndef EIGEN_DIAGONAL_H
#define EIGEN_DIAGONAL_H #define EIGEN_DIAGONAL_H
namespace Eigen { namespace Eigen {
/** \class Diagonal /** \class Diagonal
* \ingroup Core_Module * \ingroup Core_Module
@ -84,16 +84,20 @@ template<typename MatrixType, int _DiagIndex> class Diagonal
: numext::mini<Index>(m_matrix.rows(),m_matrix.cols()-m_index.value()); : numext::mini<Index>(m_matrix.rows(),m_matrix.cols()-m_index.value());
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return 1; } inline Index cols() const { return 1; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const EIGEN_NOEXCEPT { inline Index innerStride() const
{
return m_matrix.outerStride() + 1; return m_matrix.outerStride() + 1;
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const EIGEN_NOEXCEPT { return 0; } inline Index outerStride() const
{
return 0;
}
typedef typename internal::conditional< typedef typename internal::conditional<
internal::is_lvalue<MatrixType>::value, internal::is_lvalue<MatrixType>::value,
@ -145,8 +149,8 @@ template<typename MatrixType, int _DiagIndex> class Diagonal
} }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline const typename internal::remove_all<typename MatrixType::Nested>::type& inline const typename internal::remove_all<typename MatrixType::Nested>::type&
nestedExpression() const nestedExpression() const
{ {
return m_matrix; return m_matrix;
} }
@ -163,12 +167,12 @@ template<typename MatrixType, int _DiagIndex> class Diagonal
private: private:
// some compilers may fail to optimize std::max etc in case of compile-time constants... // some compilers may fail to optimize std::max etc in case of compile-time constants...
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index absDiagIndex() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : -m_index.value(); } EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index rowOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? 0 : -m_index.value(); } EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index colOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : 0; } EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; }
// trigger a compile-time error if someone try to call packet // trigger a compile-time error if someone try to call packet
template<int LoadMode> typename MatrixType::PacketReturnType packet(Index) const; template<int LoadMode> typename MatrixType::PacketReturnType packet(Index) const;
template<int LoadMode> typename MatrixType::PacketReturnType packet(Index,Index) const; template<int LoadMode> typename MatrixType::PacketReturnType packet(Index,Index) const;

View File

@ -15,7 +15,7 @@ namespace Eigen {
/** \class EigenBase /** \class EigenBase
* \ingroup Core_Module * \ingroup Core_Module
* *
* Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). * Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T).
* *
* In other words, an EigenBase object is an object that can be copied into a MatrixBase. * In other words, an EigenBase object is an object that can be copied into a MatrixBase.
@ -29,7 +29,7 @@ namespace Eigen {
template<typename Derived> struct EigenBase template<typename Derived> struct EigenBase
{ {
// typedef typename internal::plain_matrix_type<Derived>::type PlainObject; // typedef typename internal::plain_matrix_type<Derived>::type PlainObject;
/** \brief The interface type of indices /** \brief The interface type of indices
* \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE.
* \sa StorageIndex, \ref TopicPreprocessorDirectives. * \sa StorageIndex, \ref TopicPreprocessorDirectives.
@ -56,15 +56,15 @@ template<typename Derived> struct EigenBase
{ return *static_cast<const Derived*>(this); } { return *static_cast<const Derived*>(this); }
/** \returns the number of rows. \sa cols(), RowsAtCompileTime */ /** \returns the number of rows. \sa cols(), RowsAtCompileTime */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const EIGEN_NOEXCEPT { return derived().rows(); } inline Index rows() const { return derived().rows(); }
/** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return derived().cols(); } inline Index cols() const { return derived().cols(); }
/** \returns the number of coefficients, which is rows()*cols(). /** \returns the number of coefficients, which is rows()*cols().
* \sa rows(), cols(), SizeAtCompileTime. */ * \sa rows(), cols(), SizeAtCompileTime. */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index size() const EIGEN_NOEXCEPT { return rows() * cols(); } inline Index size() const { return rows() * cols(); }
/** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */
template<typename Dest> template<typename Dest>

View File

@ -41,14 +41,10 @@ template<typename ExpressionType> class ForceAlignedAccess
EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); }
inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); }
inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); }
EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const
{ {

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_INVERSE_H #ifndef EIGEN_INVERSE_H
#define EIGEN_INVERSE_H #define EIGEN_INVERSE_H
namespace Eigen { namespace Eigen {
template<typename XprType,typename StorageKind> class InverseImpl; template<typename XprType,typename StorageKind> class InverseImpl;
@ -49,13 +49,13 @@ public:
typedef typename internal::remove_all<XprTypeNested>::type XprTypeNestedCleaned; typedef typename internal::remove_all<XprTypeNested>::type XprTypeNestedCleaned;
typedef typename internal::ref_selector<Inverse>::type Nested; typedef typename internal::ref_selector<Inverse>::type Nested;
typedef typename internal::remove_all<XprType>::type NestedExpression; typedef typename internal::remove_all<XprType>::type NestedExpression;
explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr)
: m_xpr(xpr) : m_xpr(xpr)
{} {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_xpr.cols(); } EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_xpr.rows(); } EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; }
@ -81,7 +81,7 @@ namespace internal {
/** \internal /** \internal
* \brief Default evaluator for Inverse expression. * \brief Default evaluator for Inverse expression.
* *
* This default evaluator for Inverse expression simply evaluate the inverse into a temporary * This default evaluator for Inverse expression simply evaluate the inverse into a temporary
* by a call to internal::call_assignment_no_alias. * by a call to internal::call_assignment_no_alias.
* Therefore, inverse implementers only have to specialize Assignment<Dst,Inverse<...>, ...> for * Therefore, inverse implementers only have to specialize Assignment<Dst,Inverse<...>, ...> for
@ -96,7 +96,7 @@ struct unary_evaluator<Inverse<ArgType> >
typedef Inverse<ArgType> InverseType; typedef Inverse<ArgType> InverseType;
typedef typename InverseType::PlainObject PlainObject; typedef typename InverseType::PlainObject PlainObject;
typedef evaluator<PlainObject> Base; typedef evaluator<PlainObject> Base;
enum { Flags = Base::Flags | EvalBeforeNestingBit }; enum { Flags = Base::Flags | EvalBeforeNestingBit };
unary_evaluator(const InverseType& inv_xpr) unary_evaluator(const InverseType& inv_xpr)
@ -105,11 +105,11 @@ struct unary_evaluator<Inverse<ArgType> >
::new (static_cast<Base*>(this)) Base(m_result); ::new (static_cast<Base*>(this)) Base(m_result);
internal::call_assignment_no_alias(m_result, inv_xpr); internal::call_assignment_no_alias(m_result, inv_xpr);
} }
protected: protected:
PlainObject m_result; PlainObject m_result;
}; };
} // end namespace internal } // end namespace internal
} // end namespace Eigen } // end namespace Eigen

View File

@ -11,7 +11,7 @@
#ifndef EIGEN_MAP_H #ifndef EIGEN_MAP_H
#define EIGEN_MAP_H #define EIGEN_MAP_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<typename PlainObjectType, int MapOptions, typename StrideType> template<typename PlainObjectType, int MapOptions, typename StrideType>
@ -104,13 +104,13 @@ template<typename PlainObjectType, int MapOptions, typename StrideType> class Ma
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const inline Index innerStride() const
{ {
return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const inline Index outerStride() const
{ {
return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()

View File

@ -15,7 +15,7 @@
EIGEN_STATIC_ASSERT((int(internal::evaluator<Derived>::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ EIGEN_STATIC_ASSERT((int(internal::evaluator<Derived>::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \
YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT)
namespace Eigen { namespace Eigen {
/** \ingroup Core_Module /** \ingroup Core_Module
* *
@ -87,11 +87,9 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
typedef typename Base::CoeffReturnType CoeffReturnType; typedef typename Base::CoeffReturnType CoeffReturnType;
/** \copydoc DenseBase::rows() */ /** \copydoc DenseBase::rows() */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return m_rows.value(); }
inline Index rows() const EIGEN_NOEXCEPT { return m_rows.value(); }
/** \copydoc DenseBase::cols() */ /** \copydoc DenseBase::cols() */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index cols() const { return m_cols.value(); }
inline Index cols() const EIGEN_NOEXCEPT { return m_cols.value(); }
/** Returns a pointer to the first coefficient of the matrix or vector. /** Returns a pointer to the first coefficient of the matrix or vector.
* *

View File

@ -214,12 +214,12 @@ struct imag_ref_default_impl
template<typename Scalar> template<typename Scalar>
struct imag_ref_default_impl<Scalar, false> struct imag_ref_default_impl<Scalar, false>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static inline Scalar run(Scalar&) static inline Scalar run(Scalar&)
{ {
return Scalar(0); return Scalar(0);
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static inline const Scalar run(const Scalar&) static inline const Scalar run(const Scalar&)
{ {
return Scalar(0); return Scalar(0);

View File

@ -29,7 +29,7 @@ private:
required_alignment = unpacket_traits<PacketScalar>::alignment, required_alignment = unpacket_traits<PacketScalar>::alignment,
packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0 packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0
}; };
public: public:
typedef _Scalar Scalar; typedef _Scalar Scalar;
typedef Dense StorageKind; typedef Dense StorageKind;
@ -44,7 +44,7 @@ public:
Options = _Options, Options = _Options,
InnerStrideAtCompileTime = 1, InnerStrideAtCompileTime = 1,
OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime, OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime,
// FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase // FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase
EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit, EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit,
Alignment = actual_alignment Alignment = actual_alignment
@ -297,24 +297,24 @@ class Matrix
: Base(a0, a1, a2, a3, args...) {} : Base(a0, a1, a2, a3, args...) {}
/** \brief Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 /** \brief Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11
* *
* In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients:
* *
* Example: \include Matrix_initializer_list_23_cxx11.cpp * Example: \include Matrix_initializer_list_23_cxx11.cpp
* Output: \verbinclude Matrix_initializer_list_23_cxx11.out * Output: \verbinclude Matrix_initializer_list_23_cxx11.out
* *
* Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered.
* *
* In the case of a compile-time column vector, implicit transposition from a single row is allowed. * In the case of a compile-time column vector, implicit transposition from a single row is allowed.
* Therefore <code>VectorXd{{1,2,3,4,5}}</code> is legal and the more verbose syntax * Therefore <code>VectorXd{{1,2,3,4,5}}</code> is legal and the more verbose syntax
* <code>RowVectorXd{{1},{2},{3},{4},{5}}</code> can be avoided: * <code>RowVectorXd{{1},{2},{3},{4},{5}}</code> can be avoided:
* *
* Example: \include Matrix_initializer_list_vector_cxx11.cpp * Example: \include Matrix_initializer_list_vector_cxx11.cpp
* Output: \verbinclude Matrix_initializer_list_vector_cxx11.out * Output: \verbinclude Matrix_initializer_list_vector_cxx11.out
* *
* In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes, * In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes,
* and implicit transposition is allowed for compile-time vectors only. * and implicit transposition is allowed for compile-time vectors only.
* *
* \sa Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) * \sa Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args)
*/ */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
@ -351,7 +351,7 @@ class Matrix
* This is useful for dynamic-size vectors. For fixed-size vectors, * This is useful for dynamic-size vectors. For fixed-size vectors,
* it is redundant to pass these parameters, so one should use the default constructor * it is redundant to pass these parameters, so one should use the default constructor
* Matrix() instead. * Matrix() instead.
* *
* \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance, * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance,
* calling Matrix<double,1,1>(1) will call the initialization constructor: Matrix(const Scalar&). * calling Matrix<double,1,1>(1) will call the initialization constructor: Matrix(const Scalar&).
* For fixed-size \c 1x1 matrices it is therefore recommended to use the default * For fixed-size \c 1x1 matrices it is therefore recommended to use the default
@ -367,7 +367,7 @@ class Matrix
* This is useful for dynamic-size matrices. For fixed-size matrices, * This is useful for dynamic-size matrices. For fixed-size matrices,
* it is redundant to pass these parameters, so one should use the default constructor * it is redundant to pass these parameters, so one should use the default constructor
* Matrix() instead. * Matrix() instead.
* *
* \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance, * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance,
* calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y). * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y).
* For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default
@ -376,7 +376,7 @@ class Matrix
*/ */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
Matrix(Index rows, Index cols); Matrix(Index rows, Index cols);
/** \brief Constructs an initialized 2D vector with given coefficients /** \brief Constructs an initialized 2D vector with given coefficients
* \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */
Matrix(const Scalar& x, const Scalar& y); Matrix(const Scalar& x, const Scalar& y);
@ -423,10 +423,8 @@ class Matrix
: Base(other.derived()) : Base(other.derived())
{ } { }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index innerStride() const { return 1; }
inline Index innerStride() const EIGEN_NOEXCEPT { return 1; } EIGEN_DEVICE_FUNC inline Index outerStride() const { return this->innerSize(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); }
/////////// Geometry module /////////// /////////// Geometry module ///////////
@ -465,14 +463,14 @@ class Matrix
* *
* There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is
* a fixed-size vector of 4 complex floats. * a fixed-size vector of 4 complex floats.
* *
* With \cpp11, template alias are also defined for common sizes. * With \cpp11, template alias are also defined for common sizes.
* They follow the same pattern as above except that the scalar type suffix is replaced by a * They follow the same pattern as above except that the scalar type suffix is replaced by a
* template parameter, i.e.: * template parameter, i.e.:
* - `MatrixSize<Type>` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size. * - `MatrixSize<Type>` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size.
* - `MatrixXSize<Type>` and `MatrixSizeX<Type>` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices. * - `MatrixXSize<Type>` and `MatrixSizeX<Type>` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices.
* - `VectorSize<Type>` and `RowVectorSize<Type>` for column and row vectors. * - `VectorSize<Type>` and `RowVectorSize<Type>` for column and row vectors.
* *
* With \cpp11, you can also use fully generic column and row vector types: `Vector<Type,Size>` and `RowVector<Type,Size>`. * With \cpp11, you can also use fully generic column and row vector types: `Vector<Type,Size>` and `RowVector<Type,Size>`.
* *
* \sa class Matrix * \sa class Matrix

View File

@ -45,8 +45,8 @@ template<typename ExpressionType> class NestByValue
EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); }
EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; }

View File

@ -147,10 +147,10 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
const Base& base() const { return *static_cast<const Base*>(this); } const Base& base() const { return *static_cast<const Base*>(this); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index rows() const EIGEN_NOEXCEPT { return m_storage.rows(); } EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index cols() const EIGEN_NOEXCEPT { return m_storage.cols(); } EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); }
/** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const /** This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const
* provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.
@ -530,11 +530,11 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
/** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients. \cpp11 /** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients. \cpp11
* *
* \only_for_vectors * \only_for_vectors
* *
* This constructor is for 1D array or vectors with more than 4 coefficients. * This constructor is for 1D array or vectors with more than 4 coefficients.
* There exists C++98 analogue constructors for fixed-size array/vector having 1, 2, 3, or 4 coefficients. * There exists C++98 analogue constructors for fixed-size array/vector having 1, 2, 3, or 4 coefficients.
* *
* \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this * \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this
* constructor must match the the fixed number of rows (resp. columns) of \c *this. * constructor must match the the fixed number of rows (resp. columns) of \c *this.
*/ */
template <typename... ArgTypes> template <typename... ArgTypes>
@ -576,7 +576,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
eigen_assert(list.size() == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); eigen_assert(list.size() == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
eigen_assert(list_size == static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic); eigen_assert(list_size == static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
resize(list.size(), list_size); resize(list.size(), list_size);
Index row_index = 0; Index row_index = 0;
for (const std::initializer_list<Scalar>& row : list) { for (const std::initializer_list<Scalar>& row : list) {
eigen_assert(list_size == row.size()); eigen_assert(list_size == row.size());

View File

@ -23,25 +23,25 @@ struct traits<Product<Lhs, Rhs, Option> >
typedef typename remove_all<Rhs>::type RhsCleaned; typedef typename remove_all<Rhs>::type RhsCleaned;
typedef traits<LhsCleaned> LhsTraits; typedef traits<LhsCleaned> LhsTraits;
typedef traits<RhsCleaned> RhsTraits; typedef traits<RhsCleaned> RhsTraits;
typedef MatrixXpr XprKind; typedef MatrixXpr XprKind;
typedef typename ScalarBinaryOpTraits<typename traits<LhsCleaned>::Scalar, typename traits<RhsCleaned>::Scalar>::ReturnType Scalar; typedef typename ScalarBinaryOpTraits<typename traits<LhsCleaned>::Scalar, typename traits<RhsCleaned>::Scalar>::ReturnType Scalar;
typedef typename product_promote_storage_type<typename LhsTraits::StorageKind, typedef typename product_promote_storage_type<typename LhsTraits::StorageKind,
typename RhsTraits::StorageKind, typename RhsTraits::StorageKind,
internal::product_type<Lhs,Rhs>::ret>::ret StorageKind; internal::product_type<Lhs,Rhs>::ret>::ret StorageKind;
typedef typename promote_index_type<typename LhsTraits::StorageIndex, typedef typename promote_index_type<typename LhsTraits::StorageIndex,
typename RhsTraits::StorageIndex>::type StorageIndex; typename RhsTraits::StorageIndex>::type StorageIndex;
enum { enum {
RowsAtCompileTime = LhsTraits::RowsAtCompileTime, RowsAtCompileTime = LhsTraits::RowsAtCompileTime,
ColsAtCompileTime = RhsTraits::ColsAtCompileTime, ColsAtCompileTime = RhsTraits::ColsAtCompileTime,
MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime, MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime,
MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime, MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime,
// FIXME: only needed by GeneralMatrixMatrixTriangular // FIXME: only needed by GeneralMatrixMatrixTriangular
InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime), InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime),
// The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator.
Flags = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? RowMajorBit Flags = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? RowMajorBit
: (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0
@ -74,10 +74,10 @@ class Product : public ProductImpl<_Lhs,_Rhs,Option,
internal::product_type<_Lhs,_Rhs>::ret>::ret> internal::product_type<_Lhs,_Rhs>::ret>::ret>
{ {
public: public:
typedef _Lhs Lhs; typedef _Lhs Lhs;
typedef _Rhs Rhs; typedef _Rhs Rhs;
typedef typename ProductImpl< typedef typename ProductImpl<
Lhs, Rhs, Option, Lhs, Rhs, Option,
typename internal::product_promote_storage_type<typename internal::traits<Lhs>::StorageKind, typename internal::product_promote_storage_type<typename internal::traits<Lhs>::StorageKind,
@ -98,10 +98,10 @@ class Product : public ProductImpl<_Lhs,_Rhs,Option,
&& "if you wanted a coeff-wise or a dot product use the respective explicit functions"); && "if you wanted a coeff-wise or a dot product use the respective explicit functions");
} }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } Index rows() const { return m_lhs.rows(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } Index cols() const { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const LhsNestedCleaned& lhs() const { return m_lhs; } const LhsNestedCleaned& lhs() const { return m_lhs; }
@ -115,7 +115,7 @@ class Product : public ProductImpl<_Lhs,_Rhs,Option,
}; };
namespace internal { namespace internal {
template<typename Lhs, typename Rhs, int Option, int ProductTag = internal::product_type<Lhs,Rhs>::ret> template<typename Lhs, typename Rhs, int Option, int ProductTag = internal::product_type<Lhs,Rhs>::ret>
class dense_product_base class dense_product_base
: public internal::dense_xpr_base<Product<Lhs,Rhs,Option> >::type : public internal::dense_xpr_base<Product<Lhs,Rhs,Option> >::type
@ -131,7 +131,7 @@ class dense_product_base<Lhs, Rhs, Option, InnerProduct>
public: public:
using Base::derived; using Base::derived;
typedef typename Base::Scalar Scalar; typedef typename Base::Scalar Scalar;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator const Scalar() const EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator const Scalar() const
{ {
return internal::evaluator<ProductXpr>(derived()).coeff(0,0); return internal::evaluator<ProductXpr>(derived()).coeff(0,0);
@ -153,25 +153,25 @@ class ProductImpl<Lhs,Rhs,Option,Dense>
: public internal::dense_product_base<Lhs,Rhs,Option> : public internal::dense_product_base<Lhs,Rhs,Option>
{ {
typedef Product<Lhs, Rhs, Option> Derived; typedef Product<Lhs, Rhs, Option> Derived;
public: public:
typedef typename internal::dense_product_base<Lhs, Rhs, Option> Base; typedef typename internal::dense_product_base<Lhs, Rhs, Option> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived) EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
protected: protected:
enum { enum {
IsOneByOne = (RowsAtCompileTime == 1 || RowsAtCompileTime == Dynamic) && IsOneByOne = (RowsAtCompileTime == 1 || RowsAtCompileTime == Dynamic) &&
(ColsAtCompileTime == 1 || ColsAtCompileTime == Dynamic), (ColsAtCompileTime == 1 || ColsAtCompileTime == Dynamic),
EnableCoeff = IsOneByOne || Option==LazyProduct EnableCoeff = IsOneByOne || Option==LazyProduct
}; };
public: public:
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index row, Index col) const EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index row, Index col) const
{ {
EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS);
eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) );
return internal::evaluator<Derived>(derived()).coeff(row,col); return internal::evaluator<Derived>(derived()).coeff(row,col);
} }
@ -179,11 +179,11 @@ class ProductImpl<Lhs,Rhs,Option,Dense>
{ {
EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS);
eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) );
return internal::evaluator<Derived>(derived()).coeff(i); return internal::evaluator<Derived>(derived()).coeff(i);
} }
}; };
} // end namespace Eigen } // end namespace Eigen

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_REF_H #ifndef EIGEN_REF_H
#define EIGEN_REF_H #define EIGEN_REF_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
@ -48,7 +48,7 @@ struct traits<Ref<_PlainObjectType, _Options, _StrideType> >
}; };
typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type; typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type;
}; };
}; };
template<typename Derived> template<typename Derived>
@ -67,12 +67,12 @@ public:
typedef MapBase<Derived> Base; typedef MapBase<Derived> Base;
EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) EIGEN_DENSE_PUBLIC_INTERFACE(RefBase)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const EIGEN_DEVICE_FUNC inline Index innerStride() const
{ {
return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const EIGEN_DEVICE_FUNC inline Index outerStride() const
{ {
return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
: IsVectorAtCompileTime ? this->size() : IsVectorAtCompileTime ? this->size()
@ -86,7 +86,7 @@ public:
m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime,
StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime)
{} {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase)
protected: protected:
@ -94,13 +94,25 @@ protected:
typedef Stride<StrideType::OuterStrideAtCompileTime,StrideType::InnerStrideAtCompileTime> StrideBase; typedef Stride<StrideType::OuterStrideAtCompileTime,StrideType::InnerStrideAtCompileTime> StrideBase;
// Resolves inner stride if default 0. // Resolves inner stride if default 0.
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveInnerStride(Index inner) { static EIGEN_DEVICE_FUNC Index resolveInnerStride(Index inner) {
return inner == 0 ? 1 : inner; if (inner == 0) {
return 1;
}
return inner;
} }
// Resolves outer stride if default 0. // Resolves outer stride if default 0.
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor) { static EIGEN_DEVICE_FUNC Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor) {
return outer == 0 ? isVectorAtCompileTime ? inner * rows * cols : isRowMajor ? inner * cols : inner * rows : outer; if (outer == 0) {
if (isVectorAtCompileTime) {
outer = inner * rows * cols;
} else if (isRowMajor) {
outer = inner * cols;
} else {
outer = inner * rows;
}
}
return outer;
} }
// Returns true if construction is valid, false if there is a stride mismatch, // Returns true if construction is valid, false if there is a stride mismatch,
@ -143,8 +155,8 @@ protected:
(PlainObjectType::RowsAtCompileTime == Dynamic) || (PlainObjectType::RowsAtCompileTime == rows)); (PlainObjectType::RowsAtCompileTime == Dynamic) || (PlainObjectType::RowsAtCompileTime == rows));
eigen_assert( eigen_assert(
(PlainObjectType::ColsAtCompileTime == Dynamic) || (PlainObjectType::ColsAtCompileTime == cols)); (PlainObjectType::ColsAtCompileTime == Dynamic) || (PlainObjectType::ColsAtCompileTime == cols));
// If this is a vector, we might be transposing, which means that stride should swap. // If this is a vector, we might be transposing, which means that stride should swap.
const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows()); const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows());
// If the storage format differs, we also need to swap the stride. // If the storage format differs, we also need to swap the stride.
@ -153,42 +165,42 @@ protected:
const bool storage_differs = (row_major != expr_row_major); const bool storage_differs = (row_major != expr_row_major);
const bool swap_stride = (transpose != storage_differs); const bool swap_stride = (transpose != storage_differs);
// Determine expr's actual strides, resolving any defaults if zero. // Determine expr's actual strides, resolving any defaults if zero.
const Index expr_inner_actual = resolveInnerStride(expr.innerStride()); const Index expr_inner_actual = resolveInnerStride(expr.innerStride());
const Index expr_outer_actual = resolveOuterStride(expr_inner_actual, const Index expr_outer_actual = resolveOuterStride(expr_inner_actual,
expr.outerStride(), expr.outerStride(),
expr.rows(), expr.rows(),
expr.cols(), expr.cols(),
Expression::IsVectorAtCompileTime != 0, Expression::IsVectorAtCompileTime != 0,
expr_row_major); expr_row_major);
// If this is a column-major row vector or row-major column vector, the inner-stride // If this is a column-major row vector or row-major column vector, the inner-stride
// is arbitrary, so set it to either the compile-time inner stride or 1. // is arbitrary, so set it to either the compile-time inner stride or 1.
const bool row_vector = (rows == 1); const bool row_vector = (rows == 1);
const bool col_vector = (cols == 1); const bool col_vector = (cols == 1);
const Index inner_stride = const Index inner_stride =
( (!row_major && row_vector) || (row_major && col_vector) ) ? ( (!row_major && row_vector) || (row_major && col_vector) ) ?
( StrideType::InnerStrideAtCompileTime > 0 ? Index(StrideType::InnerStrideAtCompileTime) : 1) ( StrideType::InnerStrideAtCompileTime > 0 ? Index(StrideType::InnerStrideAtCompileTime) : 1)
: swap_stride ? expr_outer_actual : expr_inner_actual; : swap_stride ? expr_outer_actual : expr_inner_actual;
// If this is a column-major column vector or row-major row vector, the outer-stride // If this is a column-major column vector or row-major row vector, the outer-stride
// is arbitrary, so set it to either the compile-time outer stride or vector size. // is arbitrary, so set it to either the compile-time outer stride or vector size.
const Index outer_stride = const Index outer_stride =
( (!row_major && col_vector) || (row_major && row_vector) ) ? ( (!row_major && col_vector) || (row_major && row_vector) ) ?
( StrideType::OuterStrideAtCompileTime > 0 ? Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride) ( StrideType::OuterStrideAtCompileTime > 0 ? Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride)
: swap_stride ? expr_inner_actual : expr_outer_actual; : swap_stride ? expr_inner_actual : expr_outer_actual;
// Check if given inner/outer strides are compatible with compile-time strides. // Check if given inner/outer strides are compatible with compile-time strides.
const bool inner_valid = (StrideType::InnerStrideAtCompileTime == Dynamic) const bool inner_valid = (StrideType::InnerStrideAtCompileTime == Dynamic)
|| (resolveInnerStride(Index(StrideType::InnerStrideAtCompileTime)) == inner_stride); || (resolveInnerStride(Index(StrideType::InnerStrideAtCompileTime)) == inner_stride);
if (!inner_valid) { if (!inner_valid) {
return false; return false;
} }
const bool outer_valid = (StrideType::OuterStrideAtCompileTime == Dynamic) const bool outer_valid = (StrideType::OuterStrideAtCompileTime == Dynamic)
|| (resolveOuterStride( || (resolveOuterStride(
inner_stride, inner_stride,
Index(StrideType::OuterStrideAtCompileTime), Index(StrideType::OuterStrideAtCompileTime),
rows, cols, PlainObjectType::IsVectorAtCompileTime != 0, rows, cols, PlainObjectType::IsVectorAtCompileTime != 0,
row_major) row_major)
@ -196,7 +208,7 @@ protected:
if (!outer_valid) { if (!outer_valid) {
return false; return false;
} }
::new (static_cast<Base*>(this)) Base(expr.data(), rows, cols); ::new (static_cast<Base*>(this)) Base(expr.data(), rows, cols);
::new (&m_stride) StrideBase( ::new (&m_stride) StrideBase(
(StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride, (StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride,

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_REPLICATE_H #ifndef EIGEN_REPLICATE_H
#define EIGEN_REPLICATE_H #define EIGEN_REPLICATE_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<typename MatrixType,int RowFactor,int ColFactor> template<typename MatrixType,int RowFactor,int ColFactor>
@ -35,7 +35,7 @@ struct traits<Replicate<MatrixType,RowFactor,ColFactor> >
IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1 IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
: MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0 : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
: (MatrixType::Flags & RowMajorBit) ? 1 : 0, : (MatrixType::Flags & RowMajorBit) ? 1 : 0,
// FIXME enable DirectAccess with negative strides? // FIXME enable DirectAccess with negative strides?
Flags = IsRowMajor ? RowMajorBit : 0 Flags = IsRowMajor ? RowMajorBit : 0
}; };
@ -88,15 +88,15 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
const _MatrixTypeNested& nestedExpression() const const _MatrixTypeNested& nestedExpression() const
{ {
return m_matrix; return m_matrix;
} }
protected: protected:

View File

@ -240,14 +240,14 @@ class ReshapedImpl_dense<XprType, Rows, Cols, Order, true>
XprType& nestedExpression() { return m_xpr; } XprType& nestedExpression() { return m_xpr; }
/** \sa MapBase::innerStride() */ /** \sa MapBase::innerStride() */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const inline Index innerStride() const
{ {
return m_xpr.innerStride(); return m_xpr.innerStride();
} }
/** \sa MapBase::outerStride() */ /** \sa MapBase::outerStride() */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const inline Index outerStride() const
{ {
return ((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows(); return ((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows();

View File

@ -60,10 +60,8 @@ template<typename Derived> class ReturnByValue
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline void evalTo(Dest& dst) const inline void evalTo(Dest& dst) const
{ static_cast<const Derived*>(this)->evalTo(dst); } { static_cast<const Derived*>(this)->evalTo(dst); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return static_cast<const Derived*>(this)->rows(); }
inline Index rows() const EIGEN_NOEXCEPT { return static_cast<const Derived*>(this)->rows(); } EIGEN_DEVICE_FUNC inline Index cols() const { return static_cast<const Derived*>(this)->cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index cols() const EIGEN_NOEXCEPT { return static_cast<const Derived*>(this)->cols(); }
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
#define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT
@ -92,7 +90,7 @@ namespace internal {
// Expression is evaluated in a temporary; default implementation of Assignment is bypassed so that // Expression is evaluated in a temporary; default implementation of Assignment is bypassed so that
// when a ReturnByValue expression is assigned, the evaluator is not constructed. // when a ReturnByValue expression is assigned, the evaluator is not constructed.
// TODO: Finalize port to new regime; ReturnByValue should not exist in the expression world // TODO: Finalize port to new regime; ReturnByValue should not exist in the expression world
template<typename Derived> template<typename Derived>
struct evaluator<ReturnByValue<Derived> > struct evaluator<ReturnByValue<Derived> >
: public evaluator<typename internal::traits<Derived>::ReturnType> : public evaluator<typename internal::traits<Derived>::ReturnType>
@ -100,7 +98,7 @@ struct evaluator<ReturnByValue<Derived> >
typedef ReturnByValue<Derived> XprType; typedef ReturnByValue<Derived> XprType;
typedef typename internal::traits<Derived>::ReturnType PlainObject; typedef typename internal::traits<Derived>::ReturnType PlainObject;
typedef evaluator<PlainObject> Base; typedef evaluator<PlainObject> Base;
EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr)
: m_result(xpr.rows(), xpr.cols()) : m_result(xpr.rows(), xpr.cols())
{ {

View File

@ -12,7 +12,7 @@
#ifndef EIGEN_REVERSE_H #ifndef EIGEN_REVERSE_H
#define EIGEN_REVERSE_H #define EIGEN_REVERSE_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
@ -44,7 +44,7 @@ template<typename PacketType> struct reverse_packet_cond<PacketType,false>
static inline PacketType run(const PacketType& x) { return x; } static inline PacketType run(const PacketType& x) { return x; }
}; };
} // end namespace internal } // end namespace internal
/** \class Reverse /** \class Reverse
* \ingroup Core_Module * \ingroup Core_Module
@ -89,10 +89,8 @@ template<typename MatrixType, int Direction> class Reverse
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse)
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.rows(); }
inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC inline Index innerStride() const EIGEN_DEVICE_FUNC inline Index innerStride() const
{ {
@ -100,7 +98,7 @@ template<typename MatrixType, int Direction> class Reverse
} }
EIGEN_DEVICE_FUNC const typename internal::remove_all<typename MatrixType::Nested>::type& EIGEN_DEVICE_FUNC const typename internal::remove_all<typename MatrixType::Nested>::type&
nestedExpression() const nestedExpression() const
{ {
return m_matrix; return m_matrix;
} }
@ -163,7 +161,7 @@ EIGEN_DEVICE_FUNC inline void DenseBase<Derived>::reverseInPlace()
} }
namespace internal { namespace internal {
template<int Direction> template<int Direction>
struct vectorwise_reverse_inplace_impl; struct vectorwise_reverse_inplace_impl;

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_SELECT_H #ifndef EIGEN_SELECT_H
#define EIGEN_SELECT_H #define EIGEN_SELECT_H
namespace Eigen { namespace Eigen {
/** \class Select /** \class Select
* \ingroup Core_Module * \ingroup Core_Module
@ -67,10 +67,8 @@ class Select : public internal::dense_xpr_base< Select<ConditionMatrixType, Then
eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols()); eigen_assert(m_condition.cols() == m_then.cols() && m_condition.cols() == m_else.cols());
} }
inline EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline EIGEN_DEVICE_FUNC Index rows() const { return m_condition.rows(); }
Index rows() const EIGEN_NOEXCEPT { return m_condition.rows(); } inline EIGEN_DEVICE_FUNC Index cols() const { return m_condition.cols(); }
inline EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index cols() const EIGEN_NOEXCEPT { return m_condition.cols(); }
inline EIGEN_DEVICE_FUNC inline EIGEN_DEVICE_FUNC
const Scalar coeff(Index i, Index j) const const Scalar coeff(Index i, Index j) const

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_SELFADJOINTMATRIX_H #ifndef EIGEN_SELFADJOINTMATRIX_H
#define EIGEN_SELFADJOINTMATRIX_H #define EIGEN_SELFADJOINTMATRIX_H
namespace Eigen { namespace Eigen {
/** \class SelfAdjointView /** \class SelfAdjointView
* \ingroup Core_Module * \ingroup Core_Module
@ -58,7 +58,7 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
typedef MatrixTypeNestedCleaned NestedExpression; typedef MatrixTypeNestedCleaned NestedExpression;
/** \brief The type of coefficients in this matrix */ /** \brief The type of coefficients in this matrix */
typedef typename internal::traits<SelfAdjointView>::Scalar Scalar; typedef typename internal::traits<SelfAdjointView>::Scalar Scalar;
typedef typename MatrixType::StorageIndex StorageIndex; typedef typename MatrixType::StorageIndex StorageIndex;
typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType; typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
typedef SelfAdjointView<typename internal::add_const<MatrixType>::type, UpLo> ConstSelfAdjointView; typedef SelfAdjointView<typename internal::add_const<MatrixType>::type, UpLo> ConstSelfAdjointView;
@ -76,14 +76,14 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY); EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY);
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } inline Index rows() const { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } inline Index cols() const { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const EIGEN_NOEXCEPT { return m_matrix.outerStride(); } inline Index outerStride() const { return m_matrix.outerStride(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const EIGEN_NOEXCEPT { return m_matrix.innerStride(); } inline Index innerStride() const { return m_matrix.innerStride(); }
/** \sa MatrixBase::coeff() /** \sa MatrixBase::coeff()
* \warning the coordinates must fit into the referenced triangular part * \warning the coordinates must fit into the referenced triangular part
@ -132,7 +132,7 @@ template<typename _MatrixType, unsigned int UpLo> class SelfAdjointView
{ {
return Product<OtherDerived,SelfAdjointView>(lhs.derived(),rhs); return Product<OtherDerived,SelfAdjointView>(lhs.derived(),rhs);
} }
friend EIGEN_DEVICE_FUNC friend EIGEN_DEVICE_FUNC
const SelfAdjointView<const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,MatrixType,product),UpLo> const SelfAdjointView<const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,MatrixType,product),UpLo>
operator*(const Scalar& s, const SelfAdjointView& mat) operator*(const Scalar& s, const SelfAdjointView& mat)
@ -300,17 +300,17 @@ protected:
using Base::m_src; using Base::m_src;
using Base::m_functor; using Base::m_functor;
public: public:
typedef typename Base::DstEvaluatorType DstEvaluatorType; typedef typename Base::DstEvaluatorType DstEvaluatorType;
typedef typename Base::SrcEvaluatorType SrcEvaluatorType; typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
typedef typename Base::Scalar Scalar; typedef typename Base::Scalar Scalar;
typedef typename Base::AssignmentTraits AssignmentTraits; typedef typename Base::AssignmentTraits AssignmentTraits;
EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr) EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr)
: Base(dst, src, func, dstExpr) : Base(dst, src, func, dstExpr)
{} {}
EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col) EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col)
{ {
eigen_internal_assert(row!=col); eigen_internal_assert(row!=col);
@ -318,12 +318,12 @@ public:
m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp); m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp)); m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
} }
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id) EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id)
{ {
Base::assignCoeff(id,id); Base::assignCoeff(id,id);
} }
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index, Index) EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index, Index)
{ eigen_internal_assert(false && "should never be called"); } { eigen_internal_assert(false && "should never be called"); }
}; };

View File

@ -13,7 +13,7 @@
namespace Eigen { namespace Eigen {
template<typename Decomposition, typename RhsType, typename StorageKind> class SolveImpl; template<typename Decomposition, typename RhsType, typename StorageKind> class SolveImpl;
/** \class Solve /** \class Solve
* \ingroup Core_Module * \ingroup Core_Module
* *
@ -64,13 +64,13 @@ class Solve : public SolveImpl<Decomposition,RhsType,typename internal::traits<R
public: public:
typedef typename internal::traits<Solve>::PlainObject PlainObject; typedef typename internal::traits<Solve>::PlainObject PlainObject;
typedef typename internal::traits<Solve>::StorageIndex StorageIndex; typedef typename internal::traits<Solve>::StorageIndex StorageIndex;
Solve(const Decomposition &dec, const RhsType &rhs) Solve(const Decomposition &dec, const RhsType &rhs)
: m_dec(dec), m_rhs(rhs) : m_dec(dec), m_rhs(rhs)
{} {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dec.cols(); } EIGEN_DEVICE_FUNC Index rows() const { return m_dec.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } EIGEN_DEVICE_FUNC Index cols() const { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; } EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; }
EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; } EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; }
@ -87,14 +87,14 @@ class SolveImpl<Decomposition,RhsType,Dense>
: public MatrixBase<Solve<Decomposition,RhsType> > : public MatrixBase<Solve<Decomposition,RhsType> >
{ {
typedef Solve<Decomposition,RhsType> Derived; typedef Solve<Decomposition,RhsType> Derived;
public: public:
typedef MatrixBase<Solve<Decomposition,RhsType> > Base; typedef MatrixBase<Solve<Decomposition,RhsType> > Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Derived) EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
private: private:
Scalar coeff(Index row, Index col) const; Scalar coeff(Index row, Index col) const;
Scalar coeff(Index i) const; Scalar coeff(Index i) const;
}; };
@ -119,15 +119,15 @@ struct evaluator<Solve<Decomposition,RhsType> >
typedef evaluator<PlainObject> Base; typedef evaluator<PlainObject> Base;
enum { Flags = Base::Flags | EvalBeforeNestingBit }; enum { Flags = Base::Flags | EvalBeforeNestingBit };
EIGEN_DEVICE_FUNC explicit evaluator(const SolveType& solve) EIGEN_DEVICE_FUNC explicit evaluator(const SolveType& solve)
: m_result(solve.rows(), solve.cols()) : m_result(solve.rows(), solve.cols())
{ {
::new (static_cast<Base*>(this)) Base(m_result); ::new (static_cast<Base*>(this)) Base(m_result);
solve.dec()._solve_impl(solve.rhs(), m_result); solve.dec()._solve_impl(solve.rhs(), m_result);
} }
protected: protected:
PlainObject m_result; PlainObject m_result;
}; };
@ -176,7 +176,7 @@ struct Assignment<DstXprType, Solve<CwiseUnaryOp<internal::scalar_conjugate_op<t
Index dstCols = src.cols(); Index dstCols = src.cols();
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
dst.resize(dstRows, dstCols); dst.resize(dstRows, dstCols);
src.dec().nestedExpression().nestedExpression().template _solve_impl_transposed<true>(src.rhs(), dst); src.dec().nestedExpression().nestedExpression().template _solve_impl_transposed<true>(src.rhs(), dst);
} }
}; };

View File

@ -213,8 +213,8 @@ template<int Side, typename TriangularType, typename Rhs> struct triangular_solv
: m_triangularMatrix(tri), m_rhs(rhs) : m_triangularMatrix(tri), m_rhs(rhs)
{} {}
inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_rhs.rows(); } inline Index rows() const { return m_rhs.rows(); }
inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } inline Index cols() const { return m_rhs.cols(); }
template<typename Dest> inline void evalTo(Dest& dst) const template<typename Dest> inline void evalTo(Dest& dst) const
{ {

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_STRIDE_H #ifndef EIGEN_STRIDE_H
#define EIGEN_STRIDE_H #define EIGEN_STRIDE_H
namespace Eigen { namespace Eigen {
/** \class Stride /** \class Stride
* \ingroup Core_Module * \ingroup Core_Module
@ -26,7 +26,7 @@ namespace Eigen {
* *
* The outer stride is the pointer increment between two consecutive rows of a row-major matrix or * The outer stride is the pointer increment between two consecutive rows of a row-major matrix or
* between two consecutive columns of a column-major matrix. * between two consecutive columns of a column-major matrix.
* *
* These two values can be passed either at compile-time as template parameters, or at runtime as * These two values can be passed either at compile-time as template parameters, or at runtime as
* arguments to the constructor. * arguments to the constructor.
* *
@ -41,7 +41,7 @@ namespace Eigen {
* Both strides can be negative, however, a negative stride of -1 cannot be specified at compiletime * Both strides can be negative, however, a negative stride of -1 cannot be specified at compiletime
* because of the ambiguity with Dynamic which is defined to -1 (historically, negative strides were * because of the ambiguity with Dynamic which is defined to -1 (historically, negative strides were
* not allowed). * not allowed).
* *
* \sa class InnerStride, class OuterStride, \ref TopicStorageOrders * \sa class InnerStride, class OuterStride, \ref TopicStorageOrders
*/ */
template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime> template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
@ -78,10 +78,10 @@ class Stride
{} {}
/** \returns the outer stride */ /** \returns the outer stride */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outer() const { return m_outer.value(); } inline Index outer() const { return m_outer.value(); }
/** \returns the inner stride */ /** \returns the inner stride */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index inner() const { return m_inner.value(); } inline Index inner() const { return m_inner.value(); }
protected: protected:

View File

@ -11,7 +11,7 @@
#ifndef EIGEN_TRANSPOSE_H #ifndef EIGEN_TRANSPOSE_H
#define EIGEN_TRANSPOSE_H #define EIGEN_TRANSPOSE_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<typename MatrixType> template<typename MatrixType>
@ -65,10 +65,10 @@ template<typename MatrixType> class Transpose
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index rows() const EIGEN_NOEXCEPT { return m_matrix.cols(); } Index rows() const { return m_matrix.cols(); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index cols() const EIGEN_NOEXCEPT { return m_matrix.rows(); } Index cols() const { return m_matrix.rows(); }
/** \returns the nested expression */ /** \returns the nested expression */
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
@ -336,7 +336,7 @@ struct inplace_transpose_selector<MatrixType,false,MatchPacketSize> { // non squ
* Notice however that this method is only useful if you want to replace a matrix by its own transpose. * Notice however that this method is only useful if you want to replace a matrix by its own transpose.
* If you just need the transpose of a matrix, use transpose(). * If you just need the transpose of a matrix, use transpose().
* *
* \note if the matrix is not square, then \c *this must be a resizable matrix. * \note if the matrix is not square, then \c *this must be a resizable matrix.
* This excludes (non-square) fixed-size matrices, block-expressions and maps. * This excludes (non-square) fixed-size matrices, block-expressions and maps.
* *
* \sa transpose(), adjoint(), adjointInPlace() */ * \sa transpose(), adjoint(), adjointInPlace() */

View File

@ -349,12 +349,12 @@ class Transpose<TranspositionsBase<TranspositionsDerived> >
explicit Transpose(const TranspositionType& t) : m_transpositions(t) {} explicit Transpose(const TranspositionType& t) : m_transpositions(t) {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index size() const EIGEN_NOEXCEPT { return m_transpositions.size(); } Index size() const { return m_transpositions.size(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index rows() const EIGEN_NOEXCEPT { return m_transpositions.size(); } Index rows() const { return m_transpositions.size(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index cols() const EIGEN_NOEXCEPT { return m_transpositions.size(); } Index cols() const { return m_transpositions.size(); }
/** \returns the \a matrix with the inverse transpositions applied to the columns. /** \returns the \a matrix with the inverse transpositions applied to the columns.
*/ */

View File

@ -11,12 +11,12 @@
#ifndef EIGEN_TRIANGULARMATRIX_H #ifndef EIGEN_TRIANGULARMATRIX_H
#define EIGEN_TRIANGULARMATRIX_H #define EIGEN_TRIANGULARMATRIX_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<int Side, typename TriangularType, typename Rhs> struct triangular_solve_retval; template<int Side, typename TriangularType, typename Rhs> struct triangular_solve_retval;
} }
/** \class TriangularBase /** \class TriangularBase
@ -34,16 +34,16 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime, ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime, MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime, MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime, SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
internal::traits<Derived>::ColsAtCompileTime>::ret), internal::traits<Derived>::ColsAtCompileTime>::ret),
/**< This is equal to the number of coefficients, i.e. the number of /**< This is equal to the number of coefficients, i.e. the number of
* rows times the number of columns, or to \a Dynamic if this is not * rows times the number of columns, or to \a Dynamic if this is not
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */ * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime, MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
internal::traits<Derived>::MaxColsAtCompileTime>::ret) internal::traits<Derived>::MaxColsAtCompileTime>::ret)
}; };
typedef typename internal::traits<Derived>::Scalar Scalar; typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename internal::traits<Derived>::StorageKind StorageKind; typedef typename internal::traits<Derived>::StorageKind StorageKind;
@ -55,15 +55,15 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); } inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const EIGEN_NOEXCEPT { return derived().rows(); } inline Index rows() const { return derived().rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return derived().cols(); } inline Index cols() const { return derived().cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index outerStride() const EIGEN_NOEXCEPT { return derived().outerStride(); } inline Index outerStride() const { return derived().outerStride(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index innerStride() const EIGEN_NOEXCEPT { return derived().innerStride(); } inline Index innerStride() const { return derived().innerStride(); }
// dummy resize function // dummy resize function
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
void resize(Index rows, Index cols) void resize(Index rows, Index cols)
@ -156,7 +156,7 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
* \param MatrixType the type of the object in which we are taking the triangular part * \param MatrixType the type of the object in which we are taking the triangular part
* \param Mode the kind of triangular matrix expression to construct. Can be #Upper, * \param Mode the kind of triangular matrix expression to construct. Can be #Upper,
* #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower. * #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower.
* This is in fact a bit field; it must have either #Upper or #Lower, * This is in fact a bit field; it must have either #Upper or #Lower,
* and additionally it may have #UnitDiag or #ZeroDiag or neither. * and additionally it may have #UnitDiag or #ZeroDiag or neither.
* *
* This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular * This class represents a triangular part of a matrix, not necessarily square. Strictly speaking, for rectangular
@ -199,7 +199,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType; typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
typedef TriangularView<typename internal::add_const<MatrixType>::type, _Mode> ConstTriangularView; typedef TriangularView<typename internal::add_const<MatrixType>::type, _Mode> ConstTriangularView;
public: public:
typedef typename internal::traits<TriangularView>::StorageKind StorageKind; typedef typename internal::traits<TriangularView>::StorageKind StorageKind;
@ -218,15 +218,15 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
explicit inline TriangularView(MatrixType& matrix) : m_matrix(matrix) explicit inline TriangularView(MatrixType& matrix) : m_matrix(matrix)
{} {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(TriangularView) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(TriangularView)
/** \copydoc EigenBase::rows() */ /** \copydoc EigenBase::rows() */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } inline Index rows() const { return m_matrix.rows(); }
/** \copydoc EigenBase::cols() */ /** \copydoc EigenBase::cols() */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } inline Index cols() const { return m_matrix.cols(); }
/** \returns a const reference to the nested expression */ /** \returns a const reference to the nested expression */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
@ -235,7 +235,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
/** \returns a reference to the nested expression */ /** \returns a reference to the nested expression */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
NestedExpression& nestedExpression() { return m_matrix; } NestedExpression& nestedExpression() { return m_matrix; }
typedef TriangularView<const MatrixConjugateReturnType,Mode> ConjugateReturnType; typedef TriangularView<const MatrixConjugateReturnType,Mode> ConjugateReturnType;
/** \sa MatrixBase::conjugate() const */ /** \sa MatrixBase::conjugate() const */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
@ -269,7 +269,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
typename MatrixType::TransposeReturnType tmp(m_matrix); typename MatrixType::TransposeReturnType tmp(m_matrix);
return TransposeReturnType(tmp); return TransposeReturnType(tmp);
} }
typedef TriangularView<const typename MatrixType::ConstTransposeReturnType,TransposeMode> ConstTransposeReturnType; typedef TriangularView<const typename MatrixType::ConstTransposeReturnType,TransposeMode> ConstTransposeReturnType;
/** \sa MatrixBase::transpose() const */ /** \sa MatrixBase::transpose() const */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
@ -280,10 +280,10 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
template<typename Other> template<typename Other>
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline const Solve<TriangularView, Other> inline const Solve<TriangularView, Other>
solve(const MatrixBase<Other>& other) const solve(const MatrixBase<Other>& other) const
{ return Solve<TriangularView, Other>(*this, other.derived()); } { return Solve<TriangularView, Other>(*this, other.derived()); }
// workaround MSVC ICE // workaround MSVC ICE
#if EIGEN_COMP_MSVC #if EIGEN_COMP_MSVC
template<int Side, typename Other> template<int Side, typename Other>
@ -327,7 +327,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
else else
return m_matrix.diagonal().prod(); return m_matrix.diagonal().prod();
} }
protected: protected:
MatrixTypeNested m_matrix; MatrixTypeNested m_matrix;
@ -389,7 +389,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularViewImpl<_Mat
internal::call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op<Scalar,typename Other::Scalar>()); internal::call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op<Scalar,typename Other::Scalar>());
return derived(); return derived();
} }
/** \sa MatrixBase::operator*=() */ /** \sa MatrixBase::operator*=() */
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
TriangularViewType& operator*=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = derived().nestedExpression() * other; } TriangularViewType& operator*=(const typename internal::traits<MatrixType>::Scalar& other) { return *this = derived().nestedExpression() * other; }
@ -715,7 +715,7 @@ bool MatrixBase<Derived>::isLowerTriangular(const RealScalar& prec) const
namespace internal { namespace internal {
// TODO currently a triangular expression has the form TriangularView<.,.> // TODO currently a triangular expression has the form TriangularView<.,.>
// in the future triangular-ness should be defined by the expression traits // in the future triangular-ness should be defined by the expression traits
// such that Transpose<TriangularView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make it work) // such that Transpose<TriangularView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make it work)
@ -744,7 +744,7 @@ struct Dense2Triangular {};
template<typename Kernel, unsigned int Mode, int UnrollCount, bool ClearOpposite> struct triangular_assignment_loop; template<typename Kernel, unsigned int Mode, int UnrollCount, bool ClearOpposite> struct triangular_assignment_loop;
/** \internal Specialization of the dense assignment kernel for triangular matrices. /** \internal Specialization of the dense assignment kernel for triangular matrices.
* The main difference is that the triangular, diagonal, and opposite parts are processed through three different functions. * The main difference is that the triangular, diagonal, and opposite parts are processed through three different functions.
* \tparam UpLo must be either Lower or Upper * \tparam UpLo must be either Lower or Upper
@ -761,17 +761,17 @@ protected:
using Base::m_src; using Base::m_src;
using Base::m_functor; using Base::m_functor;
public: public:
typedef typename Base::DstEvaluatorType DstEvaluatorType; typedef typename Base::DstEvaluatorType DstEvaluatorType;
typedef typename Base::SrcEvaluatorType SrcEvaluatorType; typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
typedef typename Base::Scalar Scalar; typedef typename Base::Scalar Scalar;
typedef typename Base::AssignmentTraits AssignmentTraits; typedef typename Base::AssignmentTraits AssignmentTraits;
EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr) EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr)
: Base(dst, src, func, dstExpr) : Base(dst, src, func, dstExpr)
{} {}
#ifdef EIGEN_INTERNAL_DEBUGGING #ifdef EIGEN_INTERNAL_DEBUGGING
EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col) EIGEN_DEVICE_FUNC void assignCoeff(Index row, Index col)
{ {
@ -781,16 +781,16 @@ public:
#else #else
using Base::assignCoeff; using Base::assignCoeff;
#endif #endif
EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id) EIGEN_DEVICE_FUNC void assignDiagonalCoeff(Index id)
{ {
if(Mode==UnitDiag && SetOpposite) m_functor.assignCoeff(m_dst.coeffRef(id,id), Scalar(1)); if(Mode==UnitDiag && SetOpposite) m_functor.assignCoeff(m_dst.coeffRef(id,id), Scalar(1));
else if(Mode==ZeroDiag && SetOpposite) m_functor.assignCoeff(m_dst.coeffRef(id,id), Scalar(0)); else if(Mode==ZeroDiag && SetOpposite) m_functor.assignCoeff(m_dst.coeffRef(id,id), Scalar(0));
else if(Mode==0) Base::assignCoeff(id,id); else if(Mode==0) Base::assignCoeff(id,id);
} }
EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index row, Index col) EIGEN_DEVICE_FUNC void assignOppositeCoeff(Index row, Index col)
{ {
eigen_internal_assert(row!=col); eigen_internal_assert(row!=col);
if(SetOpposite) if(SetOpposite)
m_functor.assignCoeff(m_dst.coeffRef(row,col), Scalar(0)); m_functor.assignCoeff(m_dst.coeffRef(row,col), Scalar(0));
@ -811,17 +811,17 @@ void call_triangular_assignment_loop(DstXprType& dst, const SrcXprType& src, con
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
dst.resize(dstRows, dstCols); dst.resize(dstRows, dstCols);
DstEvaluatorType dstEvaluator(dst); DstEvaluatorType dstEvaluator(dst);
typedef triangular_dense_assignment_kernel< Mode&(Lower|Upper),Mode&(UnitDiag|ZeroDiag|SelfAdjoint),SetOpposite, typedef triangular_dense_assignment_kernel< Mode&(Lower|Upper),Mode&(UnitDiag|ZeroDiag|SelfAdjoint),SetOpposite,
DstEvaluatorType,SrcEvaluatorType,Functor> Kernel; DstEvaluatorType,SrcEvaluatorType,Functor> Kernel;
Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived());
enum { enum {
unroll = DstXprType::SizeAtCompileTime != Dynamic unroll = DstXprType::SizeAtCompileTime != Dynamic
&& SrcEvaluatorType::CoeffReadCost < HugeCost && SrcEvaluatorType::CoeffReadCost < HugeCost
&& DstXprType::SizeAtCompileTime * (DstEvaluatorType::CoeffReadCost+SrcEvaluatorType::CoeffReadCost) / 2 <= EIGEN_UNROLLING_LIMIT && DstXprType::SizeAtCompileTime * (DstEvaluatorType::CoeffReadCost+SrcEvaluatorType::CoeffReadCost) / 2 <= EIGEN_UNROLLING_LIMIT
}; };
triangular_assignment_loop<Kernel, Mode, unroll ? int(DstXprType::SizeAtCompileTime) : Dynamic, SetOpposite>::run(kernel); triangular_assignment_loop<Kernel, Mode, unroll ? int(DstXprType::SizeAtCompileTime) : Dynamic, SetOpposite>::run(kernel);
} }
@ -843,8 +843,8 @@ struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Triangular>
EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func) EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
{ {
eigen_assert(int(DstXprType::Mode) == int(SrcXprType::Mode)); eigen_assert(int(DstXprType::Mode) == int(SrcXprType::Mode));
call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func); call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
} }
}; };
@ -853,7 +853,7 @@ struct Assignment<DstXprType, SrcXprType, Functor, Triangular2Dense>
{ {
EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func) EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
{ {
call_triangular_assignment_loop<SrcXprType::Mode, (SrcXprType::Mode&SelfAdjoint)==0>(dst, src, func); call_triangular_assignment_loop<SrcXprType::Mode, (SrcXprType::Mode&SelfAdjoint)==0>(dst, src, func);
} }
}; };
@ -862,7 +862,7 @@ struct Assignment<DstXprType, SrcXprType, Functor, Dense2Triangular>
{ {
EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func) EIGEN_DEVICE_FUNC static void run(DstXprType &dst, const SrcXprType &src, const Functor &func)
{ {
call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func); call_triangular_assignment_loop<DstXprType::Mode, false>(dst, src, func);
} }
}; };
@ -873,19 +873,19 @@ struct triangular_assignment_loop
// FIXME: this is not very clean, perhaps this information should be provided by the kernel? // FIXME: this is not very clean, perhaps this information should be provided by the kernel?
typedef typename Kernel::DstEvaluatorType DstEvaluatorType; typedef typename Kernel::DstEvaluatorType DstEvaluatorType;
typedef typename DstEvaluatorType::XprType DstXprType; typedef typename DstEvaluatorType::XprType DstXprType;
enum { enum {
col = (UnrollCount-1) / DstXprType::RowsAtCompileTime, col = (UnrollCount-1) / DstXprType::RowsAtCompileTime,
row = (UnrollCount-1) % DstXprType::RowsAtCompileTime row = (UnrollCount-1) % DstXprType::RowsAtCompileTime
}; };
typedef typename Kernel::Scalar Scalar; typedef typename Kernel::Scalar Scalar;
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
static inline void run(Kernel &kernel) static inline void run(Kernel &kernel)
{ {
triangular_assignment_loop<Kernel, Mode, UnrollCount-1, SetOpposite>::run(kernel); triangular_assignment_loop<Kernel, Mode, UnrollCount-1, SetOpposite>::run(kernel);
if(row==col) if(row==col)
kernel.assignDiagonalCoeff(row); kernel.assignDiagonalCoeff(row);
else if( ((Mode&Lower) && row>col) || ((Mode&Upper) && row<col) ) else if( ((Mode&Lower) && row>col) || ((Mode&Upper) && row<col) )
@ -928,10 +928,10 @@ struct triangular_assignment_loop<Kernel, Mode, Dynamic, SetOpposite>
} }
else else
i = maxi; i = maxi;
if(i<kernel.rows()) // then i==j if(i<kernel.rows()) // then i==j
kernel.assignDiagonalCoeff(i++); kernel.assignDiagonalCoeff(i++);
if (((Mode&Upper) && SetOpposite) || (Mode&Lower)) if (((Mode&Upper) && SetOpposite) || (Mode&Lower))
{ {
for(; i < kernel.rows(); ++i) for(; i < kernel.rows(); ++i)
@ -955,7 +955,7 @@ EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDeriv
} }
namespace internal { namespace internal {
// Triangular = Product // Triangular = Product
template< typename DstXprType, typename Lhs, typename Rhs, typename Scalar> template< typename DstXprType, typename Lhs, typename Rhs, typename Scalar>
struct Assignment<DstXprType, Product<Lhs,Rhs,DefaultProduct>, internal::assign_op<Scalar,typename Product<Lhs,Rhs,DefaultProduct>::Scalar>, Dense2Triangular> struct Assignment<DstXprType, Product<Lhs,Rhs,DefaultProduct>, internal::assign_op<Scalar,typename Product<Lhs,Rhs,DefaultProduct>::Scalar>, Dense2Triangular>

View File

@ -65,10 +65,10 @@ class PartialReduxExpr : public internal::dense_xpr_base< PartialReduxExpr<Matri
explicit PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp()) explicit PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp())
: m_matrix(mat), m_functor(func) {} : m_matrix(mat), m_functor(func) {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index rows() const EIGEN_NOEXCEPT { return (Direction==Vertical ? 1 : m_matrix.rows()); } Index rows() const { return (Direction==Vertical ? 1 : m_matrix.rows()); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index cols() const EIGEN_NOEXCEPT { return (Direction==Horizontal ? 1 : m_matrix.cols()); } Index cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
typename MatrixType::Nested nestedExpression() const { return m_matrix; } typename MatrixType::Nested nestedExpression() const { return m_matrix; }
@ -134,7 +134,7 @@ struct member_redux {
typedef typename result_of< typedef typename result_of<
BinaryOp(const Scalar&,const Scalar&) BinaryOp(const Scalar&,const Scalar&)
>::type result_type; >::type result_type;
enum { Vectorizable = functor_traits<BinaryOp>::PacketAccess }; enum { Vectorizable = functor_traits<BinaryOp>::PacketAccess };
template<int Size> struct Cost { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; }; template<int Size> struct Cost { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; };
EIGEN_DEVICE_FUNC explicit member_redux(const BinaryOp func) : m_functor(func) {} EIGEN_DEVICE_FUNC explicit member_redux(const BinaryOp func) : m_functor(func) {}
@ -162,17 +162,17 @@ struct member_redux {
* where `foo` is any method of `VectorwiseOp`. This expression is equivalent to applying `foo()` to each * where `foo` is any method of `VectorwiseOp`. This expression is equivalent to applying `foo()` to each
* column of `A` and then re-assemble the outputs in a matrix expression: * column of `A` and then re-assemble the outputs in a matrix expression:
* \code [A.col(0).foo(), A.col(1).foo(), ..., A.col(A.cols()-1).foo()] \endcode * \code [A.col(0).foo(), A.col(1).foo(), ..., A.col(A.cols()-1).foo()] \endcode
* *
* Example: \include MatrixBase_colwise.cpp * Example: \include MatrixBase_colwise.cpp
* Output: \verbinclude MatrixBase_colwise.out * Output: \verbinclude MatrixBase_colwise.out
* *
* The begin() and end() methods are obviously exceptions to the previous rule as they * The begin() and end() methods are obviously exceptions to the previous rule as they
* return STL-compatible begin/end iterators to the rows or columns of the nested expression. * return STL-compatible begin/end iterators to the rows or columns of the nested expression.
* Typical use cases include for-range-loop and calls to STL algorithms: * Typical use cases include for-range-loop and calls to STL algorithms:
* *
* Example: \include MatrixBase_colwise_iterator_cxx11.cpp * Example: \include MatrixBase_colwise_iterator_cxx11.cpp
* Output: \verbinclude MatrixBase_colwise_iterator_cxx11.out * Output: \verbinclude MatrixBase_colwise_iterator_cxx11.out
* *
* For a partial reduction on an empty input, some rules apply. * For a partial reduction on an empty input, some rules apply.
* For the sake of clarity, let's consider a vertical reduction: * For the sake of clarity, let's consider a vertical reduction:
* - If the number of columns is zero, then a 1x0 row-major vector expression is returned. * - If the number of columns is zero, then a 1x0 row-major vector expression is returned.
@ -180,7 +180,7 @@ struct member_redux {
* - a row vector of zeros is returned for sum-like reductions (sum, squaredNorm, norm, etc.) * - a row vector of zeros is returned for sum-like reductions (sum, squaredNorm, norm, etc.)
* - a row vector of ones is returned for a product reduction (e.g., <code>MatrixXd(n,0).colwise().prod()</code>) * - a row vector of ones is returned for a product reduction (e.g., <code>MatrixXd(n,0).colwise().prod()</code>)
* - an assert is triggered for all other reductions (minCoeff,maxCoeff,redux(bin_op)) * - an assert is triggered for all other reductions (minCoeff,maxCoeff,redux(bin_op))
* *
* \sa DenseBase::colwise(), DenseBase::rowwise(), class PartialReduxExpr * \sa DenseBase::colwise(), DenseBase::rowwise(), class PartialReduxExpr
*/ */
template<typename ExpressionType, int Direction> class VectorwiseOp template<typename ExpressionType, int Direction> class VectorwiseOp
@ -216,7 +216,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
}; };
protected: protected:
template<typename OtherDerived> struct ExtendedType { template<typename OtherDerived> struct ExtendedType {
typedef Replicate<OtherDerived, typedef Replicate<OtherDerived,
isVertical ? 1 : ExpressionType::RowsAtCompileTime, isVertical ? 1 : ExpressionType::RowsAtCompileTime,
@ -328,7 +328,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* *
* \warning the size along the reduction direction must be strictly positive, * \warning the size along the reduction direction must be strictly positive,
* otherwise an assertion is triggered. * otherwise an assertion is triggered.
* *
* \sa class VectorwiseOp, DenseBase::colwise(), DenseBase::rowwise() * \sa class VectorwiseOp, DenseBase::colwise(), DenseBase::rowwise()
*/ */
template<typename BinaryOp> template<typename BinaryOp>
@ -365,7 +365,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* *
* \warning the size along the reduction direction must be strictly positive, * \warning the size along the reduction direction must be strictly positive,
* otherwise an assertion is triggered. * otherwise an assertion is triggered.
* *
* \warning the result is undefined if \c *this contains NaN. * \warning the result is undefined if \c *this contains NaN.
* *
* Example: \include PartialRedux_minCoeff.cpp * Example: \include PartialRedux_minCoeff.cpp
@ -384,7 +384,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
* *
* \warning the size along the reduction direction must be strictly positive, * \warning the size along the reduction direction must be strictly positive,
* otherwise an assertion is triggered. * otherwise an assertion is triggered.
* *
* \warning the result is undefined if \c *this contains NaN. * \warning the result is undefined if \c *this contains NaN.
* *
* Example: \include PartialRedux_maxCoeff.cpp * Example: \include PartialRedux_maxCoeff.cpp

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_VISITOR_H #ifndef EIGEN_VISITOR_H
#define EIGEN_VISITOR_H #define EIGEN_VISITOR_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
@ -70,22 +70,22 @@ class visitor_evaluator
public: public:
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
explicit visitor_evaluator(const XprType &xpr) : m_evaluator(xpr), m_xpr(xpr) {} explicit visitor_evaluator(const XprType &xpr) : m_evaluator(xpr), m_xpr(xpr) {}
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
enum { enum {
RowsAtCompileTime = XprType::RowsAtCompileTime, RowsAtCompileTime = XprType::RowsAtCompileTime,
CoeffReadCost = internal::evaluator<XprType>::CoeffReadCost CoeffReadCost = internal::evaluator<XprType>::CoeffReadCost
}; };
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_xpr.rows(); } EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_xpr.cols(); } EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { return m_xpr.size(); } EIGEN_DEVICE_FUNC Index size() const { return m_xpr.size(); }
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const
{ return m_evaluator.coeff(row, col); } { return m_evaluator.coeff(row, col); }
protected: protected:
internal::evaluator<XprType> m_evaluator; internal::evaluator<XprType> m_evaluator;
const XprType &m_xpr; const XprType &m_xpr;
@ -106,7 +106,7 @@ protected:
* *
* \note compared to one or two \em for \em loops, visitors offer automatic * \note compared to one or two \em for \em loops, visitors offer automatic
* unrolling for small fixed size matrix. * unrolling for small fixed size matrix.
* *
* \note if the matrix is empty, then the visitor is left unchanged. * \note if the matrix is empty, then the visitor is left unchanged.
* *
* \sa minCoeff(Index*,Index*), maxCoeff(Index*,Index*), DenseBase::redux() * \sa minCoeff(Index*,Index*), maxCoeff(Index*,Index*), DenseBase::redux()
@ -118,10 +118,10 @@ void DenseBase<Derived>::visit(Visitor& visitor) const
{ {
if(size()==0) if(size()==0)
return; return;
typedef typename internal::visitor_evaluator<Derived> ThisEvaluator; typedef typename internal::visitor_evaluator<Derived> ThisEvaluator;
ThisEvaluator thisEval(derived()); ThisEvaluator thisEval(derived());
enum { enum {
unroll = SizeAtCompileTime != Dynamic unroll = SizeAtCompileTime != Dynamic
&& SizeAtCompileTime * ThisEvaluator::CoeffReadCost + (SizeAtCompileTime-1) * internal::functor_traits<Visitor>::Cost <= EIGEN_UNROLLING_LIMIT && SizeAtCompileTime * ThisEvaluator::CoeffReadCost + (SizeAtCompileTime-1) * internal::functor_traits<Visitor>::Cost <= EIGEN_UNROLLING_LIMIT
@ -188,7 +188,7 @@ struct functor_traits<min_coeff_visitor<Scalar> > {
template <typename Derived> template <typename Derived>
struct max_coeff_visitor : coeff_visitor<Derived> struct max_coeff_visitor : coeff_visitor<Derived>
{ {
typedef typename Derived::Scalar Scalar; typedef typename Derived::Scalar Scalar;
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
void operator() (const Scalar& value, Index i, Index j) void operator() (const Scalar& value, Index i, Index j)
{ {
@ -212,9 +212,9 @@ struct functor_traits<max_coeff_visitor<Scalar> > {
/** \fn DenseBase<Derived>::minCoeff(IndexType* rowId, IndexType* colId) const /** \fn DenseBase<Derived>::minCoeff(IndexType* rowId, IndexType* colId) const
* \returns the minimum of all coefficients of *this and puts in *row and *col its location. * \returns the minimum of all coefficients of *this and puts in *row and *col its location.
* *
* \warning the matrix must be not empty, otherwise an assertion is triggered. * \warning the matrix must be not empty, otherwise an assertion is triggered.
* *
* \warning the result is undefined if \c *this contains NaN. * \warning the result is undefined if \c *this contains NaN.
* *
* \sa DenseBase::minCoeff(Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visit(), DenseBase::minCoeff() * \sa DenseBase::minCoeff(Index*), DenseBase::maxCoeff(Index*,Index*), DenseBase::visit(), DenseBase::minCoeff()
@ -235,10 +235,10 @@ DenseBase<Derived>::minCoeff(IndexType* rowId, IndexType* colId) const
} }
/** \returns the minimum of all coefficients of *this and puts in *index its location. /** \returns the minimum of all coefficients of *this and puts in *index its location.
* *
* \warning the matrix must be not empty, otherwise an assertion is triggered. * \warning the matrix must be not empty, otherwise an assertion is triggered.
* *
* \warning the result is undefined if \c *this contains NaN. * \warning the result is undefined if \c *this contains NaN.
* *
* \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::visit(), DenseBase::minCoeff() * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::maxCoeff(IndexType*,IndexType*), DenseBase::visit(), DenseBase::minCoeff()
*/ */
@ -259,10 +259,10 @@ DenseBase<Derived>::minCoeff(IndexType* index) const
/** \fn DenseBase<Derived>::maxCoeff(IndexType* rowId, IndexType* colId) const /** \fn DenseBase<Derived>::maxCoeff(IndexType* rowId, IndexType* colId) const
* \returns the maximum of all coefficients of *this and puts in *row and *col its location. * \returns the maximum of all coefficients of *this and puts in *row and *col its location.
* *
* \warning the matrix must be not empty, otherwise an assertion is triggered. * \warning the matrix must be not empty, otherwise an assertion is triggered.
* *
* \warning the result is undefined if \c *this contains NaN. * \warning the result is undefined if \c *this contains NaN.
* *
* \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visit(), DenseBase::maxCoeff() * \sa DenseBase::minCoeff(IndexType*,IndexType*), DenseBase::visit(), DenseBase::maxCoeff()
*/ */
@ -282,7 +282,7 @@ DenseBase<Derived>::maxCoeff(IndexType* rowPtr, IndexType* colPtr) const
} }
/** \returns the maximum of all coefficients of *this and puts in *index its location. /** \returns the maximum of all coefficients of *this and puts in *index its location.
* *
* \warning the matrix must be not empty, otherwise an assertion is triggered. * \warning the matrix must be not empty, otherwise an assertion is triggered.
* *
* \warning the result is undefined if \c *this contains NaN. * \warning the result is undefined if \c *this contains NaN.

View File

@ -78,7 +78,7 @@ template<typename T, typename EnableIf = void> struct get_compile_time_incr {
// Analogue of std::get<0>(x), but tailored for our needs. // Analogue of std::get<0>(x), but tailored for our needs.
template<typename T> template<typename T>
EIGEN_CONSTEXPR Index first(const T& x) EIGEN_NOEXCEPT { return x.first(); } Index first(const T& x) { return x.first(); }
// IndexedViewCompatibleType/makeIndexedViewCompatible turn an arbitrary object of type T into something usable by MatrixSlice // IndexedViewCompatibleType/makeIndexedViewCompatible turn an arbitrary object of type T into something usable by MatrixSlice
// The generic implementation is a no-op // The generic implementation is a no-op
@ -100,8 +100,8 @@ struct SingleRange {
}; };
SingleRange(Index val) : m_value(val) {} SingleRange(Index val) : m_value(val) {}
Index operator[](Index) const { return m_value; } Index operator[](Index) const { return m_value; }
static EIGEN_CONSTEXPR Index size() EIGEN_NOEXCEPT { return 1; } Index size() const { return 1; }
Index first() const EIGEN_NOEXCEPT { return m_value; } Index first() const { return m_value; }
Index m_value; Index m_value;
}; };
@ -141,9 +141,9 @@ template<int XprSize>
struct AllRange { struct AllRange {
enum { SizeAtCompileTime = XprSize }; enum { SizeAtCompileTime = XprSize };
AllRange(Index size = XprSize) : m_size(size) {} AllRange(Index size = XprSize) : m_size(size) {}
EIGEN_CONSTEXPR Index operator[](Index i) const EIGEN_NOEXCEPT { return i; } Index operator[](Index i) const { return i; }
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { return m_size.value(); } Index size() const { return m_size.value(); }
EIGEN_CONSTEXPR Index first() const EIGEN_NOEXCEPT { return 0; } Index first() const { return 0; }
variable_if_dynamic<Index,XprSize> m_size; variable_if_dynamic<Index,XprSize> m_size;
}; };

View File

@ -52,7 +52,7 @@ template<int N> class FixedInt
{ {
public: public:
static const int value = N; static const int value = N;
EIGEN_CONSTEXPR operator int() const { return value; } operator int() const { return value; }
FixedInt() {} FixedInt() {}
FixedInt( VariableAndFixedInt<N> other) { FixedInt( VariableAndFixedInt<N> other) {
#ifndef EIGEN_INTERNAL_DEBUGGING #ifndef EIGEN_INTERNAL_DEBUGGING

View File

@ -286,7 +286,7 @@ namespace device {
template<typename T> struct numeric_limits template<typename T> struct numeric_limits
{ {
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR T epsilon() { return 0; } static T epsilon() { return 0; }
static T (max)() { assert(false && "Highest not supported for this type"); } static T (max)() { assert(false && "Highest not supported for this type"); }
static T (min)() { assert(false && "Lowest not supported for this type"); } static T (min)() { assert(false && "Lowest not supported for this type"); }
static T infinity() { assert(false && "Infinity not supported for this type"); } static T infinity() { assert(false && "Infinity not supported for this type"); }
@ -294,9 +294,9 @@ template<typename T> struct numeric_limits
}; };
template<> struct numeric_limits<float> template<> struct numeric_limits<float>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static float epsilon() { return __FLT_EPSILON__; } static float epsilon() { return __FLT_EPSILON__; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static float (max)() { static float (max)() {
#if defined(EIGEN_CUDA_ARCH) #if defined(EIGEN_CUDA_ARCH)
return CUDART_MAX_NORMAL_F; return CUDART_MAX_NORMAL_F;
@ -304,9 +304,9 @@ template<> struct numeric_limits<float>
return HIPRT_MAX_NORMAL_F; return HIPRT_MAX_NORMAL_F;
#endif #endif
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static float (min)() { return FLT_MIN; } static float (min)() { return FLT_MIN; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static float infinity() { static float infinity() {
#if defined(EIGEN_CUDA_ARCH) #if defined(EIGEN_CUDA_ARCH)
return CUDART_INF_F; return CUDART_INF_F;
@ -314,7 +314,7 @@ template<> struct numeric_limits<float>
return HIPRT_INF_F; return HIPRT_INF_F;
#endif #endif
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static float quiet_NaN() { static float quiet_NaN() {
#if defined(EIGEN_CUDA_ARCH) #if defined(EIGEN_CUDA_ARCH)
return CUDART_NAN_F; return CUDART_NAN_F;
@ -325,13 +325,13 @@ template<> struct numeric_limits<float>
}; };
template<> struct numeric_limits<double> template<> struct numeric_limits<double>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static double epsilon() { return __DBL_EPSILON__; } static double epsilon() { return __DBL_EPSILON__; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static double (max)() { return DBL_MAX; } static double (max)() { return DBL_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static double (min)() { return DBL_MIN; } static double (min)() { return DBL_MIN; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static double infinity() { static double infinity() {
#if defined(EIGEN_CUDA_ARCH) #if defined(EIGEN_CUDA_ARCH)
return CUDART_INF; return CUDART_INF;
@ -339,7 +339,7 @@ template<> struct numeric_limits<double>
return HIPRT_INF; return HIPRT_INF;
#endif #endif
} }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static double quiet_NaN() { static double quiet_NaN() {
#if defined(EIGEN_CUDA_ARCH) #if defined(EIGEN_CUDA_ARCH)
return CUDART_NAN; return CUDART_NAN;
@ -350,65 +350,65 @@ template<> struct numeric_limits<double>
}; };
template<> struct numeric_limits<int> template<> struct numeric_limits<int>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static int epsilon() { return 0; } static int epsilon() { return 0; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static int (max)() { return INT_MAX; } static int (max)() { return INT_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static int (min)() { return INT_MIN; } static int (min)() { return INT_MIN; }
}; };
template<> struct numeric_limits<unsigned int> template<> struct numeric_limits<unsigned int>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned int epsilon() { return 0; } static unsigned int epsilon() { return 0; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned int (max)() { return UINT_MAX; } static unsigned int (max)() { return UINT_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned int (min)() { return 0; } static unsigned int (min)() { return 0; }
}; };
template<> struct numeric_limits<long> template<> struct numeric_limits<long>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static long epsilon() { return 0; } static long epsilon() { return 0; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static long (max)() { return LONG_MAX; } static long (max)() { return LONG_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static long (min)() { return LONG_MIN; } static long (min)() { return LONG_MIN; }
}; };
template<> struct numeric_limits<unsigned long> template<> struct numeric_limits<unsigned long>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned long epsilon() { return 0; } static unsigned long epsilon() { return 0; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned long (max)() { return ULONG_MAX; } static unsigned long (max)() { return ULONG_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned long (min)() { return 0; } static unsigned long (min)() { return 0; }
}; };
template<> struct numeric_limits<long long> template<> struct numeric_limits<long long>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static long long epsilon() { return 0; } static long long epsilon() { return 0; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static long long (max)() { return LLONG_MAX; } static long long (max)() { return LLONG_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static long long (min)() { return LLONG_MIN; } static long long (min)() { return LLONG_MIN; }
}; };
template<> struct numeric_limits<unsigned long long> template<> struct numeric_limits<unsigned long long>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned long long epsilon() { return 0; } static unsigned long long epsilon() { return 0; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned long long (max)() { return ULLONG_MAX; } static unsigned long long (max)() { return ULLONG_MAX; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static unsigned long long (min)() { return 0; } static unsigned long long (min)() { return 0; }
}; };
template<> struct numeric_limits<bool> template<> struct numeric_limits<bool>
{ {
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static bool epsilon() { return false; } static bool epsilon() { return false; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static bool (max)() { return true; } static bool (max)() { return true; }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
static bool (min)() { return false; } static bool (min)() { return false; }
}; };
@ -476,10 +476,10 @@ template<typename T, std::size_t N> struct array_size<std::array<T,N> > {
* *
*/ */
template<typename T> template<typename T>
EIGEN_CONSTEXPR Index size(const T& x) { return x.size(); } Index size(const T& x) { return x.size(); }
template<typename T,std::size_t N> template<typename T,std::size_t N>
EIGEN_CONSTEXPR Index size(const T (&) [N]) { return N; } Index size(const T (&) [N]) { return N; }
/** \internal /** \internal
* Convenient struct to get the result type of a nullary, unary, binary, or * Convenient struct to get the result type of a nullary, unary, binary, or

View File

@ -65,7 +65,7 @@ class ValueExpr<internal::FixedInt<N> > {
public: public:
ValueExpr() {} ValueExpr() {}
template<typename T> template<typename T>
EIGEN_CONSTEXPR Index eval_impl(const T&) const { return N; } Index eval_impl(const T&) const { return N; }
}; };

View File

@ -131,12 +131,9 @@ template<typename T, int Value> class variable_if_dynamic
public: public:
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(variable_if_dynamic) EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(variable_if_dynamic)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T value() { return T(Value); }
T value() { return T(Value); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator T() const { return T(Value); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T) {}
operator T() const { return T(Value); }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
void setValue(T) {}
}; };
template<typename T> class variable_if_dynamic<T, Dynamic> template<typename T> class variable_if_dynamic<T, Dynamic>
@ -157,10 +154,8 @@ template<typename T, int Value> class variable_if_dynamicindex
public: public:
EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamicindex) EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamicindex)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T value() { return T(Value); }
T value() { return T(Value); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T) {}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
void setValue(T) {}
}; };
template<typename T> class variable_if_dynamicindex<T, DynamicIndex> template<typename T> class variable_if_dynamicindex<T, DynamicIndex>
@ -433,7 +428,7 @@ struct ref_selector
T const&, T const&,
const T const T
>::type type; >::type type;
typedef typename conditional< typedef typename conditional<
bool(traits<T>::Flags & NestByRefBit), bool(traits<T>::Flags & NestByRefBit),
T &, T &,
@ -619,7 +614,7 @@ struct plain_row_type
typedef typename conditional< typedef typename conditional<
is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value, is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
MatrixRowType, MatrixRowType,
ArrayRowType ArrayRowType
>::type type; >::type type;
}; };
@ -634,7 +629,7 @@ struct plain_col_type
typedef typename conditional< typedef typename conditional<
is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value, is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
MatrixColType, MatrixColType,
ArrayColType ArrayColType
>::type type; >::type type;
}; };
@ -650,7 +645,7 @@ struct plain_diag_type
typedef typename conditional< typedef typename conditional<
is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value, is_same< typename traits<ExpressionType>::XprKind, MatrixXpr >::value,
MatrixDiagType, MatrixDiagType,
ArrayDiagType ArrayDiagType
>::type type; >::type type;
}; };
@ -766,7 +761,7 @@ std::string demangle_flags(int f)
if(f&DirectAccessBit) res += " | Direct"; if(f&DirectAccessBit) res += " | Direct";
if(f&NestByRefBit) res += " | NestByRef"; if(f&NestByRefBit) res += " | NestByRef";
if(f&NoPreferredStorageOrderBit) res += " | NoPreferredStorageOrderBit"; if(f&NoPreferredStorageOrderBit) res += " | NoPreferredStorageOrderBit";
return res; return res;
} }
#endif #endif
@ -863,7 +858,7 @@ struct ScalarBinaryOpTraits<void,void,BinaryOp>
#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ #define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \
EIGEN_STATIC_ASSERT((Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<LHS, RHS,BINOP> >::value), \ EIGEN_STATIC_ASSERT((Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<LHS, RHS,BINOP> >::value), \
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
} // end namespace Eigen } // end namespace Eigen
#endif // EIGEN_XPRHELPER_H #endif // EIGEN_XPRHELPER_H

View File

@ -11,10 +11,10 @@
#ifndef EIGEN_TRIDIAGONALIZATION_H #ifndef EIGEN_TRIDIAGONALIZATION_H
#define EIGEN_TRIDIAGONALIZATION_H #define EIGEN_TRIDIAGONALIZATION_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
template<typename MatrixType> struct TridiagonalizationMatrixTReturnType; template<typename MatrixType> struct TridiagonalizationMatrixTReturnType;
template<typename MatrixType> template<typename MatrixType>
struct traits<TridiagonalizationMatrixTReturnType<MatrixType> > struct traits<TridiagonalizationMatrixTReturnType<MatrixType> >
@ -354,7 +354,7 @@ void tridiagonalization_inplace(MatrixType& matA, CoeffVectorType& hCoeffs)
Index n = matA.rows(); Index n = matA.rows();
eigen_assert(n==matA.cols()); eigen_assert(n==matA.cols());
eigen_assert(n==hCoeffs.size()+1 || n==1); eigen_assert(n==hCoeffs.size()+1 || n==1);
for (Index i = 0; i<n-1; ++i) for (Index i = 0; i<n-1; ++i)
{ {
Index remainingSize = n-i-1; Index remainingSize = n-i-1;
@ -547,8 +547,8 @@ template<typename MatrixType> struct TridiagonalizationMatrixTReturnType
result.template diagonal<-1>() = m_matrix.template diagonal<-1>(); result.template diagonal<-1>() = m_matrix.template diagonal<-1>();
} }
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } Index rows() const { return m_matrix.rows(); }
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } Index cols() const { return m_matrix.cols(); }
protected: protected:
typename MatrixType::Nested m_matrix; typename MatrixType::Nested m_matrix;

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_HOMOGENEOUS_H #ifndef EIGEN_HOMOGENEOUS_H
#define EIGEN_HOMOGENEOUS_H #define EIGEN_HOMOGENEOUS_H
namespace Eigen { namespace Eigen {
/** \geometry_module \ingroup Geometry_Module /** \geometry_module \ingroup Geometry_Module
* *
@ -72,11 +72,9 @@ template<typename MatrixType,int _Direction> class Homogeneous
: m_matrix(matrix) : m_matrix(matrix)
{} {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); }
inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); }
EIGEN_DEVICE_FUNC const NestedExpression& nestedExpression() const { return m_matrix; } EIGEN_DEVICE_FUNC const NestedExpression& nestedExpression() const { return m_matrix; }
template<typename Rhs> template<typename Rhs>
@ -264,10 +262,8 @@ struct homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs>
m_rhs(rhs) m_rhs(rhs)
{} {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return m_lhs.rows(); }
inline Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); }
template<typename Dest> EIGEN_DEVICE_FUNC void evalTo(Dest& dst) const template<typename Dest> EIGEN_DEVICE_FUNC void evalTo(Dest& dst) const
{ {
@ -304,8 +300,8 @@ struct homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
: m_lhs(lhs), m_rhs(rhs) : m_lhs(lhs), m_rhs(rhs)
{} {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } EIGEN_DEVICE_FUNC inline Index rows() const { return m_lhs.rows(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_rhs.cols(); }
template<typename Dest> EIGEN_DEVICE_FUNC void evalTo(Dest& dst) const template<typename Dest> EIGEN_DEVICE_FUNC void evalTo(Dest& dst) const
{ {
@ -326,7 +322,7 @@ template<typename ArgType,int Direction>
struct evaluator_traits<Homogeneous<ArgType,Direction> > struct evaluator_traits<Homogeneous<ArgType,Direction> >
{ {
typedef typename storage_kind_to_evaluator_kind<typename ArgType::StorageKind>::Kind Kind; typedef typename storage_kind_to_evaluator_kind<typename ArgType::StorageKind>::Kind Kind;
typedef HomogeneousShape Shape; typedef HomogeneousShape Shape;
}; };
template<> struct AssignmentKind<DenseShape,HomogeneousShape> { typedef Dense2Dense Kind; }; template<> struct AssignmentKind<DenseShape,HomogeneousShape> { typedef Dense2Dense Kind; };
@ -418,7 +414,7 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, Homogeneous
typedef typename helper::ConstantBlock ConstantBlock; typedef typename helper::ConstantBlock ConstantBlock;
typedef typename helper::Xpr RefactoredXpr; typedef typename helper::Xpr RefactoredXpr;
typedef evaluator<RefactoredXpr> Base; typedef evaluator<RefactoredXpr> Base;
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr)
: Base( xpr.lhs().nestedExpression() .lazyProduct( xpr.rhs().template topRows<helper::Dim>(xpr.lhs().nestedExpression().cols()) ) : Base( xpr.lhs().nestedExpression() .lazyProduct( xpr.rhs().template topRows<helper::Dim>(xpr.lhs().nestedExpression().cols()) )
+ ConstantBlock(xpr.rhs().row(xpr.rhs().rows()-1),xpr.lhs().rows(), 1) ) + ConstantBlock(xpr.rhs().row(xpr.rhs().rows()-1),xpr.lhs().rows(), 1) )
@ -471,7 +467,7 @@ struct product_evaluator<Product<Lhs, Rhs, LazyProduct>, ProductTag, DenseShape,
typedef typename helper::ConstantBlock ConstantBlock; typedef typename helper::ConstantBlock ConstantBlock;
typedef typename helper::Xpr RefactoredXpr; typedef typename helper::Xpr RefactoredXpr;
typedef evaluator<RefactoredXpr> Base; typedef evaluator<RefactoredXpr> Base;
EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr)
: Base( xpr.lhs().template leftCols<helper::Dim>(xpr.rhs().nestedExpression().rows()) .lazyProduct( xpr.rhs().nestedExpression() ) : Base( xpr.lhs().template leftCols<helper::Dim>(xpr.rhs().nestedExpression().rows()) .lazyProduct( xpr.rhs().nestedExpression() )
+ ConstantBlock(xpr.lhs().col(xpr.lhs().cols()-1),1,xpr.rhs().cols()) ) + ConstantBlock(xpr.lhs().col(xpr.lhs().cols()-1),1,xpr.rhs().cols()) )

View File

@ -12,7 +12,7 @@
#ifndef EIGEN_TRANSFORM_H #ifndef EIGEN_TRANSFORM_H
#define EIGEN_TRANSFORM_H #define EIGEN_TRANSFORM_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
@ -47,7 +47,7 @@ struct transform_left_product_impl;
template< typename Lhs, template< typename Lhs,
typename Rhs, typename Rhs,
bool AnyProjective = bool AnyProjective =
transform_traits<Lhs>::IsProjective || transform_traits<Lhs>::IsProjective ||
transform_traits<Rhs>::IsProjective> transform_traits<Rhs>::IsProjective>
struct transform_transform_product_impl; struct transform_transform_product_impl;
@ -242,7 +242,7 @@ public:
typedef const Block<ConstMatrixType,Dim,1,!(internal::traits<MatrixType>::Flags & RowMajorBit)> ConstTranslationPart; typedef const Block<ConstMatrixType,Dim,1,!(internal::traits<MatrixType>::Flags & RowMajorBit)> ConstTranslationPart;
/** corresponding translation type */ /** corresponding translation type */
typedef Translation<Scalar,Dim> TranslationType; typedef Translation<Scalar,Dim> TranslationType;
// this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0 // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) }; enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
/** The return type of the product between a diagonal matrix and a transform */ /** The return type of the product between a diagonal matrix and a transform */
@ -302,7 +302,7 @@ public:
internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived()); internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
return *this; return *this;
} }
template<int OtherOptions> template<int OtherOptions>
EIGEN_DEVICE_FUNC inline Transform(const Transform<Scalar,Dim,Mode,OtherOptions>& other) EIGEN_DEVICE_FUNC inline Transform(const Transform<Scalar,Dim,Mode,OtherOptions>& other)
{ {
@ -374,9 +374,9 @@ public:
inline Transform& operator=(const QTransform& other); inline Transform& operator=(const QTransform& other);
inline QTransform toQTransform(void) const; inline QTransform toQTransform(void) const;
#endif #endif
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); } EIGEN_DEVICE_FUNC Index rows() const { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } EIGEN_DEVICE_FUNC Index cols() const { return m_matrix.cols(); }
/** shortcut for m_matrix(row,col); /** shortcut for m_matrix(row,col);
* \sa MatrixBase::operator(Index,Index) const */ * \sa MatrixBase::operator(Index,Index) const */
@ -450,7 +450,7 @@ public:
/** \returns The product expression of a transform \a a times a diagonal matrix \a b /** \returns The product expression of a transform \a a times a diagonal matrix \a b
* *
* The rhs diagonal matrix is interpreted as an affine scaling transformation. The * The rhs diagonal matrix is interpreted as an affine scaling transformation. The
* product results in a Transform of the same type (mode) as the lhs only if the lhs * product results in a Transform of the same type (mode) as the lhs only if the lhs
* mode is no isometry. In that case, the returned transform is an affinity. * mode is no isometry. In that case, the returned transform is an affinity.
*/ */
template<typename DiagonalDerived> template<typename DiagonalDerived>
@ -465,7 +465,7 @@ public:
/** \returns The product expression of a diagonal matrix \a a times a transform \a b /** \returns The product expression of a diagonal matrix \a a times a transform \a b
* *
* The lhs diagonal matrix is interpreted as an affine scaling transformation. The * The lhs diagonal matrix is interpreted as an affine scaling transformation. The
* product results in a Transform of the same type (mode) as the lhs only if the lhs * product results in a Transform of the same type (mode) as the lhs only if the lhs
* mode is no isometry. In that case, the returned transform is an affinity. * mode is no isometry. In that case, the returned transform is an affinity.
*/ */
template<typename DiagonalDerived> template<typename DiagonalDerived>
@ -488,7 +488,7 @@ public:
{ {
return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other); return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
} }
#if EIGEN_COMP_ICC #if EIGEN_COMP_ICC
private: private:
// this intermediate structure permits to workaround a bug in ICC 11: // this intermediate structure permits to workaround a bug in ICC 11:
@ -497,13 +497,13 @@ private:
// (the meaning of a name may have changed since the template declaration -- the type of the template is: // (the meaning of a name may have changed since the template declaration -- the type of the template is:
// "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>, // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
// Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const") // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
// //
template<int OtherMode,int OtherOptions> struct icc_11_workaround template<int OtherMode,int OtherOptions> struct icc_11_workaround
{ {
typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType; typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
typedef typename ProductType::ResultType ResultType; typedef typename ProductType::ResultType ResultType;
}; };
public: public:
/** Concatenates two different transformations */ /** Concatenates two different transformations */
template<int OtherMode,int OtherOptions> template<int OtherMode,int OtherOptions>
@ -536,7 +536,7 @@ public:
} }
template<typename OtherDerived> template<typename OtherDerived>
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline Transform& scale(const MatrixBase<OtherDerived> &other); inline Transform& scale(const MatrixBase<OtherDerived> &other);
template<typename OtherDerived> template<typename OtherDerived>
@ -566,18 +566,18 @@ public:
EIGEN_DEVICE_FUNC Transform& preshear(const Scalar& sx, const Scalar& sy); EIGEN_DEVICE_FUNC Transform& preshear(const Scalar& sx, const Scalar& sy);
EIGEN_DEVICE_FUNC inline Transform& operator=(const TranslationType& t); EIGEN_DEVICE_FUNC inline Transform& operator=(const TranslationType& t);
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); } inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
EIGEN_DEVICE_FUNC inline Transform operator*(const TranslationType& t) const; EIGEN_DEVICE_FUNC inline Transform operator*(const TranslationType& t) const;
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline Transform& operator=(const UniformScaling<Scalar>& t); inline Transform& operator=(const UniformScaling<Scalar>& t);
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); } inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const
{ {
@ -680,7 +680,7 @@ public:
#ifdef EIGEN_TRANSFORM_PLUGIN #ifdef EIGEN_TRANSFORM_PLUGIN
#include EIGEN_TRANSFORM_PLUGIN #include EIGEN_TRANSFORM_PLUGIN
#endif #endif
protected: protected:
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void check_template_params() EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void check_template_params()
@ -1048,7 +1048,7 @@ template<int Mode> struct transform_rotation_impl {
EIGEN_DEVICE_FUNC static inline EIGEN_DEVICE_FUNC static inline
const typename TransformType::LinearMatrixType run(const TransformType& t) const typename TransformType::LinearMatrixType run(const TransformType& t)
{ {
typedef typename TransformType::LinearMatrixType LinearMatrixType; typedef typename TransformType::LinearMatrixType LinearMatrixType;
LinearMatrixType result; LinearMatrixType result;
t.computeRotationScaling(&result, (LinearMatrixType*)0); t.computeRotationScaling(&result, (LinearMatrixType*)0);
return result; return result;
@ -1177,7 +1177,7 @@ struct transform_make_affine<AffineCompact>
{ {
template<typename MatrixType> EIGEN_DEVICE_FUNC static void run(MatrixType &) { } template<typename MatrixType> EIGEN_DEVICE_FUNC static void run(MatrixType &) { }
}; };
// selector needed to avoid taking the inverse of a 3x4 matrix // selector needed to avoid taking the inverse of a 3x4 matrix
template<typename TransformType, int Mode=TransformType::Mode> template<typename TransformType, int Mode=TransformType::Mode>
struct projective_transform_inverse struct projective_transform_inverse
@ -1318,8 +1318,8 @@ struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HD
template<int LhsMode,int RhsMode> template<int LhsMode,int RhsMode>
struct transform_product_result struct transform_product_result
{ {
enum enum
{ {
Mode = Mode =
(LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective : (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
(LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine : (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
@ -1342,8 +1342,8 @@ struct transform_right_product_impl< TransformType, MatrixType, 0, RhsCols>
template< typename TransformType, typename MatrixType, int RhsCols> template< typename TransformType, typename MatrixType, int RhsCols>
struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols> struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols>
{ {
enum { enum {
Dim = TransformType::Dim, Dim = TransformType::Dim,
HDim = TransformType::HDim, HDim = TransformType::HDim,
OtherRows = MatrixType::RowsAtCompileTime, OtherRows = MatrixType::RowsAtCompileTime,
OtherCols = MatrixType::ColsAtCompileTime OtherCols = MatrixType::ColsAtCompileTime
@ -1360,7 +1360,7 @@ struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols>
ResultType res(other.rows(),other.cols()); ResultType res(other.rows(),other.cols());
TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other; TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
res.row(OtherRows-1) = other.row(OtherRows-1); res.row(OtherRows-1) = other.row(OtherRows-1);
return res; return res;
} }
}; };
@ -1368,8 +1368,8 @@ struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols>
template< typename TransformType, typename MatrixType, int RhsCols> template< typename TransformType, typename MatrixType, int RhsCols>
struct transform_right_product_impl< TransformType, MatrixType, 2, RhsCols> struct transform_right_product_impl< TransformType, MatrixType, 2, RhsCols>
{ {
enum { enum {
Dim = TransformType::Dim, Dim = TransformType::Dim,
HDim = TransformType::HDim, HDim = TransformType::HDim,
OtherRows = MatrixType::RowsAtCompileTime, OtherRows = MatrixType::RowsAtCompileTime,
OtherCols = MatrixType::ColsAtCompileTime OtherCols = MatrixType::ColsAtCompileTime

View File

@ -11,7 +11,7 @@
#ifndef EIGEN_HOUSEHOLDER_SEQUENCE_H #ifndef EIGEN_HOUSEHOLDER_SEQUENCE_H
#define EIGEN_HOUSEHOLDER_SEQUENCE_H #define EIGEN_HOUSEHOLDER_SEQUENCE_H
namespace Eigen { namespace Eigen {
/** \ingroup Householder_Module /** \ingroup Householder_Module
* \householder_module * \householder_module
@ -34,8 +34,8 @@ namespace Eigen {
* form \f$ H = \prod_{i=0}^{n-1} H_i \f$ where the i-th Householder reflection is \f$ H_i = I - h_i v_i * form \f$ H = \prod_{i=0}^{n-1} H_i \f$ where the i-th Householder reflection is \f$ H_i = I - h_i v_i
* v_i^* \f$. The i-th Householder coefficient \f$ h_i \f$ is a scalar and the i-th Householder vector \f$ * v_i^* \f$. The i-th Householder coefficient \f$ h_i \f$ is a scalar and the i-th Householder vector \f$
* v_i \f$ is a vector of the form * v_i \f$ is a vector of the form
* \f[ * \f[
* v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ]. * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
* \f] * \f]
* The last \f$ n-i \f$ entries of \f$ v_i \f$ are called the essential part of the Householder vector. * The last \f$ n-i \f$ entries of \f$ v_i \f$ are called the essential part of the Householder vector.
* *
@ -120,7 +120,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
: public EigenBase<HouseholderSequence<VectorsType,CoeffsType,Side> > : public EigenBase<HouseholderSequence<VectorsType,CoeffsType,Side> >
{ {
typedef typename internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType EssentialVectorType; typedef typename internal::hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType EssentialVectorType;
public: public:
enum { enum {
RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime, RowsAtCompileTime = internal::traits<HouseholderSequence>::RowsAtCompileTime,
@ -198,18 +198,18 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
} }
/** \brief Number of rows of transformation viewed as a matrix. /** \brief Number of rows of transformation viewed as a matrix.
* \returns Number of rows * \returns Number of rows
* \details This equals the dimension of the space that the transformation acts on. * \details This equals the dimension of the space that the transformation acts on.
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index rows() const EIGEN_NOEXCEPT { return Side==OnTheLeft ? m_vectors.rows() : m_vectors.cols(); } Index rows() const { return Side==OnTheLeft ? m_vectors.rows() : m_vectors.cols(); }
/** \brief Number of columns of transformation viewed as a matrix. /** \brief Number of columns of transformation viewed as a matrix.
* \returns Number of columns * \returns Number of columns
* \details This equals the dimension of the space that the transformation acts on. * \details This equals the dimension of the space that the transformation acts on.
*/ */
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC
Index cols() const EIGEN_NOEXCEPT { return rows(); } Index cols() const { return rows(); }
/** \brief Essential part of a Householder vector. /** \brief Essential part of a Householder vector.
* \param[in] k Index of Householder reflection * \param[in] k Index of Householder reflection
@ -217,8 +217,8 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
* *
* This function returns the essential part of the Householder vector \f$ v_i \f$. This is a vector of * This function returns the essential part of the Householder vector \f$ v_i \f$. This is a vector of
* length \f$ n-i \f$ containing the last \f$ n-i \f$ entries of the vector * length \f$ n-i \f$ containing the last \f$ n-i \f$ entries of the vector
* \f[ * \f[
* v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ]. * v_i = [\underbrace{0, \ldots, 0}_{i-1\mbox{ zeros}}, 1, \underbrace{*, \ldots,*}_{n-i\mbox{ arbitrary entries}} ].
* \f] * \f]
* The index \f$ i \f$ equals \p k + shift(), corresponding to the k-th column of the matrix \p v * The index \f$ i \f$ equals \p k + shift(), corresponding to the k-th column of the matrix \p v
* passed to the constructor. * passed to the constructor.
@ -381,7 +381,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
Index k = m_reverse ? i : (std::max)(Index(0),end-blockSize); Index k = m_reverse ? i : (std::max)(Index(0),end-blockSize);
Index bs = end-k; Index bs = end-k;
Index start = k + m_shift; Index start = k + m_shift;
typedef Block<typename internal::remove_all<VectorsType>::type,Dynamic,Dynamic> SubVectorsType; typedef Block<typename internal::remove_all<VectorsType>::type,Dynamic,Dynamic> SubVectorsType;
SubVectorsType sub_vecs1(m_vectors.const_cast_derived(), Side==OnTheRight ? k : start, SubVectorsType sub_vecs1(m_vectors.const_cast_derived(), Side==OnTheRight ? k : start,
Side==OnTheRight ? start : k, Side==OnTheRight ? start : k,
@ -519,7 +519,7 @@ typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,Ot
} }
/** \ingroup Householder_Module \householder_module /** \ingroup Householder_Module \householder_module
* \brief Convenience function for constructing a Householder sequence. * \brief Convenience function for constructing a Householder sequence.
* \returns A HouseholderSequence constructed from the specified arguments. * \returns A HouseholderSequence constructed from the specified arguments.
*/ */
template<typename VectorsType, typename CoeffsType> template<typename VectorsType, typename CoeffsType>
@ -529,7 +529,7 @@ HouseholderSequence<VectorsType,CoeffsType> householderSequence(const VectorsTyp
} }
/** \ingroup Householder_Module \householder_module /** \ingroup Householder_Module \householder_module
* \brief Convenience function for constructing a Householder sequence. * \brief Convenience function for constructing a Householder sequence.
* \returns A HouseholderSequence constructed from the specified arguments. * \returns A HouseholderSequence constructed from the specified arguments.
* \details This function differs from householderSequence() in that the template argument \p OnTheSide of * \details This function differs from householderSequence() in that the template argument \p OnTheSide of
* the constructed HouseholderSequence is set to OnTheRight, instead of the default OnTheLeft. * the constructed HouseholderSequence is set to OnTheRight, instead of the default OnTheLeft.

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_BASIC_PRECONDITIONERS_H #ifndef EIGEN_BASIC_PRECONDITIONERS_H
#define EIGEN_BASIC_PRECONDITIONERS_H #define EIGEN_BASIC_PRECONDITIONERS_H
namespace Eigen { namespace Eigen {
/** \ingroup IterativeLinearSolvers_Module /** \ingroup IterativeLinearSolvers_Module
* \brief A preconditioner based on the digonal entries * \brief A preconditioner based on the digonal entries
@ -52,15 +52,15 @@ class DiagonalPreconditioner
compute(mat); compute(mat);
} }
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_invdiag.size(); } Index rows() const { return m_invdiag.size(); }
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_invdiag.size(); } Index cols() const { return m_invdiag.size(); }
template<typename MatType> template<typename MatType>
DiagonalPreconditioner& analyzePattern(const MatType& ) DiagonalPreconditioner& analyzePattern(const MatType& )
{ {
return *this; return *this;
} }
template<typename MatType> template<typename MatType>
DiagonalPreconditioner& factorize(const MatType& mat) DiagonalPreconditioner& factorize(const MatType& mat)
{ {
@ -77,7 +77,7 @@ class DiagonalPreconditioner
m_isInitialized = true; m_isInitialized = true;
return *this; return *this;
} }
template<typename MatType> template<typename MatType>
DiagonalPreconditioner& compute(const MatType& mat) DiagonalPreconditioner& compute(const MatType& mat)
{ {
@ -99,7 +99,7 @@ class DiagonalPreconditioner
&& "DiagonalPreconditioner::solve(): invalid number of rows of the right hand side matrix b"); && "DiagonalPreconditioner::solve(): invalid number of rows of the right hand side matrix b");
return Solve<DiagonalPreconditioner, Rhs>(*this, b.derived()); return Solve<DiagonalPreconditioner, Rhs>(*this, b.derived());
} }
ComputationInfo info() { return Success; } ComputationInfo info() { return Success; }
protected: protected:
@ -121,7 +121,7 @@ class DiagonalPreconditioner
* \implsparsesolverconcept * \implsparsesolverconcept
* *
* The diagonal entries are pre-inverted and stored into a dense vector. * The diagonal entries are pre-inverted and stored into a dense vector.
* *
* \sa class LeastSquaresConjugateGradient, class DiagonalPreconditioner * \sa class LeastSquaresConjugateGradient, class DiagonalPreconditioner
*/ */
template <typename _Scalar> template <typename _Scalar>
@ -146,7 +146,7 @@ class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<_Scalar>
{ {
return *this; return *this;
} }
template<typename MatType> template<typename MatType>
LeastSquareDiagonalPreconditioner& factorize(const MatType& mat) LeastSquareDiagonalPreconditioner& factorize(const MatType& mat)
{ {
@ -178,13 +178,13 @@ class LeastSquareDiagonalPreconditioner : public DiagonalPreconditioner<_Scalar>
Base::m_isInitialized = true; Base::m_isInitialized = true;
return *this; return *this;
} }
template<typename MatType> template<typename MatType>
LeastSquareDiagonalPreconditioner& compute(const MatType& mat) LeastSquareDiagonalPreconditioner& compute(const MatType& mat)
{ {
return factorize(mat); return factorize(mat);
} }
ComputationInfo info() { return Success; } ComputationInfo info() { return Success; }
protected: protected:
@ -205,19 +205,19 @@ class IdentityPreconditioner
template<typename MatrixType> template<typename MatrixType>
explicit IdentityPreconditioner(const MatrixType& ) {} explicit IdentityPreconditioner(const MatrixType& ) {}
template<typename MatrixType> template<typename MatrixType>
IdentityPreconditioner& analyzePattern(const MatrixType& ) { return *this; } IdentityPreconditioner& analyzePattern(const MatrixType& ) { return *this; }
template<typename MatrixType> template<typename MatrixType>
IdentityPreconditioner& factorize(const MatrixType& ) { return *this; } IdentityPreconditioner& factorize(const MatrixType& ) { return *this; }
template<typename MatrixType> template<typename MatrixType>
IdentityPreconditioner& compute(const MatrixType& ) { return *this; } IdentityPreconditioner& compute(const MatrixType& ) { return *this; }
template<typename Rhs> template<typename Rhs>
inline const Rhs& solve(const Rhs& b) const { return b; } inline const Rhs& solve(const Rhs& b) const { return b; }
ComputationInfo info() { return Success; } ComputationInfo info() { return Success; }
}; };

View File

@ -14,8 +14,8 @@
#include <vector> #include <vector>
#include <list> #include <list>
namespace Eigen { namespace Eigen {
/** /**
* \brief Modified Incomplete Cholesky with dual threshold * \brief Modified Incomplete Cholesky with dual threshold
* *
* References : C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with * References : C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with
@ -48,15 +48,15 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
typedef SparseSolverBase<IncompleteCholesky<Scalar,_UpLo,_OrderingType> > Base; typedef SparseSolverBase<IncompleteCholesky<Scalar,_UpLo,_OrderingType> > Base;
using Base::m_isInitialized; using Base::m_isInitialized;
public: public:
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
typedef _OrderingType OrderingType; typedef _OrderingType OrderingType;
typedef typename OrderingType::PermutationType PermutationType; typedef typename OrderingType::PermutationType PermutationType;
typedef typename PermutationType::StorageIndex StorageIndex; typedef typename PermutationType::StorageIndex StorageIndex;
typedef SparseMatrix<Scalar,ColMajor,StorageIndex> FactorType; typedef SparseMatrix<Scalar,ColMajor,StorageIndex> FactorType;
typedef Matrix<Scalar,Dynamic,1> VectorSx; typedef Matrix<Scalar,Dynamic,1> VectorSx;
typedef Matrix<RealScalar,Dynamic,1> VectorRx; typedef Matrix<RealScalar,Dynamic,1> VectorRx;
typedef Matrix<StorageIndex,Dynamic, 1> VectorIx; typedef Matrix<StorageIndex,Dynamic, 1> VectorIx;
typedef std::vector<std::list<StorageIndex> > VectorList; typedef std::vector<std::list<StorageIndex> > VectorList;
enum { UpLo = _UpLo }; enum { UpLo = _UpLo };
enum { enum {
ColsAtCompileTime = Dynamic, ColsAtCompileTime = Dynamic,
@ -71,7 +71,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
* \sa IncompleteCholesky(const MatrixType&) * \sa IncompleteCholesky(const MatrixType&)
*/ */
IncompleteCholesky() : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false) {} IncompleteCholesky() : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false) {}
/** Constructor computing the incomplete factorization for the given matrix \a matrix. /** Constructor computing the incomplete factorization for the given matrix \a matrix.
*/ */
template<typename MatrixType> template<typename MatrixType>
@ -79,13 +79,13 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
{ {
compute(matrix); compute(matrix);
} }
/** \returns number of rows of the factored matrix */ /** \returns number of rows of the factored matrix */
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_L.rows(); } Index rows() const { return m_L.rows(); }
/** \returns number of columns of the factored matrix */ /** \returns number of columns of the factored matrix */
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_L.cols(); } Index cols() const { return m_L.cols(); }
/** \brief Reports whether previous computation was successful. /** \brief Reports whether previous computation was successful.
* *
@ -100,19 +100,19 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
eigen_assert(m_isInitialized && "IncompleteCholesky is not initialized."); eigen_assert(m_isInitialized && "IncompleteCholesky is not initialized.");
return m_info; return m_info;
} }
/** \brief Set the initial shift parameter \f$ \sigma \f$. /** \brief Set the initial shift parameter \f$ \sigma \f$.
*/ */
void setInitialShift(RealScalar shift) { m_initialShift = shift; } void setInitialShift(RealScalar shift) { m_initialShift = shift; }
/** \brief Computes the fill reducing permutation vector using the sparsity pattern of \a mat /** \brief Computes the fill reducing permutation vector using the sparsity pattern of \a mat
*/ */
template<typename MatrixType> template<typename MatrixType>
void analyzePattern(const MatrixType& mat) void analyzePattern(const MatrixType& mat)
{ {
OrderingType ord; OrderingType ord;
PermutationType pinv; PermutationType pinv;
ord(mat.template selfadjointView<UpLo>(), pinv); ord(mat.template selfadjointView<UpLo>(), pinv);
if(pinv.size()>0) m_perm = pinv.inverse(); if(pinv.size()>0) m_perm = pinv.inverse();
else m_perm.resize(0); else m_perm.resize(0);
m_L.resize(mat.rows(), mat.cols()); m_L.resize(mat.rows(), mat.cols());
@ -120,7 +120,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
m_isInitialized = true; m_isInitialized = true;
m_info = Success; m_info = Success;
} }
/** \brief Performs the numerical factorization of the input matrix \a mat /** \brief Performs the numerical factorization of the input matrix \a mat
* *
* The method analyzePattern() or compute() must have been called beforehand * The method analyzePattern() or compute() must have been called beforehand
@ -130,7 +130,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
*/ */
template<typename MatrixType> template<typename MatrixType>
void factorize(const MatrixType& mat); void factorize(const MatrixType& mat);
/** Computes or re-computes the incomplete Cholesky factorization of the input matrix \a mat /** Computes or re-computes the incomplete Cholesky factorization of the input matrix \a mat
* *
* It is a shortcut for a sequential call to the analyzePattern() and factorize() methods. * It is a shortcut for a sequential call to the analyzePattern() and factorize() methods.
@ -143,7 +143,7 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
analyzePattern(mat); analyzePattern(mat);
factorize(mat); factorize(mat);
} }
// internal // internal
template<typename Rhs, typename Dest> template<typename Rhs, typename Dest>
void _solve_impl(const Rhs& b, Dest& x) const void _solve_impl(const Rhs& b, Dest& x) const
@ -170,16 +170,16 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
protected: protected:
FactorType m_L; // The lower part stored in CSC FactorType m_L; // The lower part stored in CSC
VectorRx m_scale; // The vector for scaling the matrix VectorRx m_scale; // The vector for scaling the matrix
RealScalar m_initialShift; // The initial shift parameter RealScalar m_initialShift; // The initial shift parameter
bool m_analysisIsOk; bool m_analysisIsOk;
bool m_factorizationIsOk; bool m_factorizationIsOk;
ComputationInfo m_info; ComputationInfo m_info;
PermutationType m_perm; PermutationType m_perm;
private: private:
inline void updateList(Ref<const VectorIx> colPtr, Ref<VectorIx> rowIdx, Ref<VectorSx> vals, const Index& col, const Index& jk, VectorIx& firstElt, VectorList& listCol); inline void updateList(Ref<const VectorIx> colPtr, Ref<VectorIx> rowIdx, Ref<VectorSx> vals, const Index& col, const Index& jk, VectorIx& firstElt, VectorList& listCol);
}; };
// Based on the following paper: // Based on the following paper:
// C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with // C-J. Lin and J. J. Moré, Incomplete Cholesky Factorizations with
@ -190,10 +190,10 @@ template<typename _MatrixType>
void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType& mat) void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType& mat)
{ {
using std::sqrt; using std::sqrt;
eigen_assert(m_analysisIsOk && "analyzePattern() should be called first"); eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");
// Dropping strategy : Keep only the p largest elements per column, where p is the number of elements in the column of the original matrix. Other strategies will be added // Dropping strategy : Keep only the p largest elements per column, where p is the number of elements in the column of the original matrix. Other strategies will be added
// Apply the fill-reducing permutation computed in analyzePattern() // Apply the fill-reducing permutation computed in analyzePattern()
if (m_perm.rows() == mat.rows() ) // To detect the null permutation if (m_perm.rows() == mat.rows() ) // To detect the null permutation
{ {
@ -206,8 +206,8 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
{ {
m_L.template selfadjointView<Lower>() = mat.template selfadjointView<_UpLo>(); m_L.template selfadjointView<Lower>() = mat.template selfadjointView<_UpLo>();
} }
Index n = m_L.cols(); Index n = m_L.cols();
Index nnz = m_L.nonZeros(); Index nnz = m_L.nonZeros();
Map<VectorSx> vals(m_L.valuePtr(), nnz); //values Map<VectorSx> vals(m_L.valuePtr(), nnz); //values
Map<VectorIx> rowIdx(m_L.innerIndexPtr(), nnz); //Row indices Map<VectorIx> rowIdx(m_L.innerIndexPtr(), nnz); //Row indices
@ -219,9 +219,9 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
VectorIx col_pattern(n); VectorIx col_pattern(n);
col_pattern.fill(-1); col_pattern.fill(-1);
StorageIndex col_nnz; StorageIndex col_nnz;
// Computes the scaling factors // Computes the scaling factors
m_scale.resize(n); m_scale.resize(n);
m_scale.setZero(); m_scale.setZero();
for (Index j = 0; j < n; j++) for (Index j = 0; j < n; j++)
@ -231,7 +231,7 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
if(rowIdx[k]!=j) if(rowIdx[k]!=j)
m_scale(rowIdx[k]) += numext::abs2(vals(k)); m_scale(rowIdx[k]) += numext::abs2(vals(k));
} }
m_scale = m_scale.cwiseSqrt().cwiseSqrt(); m_scale = m_scale.cwiseSqrt().cwiseSqrt();
for (Index j = 0; j < n; ++j) for (Index j = 0; j < n; ++j)
@ -241,8 +241,8 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
m_scale(j) = 1; m_scale(j) = 1;
// TODO disable scaling if not needed, i.e., if it is roughly uniform? (this will make solve() faster) // TODO disable scaling if not needed, i.e., if it is roughly uniform? (this will make solve() faster)
// Scale and compute the shift for the matrix // Scale and compute the shift for the matrix
RealScalar mindiag = NumTraits<RealScalar>::highest(); RealScalar mindiag = NumTraits<RealScalar>::highest();
for (Index j = 0; j < n; j++) for (Index j = 0; j < n; j++)
{ {
@ -253,7 +253,7 @@ void IncompleteCholesky<Scalar,_UpLo, OrderingType>::factorize(const _MatrixType
} }
FactorType L_save = m_L; FactorType L_save = m_L;
RealScalar shift = 0; RealScalar shift = 0;
if(mindiag <= RealScalar(0.)) if(mindiag <= RealScalar(0.))
shift = m_initialShift - mindiag; shift = m_initialShift - mindiag;
@ -375,7 +375,7 @@ inline void IncompleteCholesky<Scalar,_UpLo, OrderingType>::updateList(Ref<const
if (jk < colPtr(col+1) ) if (jk < colPtr(col+1) )
{ {
Index p = colPtr(col+1) - jk; Index p = colPtr(col+1) - jk;
Index minpos; Index minpos;
rowIdx.segment(jk,p).minCoeff(&minpos); rowIdx.segment(jk,p).minCoeff(&minpos);
minpos += jk; minpos += jk;
if (rowIdx(minpos) != rowIdx(jk)) if (rowIdx(minpos) != rowIdx(jk))
@ -389,6 +389,6 @@ inline void IncompleteCholesky<Scalar,_UpLo, OrderingType>::updateList(Ref<const
} }
} }
} // end namespace Eigen } // end namespace Eigen
#endif #endif

View File

@ -12,19 +12,19 @@
#define EIGEN_INCOMPLETE_LUT_H #define EIGEN_INCOMPLETE_LUT_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
/** \internal /** \internal
* Compute a quick-sort split of a vector * Compute a quick-sort split of a vector
* On output, the vector row is permuted such that its elements satisfy * On output, the vector row is permuted such that its elements satisfy
* abs(row(i)) >= abs(row(ncut)) if i<ncut * abs(row(i)) >= abs(row(ncut)) if i<ncut
* abs(row(i)) <= abs(row(ncut)) if i>ncut * abs(row(i)) <= abs(row(ncut)) if i>ncut
* \param row The vector of values * \param row The vector of values
* \param ind The array of index for the elements in @p row * \param ind The array of index for the elements in @p row
* \param ncut The number of largest elements to keep * \param ncut The number of largest elements to keep
**/ **/
template <typename VectorV, typename VectorI> template <typename VectorV, typename VectorI>
Index QuickSplit(VectorV &row, VectorI &ind, Index ncut) Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
{ {
@ -34,15 +34,15 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
Index mid; Index mid;
Index n = row.size(); /* length of the vector */ Index n = row.size(); /* length of the vector */
Index first, last ; Index first, last ;
ncut--; /* to fit the zero-based indices */ ncut--; /* to fit the zero-based indices */
first = 0; first = 0;
last = n-1; last = n-1;
if (ncut < first || ncut > last ) return 0; if (ncut < first || ncut > last ) return 0;
do { do {
mid = first; mid = first;
RealScalar abskey = abs(row(mid)); RealScalar abskey = abs(row(mid));
for (Index j = first + 1; j <= last; j++) { for (Index j = first + 1; j <= last; j++) {
if ( abs(row(j)) > abskey) { if ( abs(row(j)) > abskey) {
++mid; ++mid;
@ -53,12 +53,12 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
/* Interchange for the pivot element */ /* Interchange for the pivot element */
swap(row(mid), row(first)); swap(row(mid), row(first));
swap(ind(mid), ind(first)); swap(ind(mid), ind(first));
if (mid > ncut) last = mid - 1; if (mid > ncut) last = mid - 1;
else if (mid < ncut ) first = mid + 1; else if (mid < ncut ) first = mid + 1;
} while (mid != ncut ); } while (mid != ncut );
return 0; /* mid is equal to ncut */ return 0; /* mid is equal to ncut */
} }
}// end namespace internal }// end namespace internal
@ -71,23 +71,23 @@ Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
* *
* During the numerical factorization, two dropping rules are used : * During the numerical factorization, two dropping rules are used :
* 1) any element whose magnitude is less than some tolerance is dropped. * 1) any element whose magnitude is less than some tolerance is dropped.
* This tolerance is obtained by multiplying the input tolerance @p droptol * This tolerance is obtained by multiplying the input tolerance @p droptol
* by the average magnitude of all the original elements in the current row. * by the average magnitude of all the original elements in the current row.
* 2) After the elimination of the row, only the @p fill largest elements in * 2) After the elimination of the row, only the @p fill largest elements in
* the L part and the @p fill largest elements in the U part are kept * the L part and the @p fill largest elements in the U part are kept
* (in addition to the diagonal element ). Note that @p fill is computed from * (in addition to the diagonal element ). Note that @p fill is computed from
* the input parameter @p fillfactor which is used the ratio to control the fill_in * the input parameter @p fillfactor which is used the ratio to control the fill_in
* relatively to the initial number of nonzero elements. * relatively to the initial number of nonzero elements.
* *
* The two extreme cases are when @p droptol=0 (to keep all the @p fill*2 largest elements) * The two extreme cases are when @p droptol=0 (to keep all the @p fill*2 largest elements)
* and when @p fill=n/2 with @p droptol being different to zero. * and when @p fill=n/2 with @p droptol being different to zero.
* *
* References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization, * References : Yousef Saad, ILUT: A dual threshold incomplete LU factorization,
* Numerical Linear Algebra with Applications, 1(4), pp 387-402, 1994. * Numerical Linear Algebra with Applications, 1(4), pp 387-402, 1994.
* *
* NOTE : The following implementation is derived from the ILUT implementation * NOTE : The following implementation is derived from the ILUT implementation
* in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota * in the SPARSKIT package, Copyright (C) 2005, the Regents of the University of Minnesota
* released under the terms of the GNU LGPL: * released under the terms of the GNU LGPL:
* http://www-users.cs.umn.edu/~saad/software/SPARSKIT/README * http://www-users.cs.umn.edu/~saad/software/SPARSKIT/README
* However, Yousef Saad gave us permission to relicense his ILUT code to MPL2. * However, Yousef Saad gave us permission to relicense his ILUT code to MPL2.
* See the Eigen mailing list archive, thread: ILUT, date: July 8, 2012: * See the Eigen mailing list archive, thread: ILUT, date: July 8, 2012:
@ -115,24 +115,24 @@ class IncompleteLUT : public SparseSolverBase<IncompleteLUT<_Scalar, _StorageInd
}; };
public: public:
IncompleteLUT() IncompleteLUT()
: m_droptol(NumTraits<Scalar>::dummy_precision()), m_fillfactor(10), : m_droptol(NumTraits<Scalar>::dummy_precision()), m_fillfactor(10),
m_analysisIsOk(false), m_factorizationIsOk(false) m_analysisIsOk(false), m_factorizationIsOk(false)
{} {}
template<typename MatrixType> template<typename MatrixType>
explicit IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits<Scalar>::dummy_precision(), int fillfactor = 10) explicit IncompleteLUT(const MatrixType& mat, const RealScalar& droptol=NumTraits<Scalar>::dummy_precision(), int fillfactor = 10)
: m_droptol(droptol),m_fillfactor(fillfactor), : m_droptol(droptol),m_fillfactor(fillfactor),
m_analysisIsOk(false),m_factorizationIsOk(false) m_analysisIsOk(false),m_factorizationIsOk(false)
{ {
eigen_assert(fillfactor != 0); eigen_assert(fillfactor != 0);
compute(mat); compute(mat);
} }
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); } Index rows() const { return m_lu.rows(); }
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); } Index cols() const { return m_lu.cols(); }
/** \brief Reports whether previous computation was successful. /** \brief Reports whether previous computation was successful.
* *
@ -144,36 +144,36 @@ class IncompleteLUT : public SparseSolverBase<IncompleteLUT<_Scalar, _StorageInd
eigen_assert(m_isInitialized && "IncompleteLUT is not initialized."); eigen_assert(m_isInitialized && "IncompleteLUT is not initialized.");
return m_info; return m_info;
} }
template<typename MatrixType> template<typename MatrixType>
void analyzePattern(const MatrixType& amat); void analyzePattern(const MatrixType& amat);
template<typename MatrixType> template<typename MatrixType>
void factorize(const MatrixType& amat); void factorize(const MatrixType& amat);
/** /**
* Compute an incomplete LU factorization with dual threshold on the matrix mat * Compute an incomplete LU factorization with dual threshold on the matrix mat
* No pivoting is done in this version * No pivoting is done in this version
* *
**/ **/
template<typename MatrixType> template<typename MatrixType>
IncompleteLUT& compute(const MatrixType& amat) IncompleteLUT& compute(const MatrixType& amat)
{ {
analyzePattern(amat); analyzePattern(amat);
factorize(amat); factorize(amat);
return *this; return *this;
} }
void setDroptol(const RealScalar& droptol); void setDroptol(const RealScalar& droptol);
void setFillfactor(int fillfactor); void setFillfactor(int fillfactor);
template<typename Rhs, typename Dest> template<typename Rhs, typename Dest>
void _solve_impl(const Rhs& b, Dest& x) const void _solve_impl(const Rhs& b, Dest& x) const
{ {
x = m_Pinv * b; x = m_Pinv * b;
x = m_lu.template triangularView<UnitLower>().solve(x); x = m_lu.template triangularView<UnitLower>().solve(x);
x = m_lu.template triangularView<Upper>().solve(x); x = m_lu.template triangularView<Upper>().solve(x);
x = m_P * x; x = m_P * x;
} }
protected: protected:
@ -200,22 +200,22 @@ protected:
/** /**
* Set control parameter droptol * Set control parameter droptol
* \param droptol Drop any element whose magnitude is less than this tolerance * \param droptol Drop any element whose magnitude is less than this tolerance
**/ **/
template<typename Scalar, typename StorageIndex> template<typename Scalar, typename StorageIndex>
void IncompleteLUT<Scalar,StorageIndex>::setDroptol(const RealScalar& droptol) void IncompleteLUT<Scalar,StorageIndex>::setDroptol(const RealScalar& droptol)
{ {
this->m_droptol = droptol; this->m_droptol = droptol;
} }
/** /**
* Set control parameter fillfactor * Set control parameter fillfactor
* \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row. * \param fillfactor This is used to compute the number @p fill_in of largest elements to keep on each row.
**/ **/
template<typename Scalar, typename StorageIndex> template<typename Scalar, typename StorageIndex>
void IncompleteLUT<Scalar,StorageIndex>::setFillfactor(int fillfactor) void IncompleteLUT<Scalar,StorageIndex>::setFillfactor(int fillfactor)
{ {
this->m_fillfactor = fillfactor; this->m_fillfactor = fillfactor;
} }
template <typename Scalar, typename StorageIndex> template <typename Scalar, typename StorageIndex>

View File

@ -10,7 +10,7 @@
#ifndef EIGEN_ITERATIVE_SOLVER_BASE_H #ifndef EIGEN_ITERATIVE_SOLVER_BASE_H
#define EIGEN_ITERATIVE_SOLVER_BASE_H #define EIGEN_ITERATIVE_SOLVER_BASE_H
namespace Eigen { namespace Eigen {
namespace internal { namespace internal {
@ -145,7 +145,7 @@ class IterativeSolverBase : public SparseSolverBase<Derived>
protected: protected:
typedef SparseSolverBase<Derived> Base; typedef SparseSolverBase<Derived> Base;
using Base::m_isInitialized; using Base::m_isInitialized;
public: public:
typedef typename internal::traits<Derived>::MatrixType MatrixType; typedef typename internal::traits<Derived>::MatrixType MatrixType;
typedef typename internal::traits<Derived>::Preconditioner Preconditioner; typedef typename internal::traits<Derived>::Preconditioner Preconditioner;
@ -169,10 +169,10 @@ public:
} }
/** Initialize the solver with matrix \a A for further \c Ax=b solving. /** Initialize the solver with matrix \a A for further \c Ax=b solving.
* *
* This constructor is a shortcut for the default constructor followed * This constructor is a shortcut for the default constructor followed
* by a call to compute(). * by a call to compute().
* *
* \warning this class stores a reference to the matrix A as well as some * \warning this class stores a reference to the matrix A as well as some
* precomputed values that depend on it. Therefore, if \a A is changed * precomputed values that depend on it. Therefore, if \a A is changed
* this class becomes invalid. Call compute() to update it with the new * this class becomes invalid. Call compute() to update it with the new
@ -187,7 +187,7 @@ public:
} }
~IterativeSolverBase() {} ~IterativeSolverBase() {}
/** Initializes the iterative solver for the sparsity pattern of the matrix \a A for further solving \c Ax=b problems. /** Initializes the iterative solver for the sparsity pattern of the matrix \a A for further solving \c Ax=b problems.
* *
* Currently, this function mostly calls analyzePattern on the preconditioner. In the future * Currently, this function mostly calls analyzePattern on the preconditioner. In the future
@ -203,7 +203,7 @@ public:
m_info = m_preconditioner.info(); m_info = m_preconditioner.info();
return derived(); return derived();
} }
/** Initializes the iterative solver with the numerical values of the matrix \a A for further solving \c Ax=b problems. /** Initializes the iterative solver with the numerical values of the matrix \a A for further solving \c Ax=b problems.
* *
* Currently, this function mostly calls factorize on the preconditioner. * Currently, this function mostly calls factorize on the preconditioner.
@ -216,7 +216,7 @@ public:
template<typename MatrixDerived> template<typename MatrixDerived>
Derived& factorize(const EigenBase<MatrixDerived>& A) Derived& factorize(const EigenBase<MatrixDerived>& A)
{ {
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
grab(A.derived()); grab(A.derived());
m_preconditioner.factorize(matrix()); m_preconditioner.factorize(matrix());
m_factorizationIsOk = true; m_factorizationIsOk = true;
@ -247,16 +247,16 @@ public:
} }
/** \internal */ /** \internal */
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return matrix().rows(); } Index rows() const { return matrix().rows(); }
/** \internal */ /** \internal */
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return matrix().cols(); } Index cols() const { return matrix().cols(); }
/** \returns the tolerance threshold used by the stopping criteria. /** \returns the tolerance threshold used by the stopping criteria.
* \sa setTolerance() * \sa setTolerance()
*/ */
RealScalar tolerance() const { return m_tolerance; } RealScalar tolerance() const { return m_tolerance; }
/** Sets the tolerance threshold used by the stopping criteria. /** Sets the tolerance threshold used by the stopping criteria.
* *
* This value is used as an upper bound to the relative residual error: |Ax-b|/|b|. * This value is used as an upper bound to the relative residual error: |Ax-b|/|b|.
@ -270,7 +270,7 @@ public:
/** \returns a read-write reference to the preconditioner for custom configuration. */ /** \returns a read-write reference to the preconditioner for custom configuration. */
Preconditioner& preconditioner() { return m_preconditioner; } Preconditioner& preconditioner() { return m_preconditioner; }
/** \returns a read-only reference to the preconditioner. */ /** \returns a read-only reference to the preconditioner. */
const Preconditioner& preconditioner() const { return m_preconditioner; } const Preconditioner& preconditioner() const { return m_preconditioner; }
@ -282,7 +282,7 @@ public:
{ {
return (m_maxIterations<0) ? 2*matrix().cols() : m_maxIterations; return (m_maxIterations<0) ? 2*matrix().cols() : m_maxIterations;
} }
/** Sets the max number of iterations. /** Sets the max number of iterations.
* Default is twice the number of columns of the matrix. * Default is twice the number of columns of the matrix.
*/ */
@ -328,13 +328,13 @@ public:
eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized."); eigen_assert(m_isInitialized && "IterativeSolverBase is not initialized.");
return m_info; return m_info;
} }
/** \internal */ /** \internal */
template<typename Rhs, typename DestDerived> template<typename Rhs, typename DestDerived>
void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase<DestDerived> &aDest) const void _solve_with_guess_impl(const Rhs& b, SparseMatrixBase<DestDerived> &aDest) const
{ {
eigen_assert(rows()==b.rows()); eigen_assert(rows()==b.rows());
Index rhsCols = b.cols(); Index rhsCols = b.cols();
Index size = b.rows(); Index size = b.rows();
DestDerived& dest(aDest.derived()); DestDerived& dest(aDest.derived());
@ -368,7 +368,7 @@ public:
_solve_with_guess_impl(const Rhs& b, MatrixBase<DestDerived> &aDest) const _solve_with_guess_impl(const Rhs& b, MatrixBase<DestDerived> &aDest) const
{ {
eigen_assert(rows()==b.rows()); eigen_assert(rows()==b.rows());
Index rhsCols = b.cols(); Index rhsCols = b.cols();
DestDerived& dest(aDest.derived()); DestDerived& dest(aDest.derived());
ComputationInfo global_info = Success; ComputationInfo global_info = Success;
@ -420,19 +420,19 @@ protected:
{ {
return m_matrixWrapper.matrix(); return m_matrixWrapper.matrix();
} }
template<typename InputType> template<typename InputType>
void grab(const InputType &A) void grab(const InputType &A)
{ {
m_matrixWrapper.grab(A); m_matrixWrapper.grab(A);
} }
MatrixWrapper m_matrixWrapper; MatrixWrapper m_matrixWrapper;
Preconditioner m_preconditioner; Preconditioner m_preconditioner;
Index m_maxIterations; Index m_maxIterations;
RealScalar m_tolerance; RealScalar m_tolerance;
mutable RealScalar m_error; mutable RealScalar m_error;
mutable Index m_iterations; mutable Index m_iterations;
mutable ComputationInfo m_info; mutable ComputationInfo m_info;

View File

@ -13,7 +13,7 @@
namespace Eigen { namespace Eigen {
template<typename Decomposition, typename RhsType, typename GuessType> class SolveWithGuess; template<typename Decomposition, typename RhsType, typename GuessType> class SolveWithGuess;
/** \class SolveWithGuess /** \class SolveWithGuess
* \ingroup IterativeLinearSolvers_Module * \ingroup IterativeLinearSolvers_Module
* *
@ -45,15 +45,13 @@ public:
typedef typename internal::traits<SolveWithGuess>::PlainObject PlainObject; typedef typename internal::traits<SolveWithGuess>::PlainObject PlainObject;
typedef typename internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>, MatrixXpr, typename internal::traits<RhsType>::StorageKind>::type Base; typedef typename internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>, MatrixXpr, typename internal::traits<RhsType>::StorageKind>::type Base;
typedef typename internal::ref_selector<SolveWithGuess>::type Nested; typedef typename internal::ref_selector<SolveWithGuess>::type Nested;
SolveWithGuess(const Decomposition &dec, const RhsType &rhs, const GuessType &guess) SolveWithGuess(const Decomposition &dec, const RhsType &rhs, const GuessType &guess)
: m_dec(dec), m_rhs(rhs), m_guess(guess) : m_dec(dec), m_rhs(rhs), m_guess(guess)
{} {}
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC Index rows() const { return m_dec.cols(); }
Index rows() const EIGEN_NOEXCEPT { return m_dec.cols(); } EIGEN_DEVICE_FUNC Index cols() const { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); }
EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; } EIGEN_DEVICE_FUNC const Decomposition& dec() const { return m_dec; }
EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; } EIGEN_DEVICE_FUNC const RhsType& rhs() const { return m_rhs; }
@ -63,7 +61,7 @@ protected:
const Decomposition &m_dec; const Decomposition &m_dec;
const RhsType &m_rhs; const RhsType &m_rhs;
const GuessType &m_guess; const GuessType &m_guess;
private: private:
Scalar coeff(Index row, Index col) const; Scalar coeff(Index row, Index col) const;
Scalar coeff(Index i) const; Scalar coeff(Index i) const;
@ -87,8 +85,8 @@ struct evaluator<SolveWithGuess<Decomposition,RhsType, GuessType> >
m_result = solve.guess(); m_result = solve.guess();
solve.dec()._solve_with_guess_impl(solve.rhs(), m_result); solve.dec()._solve_with_guess_impl(solve.rhs(), m_result);
} }
protected: protected:
PlainObject m_result; PlainObject m_result;
}; };

View File

@ -101,8 +101,8 @@ class KLU : public SparseSolverBase<KLU<_MatrixType> >
if(m_numeric) klu_free_numeric(&m_numeric,&m_common); if(m_numeric) klu_free_numeric(&m_numeric,&m_common);
} }
EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return mp_matrix.rows(); } inline Index rows() const { return mp_matrix.rows(); }
EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return mp_matrix.cols(); } inline Index cols() const { return mp_matrix.cols(); }
/** \brief Reports whether previous computation was successful. /** \brief Reports whether previous computation was successful.
* *
@ -253,7 +253,7 @@ class KLU : public SparseSolverBase<KLU<_MatrixType> >
m_numeric = klu_factor(const_cast<StorageIndex*>(mp_matrix.outerIndexPtr()), const_cast<StorageIndex*>(mp_matrix.innerIndexPtr()), const_cast<Scalar*>(mp_matrix.valuePtr()), m_numeric = klu_factor(const_cast<StorageIndex*>(mp_matrix.outerIndexPtr()), const_cast<StorageIndex*>(mp_matrix.innerIndexPtr()), const_cast<Scalar*>(mp_matrix.valuePtr()),
m_symbolic, &m_common, Scalar()); m_symbolic, &m_common, Scalar());
m_info = m_numeric ? Success : NumericalIssue; m_info = m_numeric ? Success : NumericalIssue;
m_factorizationIsOk = m_numeric ? 1 : 0; m_factorizationIsOk = m_numeric ? 1 : 0;

View File

@ -404,10 +404,8 @@ template<typename _MatrixType> class FullPivLU
MatrixType reconstructedMatrix() const; MatrixType reconstructedMatrix() const;
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC inline Index rows() const { return m_lu.rows(); }
inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); } EIGEN_DEVICE_FUNC inline Index cols() const { return m_lu.cols(); }
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); }
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
template<typename RhsType, typename DstType> template<typename RhsType, typename DstType>

View File

@ -70,7 +70,7 @@ struct enable_if_ref<Ref<T>,Derived> {
* The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP(). * The data of the LU decomposition can be directly accessed through the methods matrixLU(), permutationP().
* *
* This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
* *
* \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU * \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU
*/ */
template<typename _MatrixType> class PartialPivLU template<typename _MatrixType> class PartialPivLU
@ -216,8 +216,8 @@ template<typename _MatrixType> class PartialPivLU
MatrixType reconstructedMatrix() const; MatrixType reconstructedMatrix() const;
EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_lu.rows(); } inline Index rows() const { return m_lu.rows(); }
EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_lu.cols(); } inline Index cols() const { return m_lu.cols(); }
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
template<typename RhsType, typename DstType> template<typename RhsType, typename DstType>

View File

@ -1437,6 +1437,7 @@ subVector(Index i) const
* \sa subVector(Index) * \sa subVector(Index)
*/ */
template<DirectionType Direction> template<DirectionType Direction>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Index subVectors() const Index subVectors() const
{ return (Direction==Vertical)?cols():rows(); } { return (Direction==Vertical)?cols():rows(); }

View File

@ -12,7 +12,7 @@
#include "SkylineUtil.h" #include "SkylineUtil.h"
namespace Eigen { namespace Eigen {
/** \ingroup Skyline_Module /** \ingroup Skyline_Module
* *
@ -102,18 +102,18 @@ public:
#endif // not EIGEN_PARSED_BY_DOXYGEN #endif // not EIGEN_PARSED_BY_DOXYGEN
/** \returns the number of rows. \sa cols(), RowsAtCompileTime */ /** \returns the number of rows. \sa cols(), RowsAtCompileTime */
inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { inline Index rows() const {
return derived().rows(); return derived().rows();
} }
/** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/
inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { inline Index cols() const {
return derived().cols(); return derived().cols();
} }
/** \returns the number of coefficients, which is \a rows()*cols(). /** \returns the number of coefficients, which is \a rows()*cols().
* \sa rows(), cols(), SizeAtCompileTime. */ * \sa rows(), cols(), SizeAtCompileTime. */
inline EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { inline Index size() const {
return rows() * cols(); return rows() * cols();
} }