cpplib05.gms : Test extrinsic functions in cppcclib

Description

Here we test that the extrinsic function in cppcclib for the tri-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 : cpplib05.gms

$title Test extrinsic functions in cppcclib (CPPLIB05,SEQ=656)

$onText
Here we test that the extrinsic function in cppcclib for the tri-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 xdf    'PDF of trivariate normal'  / mvnLib.pdfTVN /;

$if not set INFILE $set INFILE tvnInit

$macro f0         xdf.value(      data(T,'x'),data(T,'y'),data(T,'z'),data(T,'r'),data(T,'s'),data(T,'t'))
$macro f1(j)      xdf.grad (j:    data(T,'x'),data(T,'y'),data(T,'z'),data(T,'r'),data(T,'s'),data(T,'t'))
$macro f1n(j)     xdf.gradn(j:    data(T,'x'),data(T,'y'),data(T,'z'),data(T,'r'),data(T,'s'),data(T,'t'))
$macro f2(j1,j2)  xdf.hess (j1:j2:data(T,'x'),data(T,'y'),data(T,'r'),data(T,'r'),data(T,'s'),data(T,'t'))
$macro f2n(j1,j2) xdf.hessn(j1:j2:data(T,'x'),data(T,'y'),data(T,'r'),data(T,'r'),data(T,'s'),data(T,'t'))

$include extrtest3a.inc

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

scalar
 aeps0       'absolute error tolerance: function' / 1e-7 /
 reps0       'relative error tolerance: function' / 1e-8 /
 aeps1       'absolute error tolerance: grad'     / 2e-2 /
 reps1       'relative error tolerance: grad'     / 2e-2 /
 aeps2       'absolute error tolerance: hess'     / 1e-2 /
 reps2       'relative error tolerance: hess'     / 1e-2 /
 aepsr       'absolute error tolerance: hess Xr'  / .01 /
 repsr       'relative error tolerance: hess Xr'  / .15 /
 ;

$include extrtest3b.inc