/* Copyright (C) 1999 E. H. Haley (cwm.c was 1D CWM. crwth.c was 2D with separable gaussians. crwton.c uses the full covariance matrix.) trwth is crwton for the triagely image blending. */ #include #include #include #define RTP 2.5066283 //root two pi //#define NDATA 21 #define NX 21 #define NY 21 #define NCLU 4 #define NITS 100 int main(void) { int i,j, //data plane indices m, //cluster # d,d2, //dimension it; //iteration float num,denom, small=0.01, ploti,plotj, rdcim, term; float x[NX][NY][2], y[NX][NY]; float mux[NCLU][2], sigy[NCLU], f[NX][NY][NCLU]; float pc[NCLU], norm[NCLU]; float cov[NCLU][2][2], invcov[NCLU][2][2]; float px_c[NX][NY][NCLU], py_xc[NX][NY][NCLU], pc_yx[NX][NY][NCLU]; FILE *fd; char fname[32]; // srandom(2); for(i=0; i0 ? 1.0 : 0.0)+(j-10.0>0 ? 1.0 : 0.0); // printf("x[%d]=%.3f, y[%d]=%.3f\n", i,x[i][j], i,y[i][j]); } for(m=0; m_m for(m=0; mcol? sprintf(fname, "crwton%d.dat", NCLU); fd = fopen(fname, "w"); for (ploti=-11.0; ploti<11.0; ploti+=0.5) for (plotj=-11.0; plotj<11.0; plotj+=0.5) { num=denom=0.0; for (m=0; m