Asked by Mo

Hi folks,

Just a quick question about Apinv in demo When we assemble stiffness matrix (say A in this demo), I can easily print it as:

print A.array()

But for Apinv, I cannot do something like this or save it to a .mat file. When I want to print it, I get the following error:

AttributeError: 'ConjGrad' object has no attribute 'array'

I want to be able to save Apinv to a .mat file similar to what I can do for assembled stiffness matrix easily.
Any help is deeply deeply appreciated.


Question information

English Edit question
CBC.Block Edit question
No assignee Edit question
Solved by:
Joachim Haga
Last query:
Last reply:
Revision history for this message
Mo (mo-h) said :

I really appreciate if anyone could help me out!

Revision history for this message
Launchpad Janitor (janitor) said :

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Joachim Haga (jobh) said :

Sorry, I didn't notice this question. Looks like we haven't set up the mail subscriptions properly. Is the question still relevant?

Revision history for this message
Mo (mo-h) said :

Yes, I would be grateful if you could help me in this regard.


Revision history for this message
Best Joachim Haga (jobh) said :

The inverse (and hence the pseudo-inverse) are not matrices, but actions. The inverse is not computed explicitly - that would be a very expensive operation, and result in a dense matrix.

If the matrices are small, the (dense) pseudoinverse can be calculated for example by multiplying by the unit vectors, one by one; each result is one row or column of the inverse. Or just calculate it with numpy/scipy/octave/matlab.

Revision history for this message
Mo (mo-h) said :

Thanks Joachim Haga, that solved my question.