ufuncs, iterators

Matthew Knepley knepley at mcs.anl.gov
Fri Aug 19 00:11:12 CDT 2005

S V N Vishwanathan <vishy at mail.rsise.anu.edu.au> writes:

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

  Linear operators are members of the space of linear maps between two
vector spaces. They, for instance, have a characteristic behavior under
coordinate transformations. 2-d arrays are just lists of values. They need
not have any transformation properties. In fact, linear operators also
have spectral characteristics, and analytic behaviors. Using a PETSc Mat
just to store a collection of values is wrong. This goes back to the
modeling for your equations.

"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness

More information about the petsc-dev mailing list