Example description
/* E02BB_P0W_F C++ Header Example Program.
 *
 * Copyright 2019 Numerical Algorithms Group.
 * Mark 27, 2019.
 */

#include <nag.h>
#include <nagad.h>
#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;

int main(void)
{
  // Scalars
  int           exit_status = 0;
  const Integer m = 7;
  
  cout << "E02BB_P0W_F C++ Header Example Program Results\n\n";

  // Data points and values.
  double        x[m], y[m];

  x[0] = 0.0;  x[1] = 0.2; x[2] = 0.4; x[3] = 0.6;
  x[4] = 0.75; x[5] = 0.9; x[6] = 1.0;

  for (int i= 0; i < m; i++) {
    y[i] = exp(x[i]);
  }
  
  // Call the passive routine
  const Integer lck = m + 4, lwrk = 6*m+16;
  double        c[lck], lamda[lck], wrk[lwrk];
  Integer       ifail = 0;
  void          *ad_handle = 0;
  e01ba_p0w_f_(ad_handle,m,x,y,lamda,c,lck,wrk,lwrk,ifail);

  // Evaluate computed spline using e02bb
  double        xint = 0.5;
  double        fit;

  ifail = 0;
  e02bb_p0w_f_(ad_handle,lck,lamda,c,xint,fit,ifail);

  cout << "\n Value of fitted spline at x = " << xint;
  cout.precision(5);
  cout << " is: " << fit << endl;

  return exit_status;
}