X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=sources%2Fmulticoil%2Fmatrix_operations.c;fp=sources%2Fmulticoil%2Fmatrix_operations.c;h=06b0098220e8654cff605a9ae8a4f2b89172a3db;hb=1431c641556befdbff5922788061394f2c870a80;hp=0000000000000000000000000000000000000000;hpb=4e8f16a99a41f25bcaf0772796d4d3b8f63aa38f;p=jpred.git diff --git a/sources/multicoil/matrix_operations.c b/sources/multicoil/matrix_operations.c new file mode 100644 index 0000000..06b0098 --- /dev/null +++ b/sources/multicoil/matrix_operations.c @@ -0,0 +1,347 @@ +/*** These are from numerical_recipes in C. */ +/*** PROBLEM: Thier counts went from 1 to N. **/ +/*** I Changed that. ***/ +#include +#include +#include "scconst.h" + +#define MAX_MATRIX_SIZE MAX_NUM_SCORE_DIM + +/*** gaussj replaces a by its inverse?? If b starts as identity matrix?? ***/ +#define SWAP(a,b) {double temp=(a);(a)=(b);(b)=temp;} + +void gaussj(a,n,b,m) +double a[MAX_MATRIX_SIZE][MAX_MATRIX_SIZE],b[MAX_MATRIX_SIZE][MAX_MATRIX_SIZE]; +int n,m; +{ + int *indxc,*indxr,*ipiv; + int i,icol,irow,j,k,l,ll,*ivector(); + double big,dum,pivinv; + void nrerror(),free_ivector(); + + indxc=ivector(1,n); + indxr=ivector(1,n); + ipiv=ivector(1,n); + for (j=0;j= big) { + big=fabs(a[j][k]); + irow=j; + icol=k; + } + } else if (ipiv[k] > 1) nrerror("GAUSSJ: Singular Matrix-1"); + } + ++(ipiv[icol]); + if (irow != icol) { + for (l=0;l=0;l--) { + if (indxr[l] != indxc[l]) + for (k=0;k big) big=temp; + } + if (big == 0.0) nrerror("Singular matrix in routine LUDCMP"); + vv[i]=1.0/big; + } + + for (j=0;j= big) { + big=dum; + imax=i; + } + } + if (j != imax) { + for (k=0;k=0;i--) { + sum=b[i]; + for (j=i+1;j