Matrix addition

Matthew Knepley knepley at
Thu Dec 28 09:54:58 CST 2006

We do have MatAXPY() modeled after BLAS.


On 12/28/06, Tobias Neckel <neckel at> wrote:
> Hi,
> I have a small (perhaps even silly) question concerning an addition of two matrices.
> Sorry in advance since I am quite new in using petsc.
> Currently I am successfully using MatPtAP for the computation of a matrix Q = M^T*A*M
> with matrices M and A in my C++ code.
> Now, I need to enlarge the functionality to use two matrices M1 and M2 together with
> A in order to calculate Q = M1^T*A*M1 + M2^T*A*M2.
> I have been looking in the manual pages for a routine for adding up two matrices
> without success. Is there any way to do this and I just didn't see it? Or is there
> another possibility in order to compute my desired matrix Q?
> Thank you
> Tobias

One trouble is that despite this system, anyone who reads journals widely
and critically is forced to realize that there are scarcely any bars to eventual
publication. There seems to be no study too fragmented, no hypothesis too
trivial, no literature citation too biased or too egotistical, no design too
warped, no methodology too bungled, no presentation of results too
inaccurate, too obscure, and too contradictory, no analysis too self-serving,
no argument too circular, no conclusions too trifling or too unjustified, and
no grammar and syntax too offensive for a paper to end up in print. --
Drummond Rennie

More information about the petsc-users mailing list