NAG Library Manual, Mark 27.3
Interfaces:  FL   CL   CPP   AD 

NAG CL Interface Introduction
Example description
/* nag_specfun_hankel_complex (s17dlc) Example Program.
 *
 * Copyright 2021 Numerical Algorithms Group.
 *
 * Mark 27.3, 2021.
 */

#include <nag.h>
#include <stdio.h>

int main(void) {
  Integer exit_status = 0;
  Complex z, cy[2];
  double fnu;
  const Integer n = 2;
  Integer m, nz;
  char nag_enum_arg[40];
  Nag_ScaleResType scal;
  NagError fail;

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n]");
  printf("nag_specfun_hankel_complex (s17dlc) Example Program Results\n");
  printf("Calling with n = %" NAG_IFMT "\n", n);
  printf("m    fnu           z             scal              cy[0]"
         "           cy[1]      nz\n");
  while (scanf(" %" NAG_IFMT " %lf (%lf,%lf) %39s%*[^\n] ", &m, &fnu, &z.re,
               &z.im, nag_enum_arg) != EOF) {
    /* nag_enum_name_to_value (x04nac).
     * Converts NAG enum member name to value
     */
    scal = (Nag_ScaleResType)nag_enum_name_to_value(nag_enum_arg);

    /* nag_specfun_hankel_complex (s17dlc).
     * Hankel functions H_(nu+a)^(j)(z), j = 1,2, real a >= 0,
     * complex z, nu = 0,1,2,...
     */
    nag_specfun_hankel_complex(m, fnu, z, n, scal, cy, &nz, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_specfun_hankel_complex (s17dlc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    if (fail.code == NE_NOERROR)
      printf("%" NAG_IFMT " %7.4f (%7.3f,%7.3f) %-14s (%7.3f,%7.3f) "
             "(%7.3f,%7.3f) %" NAG_IFMT "\n",
             m, fnu, z.re, z.im, nag_enum_arg, cy[0].re, cy[0].im, cy[1].re,
             cy[1].im, nz);
    else {
      printf("Error from nag_specfun_hankel_complex (s17dlc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
  }

END:

  return exit_status;
}