diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-25 10:15:22 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-25 10:15:22 -0400 |
commit | 4716040703be1ee906439385d20475dcddad5ce3 (patch) | |
tree | 8efd3cf3007d8360e66f38e2d280127cbb70daa6 /Eigen/src/Core/CwiseBinaryOp.h | |
parent | ca85a1f6c5fc33ac382aa2d7ba2da63d55d3223e (diff) |
bug #86 : use internal:: namespace instead of ei_ prefix
Diffstat (limited to 'Eigen/src/Core/CwiseBinaryOp.h')
-rw-r--r-- | Eigen/src/Core/CwiseBinaryOp.h | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index 5def0db2a..8e9761640 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -45,56 +45,59 @@ * * \sa MatrixBase::binaryExpr(const MatrixBase<OtherDerived> &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp */ + +namespace internal { template<typename BinaryOp, typename Lhs, typename Rhs> -struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > +struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > { - // we must not inherit from ei_traits<Lhs> since it has + // we must not inherit from traits<Lhs> since it has // the potential to cause problems with MSVC - typedef typename ei_cleantype<Lhs>::type Ancestor; - typedef typename ei_traits<Ancestor>::XprKind XprKind; + typedef typename cleantype<Lhs>::type Ancestor; + typedef typename traits<Ancestor>::XprKind XprKind; enum { - RowsAtCompileTime = ei_traits<Ancestor>::RowsAtCompileTime, - ColsAtCompileTime = ei_traits<Ancestor>::ColsAtCompileTime, - MaxRowsAtCompileTime = ei_traits<Ancestor>::MaxRowsAtCompileTime, - MaxColsAtCompileTime = ei_traits<Ancestor>::MaxColsAtCompileTime + RowsAtCompileTime = traits<Ancestor>::RowsAtCompileTime, + ColsAtCompileTime = traits<Ancestor>::ColsAtCompileTime, + MaxRowsAtCompileTime = traits<Ancestor>::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits<Ancestor>::MaxColsAtCompileTime }; // even though we require Lhs and Rhs to have the same scalar type (see CwiseBinaryOp constructor), // we still want to handle the case when the result type is different. - typedef typename ei_result_of< + typedef typename result_of< BinaryOp( typename Lhs::Scalar, typename Rhs::Scalar ) >::type Scalar; - typedef typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind, - typename ei_traits<Rhs>::StorageKind>::ret StorageKind; - typedef typename ei_promote_index_type<typename ei_traits<Lhs>::Index, - typename ei_traits<Rhs>::Index>::type Index; + typedef typename promote_storage_type<typename traits<Lhs>::StorageKind, + typename traits<Rhs>::StorageKind>::ret StorageKind; + typedef typename promote_index_type<typename traits<Lhs>::Index, + typename traits<Rhs>::Index>::type Index; typedef typename Lhs::Nested LhsNested; typedef typename Rhs::Nested RhsNested; - typedef typename ei_unref<LhsNested>::type _LhsNested; - typedef typename ei_unref<RhsNested>::type _RhsNested; + typedef typename unref<LhsNested>::type _LhsNested; + typedef typename unref<RhsNested>::type _RhsNested; enum { LhsCoeffReadCost = _LhsNested::CoeffReadCost, RhsCoeffReadCost = _RhsNested::CoeffReadCost, LhsFlags = _LhsNested::Flags, RhsFlags = _RhsNested::Flags, - SameType = ei_is_same_type<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::ret, + SameType = is_same_type<typename _LhsNested::Scalar,typename _RhsNested::Scalar>::ret, StorageOrdersAgree = (int(Lhs::Flags)&RowMajorBit)==(int(Rhs::Flags)&RowMajorBit), Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( HereditaryBits | (int(LhsFlags) & int(RhsFlags) & ( AlignedBit | (StorageOrdersAgree ? LinearAccessBit : 0) - | (ei_functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + | (functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) ) ) ), Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), - CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + ei_functor_traits<BinaryOp>::Cost + CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + functor_traits<BinaryOp>::Cost }; }; +} // end namespace internal // we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor // that would take two operands of different types. If there were such an example, then this check should be @@ -104,33 +107,33 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > // So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to // add together a float matrix and a double matrix. #define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ - EIGEN_STATIC_ASSERT((ei_functor_allows_mixing_real_and_complex<BINOP>::ret \ - ? int(ei_is_same_type<typename NumTraits<LHS>::Real, typename NumTraits<RHS>::Real>::ret) \ - : int(ei_is_same_type<LHS, RHS>::ret)), \ + EIGEN_STATIC_ASSERT((internal::functor_allows_mixing_real_and_complex<BINOP>::ret \ + ? int(internal::is_same_type<typename NumTraits<LHS>::Real, typename NumTraits<RHS>::Real>::ret) \ + : int(internal::is_same_type<LHS, RHS>::ret)), \ YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) template<typename BinaryOp, typename Lhs, typename Rhs, typename StorageKind> class CwiseBinaryOpImpl; template<typename BinaryOp, typename Lhs, typename Rhs> -class CwiseBinaryOp : ei_no_assignment_operator, +class CwiseBinaryOp : internal::no_assignment_operator, public CwiseBinaryOpImpl< BinaryOp, Lhs, Rhs, - typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind, - typename ei_traits<Rhs>::StorageKind>::ret> + typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind, + typename internal::traits<Rhs>::StorageKind>::ret> { public: typedef typename CwiseBinaryOpImpl< BinaryOp, Lhs, Rhs, - typename ei_promote_storage_type<typename ei_traits<Lhs>::StorageKind, - typename ei_traits<Rhs>::StorageKind>::ret>::Base Base; + typename internal::promote_storage_type<typename internal::traits<Lhs>::StorageKind, + typename internal::traits<Rhs>::StorageKind>::ret>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) - typedef typename ei_nested<Lhs>::type LhsNested; - typedef typename ei_nested<Rhs>::type RhsNested; - typedef typename ei_unref<LhsNested>::type _LhsNested; - typedef typename ei_unref<RhsNested>::type _RhsNested; + typedef typename internal::nested<Lhs>::type LhsNested; + typedef typename internal::nested<Rhs>::type RhsNested; + typedef typename internal::unref<LhsNested>::type _LhsNested; + typedef typename internal::unref<RhsNested>::type _RhsNested; EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& lhs, const Rhs& rhs, const BinaryOp& func = BinaryOp()) : m_lhs(lhs), m_rhs(rhs), m_functor(func) @@ -138,19 +141,19 @@ class CwiseBinaryOp : ei_no_assignment_operator, EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); // require the sizes to match EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) - ei_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); + eigen_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } EIGEN_STRONG_INLINE Index rows() const { // return the fixed size type if available to enable compile time optimizations - if (ei_traits<typename ei_cleantype<LhsNested>::type>::RowsAtCompileTime==Dynamic) + if (internal::traits<typename internal::cleantype<LhsNested>::type>::RowsAtCompileTime==Dynamic) return m_rhs.rows(); else return m_lhs.rows(); } EIGEN_STRONG_INLINE Index cols() const { // return the fixed size type if available to enable compile time optimizations - if (ei_traits<typename ei_cleantype<LhsNested>::type>::ColsAtCompileTime==Dynamic) + if (internal::traits<typename internal::cleantype<LhsNested>::type>::ColsAtCompileTime==Dynamic) return m_rhs.cols(); else return m_lhs.cols(); @@ -171,12 +174,12 @@ class CwiseBinaryOp : ei_no_assignment_operator, template<typename BinaryOp, typename Lhs, typename Rhs> class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Dense> - : public ei_dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type + : public internal::dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type { typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived; public: - typedef typename ei_dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type Base; + typedef typename internal::dense_xpr_base<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >::type Base; EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const @@ -215,7 +218,7 @@ template<typename OtherDerived> EIGEN_STRONG_INLINE Derived & MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other) { - SelfCwiseBinaryOp<ei_scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived()); + SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, Derived, OtherDerived> tmp(derived()); tmp = other.derived(); return derived(); } @@ -229,7 +232,7 @@ template<typename OtherDerived> EIGEN_STRONG_INLINE Derived & MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) { - SelfCwiseBinaryOp<ei_scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived()); + SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, Derived, OtherDerived> tmp(derived()); tmp = other.derived(); return derived(); } |