/* From: "COMPUTATIONAL PHYSICS, 2nd Ed" by RH Landau, MJ Paez, and CC Bordeianu Copyright Wiley-VCH, 2007. Electronic Materials copyright: R Landau, Oregon State Univ, 2007; MJ Paez, Univ Antioquia, 2007; & CC Bordeianu, Univ Bucharest, 2007 Support by National Science Foundation */ // lineq.c: Solve matrix equation Ax = b using LAPACK routine sgesv // LAPACK has to be installed on your system #include #define size 3 // dimension of matrix main() { int i, j , c1, c2, pivot[size], ok; float A[size][size], b[size], AT[size*size]; 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; // vector b b[1]= -0.1; b[2]= 1.8; // Transform matrix for Fortran for (i = 0; i