
/* This is just an example to show you how to call solve_system */
/* You need to populate a and b as well as initialize m and n */
/* Note that the dimensions of a and b need to be incremented by 1 */
/* This is because "Numerical Recipies" do not use the 0 location */


#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

extern "C" void solve_system(int, int, float**, float*, float*); 

int main()
{
 int i;
 int m, n;
 float **a, *x, *b;

/* this is an example */

 m = n = 3;

 a = new float* [m+1];
 for(i=0; i<m+1; i++)
   a[i] = new float [n+1];

 a[1][1]=1.0; a[1][2]=0.0; a[1][3]=0.0;
 a[2][1]=0.0; a[2][2]=1.0; a[2][3]=0.0;
 a[3][1]=0.0; a[3][2]=0.0; a[3][3]=1.0;
 
 x = new float [n+1];

 b = new float [m+1];

 b[1]=1.0; b[2]=1.0; b[3]=1.0;

 solve_system(m,n,a,x,b);

 printf("x[1]=%f x[2]=%f x[3]=%f", x[1], x[2], x[3]);

}

