[Beowulf] Teaching Scientific Computation (looking fo the perfect text)

David Mathog mathog at caltech.edu
Wed Nov 21 17:57:55 EST 2007


Robert G. Brown wrote
> On Wed, 21 Nov 2007, David Mathog wrote:

> Unless, of course, one works in a graded (geometric) division algebra...
> but yes, I agree.  And it isn't much harder to call csum(a,b,c) where
> they are complex structs, or do whatever the GSL uses to accomplish the
> same thing (I haven't used its complex arithmetic much).
> 
> > That's the point where C++ overloading breaks down, at least for me,
> > and a function or #define is easier to work with, something like :
> >
> >  A = B + CROSS_PRODUCT(C,D)
> 

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.

Regards,

David Mathog
mathog at caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech
_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf

!DSPAM:4744b84f171211745845678!



More information about the Beowulf mailing list