Changeset 5323


Ignore:
Timestamp:
08/17/10 15:52:05 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added some checks if output is NaN

Location:
issm/trunk/src/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/Orthx/Orthx.cpp

    r4053 r5323  
    3030                ISSMERROR("||∂J/∂α||∞ = 0  gradient is zero");
    3131        }
     32        if(isnan(norm_new)){
     33                ISSMERROR("input vector norm is NaN\n");
     34        }
    3235        VecScale(newgradj,1.0/norm_new);
    3336
  • issm/trunk/src/c/shared/Numerics/BrentSearch.cpp

    r3775 r5323  
    5656        //get the value of the function at the first boundary
    5757        fxmin = (*f)(xmin,optargs);
     58        if isnan(fxmin) ISSMERROR("Function evaluation returned NaN");
    5859
    5960        //display result
     
    6364        //get the value of the function at the first boundary xmax and display result
    6465        fxmax = (*f)(xmax,optargs);
     66        if isnan(fxmax) ISSMERROR("Function evaluation returned NaN");
    6567        _printf_("        %s    %12.6g  %12.6g  %s","   N/A",xmax,fxmax,"         N/A         boundary\n");
    6668
     
    9496        //2: call the function to be evaluated
    9597        fxbest = (*f)(x,optargs);
     98        if isnan(fxbest) ISSMERROR("Function evaluation returned NaN");
    9699        iter=iter+1;
    97100
     
    190193                //evaluate function on x
    191194                fx = (*f)(x,optargs);
     195                if isnan(fx) ISSMERROR("Function evaluation returned NaN");
    192196                iter=iter+1;
    193197
Note: See TracChangeset for help on using the changeset viewer.