fnrpow2.gms : Test correctness of rpower intrinsic

Description

rpower(x,y) = x**y
these points include more difficult ones, i.e. there are cases where
we get exceptions.


Small Model of Type : GAMS


Category : GAMS Test library


Main file : fnrpow2.gms   includes :   fnset_xy.inc [htmlfntest_xy.inc [html]

$title 'Test correctness of rpower intrinsic' (FNRPOW2,SEQ=195)

* rpower(x,y) = x**y
* these points include more difficult ones, i.e. there are cases where
* we get exceptions.
$include fnset_xy.inc

$gdxin fnrpow2
$load aeps reps relToInput T data
$gdxin

reps = 5e-13;
* hack for GDX bug
relToInput = max(0,relToInput);

data(T,'fyx_') = data(T,'fxy_');

loop {T,
  data(T,  'f')  = rpower.value(   data(T,'x'),data(T,'y'));
  data(T, 'fx')  = rpower.grad(1:  data(T,'x'),data(T,'y'));
  data(T, 'fy')  = rpower.grad(2:  data(T,'x'),data(T,'y'));
  data(T,'fxx')  = rpower.hess(1:1:data(T,'x'),data(T,'y'));
  data(T,'fxy')  = rpower.hess(1:2:data(T,'x'),data(T,'y'));
  data(T,'fyx')  = rpower.hess(2:1:data(T,'x'),data(T,'y'));
  data(T,'fyy')  = rpower.hess(2:2:data(T,'x'),data(T,'y'));
  data(T, 'rc')  = mathlastrc;
  data(T, 'ec')  = mathlastec;
};

abort$(execerror lt 10)
  'Should get execution errors getting grad/hess of x**y, x < 0)';
execerror = 0;

display relToInput;
$include fntest_xy.inc