Getting the transpose of a Generic Matrix

Asked by Douglas Brinkerhoff

Hi,

I was wondering if there was a way to get the transpose of a Generic Matrix ( particularly the stiffness matrix that would be output by using assemble() on a bilinear form)? I can get the entries in a numpy array, but I'd rather keep the sparse format and be able to use it in the Dolfin LA framework. I'm looking for the adjoint of the stiffness matrix for use in implementing the discrete adjoint method.

Thanks in advance.

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
Joachim Haga (jobh) said :
#1

Not for creating the transpose explicitly, but you can use the
Matrix.transpmult() method to perform the transposed vector multiply.

You can also have a look at CBC.Block (http://launchpad.net/cbc.block)
which extends the PyDolfin matrix algebra. Then you can do
  A = assemble(...)
  AT= block_transpose(A)
  v = AT*x

Revision history for this message
Martin Sandve Alnæs (martinal) said :
#2

Or you can create a form for assembling the adjoint (transpose):

a = u*v*dx
aT = adjoint(a) # swaps test and trial functions

and assemble aT directly.

Martin

On 10 June 2011 09:56, Joachim Haga
<email address hidden> wrote:
> Question #160909 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/160909
>
>    Status: Open => Answered
>
> Joachim Haga proposed the following answer:
> Not for creating the transpose explicitly, but you can use the
> Matrix.transpmult() method to perform the transposed vector multiply.
>
> You can also have a look at CBC.Block (http://launchpad.net/cbc.block)
> which extends the PyDolfin matrix algebra. Then you can do
>  A = assemble(...)
>  AT= block_transpose(A)
>  v = AT*x
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Can you help with this problem?

Provide an answer of your own, or ask Douglas Brinkerhoff for more information if necessary.

To post a message you must log in.