[petsc-users] get matlab representation si, sj, sa from MATSEQAIJ
Dominik Szczerba
dominik at itis.ethz.ch
Wed Nov 23 08:54:06 CST 2011
On Wed, Nov 23, 2011 at 3:09 PM, Jed Brown <jedbrown at mcs.anl.gov>
wrote:> On Wed, Nov 23, 2011 at 08:06, Dominik Szczerba
<dominik at itis.ethz.ch>> wrote:>>>> I looked through the help index
page for AIJ, matlab and similar>> keywords, but can not find a
suitable function.>> As I said in the other mail, just view to a PETSc
binary file and read it> with bin/matlab/PetscBinaryRead.m
Thanks for a useful hint. I can not use Matlab, trying with python. I do:
In [1]: import PetscBinaryIO
In [2]: io = PetscBinaryIO.PetscBinaryIO()
In [3]: objects = io.readBinaryFile("Ab.dat")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/home/dsz/data/test-solve/NS/cylinder/steady/<ipython console> in <module>()
/home/dsz/pack/petsc-3.2-p5/bin/pythonscripts/PetscBinaryIO.pyc in
decorated_f(self, *args, **kwargs)
88 self._update_dtypes()
89
---> 90 result = f(self, *args, **kwargs)
91
92 if changed:
/home/dsz/pack/petsc-3.2-p5/bin/pythonscripts/PetscBinaryIO.pyc in
readBinaryFile(self, fid, mattype)
404 objects.append(self.readIS(fid))
405 elif objecttype == 'Mat':
--> 406 objects.append(self.readMat(fid,mattype))
407 elif objecttype == 'Bag':
408 raise NotImplementedError('Bag Reader not
yet implemented')
/home/dsz/pack/petsc-3.2-p5/bin/pythonscripts/PetscBinaryIO.pyc in
decorated_f(self, *args, **kwargs)
88 self._update_dtypes()
89
---> 90 result = f(self, *args, **kwargs)
91
92 if changed:
/home/dsz/pack/petsc-3.2-p5/bin/pythonscripts/PetscBinaryIO.pyc in
readMat(self, fh, mattype)
332
333 if mattype == 'sparse':
--> 334 return readMatSparse(fh)
335 elif mattype == 'dense':
336 return readMatDense(fh)
NameError: global name 'readMatSparse' is not defined
I see that readMatSparse is a part of the script, so I am not missing
any externals.
My variables:
$ echo $PETSC_DIR
/home/dsz/pack/petsc-3.2-p5
$ echo $PETSC_ARCH
linux-gnu-c-debug
I have petsc-3.2-p5/bin/pythonscripts/ in PYTHONPATH. What did I miss?
Many thanks
Dominik
More information about the petsc-users
mailing list