still Schur complement

Lisandro Dalcin dalcinl at
Mon Mar 17 08:54:06 CDT 2008

I'm not completelly sure what are you actually trying to do. It seems
you know how to actually compute the local Schur complement in a
entry-by-entry basis. In that case, your way is semms to be OK.

However, you get a error because of a inner implementation detail of
MATIS.  Do de following: set the local-to-global mapping AFTER setting
the matrix type. This way, your code should now work.

The other way, is to create the matrix by calling MatCreateIS(), look
at the source code of this function, and you will basically see the
same steps you are using in your example for setting-up the matrix,
however the call to MatSetLocalToGlobalMapping() appears at the very


On 3/17/08, Kathrin Burckhardt <tribur at> wrote:
> Dear all,
>  My problem, once again and more concrete:
>  I have given the local Schur matrices Si and I would like to set-up the
>  global matrix S without assembling the Si on one processor.
>  I thought "MATIS" is the suitable matrix type, but I don't succeed in
>  using it. My code is:
>      IS is;
>      ISCreateGeneral(PETSC_COMM_SELF, NPb, &uBId_global[0], &is);
>      ISLocalToGlobalMapping mapping;
>      ISLocalToGlobalMappingCreateIS(is, &mapping);
>      Mat Stot;
>      MatCreate(PETSC_COMM_WORLD,&Stot);
>      MatSetLocalToGlobalMapping(Stot, mapping);
>      MatSetSizes(Stot,NPb,NPb,NPb_tot,NPb_tot);
>      MatSetType(Stot,MATIS);
>     //or, alternatively
>     //MatCreateIS(PETSC_COMM_WORLD,NPb,NPb,NPb_tot,NPb_tot,mapping,&Stot);
>      for(int i=0; i<NPb; i++)
>        for(int j=0; j<NPb; j++)
>         MatSetValuesLocal(Stot, 1, &i, 1, &j, &S(i+1,j+1), ADD_VALUES);
>  And I got the error
>  [1]PETSC ERROR: MatSetValuesLocal() line 1471 in
>  src/mat/interface/matrix.c
>  [1]PETSC ERROR: --------------------- Error Message
>  ------------------------------------
>  [1]PETSC ERROR: Object is in wrong state!
>  [1]PETSC ERROR: Object Type not set: Argument # 1!
>  Can you tell me what's wrong?

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-users mailing list