cpplib03.gms : Test extrinsic functions in cppcclib

Description

Here we test that the extrinsic function in cppcclib for the bi-variate
normal distribution PDF works as expected, by comparing the function
values to precomputed ones and derivative values to numeric
derivatives.

Contributor: Steve


Small Model of Type : GAMS


Category : GAMS Test library


Main file : cpplib03.gms

$Title Test extrinsic functions in cppcclib (CPPLIB03,SEQ=654)

$ontext
Here we test that the extrinsic function in cppcclib for the bi-variate
normal distribution PDF works as expected, by comparing the function
values to precomputed ones and derivative values to numeric
derivatives.

Contributor: Steve
$offtext
$ondollar

$funclibin mvnLib cppcclib

function pdf2    'PDF of bivariate normal'  / mvnLib.pdfBVN /;
* function cdf2    'CDF of bivariate normal'  / mvnLib.cdfBVN /;

$if not set INFILE $set INFILE bvnFull
$macro f0         pdf2.value(data(T,'x'),data(T,'y'),data(T,'r'))
$macro f1(j)      pdf2.grad (j:data(T,'x'),data(T,'y'),data(T,'r'));
$macro f1n(j)     pdf2.gradn(j:data(T,'x'),data(T,'y'),data(T,'r'));
$macro f2(j1,j2)  pdf2.hess (j1:j2:data(T,'x'),data(T,'y'),data(T,'r'));
$macro f2n(j1,j2) pdf2.hessn(j1:j2:data(T,'x'),data(T,'y'),data(T,'r'));

$include extrtest2a.inc

data(T, 'f_') = data(T,'pdf');

scalar
 aeps0       'absolute error tolerance: function' / 1e-14 /
 reps0       'relative error tolerance: function' / 1e-14 /
 aeps1       'absolute error tolerance: grad'     / 2e-4 /
 reps1       'relative error tolerance: grad'     / 2e-4 /
 aeps2       'absolute error tolerance: hess'     / 1e-4 /
 reps2       'relative error tolerance: hess'     / 1e-4 /
 aepsr       'absolute error tolerance: hess xr'  / 1e-2 /
 repsr       'relative error tolerance: hess xr'  / 1e-2 /
 ;

$include extrtest2b.inc