[firedrake] operations on matrices
Lawrence Mitchell
lawrence.mitchell at imperial.ac.uk
Mon Jan 5 09:51:19 GMT 2015
On 5 Jan 2015, at 09:39, David Ham <David.Ham at imperial.ac.uk> wrote:
>
>
> On 5 January 2015 at 09:37, Cotter, Colin J <colin.cotter at imperial.ac.uk> wrote:
> Oh yes, good isolation of the problem.
>
> If alpha also depends on values of A, do we have a problem there too?
>
>
> Yes. Same problem. There is no current way for a parallel loop to read the entries of a matrix.
You could do this by creating a new output matrix, looping over the rows of the input matrix:
out = A.duplicate()
start, end = A.getOwnershipRange()
for row in range(start, end):
acol, aval = A.getRow(row)
alphacol, alphaval = alpha.getRow(row)
assert all(acol == alphacol), "Column pattern must match"
val = aval * alphaval
out.setValues(row, acol, val, addv=PETSc.InsertMode.INSERT_VALUES)
out.assemble()
Completely untested.
Lawrence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20150105/4cf6132b/attachment.sig>
More information about the firedrake
mailing list