[petsc-users] How can I do matrix addition with different nonzeros patterns correctly?

Fangbo Wang fangbowa at buffalo.edu
Fri Mar 3 15:31:59 CST 2017


Hi,

I am a little bit confused on how to appropriately do matrix addition with
different nonzeros patterns.

Suppose I want to do D=2*A+3*B+4*C, A, B and C all have different nonzero
patterns.
I know I can use MatDuplicate, MatCopy, MatConvert to create a matrix D,
which way is the right way?

What's the difference between MatDuplicate and MatCopy?

Thank you very much!

Best regards,

Fangbo


-- 
Fangbo Wang, PhD student
Stochastic Geomechanics Research Group
Department of Civil, Structural and Environmental Engineering
University at Buffalo
Email: *fangbowa at buffalo.edu <fangbowa at buffalo.edu>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170303/6d012e23/attachment.html>


More information about the petsc-users mailing list