[Beowulf] Teaching Scientific Computation (looking fo the perfect text)
Robert G. Brown
rgb at phy.duke.edu
Wed Nov 21 19:23:32 EST 2007
On Wed, 21 Nov 2007, David Mathog wrote:
> It would have been interesting if C++ had implemented operator
> definition instead of operator overloading (ie, redefinition).
> For instance like:
> A = B + C <VecX> D
> Admittedly it looks a bit odd, but when maintaining the code a
> programmer would see <operation> and know instantly what was happening
> if they recognized the operator, or would know to go look for the
> place "VecX" was defined if not. It would also have allowed
> the code to be somewhat self documenting, as in:
> triple = A <dot> B <vecX> C
> The flip side is that the program would need to specifically
> set operator precedence for operators it defines. It's also more
> verbose, but that's a good thing in code - I'd much rather read a
> few more characters than waste time trying to figure out what that
> "*" is actually doing. In a language aware editor the operator
> would have been highlighted, making it easier to see them.
> For all I know operator definition does exist in C++ now - the
> language is humongous and I certainly am not familiar with some of
> the more obscure corners.
(one or two last ones while I clear mail:-). Actually a really, really
interesting idea, but one does have a whole new class of typing errors.
If you go with either tensor products or graded algebra products, you
have to think carefully about what happens when you multiply e.g. real
times quaternion, complex times quaternion, etc. Some of these are as
ambiguous as multiplying a 2D vector by a 4D vector without specifying
the embedding or that their is one -- is the result a scalar, a vector,
or a tensor?
But it still is a really good idea. There is a generalized algebra of
dyad, triad, inner and outer products, and so on. It would be really
interesting to define a compiler that could cope. Even symbolic
manipulation languages tend to have to work at it and maybe have
complex and quaternions but rarely anything else.
> David Mathog
> mathog at caltech.edu
> Manager, Sequence Analysis Facility, Biology Division, Caltech
Robert G. Brown
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Lulu Bookstore: http://stores.lulu.com/store.php?fAcctID=877977
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
More information about the Beowulf