<div>They're dense. I'm trying to use a SLEPc generalized eigenvalue example that expects matrices stored in PETSc binary files.<br></div><div><br></div><div>---John</div><div><br></div><br><div class="gmail_quote">
On Wed, Jul 13, 2011 at 1:02 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
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<br>
<br>
PetscInt n;<br>
PetscScalar *values;<br>
<br>
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));<br>
<font color="#888888"><br>
Barry<br>
</font><div><div class="h5"><br>
On Jul 12, 2011, at 11:41 PM, John Chludzinski wrote:<br>
<br>
> 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:<br>
><br>
> read( (void *)K, sizeof(double), SIZE*SIZE, fpK ).<br>
><br>
> How do I convert this simple binary file of (sequentially stored) doubles into a "PETSc binary matrix file"?<br>
><br>
> ---John<br>
<br>
</div></div></blockquote></div><br>