dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17114
Re: [Question #95871]: Matrix Addition
Question #95871 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/95871
Status: Open => Answered
Johan Hake proposed the following answer:
On Friday 01 January 2010 12:57:47 Pietro Maximoff wrote:
> New question #95871 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/95871
>
> Hello
>
> How do I add two matrices together using the C++ interface, i.e, A = M + K
> ?
The operator+ is not implemented in the C++ interface. You can do something
like:
Matrix A(M);
A += K;
or
Matrix A(M);
A.axpy(1.0, K, true);
if you know they have the same sparsity pattern.
Johan
> The Matrix class has no function for this and axpy doesn't seem like the
> right one to use.
>
> Best wishes
>
> Pietro
>
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.