how to get the MPIAIJ matrix information?

Barry Smith bsmith at mcs.anl.gov
Fri Feb 13 12:10:01 CST 2009


    If you have a MPIAIJ matrix and want another with the same  
preallocation information you can simply use MatDuplicate().

Sometimes you just need to use the internal data structures of a  
matrix type if you are doing something very specific with the data
in a matrix that is not common to most solvers.

   Barry

On Feb 13, 2009, at 11:57 AM, Yujie wrote:

> thank you for your reply. Randy.
>
> Actually, I have read the manual. In the manual, it just demonstrate  
> how to obtain this information from finite difference and finite  
> element methods. However, if I only have a MPIAIJ matrix, how to  
> obtain this information? one method is to use MatGetInfo() to my  
> knolwedge, however, "info"'s structure is as  follows:
>
> 476: typedef struct {
> 477: PetscLogDouble block_size; /* block size */
> 478: PetscLogDouble nz_allocated,nz_used,nz_unneeded; /* number of  
> nonzeros */
> 479: PetscLogDouble memory; /* memory allocated */
> 480: PetscLogDouble assemblies; /* number of matrix assemblies  
> called */
> 481: PetscLogDouble mallocs; /* number of mallocs during  
> MatSetValues() */
> 482: PetscLogDouble fill_ratio_given,fill_ratio_needed; /* fill  
> ratio for LU/ILU */
> 483: PetscLogDouble factor_mallocs; /* number of mallocs during  
> factorization */
> 484: } MatInfo;
>
> I am wondering what type PetscLogDouble is, double or int?
>
> Regards,
>
> Yujie
>
> On Fri, Feb 13, 2009 at 9:37 AM, Randall Mackie  
> <rlmackie862 at gmail.com> wrote:
> Yujie,
>
> This is explained in the manual on page 59, under Preallocation of  
> Memory
> for Parallel AIJ Sparse Matrices.
>
> Randy
>
>
>
> Yujie wrote:
> Hi,
>
> In MatCreateMPIAIJ() function, it needs d_nz, d_nnz[], o_nz,  
> o_nnz[]. If one has a MATAIJ matrix, how to obtian this information?  
> thanks a lot.
>
> PetscErrorCode PETSCMAT_DLLEXPORT MatCreateMPIAIJ(MPI_Comm  
> comm,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt d_nz,const  
> PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[],Mat *A)
>
> Regards,
>
> Yujie
>
>



More information about the petsc-users mailing list