I created a binary matrix using the following loop in c
char filename[6];
filename=sprintf(filename,"file01");
moutput=fopen(filename,"wb+");
for (i=0; i<2*m+1; i++){
for (j=0; j<2*n+1; j++) {
r=rmin+(rmax-rmin)*GetRand(N);
fwrite(&r, sizeof(double), 1, moutput);
}
}
fclose(moutput);
where r is a uniformly distributed pseudorandom double precision number between $rmin$ and $rmax$. I verified that it wrote the values correctly.
So, I am using this tutorial as a guideline to load "file01" as a binary matrix. I ran the following script:
make ex1
./ex1 -f0 file01
However, it does not seem to work. I get an error saying:
[0]PETSC ERROR: Unexpected data in file!
[0]PETSC ERROR: not matrix object in file!
Is the problem that I wrote the binary file initially or that I'm using the wrong example to load this particular binary file?