MatGetSubMatrix() and MatGetSubMatrices()
Barry Smith
bsmith at mcs.anl.gov
Tue Mar 4 06:53:05 CST 2008
On Mar 4, 2008, at 1:47 AM, Yujie wrote:
> Hi, everyone
>
> #include "petscmat.h"
> PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrix(Mat mat,IS
> isrow,IS iscol,PetscInt csize,MatReuse cll,Mat *newmat)
> #include "petscmat.h"
> PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrices(Mat mat,PetscInt
> n,const IS irow[],const IS icol[],MatReuse scall,Mat *submat[])
>
> To my knowledge, I can't get different matrices at different nodes
> by setting different isrows and iscol with MatGetSubMatrix().
> Because isrow is rows current processor should obtain and the iscol
> argument must be the same on each processor.
> Furthermore, I can't get different parallel matrices at different
> nodes by setting different irow[] and icolp[] with
> MatGetSubMatrices() assuming I only want to get a matrix at each node.
> Because this function only gets different sequential matrices at
> different nodes. Is it right?
>
MatGetSubMatrices() gets one or more sequential matrix on each
process.
MatGetSubMatrix() gets ONE parallel matrix that lives on the same
communicator has the original matrix
> Another equestion is how to partition the matrix when calling
> MatConvert() to convert a sequential matrix to a parallel one?
MatConvert() is not for converting sequential matrix to parallel;
the communicator of a the new matrix from MatConvert()
is always the same as the old one.
In petsc-dev there is a utility for AIJ matrices that takes a
given sequential AIJ matrix and makes it parallel, called
/*
Distributes a SeqAIJ matrix across a set of processes. Code
stolen from
MatLoad_MPIAIJ(). Horrible lack of reuse. Should be a routine for
each matrix type.
Only for square matrices
*/
PetscErrorCode MatDistribute_MPIAIJ(MPI_Comm comm,Mat gmat,PetscInt
m,MatReuse reuse,Mat *inmat)
Barry
>
>
> Thanks a lot.
>
> Regards,
> Yujie
More information about the petsc-users
mailing list