[petsc-users] MATMPIBAIJ

Randall Mackie rlmackie862 at gmail.com
Thu Sep 19 14:15:33 CDT 2013


I'm not sure I understand your statement about matrix shells being time consuming to implement. They are easy, see this example:

http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex14f.F.html


Randy M.


On Sep 19, 2013, at 12:01 PM, Reza Yaghmaie <reza.yaghmaie2 at gmail.com> wrote:

> 
> Thanks Matthew for the reply.
> It would be time consuming for me to implement an other way for creating a matrix and doing matmult and I am not concerned with how much time this will take.
> So is there any way which you could possibly guide me through using matmpibaij?
> 
> Thanks alot,
> -Reza 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Thu, Sep 19, 2013 at 2:44 PM, Reza Yaghmaie <reza.yaghmaie2 at gmail.com> wrote:
> 
> Dear Sir/Madam,
> 
> I am very new to PETSC and I have some issues running my code.
> I want to create a global M*1 matrix (not a vector since I want to multiply this matrix with an other 1*M matrix and get a M*M matrix and I know that transpose function on vectors does not work so this is why I need to have a M*1 matrix)
> 
> I have used the below function and it works well for a M*M matrix
> 	call MatCreateMPIBAIJ  (PETSC_COMM_WORLD,6,6*numpn,6*numpn,
>      &          PETSC_DETERMINE, PETSC_DETERMINE,
>      &          PETSC_NULL_INTEGER, mr(np(246)),
>      &          PETSC_NULL_INTEGER, mr(np(247)),
>      &          matdummy2, ierr)
> 
> 
> I am trying to change it accordingly for the M*1 matrix
> 
> So I use the following function
> 
> 	call MatCreateMPIBAIJ  (PETSC_COMM_WORLD,alpha,m,n,
>      &          PETSC_DETERMINE, PETSC_DETERMINE,
>      &          PETSC_NULL_INTEGER, mr(np(246)),
>      &          PETSC_NULL_INTEGER, mr(np(247)),
>      &          mvecdummy1, ierr)
> 
> defining the following parameters respectively:
> alpha=number of degrees of freedom per node=1
> m=each processor number of rows=6*numpn
> n=local number of columns=1
> I think PETSC_DETERMINE represents the global number of rows and columns respectively.
> I think PETSC_NULL_INTEGER represents the number of nonzero terms in rows in the diagonal matrix and off diagonal matrix respectively and mr(np(246), mr(np(247) show the nnz terms in columns of diagonal and off diagonal matrices.
> mvecdummy1=the name of the matrix
> ierr is just an error compliment in the subroutine.
> 
> 
> The errors that I am getting are 
> d_nnz can not be less than 0
> o_nnz can not be less than -1
> 
> Please guide me through this issue.
> 
> Thanks alot,
> -Reza
> 
> 
> 
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130919/89e914b9/attachment.html>


More information about the petsc-users mailing list