[petsc-users] MATMPIBAIJ
Matthew Knepley
petsc-maint at mcs.anl.gov
Thu Sep 19 13:49:14 CDT 2013
On Thu, Sep 19, 2013 at 11:44 AM, 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)
>
You never ever ever want to do this. This creates a dense matrix from 2
Vecs. You would instead create a MatShell() which
holds the two vectors and applies them in sequence in its MatMult().
Matt
> 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
>
>
>
>
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130919/67d11d59/attachment.html>
More information about the petsc-users
mailing list