Zakariae,

    MatGetSubMatrix() was removed a long time ago, the routine is now 
MatCreateSubMatrix() but it does not work in way you had hoped. There is 
currently no mechanism to move values you put into the sub matrix back into the 
original larger matrix (though perhaps there should be?). 

    Please look at MatCreateSubMatrixVirtual() and also MatCreateNest() to see 
if either of those approaches satisfy your needs. 

    Please let us know if there are extensions that would be useful for you to 
accomplish what you need. 

  Barry


> On Jul 16, 2021, at 7:45 PM, Jorti, Zakariae via petsc-users 
> <[email protected]> wrote:
> 
> Hello,
> 
> I have a matrix A = [A00 , A01 ; A10, A11]. 
> I extract the submatrix A11 with MatGetSubMatrix.
> I only know the global IS is1 and is2, so to get A11 I call: 
> MatGetSubMatrix(A,is2,is2,MAT_INITIAL_MATRIX,&A11);
> I want to modify A11 and update the changes on the global matrix A but I 
> could not find any MatRestoreSubMatrix routine.
> Is there something similar to VecGetSubVector and VecRestoreSubVector for 
> matrices that uses only global indices?
> Many thanks.
> Best regards,
> 
> Zakariae 

Reply via email to