ufuncs, iterators

Barry Smith bsmith at mcs.anl.gov
Thu Aug 18 22:26:31 CDT 2005

On Fri, 19 Aug 2005, S V N Vishwanathan wrote:

> Hi!
> >> BTW: possibly related note, are you using dense matrices sometimes
> >> to represent "just" 2-arrays; that is, not as representations of linear
> >> operators. If so, I do not think this is the correct approach! Conceptually
> >> PETSc Mat's are linear operators I think it would be a big mistake to 
> >> overload them as 2-arrays also. The "correct" approach is to use the 
> >> DACreate2d() construct for handling 2-d arrays; With the DA the values
> >> are stored into Vecs but there is additional information about 
> >> the two array structure; it can be decomposed nicely in parallel and
> >> one can set/access values with the usual two i,j indices. Of course if 
> >> they are being used as operators ignore this. 
> Simon> OK, I will think about this. But what would be the strategy for
> Simon> doing all these linear algebra operations ? Swap to/from Mat/DA
> Simon> objects ?
> >> In Matlab matrix == 2-d array == matrix (in my opinion a terrible
> >> design decision) in PETSc matrix (dense) != 2-d array , the are
> >> completely different beasts mathematically
> I am not sure I understand the fine difference. As far as we are
> concerned, all the operations which we are doing (point wise addition,
> addition, multiplication etc.) are on the linear operator. 

   Certainly pointwise addition is the same as adding two operators
together (PETSc has this with MatAXPY), but what about, for example,
pointwise multiply? You could well be correct, but I'd like to see
the list and what they correspond to in terms of linear operators,
for example row and column sums what do they represent (true they
are the multiplication of the matrix (or its transpose) by the vector
of all ones, but is that a useful meaning. I just want to make sure we 
are using the right paradigm for these operations, before we move to far along
in where we implement them.


> But it might
> be that my thought process is conditioned by years of Matlab/Octave
> use. Can you maybe make this more explicit i.e. which situations would
> you use a DA array and when would you use a Mat object?
> vishy

More information about the petsc-dev mailing list