[petsc-users] submatrix times subvector

Jed Brown jedbrown at mcs.anl.gov
Tue Jan 15 12:23:04 CST 2013


On Tue, Jan 15, 2013 at 12:09 PM, Tabrez Ali <stali at geology.wisc.edu> wrote:

>  Jed
>
> The problem with MatGetSubMatrix is that iscol isn't available easily. I
> want to get all associated columns but according to the man page it is not
> possible in Fortran.
>
> "If iscol is PETSC_NULL then all columns are obtained (not supported in
> Fortran)."
>

Well, we could add Fortran support for that case (it currently needs a
custom binding to do that) or you can

call MatGetColumnOwnershipRange(A,colstart,colend,ierr)
ncols = colend - colstart
call ISCreateStride(comm,ncols,colstart,one,iscol,ierr)

and pass iscol to MatGetSubMatrix(). This is what's done internally when
you pass iscol=NULL:

  if (!iscol) {
    ierr =
ISCreateStride(((PetscObject)mat)->comm,mat->cmap->n,mat->cmap->rstart,1,&iscoltmp);CHKERRQ(ierr);



>
> Is there a workaround?
>
> Tabrez
>
>
> On 01/14/2013 03:38 PM, Jed Brown wrote:
>
> On Mon, Jan 14, 2013 at 3:27 PM, Tabrez Ali <stali at geology.wisc.edu>wrote:
>
>> Hello
>>
>> I am solving a system of equations of the form:
>>
>> |A C| |u1| = |f1|
>> |C'B| |u2|   |f2|
>>
>> After each solve, I need to perform B*f2 before updating f. Should I use
>> MatGetSubMatrix/VecGetSubVector followed by MatMult or is there something
>> simpler.
>>
>
>  Yes, or let PCFIELDSPLIT do all the block solver stuff for you.
>
>
>
> --
> No one trusts a model except the one who wrote it; Everyone trusts an observation except the one who made it- Harlow Shapley
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130115/4422dd1f/attachment.html>


More information about the petsc-users mailing list