Problem with rectangular matrices

Matthew Knepley knepley at gmail.com
Tue May 26 12:24:20 CDT 2009


On Tue, May 26, 2009 at 12:18 PM, Jed Brown <jed at 59a2.org> wrote:

> 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.


It not computing Ab. Its computing Ab, A^2b, A^3b, etc.

  Matt


>
> Jed
>
-- 
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-dev/attachments/20090526/f0f8d329/attachment.html>


More information about the petsc-dev mailing list