[petsc-users] How to efficiently assemble this matrix?

Matthew Knepley knepley at gmail.com
Thu Jul 17 08:53:28 CDT 2014


On Thu, Jul 17, 2014 at 6:35 AM, Italo Tasso <
bichinhoverde at spwinternet.com.br> wrote:

> I have two matrices: matrix A is 4n x 4n and matrix C is n x n. I want to
> set the values of A using the values of C, like this:
>
> A[4i+k][4j+k] = C[i][j]
> 0 < i < n
> 0 < j < n
> 0 < k < 3
>
> How can I do this efficiently?
>

The best way to do it is to assemble directly into the big matrix. You can
do this by explicitly
translating indices, or use something like this


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html

  Thanks,

     Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140717/f21e8fd5/attachment.html>


More information about the petsc-users mailing list