fntest_xy.inc : intrinsics tests for f(x,y)

File : fntest_xy.inc  used by :  fnpower.gms [html]   fnvcpow.gms [htmlfnvcpow2.gms [html]   fnrpow.gms [htmlfnrpow2.gms [html]   fnrpow3.gms [htmlfnatan2.gms [html]   fnatan2n.gms [html]   fnatan2x.gms [html]   fncentry.gms [html]   fncentr4.gms [html]   fncentr5.gms [html]   fncentr6.gms [html]   fnspowx.gms [htmlfnspown.gms [html]   fnslexp.gms [htmlfnslexp2.gms [html]   fnsqexp.gms [htmlfnsqexp2.gms [html]   fnsllog10.gms [html]   fnsllog102.gms [html]   fnsqlog10.gms [html]   fnsqlog102.gms [html]   fnslrec.gms [htmlfnslrec2.gms [html]   fnsqrec.gms [htmlfnsqrec2.gms [html]   fnbinomial.gms [html]

* N.B.  This file may be included multiple times,
*       so put declarations in fnset_xy.inc if necessary

$if not defined reps reps = 0;
$if not defined reps0 reps0 = reps;
$if not defined reps1 reps1 = reps;
$if not defined reps2 reps2 = reps;
$if not defined aeps aeps = 0;
$if not defined aeps0 aeps0 = aeps;
$if not defined aeps1 aeps1 = aeps;
$if not defined aeps2 aeps2 = aeps;
$if not defined relToInput relToInput = 0;

* option zeroRes = 2.0e-299;
set TT(T);

data(T,  'f_a') = abs(data(T,  'f')-data(T,  'f_'));
data(T, 'fx_a') = abs(data(T, 'fx')-data(T, 'fx_'));
data(T, 'fy_a') = abs(data(T, 'fy')-data(T, 'fy_'));
data(T,'fxx_a') = abs(data(T,'fxx')-data(T,'fxx_'));
data(T,'fxy_a') = abs(data(T,'fxy')-data(T,'fxy_'));
data(T,'fyx_a') = abs(data(T,'fyx')-data(T,'fyx_'));
data(T,'fyy_a') = abs(data(T,'fyy')-data(T,'fyy_'));
if {relToInput,
  tmp(T) = max(1,abs(data(T,'x')));
  data(T,  'f_r') = data(T,  'f_a') / tmp(T);
  data(T, 'fx_r') = data(T, 'fx_a') / tmp(T);
  data(T, 'fy_r') = data(T, 'fy_a') / tmp(T);
  data(T,'fxx_r') = data(T,'fxx_a') / tmp(T);
  data(T,'fxy_r') = data(T,'fxy_a') / tmp(T);
  data(T,'fyx_r') = data(T,'fyx_a') / tmp(T);
  data(T,'fyy_r') = data(T,'fyy_a') / tmp(T);
else
  tmp(T) = abs(data(T,'f_'));
  TT(T) = tmp(T) > 0;
  data(T,   'f_r') = INF;
  data(T ,  'f_r')$(data(T,  'f_a') eq 0) = 0;
  data(TT,  'f_r') = data(TT,   'f_a') / tmp(TT);

  tmp(T) = abs(data(T,'fx_'));
  TT(T) = tmp(T) > 0;
  data(T,  'fx_r') = INF;
  data(T , 'fx_r')$(data(T, 'fx_a') eq 0) = 0;
  data(TT, 'fx_r') = data(TT,  'fx_a') / tmp(TT);
  tmp(T) = abs(data(T,'fy_'));
  TT(T) = tmp(T) > 0;
  data(T,  'fy_r') = INF;
  data(T , 'fy_r')$(data(T, 'fy_a') eq 0) = 0;
  data(TT, 'fy_r') = data(TT,  'fy_a') / tmp(TT);

  tmp(T) = abs(data(T,'fxx_'));
  TT(T) = tmp(T) > 0;
  data(T, 'fxx_r') = INF;
  data(T ,'fxx_r')$(data(T,'fxx_a') eq 0) = 0;
  data(TT,'fxx_r') = data(TT, 'fxx_a') / tmp(TT);
  tmp(T) = abs(data(T,'fxy_'));
  TT(T) = tmp(T) > 0;
  data(T, 'fxy_r') = INF;
  data(T ,'fxy_r')$(data(T,'fxy_a') eq 0) = 0;
  data(TT,'fxy_r') = data(TT, 'fxy_a') / tmp(TT);
  tmp(T) = abs(data(T,'fyx_'));
  TT(T) = tmp(T) > 0;
  data(T, 'fyx_r') = INF;
  data(T ,'fyx_r')$(data(T,'fyx_a') eq 0) = 0;
  data(TT,'fyx_r') = data(TT, 'fyx_a') / tmp(TT);
  tmp(T) = abs(data(T,'fyy_'));
  TT(T) = tmp(T) > 0;
  data(T, 'fyy_r') = INF;
  data(T ,'fyy_r')$(data(T,'fyy_a') eq 0) = 0;
  data(TT,'fyy_r') = data(TT, 'fyy_a') / tmp(TT);
};
data(T,'rc_e') = abs(data(T,'rc')-data(T,'rc_'));
data(T,'ec_e') = abs(data(T,'ec')-data(T,'ec_'));

badTV(T,V) = no;
badTV(T,fV(V))   = ((data(T,  'f_a') > aeps0) and (data(T,  'f_r') > reps0));
badTV(T,fxV(V))  = ((data(T, 'fx_a') > aeps1) and (data(T, 'fx_r') > reps1));
badTV(T,fyV(V))  = ((data(T, 'fy_a') > aeps1) and (data(T, 'fy_r') > reps1));
badTV(T,fxxV(V)) = ((data(T,'fxx_a') > aeps2) and (data(T,'fxx_r') > reps2));
badTV(T,fxyV(V)) = ((data(T,'fxy_a') > aeps2) and (data(T,'fxy_r') > reps2));
badTV(T,fyxV(V)) = ((data(T,'fyx_a') > aeps2) and (data(T,'fyx_r') > reps2));
badTV(T,fyyV(V)) = ((data(T,'fyy_a') > aeps2) and (data(T,'fyy_r') > reps2));
badTV(T,rcV(V))  = data(T,'rc_e');
badTV(T,ecV(V))  = data(T,'ec_e');
badT(T) = sum{badTV(T,V), yes};
badTV(badT,inV) = yes;
failures(T,V) = 0;
fail2(T,V) = 0;
failures(badT,V) = data(badT,V);
fail2(badTV) = failures(badTV);
display 'failed tests', failures, fail2;
* display data;
scalar nTests, nErrors;
nTests = card(T);
nErrors = card(badT);
display 'absolute tolerance: ', aeps0, aeps1, aeps2;
display 'relative tolerance: ', reps0, reps1, reps2;
display 'data points tested: ', nTests;
display '            errors: ', nErrors;
$if set FAILGDX   execute_unload '%FAILGDX%', badT, failures, fail2, aeps, aeps0, aeps1, aeps2, reps, reps0, reps1, reps2;

abort$(nErrors) 'There were errors';