/* minv.c CCMATH mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU library * public license (LGPL). ( See the lgpl.license file for details.) * ------------------------------------------------------------------------ */ #include #include int minv(double *a,int n) { int lc,*le; double s,t,tq=0.,zr=1.e-15; double *pa,*pd,*ps,*p,*q,*q0; int i,j,k,m; le=(int *)malloc(n*sizeof(int)); q0=(double *)malloc(n*sizeof(double)); for(j=0,pa=pd=a; j0){ for(i=0,q=q0,p=pa; is){ s=t; lc=k;} } tq=tq>s?tq:s; if(s=0 ;--j){ --pa; pd-=n+1; for(i=0,m=n-j-1,q=q0,p=pd+n; ij ;--k,ps-=n){ t= -(*ps); for(i=j+1,p=ps,q=q0; ik){ t=0.; p=ps+j; i=j;} else{ t=q0[j]; p=ps+k+1; i=k+1;} for(; i=0 ;--j){ for(k=0,p=a+j,q=a+ *(--le); k