[petsc-users] Question about MatCreateSubMatrix

Jed Brown jed at jedbrown.org
Thu Mar 29 16:13:49 CDT 2018


Manav Bhatia <bhatiamanav at gmail.com> writes:

> Thanks, Matt. 
>
> I also read page 72 in the manual about creating and assembling matrices. 
>
> Just so that I understand correctly, MatGetLocalSubMatrix is a generic call to create submatrices in the split-local or split-global space? So, it is primarily a matter of the isrow and iscol? 

Yes.

> The manual says that this provides a “view” matrix, so any updates to this submatrix should show up in the global? 
>
> How is MatCreateSubMatrixVirtual different? Is this different from a “view” matrix? 

That is also a view, but specified in terms of the global space rather
than the local space.  It's normally used by solvers and other places
where you need the action of the submatrix while the local submatrix is
generally used for assembly.

>
>> On Mar 29, 2018, at 3:10 PM, Matthew Knepley <knepley at gmail.com> wrote:
>> 
>> On Thu, Mar 29, 2018 at 3:28 PM, Manav Bhatia <bhatiamanav at gmail.com <mailto:bhatiamanav at gmail.com>> wrote:
>> Hi,
>> 
>>   I have quick questions about MatCreateSubMatrix:
>> 
>> — Once the sub matrix is created, do I need to keep the IS (isrow and iscol) in memory till this matrix is active, or can I destroy it immediately after the creation of the matrix and continue to use the matrix?
>> 
>> You can destroy it.
>>  
>> — Is the assembly begin/end supposed to be called on the submatrix or the original full matrix? Is it a problem is I call this on both?
>> 
>> The SubMatrix is not a view. Its a fully independent matrix.
>>  
>> — If I modify values in the sub matrix, would these be reflected in the original matrix after assembly begin/end, or do I need to do something else for that to happen?
>> 
>> No. Do you want something like this
>> 
>>   http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html <http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html>
>> 
>>   Thanks,
>> 
>>     Matt
>>  
>> Thanks,
>> Manav
>> 
>> 
>> 
>> 
>> 
>> -- 
>> 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
>> 
>> https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>


More information about the petsc-users mailing list