/* nag_complex_hankel (s17dlc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include int main(void) { Complex z, cy[2]; double fnu; const Integer n = 2; Integer m, nz; Nag_ScaleResType scal_enum; char scal; Integer exit_status = EXIT_SUCCESS; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("nag_complex_hankel (s17dlc) Example Program Results\n"); Vprintf("Calling with n = %ld\n", n); Vprintf(" m fnu z scal cy[0] " "cy[1] nz\n"); while (scanf(" %ld %lf (%lf,%lf) '%c'%*[^\n] ", &m, &fnu, &z.re, &z.im, &scal) != EOF) { /* Convert scal character to enum */ if (scal == 's') { scal_enum = Nag_ScaleRes; } else if (scal == 'u') { scal_enum = Nag_UnscaleRes; } else { Vprintf("Unrecognised character for Nag_ScaleResType type\n"); exit_status = -1; goto END; } /* nag_complex_hankel (s17dlc). * Hankel functions H_(nu~+~a)^(j)(z), j~=~1~,~2, real * a~>=~0, complex z, nu~=0~,~1~,~2~,~... */ nag_complex_hankel(m, fnu, z, n, scal_enum, cy, &nz, &fail); if (fail.code == NE_NOERROR) Vprintf(" %ld %7.4f (%7.3f,%7.3f) '%c' (%7.3f,%7.3f) " "(%7.3f,%7.3f) %ld\n", m, fnu, z.re, z.im, scal, cy[0].re, cy[0].im, cy[1].re, cy[1].im, nz); else { Vprintf("Error from nag_complex_hankel (s17dlc).\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }