/************************************************************ * cholesky.c main program for testing Cholesky * * decomposition routine cholesky() * * * * Created by William J. De Meo * * on 11/29/97 * * * * http://www.math.hawaii.edu/~williamdemeo/C/stat243/reports/hw3/hw3/node6.html ************************************************************/ #include #include #include #include "prototypes.h" #define MAX_NAME 100 void cholesky(long N, double *A, double *diag); void read_name(char *); int main() { char *filename; double *A, *diag; long i, j, dim; filename = cmalloc(MAX_NAME); printf("\nEnter file name containing the spd matrix: "); read_name(filename); printf("\nEnter its dimension: "); scanf("%d",&dim); A = dmalloc(dim*dim); diag = dmalloc(dim); matlabread(A, dim, dim, filename); /*matrix is stored contiguously column-wise */ cholesky(dim,A,diag); printf("\nThe Cholesky factor is: \nL = \n"); for(i=0;i