Description
centropy(p,q,delta) = p * log((p+delta)/(q+delta))
Small Model of Type : GAMS
Category : GAMS Test library
Main file : fncentr.gms includes : fnset_x.inc [html] fntest_x.inc [html]
$title 'Test correctness of centropy intrinsic' (FNCENTR,SEQ=317)
$onText
centropy(p,q,delta) = p * log((p+delta)/(q+delta))
$offText
$include fnset_x.inc
$gdxIn fncentr
$load relToInput aeps reps0 reps1 reps2 T data
$gdxIn
aeps = 1e-15;
reps0 = 1e-12;
reps1 = 1e-13;
reps2 = 1e-13;
loop {T,
data(T, 'f') = centropy.value (data(T,'x'), data(T,'c'), data(T,'d'));
data(T, 'fx') = centropy.grad (data(T,'x'), data(T,'c'), data(T,'d'));
data(T,'fxx') = centropy.hess (data(T,'x'), data(T,'c'), data(T,'d'));
data(T, 'rc') = mathlastrc;
data(T, 'ec') = mathlastec;
};
* we may get evaluation errors if we have some very large
* points in the input: this should not cause the test to fail
execerror = 0;
$include fntest_x.inc