On Tue, May 26, 2009 at 12:18 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org">jed@59a2.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">Lisandro Dalcin wrote:<br>
> The only real issue I see here is that the term "diagonal block" could<br>
> lead to misinterpretation. But the behaviour you commented is the one<br>
> I would expect.<br>
><br>
> The rest of this mail is perhaps off-topic, but it is somewhat related.<br>
><br>
> The other issues is that some Mat preallocation routines are lazy<br>
> about properly setting the cmap. I had to implement some hackery in<br>
> petsc4py to make sure that created Mat's (at least these created from<br>
> petsc4py calls) have a cmap consistent with the local/global<br>
> row/column sizes.<br>
><br>
> Moreover, supose you create a global square matrix with the following<br>
> row/col distribution (I know, it is perhaps a nonsense, but IMHO is a<br>
> valid distribution)<br>
> from petsc4py import PETSc<br>
><br>
> size = PETSc.COMM_WORLD.getSize()<br>
> assert size == 2<br>
> rank = PETSc.COMM_WORLD.getRank()<br>
> Ms = [2, 6]<br>
> Ns = [6, 2]<br>
><br>
> m = Ms[rank]<br>
> n = Ns[rank]<br>
><br>
> A = PETSc.Mat().createAIJ([(m, None), (n, None)]) # None is<br>
> intrepreted as PETSc.DECIDE<br>
> for i in range(8):<br>
>     A[i,i] = 1.0/(i+1)<br>
> A.assemble()<br>
><br>
> x, b = A.getVecs()<br>
> x.set(1)<br>
> A.mult(x,b)<br>
><br>
> Up to now, all works as expected, all rmap/cmap are consistent, the<br>
> 'x' and 'b' vecs have the same global size, though different local<br>
> sizes, and the MatMult succeed. All fine... But now, suppose you do:<br>
><br>
> ksp = PETSc.KSP().create()<br>
> ksp.setOperators(A)<br>
> ksp.pc.type = 'none'<br>
> ksp.solve(b,x)<br>
><br>
> You are lost, this does not work (even if you try with nonzero initial<br>
> guess)... But it should, right?<br>
<br>
</div></div>I don't think so, the Krylov method should be able to compute A*b.</blockquote><div><br>It not computing Ab. Its computing Ab, A^2b, A^3b, etc.<br><br>  Matt<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<font color="#888888"><br>
Jed<br></font></blockquote></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>