mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-07 18:27:40 +08:00
zeta and polygamma are not unary functions, but binary ones.
This commit is contained in:
parent
7a54032408
commit
6761c64d60
@ -51,8 +51,6 @@ namespace Eigen
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(zeta,scalar_zeta_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(polygamma,scalar_polygamma_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op)
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op)
|
||||
@ -161,6 +159,42 @@ namespace Eigen
|
||||
);
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise polygamma(\a n, \a x) to the given arrays.
|
||||
*
|
||||
* It returns the \a n -th derivative of the digamma(psi) evaluated at \c x.
|
||||
*
|
||||
*/
|
||||
// * \warning Be careful with the order of the parameters: x.polygamma(n) is equivalent to polygamma(n,x)
|
||||
// * \sa ArrayBase::polygamma()
|
||||
template<typename DerivedN,typename DerivedX>
|
||||
inline const Eigen::CwiseBinaryOp<Eigen::internal::scalar_polygamma_op<typename DerivedX::Scalar>, const DerivedN, const DerivedX>
|
||||
polygamma(const Eigen::ArrayBase<DerivedN>& n, const Eigen::ArrayBase<DerivedX>& x)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_polygamma_op<typename DerivedX::Scalar>, const DerivedN, const DerivedX>(
|
||||
n.derived(),
|
||||
x.derived()
|
||||
);
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise zeta(\a x, \a q) to the given arrays.
|
||||
*
|
||||
* It returns the Riemann zeta function of two arguments \a x and \a q:
|
||||
*
|
||||
* \param x is the exposent, it must be > 1
|
||||
* \param q is the shift, it must be > 0
|
||||
*
|
||||
* \sa ArrayBase::zeta()
|
||||
*/
|
||||
template<typename DerivedX,typename DerivedQ>
|
||||
inline const Eigen::CwiseBinaryOp<Eigen::internal::scalar_zeta_op<typename DerivedX::Scalar>, const DerivedX, const DerivedQ>
|
||||
zeta(const Eigen::ArrayBase<DerivedX>& x, const Eigen::ArrayBase<DerivedQ>& q)
|
||||
{
|
||||
return Eigen::CwiseBinaryOp<Eigen::internal::scalar_zeta_op<typename DerivedX::Scalar>, const DerivedX, const DerivedQ>(
|
||||
x.derived(),
|
||||
q.derived()
|
||||
);
|
||||
}
|
||||
|
||||
namespace internal
|
||||
{
|
||||
EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op)
|
||||
|
@ -298,3 +298,37 @@ operator^(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
||||
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL);
|
||||
return CwiseBinaryOp<internal::scalar_boolean_xor_op, const Derived, const OtherDerived>(derived(),other.derived());
|
||||
}
|
||||
|
||||
// NOTE disabled until we agree on argument order
|
||||
#if 0
|
||||
/** \cpp11 \returns an expression of the coefficient-wise polygamma function.
|
||||
*
|
||||
* It returns the \a n -th derivative of the digamma(psi) evaluated at \c *this.
|
||||
*
|
||||
* \warning Be careful with the order of the parameters: x.polygamma(n) is equivalent to polygamma(n,x)
|
||||
*
|
||||
* \sa Eigen::polygamma()
|
||||
*/
|
||||
template<typename DerivedN>
|
||||
inline const CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>
|
||||
polygamma(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedN> &n) const
|
||||
{
|
||||
return CwiseBinaryOp<internal::scalar_polygamma_op<Scalar>, const DerivedN, const Derived>(n.derived(), this->derived());
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise zeta function.
|
||||
*
|
||||
* It returns the Riemann zeta function of two arguments \c *this and \a q:
|
||||
*
|
||||
* \param *this is the exposent, it must be > 1
|
||||
* \param q is the shift, it must be > 0
|
||||
*
|
||||
* \sa Eigen::zeta()
|
||||
*/
|
||||
template<typename DerivedQ>
|
||||
inline const CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>
|
||||
zeta(const EIGEN_CURRENT_STORAGE_BASE_CLASS<DerivedQ> &q) const
|
||||
{
|
||||
return CwiseBinaryOp<internal::scalar_zeta_op<Scalar>, const Derived, const DerivedQ>(this->derived(), q.derived());
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturn
|
||||
typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> CoshReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_lgamma_op<Scalar>, const Derived> LgammaReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived> DigammaReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_zeta_op<Scalar>, const Derived> ZetaReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_polygamma_op<Scalar>, const Derived> PolygammaReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_erf_op<Scalar>, const Derived> ErfReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_erfc_op<Scalar>, const Derived> ErfcReturnType;
|
||||
typedef CwiseUnaryOp<internal::scalar_pow_op<Scalar>, const Derived> PowReturnType;
|
||||
@ -331,22 +329,6 @@ digamma() const
|
||||
return DigammaReturnType(derived());
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise zeta function.
|
||||
*/
|
||||
inline const ZetaReturnType
|
||||
zeta() const
|
||||
{
|
||||
return ZetaReturnType(derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise polygamma function.
|
||||
*/
|
||||
inline const PolygammaReturnType
|
||||
polygamma() const
|
||||
{
|
||||
return PolygammaReturnType(derived());
|
||||
}
|
||||
|
||||
/** \cpp11 \returns an expression of the coefficient-wise Gauss error
|
||||
* function of *this.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user