MatCreateMPISBAIJ & Non-Square Matrix

Andrew Colombi acolombi at gmail.com
Sat Jun 7 13:39:34 CDT 2008


I am wondering how the d_nz and o_nz are treated for a matrix where N
> M (i.e. more columns than rows).  Also, if I understand the
documentation correctly, it seems the "diagonal part" of the matrix
depends only on the number of rows each processor has.  If I let PETSc
decide how can I know this before it's too late?  Should I use
MatMPISBAIJSetPreallocation after Creating the matrix?  And finally,
is d_nz the number of non zeros after having saved 1/2 for storing in
a symmetric manner? or should I pretend I actually need twice the nz
than will actually be stored.

I'd also like to describe the problem I am trying to solve as I'm sure
it's essentially the most trivial use of PETSc, and yet I am having
some difficulty expressing it.  Maybe someone can point out the
obviously correct thing to do that I am missing.

I am solving a linear elliptic PDE using linear FEM with Dirichlet
boundary conditions.  To handle boundary conditions using dense
matrices in Matlab my strategy was to create an M x N matrix, A, where
M is the number of unknowns, and N is unknowns + boundary conditions
(i.e. N > M).  Then I'd multiply A by a vector of 0s at unknowns and
boundary conditions at knowns, and subtract this from my RHS, b.
Finally I'd mask away the columns associated with the boundary
conditions of A to produce a square matrix A' = A(:, unknowns).  Then
x = A' \ b.

Scaling up to PETSc here are my concerns:

* How do I best represent A?  It is a symmetric matrix, but I'm not
sure how to find d_nz and o_nz. nz.  The trouble is I don't have any
control over the bandwidth of the matrix (at least at the present).
Though I have no estimate for d_nz, I do have one for nz; maybe I'll
find better performance with an MPIAIJ?  If such is the case would I
still be able to use KSPCG?

* How do I best produce A' from A?  Ideally this could be done without
any copying, since it's just a simple mask (i.e. remove the last N-M
columns).  Do Sub matrix commands perform a copy?  Is there a way to
avoid the copy?

Thanks!
-Andrew




More information about the petsc-users mailing list