/* nag_heston_term (s30ncc) Example Program. * * Copyright 2013 Numerical Algorithms Group. * * Mark 24, 2013. */ #include #include #include #include int main(void) { /* Scalars */ Integer exit_status = 0; double disc, fwd, t, var0; Integer i, j, m, numts; /* Arrays */ double *alpha = 0, *corr = 0, *lambda = 0, *p = 0, *sigmat = 0, *ts = 0, *x = 0; char option_str[8+1]; /* Nag Types */ Nag_CallPut option; NagError fail; printf("nag_heston_term (s30ncc) Example Program Results\n"); /* Initialise fail */ INIT_FAIL(fail); scanf("%*[^\n] "); /* Skip heading in data file */ scanf("%8s%*[^\n]", option_str); /* nag_enum_name_to_value (x04nac). * Converts NAG enum member name to value */ option = (Nag_CallPut) nag_enum_name_to_value(option_str); scanf("%ld %ld%*[^\n] ", &m, &numts); if (!(p = NAG_ALLOC(m, double))|| !(ts = NAG_ALLOC(numts, double))|| !(x = NAG_ALLOC(m, double))|| !(alpha = NAG_ALLOC(numts, double))|| !(corr = NAG_ALLOC(numts, double))|| !(lambda = NAG_ALLOC(numts, double))|| !(sigmat = NAG_ALLOC(numts, double)) ) { printf("Allocation failure\n"); exit_status = -1; goto END; } scanf("%lf %lf %lf%*[^\n] ", &fwd, &disc, &var0); for (j=0; j