Create block PETScMatrix for eigenvalue computation

Asked by Praveen C

Hello

To solve a generalized eigenvalue problem A*x = lambda*E*x, I do

E11 = PETScMatrix()
assemble(m, tensor=E11)

A11 = PETScMatrix()
assemble(a, tensor=A11)

The above is not a problem. Now I want to do the following for which I need help

A12 = [[1, 0], ..., [0 1]]

and construct block matrices (matlab notation)

E = [E11, 0; 0, 0]
A = [A11, A12; A12', 0]

Can you tell me how to construct such PETScMatrice ?

praveen

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Praveen C (cpraveen) said :
#1

I have created E and A as of type Matrix(). Is it possible to get a PETScMatrix from these, since SLEPcEigenSolver expects them to be of type PETScMatrix ?

Revision history for this message
Johan Hake (johan-hake) said :
#2

On Monday October 10 2011 04:35:36 Praveen C wrote:
> Question #173502 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/173502
>
> Praveen C gave more information on the question:
> I have created E and A as of type Matrix(). Is it possible to get a
> PETScMatrix from these, since SLEPcEigenSolver expects them to be of
> type PETScMatrix ?

You can either just create the matrix directly as a

  PETScMatrix

or use

  A.down_cast<PETScMatrix>()

in C++, or

  down_cast(A)

in Python.

Johan

Can you help with this problem?

Provide an answer of your own, or ask Praveen C for more information if necessary.

To post a message you must log in.