[petsc-users] storing a matrix in petsc binary form

2012-03-08 Thread Wu Degang
Hi, I need to convert a matrix (in standard c array form) to the "pestc binary form" so that I can pass it to a slepc program which solves the eigenvalue spectrum for the matrix. I found someone else has raised this question long before (http://lists.mcs.anl.gov/pipermail/petsc-users/2011-July

[petsc-users] storing a matrix in petsc binary form

2012-03-08 Thread Jose E. Roman
El 08/03/2012, a las 08:29, Wu Degang escribi?: > Hi, > > I need to convert a matrix (in standard c array form) to the "pestc binary > form" so that I can pass it to a slepc program which solves the eigenvalue > spectrum for the matrix. I found someone else has raised this question long > bef

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread Barry Smith
On Jul 13, 2011, at 2:40 AM, John Chludzinski wrote: > $ ls -l > -rw-r--r-- 1 John None 192208072 Jul 13 03:31 binaryoutput > -rw-r--r-- 1 John None 0 Jul 13 03:31 binaryoutput.info > -rw-r--r-- 1 John None 128128032 Jul 13 01:43 DOF4002_k_double.bin > -rw-r--r-- 1 John None 128128032 Jul 13 01:4

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread John Chludzinski
$ ls -l -rw-r--r-- 1 John None 192208072 Jul 13 03:31 binaryoutput -rw-r--r-- 1 John None 0 Jul 13 03:31 binaryoutput.info -rw-r--r-- 1 John None 128128032 Jul 13 01:43 DOF4002_k_double.bin -rw-r--r-- 1 John None 128128032 Jul 13 01:43 DOF4002_m_double.bin where DOF4002_k_double.bin and DOF4002_m_

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread John Chludzinski
Is this what you had in mind (more or less)? ---John //---CONVERTER- static char help[] = "Reads matrix: \n -f : file to load \n\n"; #define SIZE 4002 #inclu

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread John Chludzinski
They're dense. I'm trying to use a SLEPc generalized eigenvalue example that expects matrices stored in PETSc binary files. ---John On Wed, Jul 13, 2011 at 1:02 AM, Barry Smith wrote: > > If it is truly a dense matrix then it isn't clear that you want to store > it as a PETSc binary matrix

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread John Chludzinski
fread( (void *)K, sizeof(double), SIZE*SIZE, fpK ) On Wed, Jul 13, 2011 at 12:41 AM, 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 ).

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread John Chludzinski
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

[petsc-users] Storing a matrix in PETSc binary form?

2011-07-13 Thread Barry Smith
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,