mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Proper handling of domain errors.
This commit is contained in:
@@ -970,9 +970,14 @@ struct polygamma_impl {
|
||||
static Scalar run(Scalar n, Scalar x) {
|
||||
Scalar zero = 0.0, one = 1.0;
|
||||
Scalar nplus = n + one;
|
||||
const Scalar nan = NumTraits<Scalar>::quiet_NaN();
|
||||
|
||||
// Check that n is an integer
|
||||
if (numext::floor(n) != n) {
|
||||
return nan;
|
||||
}
|
||||
// Just return the digamma function for n = 1
|
||||
if (n == zero) {
|
||||
else if (n == zero) {
|
||||
return digamma_impl<Scalar>::run(x);
|
||||
}
|
||||
// Use the same implementation as scipy
|
||||
|
||||
Reference in New Issue
Block a user