dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #19231
[Question #121973]: Get sparse matrix data
New question #121973 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/121973
Hello,
The questions below are PETSc-related so please let me know if I really should ask them elsewhere.
I'm generating a sparse coefficient matrix A using
A = assemble(a)
where a is some bilinear form. I'm wondering how I can access the arrays that describe A in compressed sparse row format. I thought A.data would do the job but:
In [61]: A.data?
Type: instancemethod
Base Class: <type 'instancemethod'>
String Form: <bound method Matrix.data of <dolfin.cpp.Matrix; proxy of <Swig Object of type 'dolfin::Matrix *' at 0x916ab18> >>
Namespace: Interactive
File: /home/orban/Work/FEniCS/lib/python2.6/site-packages/dolfin/cpp.py
Definition: A.data(self)
Docstring:
Return arrays to underlying compresssed row/column storage data
In [62]: A.data()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/home/orban/Envs/sparse/dev/fenics/<ipython console> in <module>()
/home/orban/Work/FEniCS/lib/python2.6/site-packages/dolfin/cpp.pyc in data(self)
2124 """ Return arrays to underlying compresssed row/column storage data """
2125
-> 2126 return self._data()
2127
2128 def __getitem__(self,indices):
RuntimeError: *** Error: Unable to return pointers to underlying matrix data.
I'm using FEniCS under Fedora.
Also, I can compute matrix-vector products with A*x, but is there a better way to compute transpose matrix-vector products than with A.transpmult?
Thanks!
Dominique
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
Follow ups