/* This is a sample program to show how to find the determinant and the inverse of a given matrix. Here ludcmp() and lubksb() use index from 0 to n-1. */ #include #include #define TINY 1.0e-20; main() { float **a,**b,**c,**d,det,x,y; float **matrix(),*vector(); int i,j,k,l,m,n; float invdet(); printf("n="); scanf("%d",&n); printf("\nn=%d\n",n); a=matrix(0,n,0,n); b=matrix(0,n,0,n); c=matrix(0,n,0,n); d=matrix(0,n,0,n); for (i=0; i big) big=temp; if (big == 0.0) printf("Singular matrix\n"); vv[i]=1.0/big; } for (j=0; j= big) { big=dum; imax=i; } } if ( j != imax) { for (k=0; k=0) for (j=ii; j<=i-1; j++) sum -= a[i][j]*b[j]; else if (sum) ii=i; b[i]=sum; } for (i=n-1; i>=0; i--) { sum=b[i]; for (j=i+1; j