Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Queens: recursion and bit Up: Examples Previous: Reading Directories   Contents

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 2010-04-27