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

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

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

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

  // Read problem size and number of right-hand-sides 
  Integer m, n, k;
  cin >> m >> n >> k;
  double alpha, beta;
  cin >> alpha >> beta;

  // Allocate arrays containing A and its factorized form, B
  // and the solution X.
  double  *a=0, *b=0, *c=0;
  a    =  new double  [k*m];  
  b    =  new double  [n*k];  
  c    =  new double  [m*n];  
  
  // Read the matrix A
  double dd;
  for (int i = 0; i<k; ++i) {
    for (int j = 0; j<m; ++j) {
      cin >> dd;
      Integer l = i + j*k;
      a[l] = dd;
    }
  }
  for (int i = 0; i<n; ++i) {
    for (int j = 0; j<k; ++j) {
      cin >> dd;
      Integer l = i + j*n;
      b[l] = dd;
    }
  }
  for (int i = 0; i<m*n; ++i) {
    c[i] = 1.0;
  }

  //  C = beta*C + alpha*A^T*B^T
  ifail = 0;
  f06ya_p0w_f_(ad_handle,"T","T",m,n,k,alpha,a,k,b,n,beta,c,m,ifail,1,1);

  cout << endl;
  NagError  fail;
  INIT_FAIL(fail);
  x04cac(Nag_ColMajor,Nag_GeneralMatrix,Nag_NonUnitDiag,m,n,c,m,
         "  Matrix C after update",0,&fail);

  delete [] a;
  delete [] b;
  delete [] c;

  return exit_status;
}