Skip to content

Commit ae96b7b

Browse files
author
Yi Zhang
committed
replace naive C style NaN check with Eigen's hasNaN
1 parent 29f2933 commit ae96b7b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

stan/math/prim/fun/matrix_exp_2x2.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ matrix_exp_2x2(const EigMat& A) {
4848
B(1, 1) = exp_half_a_plus_d * (delta_cosh - ad_sinh_half_delta);
4949

5050
// use pade approximation if cosh & sinh ops overflow to NaN
51-
if ((B.array() != B.array()).any()) {
51+
if (B.hasNaN()) {
5252
return matrix_exp_pade(A);
5353
} else {
5454
return B / delta;

0 commit comments

Comments
 (0)