Example description
/* F11XE_P0W_F C++ Header Example Program.
 *
 * Copyright 2020 Numerical Algorithms Group.
 * Mark 27.1, 2020.
 */
#include <dco_light.hpp>
#include <nag.h>
#include <nagx04.h>
#include <nagad.h>
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void)
{
  int       exit_status = 0;
  void      *ad_handle = 0;
  Integer   ifail = 0;

  cout << "F11XE_P0W_F C++ Header Example Program Results\n\n";
  // Skip heading in data file
  string mystr;
  getline (cin, mystr);

  // Read order of matrix and number of nonzero entries
  Integer   n, nnz;
  cin >> n;
  cin >> nnz;

  double    *a=0, *x=0, *y=0;
  Integer   *icol=0, *irow=0;

  a        = new double [nnz];
  x        = new double [n];
  y        = new double [n];
  icol     = new Integer [nnz];
  irow     = new Integer [nnz];
      
  // Read the matrix A
  for (int i=0; i<nnz; i++) {
    cin >> a[i] >> irow[i] >> icol[i];
  }
      
  // Read the vector x
  for (int i=0; i<n; i++) {
    cin >> x[i];
  }

  // Calculate matrix-vector product
  ifail = 0;
  f11xe_p0w_f_(ad_handle,n,nnz,a,irow,icol,"C",x,y,ifail,1);

  // Output results
  cout.setf(ios::scientific,ios::floatfield);
  cout.precision(4);
  cout << "  Matrix-vector product" << endl;
  for (int i=0; i<n; ++i) {
    cout.width(12);cout << y[i] << endl;
  }

  delete [] a;
  delete [] x;
  delete [] y;
  delete [] icol;
  delete [] irow;

  return exit_status;
}