From 4716040703be1ee906439385d20475dcddad5ce3 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 25 Oct 2010 10:15:22 -0400 Subject: bug #86 : use internal:: namespace instead of ei_ prefix --- Eigen/src/Core/CwiseNullaryOp.h | 65 +++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 29 deletions(-) (limited to 'Eigen/src/Core/CwiseNullaryOp.h') diff --git a/Eigen/src/Core/CwiseNullaryOp.h b/Eigen/src/Core/CwiseNullaryOp.h index 0b8e7c0c1..a2f504985 100644 --- a/Eigen/src/Core/CwiseNullaryOp.h +++ b/Eigen/src/Core/CwiseNullaryOp.h @@ -42,32 +42,35 @@ * * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr() */ + +namespace internal { template -struct ei_traits > : ei_traits +struct traits > : traits { enum { - Flags = (ei_traits::Flags + Flags = (traits::Flags & ( HereditaryBits - | (ei_functor_has_linear_access::ret ? LinearAccessBit : 0) - | (ei_functor_traits::PacketAccess ? PacketAccessBit : 0))) - | (ei_functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), - CoeffReadCost = ei_functor_traits::Cost + | (functor_has_linear_access::ret ? LinearAccessBit : 0) + | (functor_traits::PacketAccess ? PacketAccessBit : 0))) + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + CoeffReadCost = functor_traits::Cost }; }; +} template -class CwiseNullaryOp : ei_no_assignment_operator, - public ei_dense_xpr_base< CwiseNullaryOp >::type +class CwiseNullaryOp : internal::no_assignment_operator, + public internal::dense_xpr_base< CwiseNullaryOp >::type { public: - typedef typename ei_dense_xpr_base::type Base; + typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) : m_rows(rows), m_cols(cols), m_functor(func) { - ei_assert(rows >= 0 + eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); @@ -99,8 +102,8 @@ class CwiseNullaryOp : ei_no_assignment_operator, } protected: - const ei_variable_if_dynamic m_rows; - const ei_variable_if_dynamic m_cols; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; const NullaryOp m_functor; }; @@ -185,7 +188,7 @@ template EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(Index rows, Index cols, const Scalar& value) { - return DenseBase::NullaryExpr(rows, cols, ei_scalar_constant_op(value)); + return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); } /** \returns an expression of a constant matrix of value \a value @@ -207,7 +210,7 @@ template EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(Index size, const Scalar& value) { - return DenseBase::NullaryExpr(size, ei_scalar_constant_op(value)); + return DenseBase::NullaryExpr(size, internal::scalar_constant_op(value)); } /** \returns an expression of a constant matrix of value \a value @@ -224,7 +227,7 @@ EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(const Scalar& value) { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_constant_op(value)); + return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op(value)); } /** @@ -247,7 +250,7 @@ EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturn DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return DenseBase::NullaryExpr(size, ei_linspaced_op(low,high,size)); + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); } /** @@ -260,7 +263,7 @@ DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& hig { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, ei_linspaced_op(low,high,Derived::SizeAtCompileTime)); + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } /** @@ -280,7 +283,7 @@ EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedRetu DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return DenseBase::NullaryExpr(size, ei_linspaced_op(low,high,size)); + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); } /** @@ -293,7 +296,7 @@ DenseBase::LinSpaced(const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, ei_linspaced_op(low,high,Derived::SizeAtCompileTime)); + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } /** \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ @@ -303,7 +306,7 @@ bool DenseBase::isApproxToConstant { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!ei_isApprox(this->coeff(i, j), value, prec)) + if(!internal::isApprox(this->coeff(i, j), value, prec)) return false; return true; } @@ -390,7 +393,7 @@ template EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return derived() = Derived::NullaryExpr(size, ei_linspaced_op(low,high,size)); + return derived() = Derived::NullaryExpr(size, internal::linspaced_op(low,high,size)); } // zero: @@ -469,7 +472,7 @@ bool DenseBase::isZero(RealScalar prec) const { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!ei_isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) return false; return true; } @@ -668,7 +671,7 @@ template EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType MatrixBase::Identity(Index rows, Index cols) { - return DenseBase::NullaryExpr(rows, cols, ei_scalar_identity_op()); + return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); } /** \returns an expression of the identity matrix (not necessarily square). @@ -686,7 +689,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType MatrixBase::Identity() { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return MatrixBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, ei_scalar_identity_op()); + return MatrixBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op()); } /** \returns true if *this is approximately equal to the identity matrix @@ -708,12 +711,12 @@ bool MatrixBase::isIdentity { if(i == j) { - if(!ei_isApprox(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isApprox(this->coeff(i, j), static_cast(1), prec)) return false; } else { - if(!ei_isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) return false; } } @@ -721,8 +724,10 @@ bool MatrixBase::isIdentity return true; } +namespace internal { + template=16)> -struct ei_setIdentity_impl +struct setIdentity_impl { static EIGEN_STRONG_INLINE Derived& run(Derived& m) { @@ -731,7 +736,7 @@ struct ei_setIdentity_impl }; template -struct ei_setIdentity_impl +struct setIdentity_impl { typedef typename Derived::Index Index; static EIGEN_STRONG_INLINE Derived& run(Derived& m) @@ -743,6 +748,8 @@ struct ei_setIdentity_impl } }; +} // end namespace internal + /** Writes the identity expression (not necessarily square) into *this. * * Example: \include MatrixBase_setIdentity.cpp @@ -753,7 +760,7 @@ struct ei_setIdentity_impl template EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() { - return ei_setIdentity_impl::run(derived()); + return internal::setIdentity_impl::run(derived()); } /** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this. -- cgit v1.2.3