Fortran: use standard-compliant ieee_is_nan() instead of GNU extension isnan()
parent
8a79899189
commit
9e7e069aa8
|
@ -22,6 +22,7 @@
|
|||
module trust_region
|
||||
use iso_fortran_env
|
||||
use lapack
|
||||
use ieee_arithmetic
|
||||
implicit none (type, external)
|
||||
|
||||
private
|
||||
|
@ -98,8 +99,8 @@ contains
|
|||
call f_and_update_norms
|
||||
|
||||
! Test if the nonlinear system of equations is well behaved at the initial guess.
|
||||
if (any(isnan(fvec))) return
|
||||
if (any(isnan(fjac))) return
|
||||
if (any(ieee_is_nan(fvec))) return
|
||||
if (any(ieee_is_nan(fjac))) return
|
||||
|
||||
! Do not iterate if the initial guess is a solution of the nonlinear system of equations.
|
||||
if (norm2(fvec)<tolf_actual) then
|
||||
|
@ -214,7 +215,7 @@ contains
|
|||
x0 = x
|
||||
x = x2
|
||||
call f_and_update_norms
|
||||
if (any(isnan(fvec)) .or. any(isnan(fjac))) then
|
||||
if (any(ieee_is_nan(fvec)) .or. any(ieee_is_nan(fjac))) then
|
||||
x = x0
|
||||
call f_and_update_norms
|
||||
delta = delta / 2
|
||||
|
|
|
@ -22,6 +22,7 @@ module c_reduction
|
|||
use lapack
|
||||
use blas
|
||||
use matlab_mex
|
||||
use ieee_arithmetic
|
||||
implicit none (type, external)
|
||||
|
||||
contains
|
||||
|
@ -73,7 +74,7 @@ loop: do
|
|||
info(1) = 401._c_double
|
||||
info(2) = real(log(norm(A1i,"1")), c_double)
|
||||
exit loop
|
||||
elseif (isnan(crit) .or. (info_inv /= 0_blint)) then
|
||||
elseif (ieee_is_nan(crit) .or. (info_inv /= 0_blint)) then
|
||||
info(1) = 402._c_double
|
||||
info(2) = real(log(norm(A1i,"1")), c_double)
|
||||
exit loop
|
||||
|
|
|
@ -22,6 +22,7 @@ module l_reduction
|
|||
use lapack
|
||||
use blas
|
||||
use matlab_mex
|
||||
use ieee_arithmetic
|
||||
implicit none (type, external)
|
||||
|
||||
contains
|
||||
|
@ -89,7 +90,7 @@ loop: do
|
|||
info(1) = 411._c_double
|
||||
info(2) = real(log(crit), c_double)
|
||||
exit loop
|
||||
elseif (isnan(crit) .or. (info_inv /= 0_blint)) then
|
||||
elseif (ieee_is_nan(crit) .or. (info_inv /= 0_blint)) then
|
||||
info(1) = 412._c_double
|
||||
info(2) = 1._c_double
|
||||
exit loop
|
||||
|
|
Loading…
Reference in New Issue