If it is truly a dense matrix then it isn't clear that you want to store it as a PETSc binary matrix but you can using the following code
PetscInt n; PetscScalar *values; allocate values the correct size; read the entries into values then call MatCreateSeqDense(PETSC_COMM_SELF,n,n,values,&A); the call MatView(A,PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)); Barry On Jul 12, 2011, at 11:41 PM, John Chludzinski wrote: > I have a matrix stored as a sequential list of binary values (not PETSc > binary form) that I read in with a single block read: > > read( (void *)K, sizeof(double), SIZE*SIZE, fpK ). > > How do I convert this simple binary file of (sequentially stored) doubles > into a "PETSc binary matrix file"? > > ---John
