I think it is a problem with matrices in R and C being stored in different row/column order
void gowsim ( double *mat, int *OBJ, int *MATDESC) {
double x [*MATDESC][*OBJ];
int i, j, nrow, ncol;
nrow = *OBJ;
ncol = *MATDESC;
/* Rebuild Matrix */
for (j=0; j < ncol; j++) {
for (i=0; i < nrow; i++) {
x[i][j] = *mat;
Swapping x[i][j] to x[j][i] should fix the problem. Sorry, I did not test it.
Rprintf("row %d col %d value %f\n", i, j, x[i][j]);
mat++;
}
}
for (i=0; i< nrow; i++) {
Rprintf("%f %f %f %f\n", x[i][0], x[i][1], x[i][2], x[i][3]);
}
}
Jarek ====================================================\======= Jarek Tuszynski, PhD. o / \ Science Applications International Corporation <\__,| (703) 676-4192 "> \ Jaroslaw.W.Tuszynski at saic.com ` \