mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Rename free functions isFinite, isInf, isNaN to be compatible with c++11
This commit is contained in:
@@ -62,9 +62,9 @@ namespace Eigen
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isNaN,scalar_isNaN_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isInf,scalar_isInf_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isFinite,scalar_isFinite_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op)
|
||||
|
||||
template<typename Derived>
|
||||
inline const Eigen::CwiseUnaryOp<Eigen::internal::scalar_pow_op<typename Derived::Scalar>, const Derived>
|
||||
|
||||
@@ -803,14 +803,12 @@ template<typename T>
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool (isfinite)(const std::complex<T>& x)
|
||||
{
|
||||
using std::real;
|
||||
using std::imag;
|
||||
return isfinite(real(x)) && isfinite(imag(x));
|
||||
return numext::isfinite(numext::real(x)) && numext::isfinite(numext::imag(x));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool (isNaN)(const T& x)
|
||||
bool (isnan)(const T& x)
|
||||
{
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
using std::isnan;
|
||||
@@ -822,17 +820,14 @@ bool (isNaN)(const T& x)
|
||||
|
||||
template<typename T>
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool (isNaN)(const std::complex<T>& x)
|
||||
bool (isnan)(const std::complex<T>& x)
|
||||
{
|
||||
using std::real;
|
||||
using std::imag;
|
||||
using std::isnan;
|
||||
return isnan(real(x)) || isnan(imag(x));
|
||||
return numext::isnan(numext::real(x)) || numext::isnan(numext::imag(x));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool (isInf)(const T& x)
|
||||
bool (isinf)(const T& x)
|
||||
{
|
||||
#ifdef EIGEN_HAS_C99_MATH
|
||||
using std::isinf;
|
||||
@@ -844,12 +839,9 @@ bool (isInf)(const T& x)
|
||||
|
||||
template<typename T>
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool (isInf)(const std::complex<T>& x)
|
||||
bool (isinf)(const std::complex<T>& x)
|
||||
{
|
||||
using std::real;
|
||||
using std::imag;
|
||||
using std::isinf;
|
||||
return isinf(real(x)) || isinf(imag(x));
|
||||
return numext::isinf(numext::real(x)) || numext::isinf(numext::imag(x));
|
||||
}
|
||||
|
||||
template<typename Scalar>
|
||||
|
||||
@@ -586,15 +586,15 @@ struct functor_traits<scalar_ceil_op<Scalar> >
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute whether a scalar is NaN
|
||||
* \sa class CwiseUnaryOp, ArrayBase::isNaN()
|
||||
* \sa class CwiseUnaryOp, ArrayBase::isnan()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_isNaN_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_isNaN_op)
|
||||
template<typename Scalar> struct scalar_isnan_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_isnan_op)
|
||||
typedef bool result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::isNaN(a); }
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::isnan(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_isNaN_op<Scalar> >
|
||||
struct functor_traits<scalar_isnan_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
Cost = NumTraits<Scalar>::MulCost,
|
||||
@@ -603,16 +603,16 @@ struct functor_traits<scalar_isNaN_op<Scalar> >
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the isInf of a scalar
|
||||
* \sa class CwiseUnaryOp, ArrayBase::isInf()
|
||||
* \brief Template functor to check whether a scalar is +/-inf
|
||||
* \sa class CwiseUnaryOp, ArrayBase::isinf()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_isInf_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_isInf_op)
|
||||
template<typename Scalar> struct scalar_isinf_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_isinf_op)
|
||||
typedef bool result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::isInf(a); }
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::isinf(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_isInf_op<Scalar> >
|
||||
struct functor_traits<scalar_isinf_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
Cost = NumTraits<Scalar>::MulCost,
|
||||
@@ -621,16 +621,16 @@ struct functor_traits<scalar_isInf_op<Scalar> >
|
||||
};
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the isFinite of a scalar
|
||||
* \sa class CwiseUnaryOp, ArrayBase::isFinite()
|
||||
* \brief Template functor to check whether a scalar has a finite value
|
||||
* \sa class CwiseUnaryOp, ArrayBase::isfinite()
|
||||
*/
|
||||
template<typename Scalar> struct scalar_isFinite_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_isFinite_op)
|
||||
template<typename Scalar> struct scalar_isfinite_op {
|
||||
EIGEN_EMPTY_STRUCT_CTOR(scalar_isfinite_op)
|
||||
typedef bool result_type;
|
||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::isfinite(a); }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct functor_traits<scalar_isFinite_op<Scalar> >
|
||||
struct functor_traits<scalar_isfinite_op<Scalar> >
|
||||
{
|
||||
enum {
|
||||
Cost = NumTraits<Scalar>::MulCost,
|
||||
|
||||
@@ -25,9 +25,9 @@ typedef CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived> CubeReturn
|
||||
typedef CwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived> RoundReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived> FloorReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived> CeilReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_isNaN_op<Scalar>, const Derived> IsNaNReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_isInf_op<Scalar>, const Derived> IsInfReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_isFinite_op<Scalar>, const Derived> IsFiniteReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_isnan_op<Scalar>, const Derived> IsNaNReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_isinf_op<Scalar>, const Derived> IsInfReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_isfinite_op<Scalar>, const Derived> IsFiniteReturnType;
|
||||
|
||||
/** \returns an expression of the coefficient-wise absolute value of \c *this
|
||||
*
|
||||
@@ -366,12 +366,12 @@ ceil() const
|
||||
return CeilReturnType(derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise isNaN of *this.
|
||||
/** \returns an expression of the coefficient-wise isnan of *this.
|
||||
*
|
||||
* Example: \include Cwise_isNaN.cpp
|
||||
* Output: \verbinclude Cwise_isNaN.out
|
||||
*
|
||||
* \sa isFinite(), isInf()
|
||||
* \sa isfinite(), isinf()
|
||||
*/
|
||||
inline const IsNaNReturnType
|
||||
isNaN() const
|
||||
@@ -379,12 +379,12 @@ isNaN() const
|
||||
return IsNaNReturnType(derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise isInf of *this.
|
||||
/** \returns an expression of the coefficient-wise isinf of *this.
|
||||
*
|
||||
* Example: \include Cwise_isInf.cpp
|
||||
* Output: \verbinclude Cwise_isInf.out
|
||||
*
|
||||
* \sa isNaN(), isFinite()
|
||||
* \sa isnan(), isfinite()
|
||||
*/
|
||||
inline const IsInfReturnType
|
||||
isInf() const
|
||||
@@ -392,12 +392,12 @@ isInf() const
|
||||
return IsInfReturnType(derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise isFinite of *this.
|
||||
/** \returns an expression of the coefficient-wise isfinite of *this.
|
||||
*
|
||||
* Example: \include Cwise_isFinite.cpp
|
||||
* Output: \verbinclude Cwise_isFinite.out
|
||||
*
|
||||
* \sa isNaN(), isInf()
|
||||
* \sa isnan(), isinf()
|
||||
*/
|
||||
inline const IsFiniteReturnType
|
||||
isFinite() const
|
||||
|
||||
Reference in New Issue
Block a user