[petsc-users] Storing a matrix in PETSc binary form?
Barry Smith
bsmith at mcs.anl.gov
Wed Jul 13 00:02:49 CDT 2011
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
More information about the petsc-users
mailing list