$title Test extrinsic functions in cppcclib (CPPLIB02,SEQ=636) $onText Here we test that the extrinsic function in cppcclib for the bi-variate normal distribution CDF 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 cdf2.value(data(T,'x'),data(T,'y'),data(T,'r')) $macro f1(j) cdf2.grad (j:data(T,'x'),data(T,'y'),data(T,'r')); $macro f1n(j) cdf2.gradn(j:data(T,'x'),data(T,'y'),data(T,'r')); $macro f2(j1,j2) cdf2.hess (j1:j2:data(T,'x'),data(T,'y'),data(T,'r')); $macro f2n(j1,j2) cdf2.hessn(j1:j2:data(T,'x'),data(T,'y'),data(T,'r')); $include extrtest2a.inc data(T, 'f_') = data(T,'cdf'); scalar aeps0 'absolute error tolerance: function' / 1e-15 / reps0 'relative error tolerance: function' / 1e-15 / aeps1 'absolute error tolerance: grad' / 1e-5 / reps1 'relative error tolerance: grad' / 1e-5 / aeps2 'absolute error tolerance: hess' / 1e-5 / reps2 'relative error tolerance: hess' / 1e-5 / aepsr 'absolute error tolerance: hess xr' / 1e-2 / repsr 'relative error tolerance: hess xr' / 1e-2 / ; $include extrtest2b.inc