/* solving the matrix equation A*x=b using LAPACK */ #include #define SIZE 3 /* dimension of matrix */ int sgesv_(int *n, int *nrhs, float *a, int *lda, int *ipiv, float *b, int *ldb, int *info); int main(int argc, char **argv) { int i, j , pivot[SIZE], ok; float A[SIZE][SIZE], b[SIZE], AT[SIZE*SIZE]; /* single precision!!! */ A[0][0]=3.1; A[0][1]=1.3; A[0][2]=-5.7; /* matrix A */ A[1][0]=1.0; A[1][1]=-6.9; A[1][2]=5.8; A[2][0]=3.4; A[2][1]=7.2; A[2][2]=-8.8; b[0]=-1.3; /* if you define b as a matrix then you */ b[1]=-0.1; /* can solve multiple equations with */ b[2]=1.8; /* the same A but different b */ /* ******************************************************************* */ /* IMPORTANT CONVERSION !!! */ /* ******************************************************************* */ for (i=0; i