[petsc-users] How to efficiently assemble this matrix?
Italo Tasso
bichinhoverde at spwinternet.com.br
Thu Jul 17 13:50:02 CDT 2014
Thanks Matt and Jed. After further analysis, it turns out that the
operation I must perform is even more complicated than what I initially
described. So direct assembly seems to be the only option. I ended up using
MatGetRow and MatSetValues.
On Thu, Jul 17, 2014 at 10:53 AM, Matthew Knepley <knepley at gmail.com> wrote:
> 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/915adcac/attachment.html>
More information about the petsc-users
mailing list