Add digamma for CPU + CUDA. Includes tests.

This commit is contained in:
Eugene Brevdo
2015-12-24 21:15:38 -08:00
parent bdcbc66a5c
commit f7362772e3
9 changed files with 447 additions and 62 deletions

View File

@@ -22,6 +22,7 @@ typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> TanhReturn
typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturnType;
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_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;
@@ -318,6 +319,19 @@ lgamma() const
return LgammaReturnType(derived());
}
/** \returns an expression of the coefficient-wise digamma (psi, derivative of lgamma).
*
* Example: \include Cwise_digamma.cpp
* Output: \verbinclude Cwise_digamma.out
*
* \sa cos(), sin(), tan()
*/
inline const DigammaReturnType
digamma() const
{
return DigammaReturnType(derived());
}
/** \returns an expression of the coefficient-wise Gauss error
* function of *this.
*