[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: Queens: recursion and bit Up: Examples Previous: Reading Directories

Calling fortan NAG library routines

#include <stdio.h>
#include <stdlib.h>
/*  c89 -L/usr/local/lib g01aaf.c -lnag -lcl */

main(){
int i;
int n, iwt, ifail;
double x[10], wt[10];
double xmean, s2, s3, s4, xmin, xmax, wtsum; 
  iwt = 0;
  n = 10;
  ifail = 0;
  for (i=0;i<10;i++){
   wt[i]=1;
   x[i]= 3.5 * i;
  }

  g01aaf(&n, x, &iwt, wt, &xmean, &s2, &s3, &s4, 
         &xmin, &xmax, &wtsum, &ifail);
  if (ifail == 0){
     printf("Mean is %lf, Std deviation is %lf\n", xmean, s2);
     printf("Max is  %lf, min is %lf\n", xmax, xmin);
  }
  else
     printf("G01AAF failed\n");
}



Tim Love
1999-10-06