Problem with rectangular matrices

Jed Brown jed at 59A2.org
Tue May 26 12:18:08 CDT 2009


Lisandro Dalcin wrote:
> The only real issue I see here is that the term "diagonal block" could
> lead to misinterpretation. But the behaviour you commented is the one
> I would expect.
> 
> The rest of this mail is perhaps off-topic, but it is somewhat related.
> 
> The other issues is that some Mat preallocation routines are lazy
> about properly setting the cmap. I had to implement some hackery in
> petsc4py to make sure that created Mat's (at least these created from
> petsc4py calls) have a cmap consistent with the local/global
> row/column sizes.
> 
> Moreover, supose you create a global square matrix with the following
> row/col distribution (I know, it is perhaps a nonsense, but IMHO is a
> valid distribution)
> from petsc4py import PETSc
> 
> size = PETSc.COMM_WORLD.getSize()
> assert size == 2
> rank = PETSc.COMM_WORLD.getRank()
> Ms = [2, 6]
> Ns = [6, 2]
> 
> m = Ms[rank]
> n = Ns[rank]
> 
> A = PETSc.Mat().createAIJ([(m, None), (n, None)]) # None is
> intrepreted as PETSc.DECIDE
> for i in range(8):
>     A[i,i] = 1.0/(i+1)
> A.assemble()
> 
> x, b = A.getVecs()
> x.set(1)
> A.mult(x,b)
> 
> Up to now, all works as expected, all rmap/cmap are consistent, the
> 'x' and 'b' vecs have the same global size, though different local
> sizes, and the MatMult succeed. All fine... But now, suppose you do:
> 
> ksp = PETSc.KSP().create()
> ksp.setOperators(A)
> ksp.pc.type = 'none'
> ksp.solve(b,x)
> 
> You are lost, this does not work (even if you try with nonzero initial
> guess)... But it should, right?

I don't think so, the Krylov method should be able to compute A*b.

Jed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20090526/457ad508/attachment.sig>


More information about the petsc-dev mailing list