[firedrake] Matrix multiplication in bilinear form
Lawrence Mitchell
lawrence.mitchell at imperial.ac.uk
Thu Nov 12 14:28:21 GMT 2015
Hi Anna,
On 12/11/15 12:38, Anna Kalogirou wrote:
> Hi Lawrence,
>
> In the email below you explained to me how to define a matrix free
> operator B. Is there a way to inspect the values of the matrix behind
> this operator?
Assuming that you are not running in parallel, and you do not have two
many degrees of freedom in your problem (I guess you want to look at
the values for a small system), you can do the following:
ctx = B.getPythonContext()
dense_A = ctx.A[:, :]
Q1_array = ctx.Q1.array_r
Q2_array = ctx.Q2.array_r
import numpy as np
dense_B = dense_A + np.outer(Q1_array, Q2_array)
print dense_B
Cheers,
Lawrence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20151112/66193f6d/attachment.sig>
More information about the firedrake
mailing list