Re: [deal.II] ABOUT OPERATING PETScWrappers::MPI::SparseMatrix

2020-08-30 Thread xs...@berkeley.edu
Thank you very much.

Best,

Xiang

On Sunday, August 30, 2020 at 2:40:14 PM UTC-7 Wolfgang Bangerth wrote:

> On 8/30/20 12:20 AM, xs...@berkeley.edu wrote:
> > Hi, I declared two same scale matrix A and B using 
> > PETScWrappers::MPI::SparseMatrix and assign values on these two 
> matrixes. I 
> > want to do some operation on them to get another matrix C which equals 
> h*A+B. 
> > How should I get the matrix C? Thank you very much.
>
> This should work:
>
> C = B;
> C.add (h, A);
>
> Best
> W.
>
> -- 
> 
> Wolfgang Bangerth email: bang...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/3be5-c161-4429-a90c-07c182062ae5n%40googlegroups.com.


Re: [deal.II] ABOUT OPERATING PETScWrappers::MPI::SparseMatrix

2020-08-30 Thread Wolfgang Bangerth

On 8/30/20 12:20 AM, xs...@berkeley.edu wrote:
Hi, I declared two same scale matrix A and B using 
PETScWrappers::MPI::SparseMatrix and assign values on these two matrixes. I 
want to do some operation on them to get another matrix C which equals h*A+B. 
How should I get the matrix C? Thank you very much.


This should work:

C = B;
C.add (h, A);

Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/b049bd31-33fa-416a-9fbf-0a2a85353788%40colostate.edu.


[deal.II] ABOUT OPERATING PETScWrappers::MPI::SparseMatrix

2020-08-30 Thread xs...@berkeley.edu
Hi, I declared two same scale matrix A and B using 
PETScWrappers::MPI::SparseMatrix and assign values on these two matrixes. I 
want to do some operation on them to get another matrix C which equals 
h*A+B. How should I get the matrix C? Thank you very much.

Xiang

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/95590c06-e628-4361-ad59-7adbe62b99b3n%40googlegroups.com.