[Beowulf] Threaded code (& Fortran)

Jeff Layton jeffrey.b.layton at lmco.com
Wed Aug 18 14:19:49 EDT 2004


Robert G. Brown wrote:

>On Wed, 18 Aug 2004, Jeff Layton wrote:
>  
>
>>But Bob, you're a physicist. Fortran is based on real mathematics, unlike C.
>>Only recently did C get a complex data type. Imagine math, physics, and
>>everything else without complex numbers (ask Arthur Anderson about complex
>>numbers in accounting). :)
>>    
>>
>
>Oh, NOW you're gonna be sorry.  Real Physicists don't mess with complex
>numbers per se any more -- complex numbers are just one of the lowest
>rank examples of a geometric algebra, where higher order examples are
>generalizations of quaternions and other what used to be called clifford
>algebras until clifford algebra was redone correctly as geometric
>algebra.  And fortran doesn't know anything about quaternions or
>geometric algebras (beyond complex types).
>

Never messed with geometric algebra nor clifford algebra (isn't that 
'red' algebra
anyway - you pinko communist!). Now I have messed quaternions before (used
them in dynamics). However, I don't think I've used quaternions used in 
control
design or flutter analysis or structural dynamics, but it may be 
interesting :)

>C, on the other hand, lets me trivially define algebraic entities such
>as:
>
>typedef struct {
>
>  double r;
>  double i;
>
>} Complex;
>
>or
>
>typedef struct {
>
>  double q0;
>  double q1;
>  double q2;
>  double q3;
>
>} Quaternion;
>
>or entities that are Nth rank tensors, including ones that are not
>rectangular and do not have indices that run from 1 to N.
>

You can do this in F90 as well. However, again, a complex type is not
intrinsic in C (it is in C99 though). :) You can also do some interesting
things with complex data types such as converting a code to compute
gradients of whatever it computes by simply using complex data types.
Very, very nifty and easy to do (it works with MPI codes as well).

>C++ afficionados would doubtless chime in at this point that their
>favorite language provides maximal structured support for this sort of
>game, since one gets constructors, destructors, and methods, and in
>methods one can define e.g. a multiplication or division operation (note
>that we are talking about creating division algebras here -- ones where
>the concepts of factorization and decomposition make sense:-).  C lovers
>such as myself would then say fooey on you, can do in C too, and we'd
>get into the usual...
>
>No, fortran has a single real advantage over C.  It has a binary
>exponentiation operator.  I've never forgiven the C mavins for not
>implementing something like x**y, even though yes I understand why
>pow(x,y) is a library call and better that way.
>

I also like that fact that Fortran arrays start with 1 and that 
something like
A(1,2) is A(first row, second column). Just like the mathematics that we
use. :)

As a word of caution, I've been forced to code in VB (yuck, ick) and
different versions of VB have arrays that start with 0 or 1 depending
upon the version you're using. This caused more problems that I like
to think about. Yuck - double yuck - triple yuck.

>>Just ribbing you... :)
>>    
>>
>
>Oh, you'll regret this, yes you will.  Fortran based on "real
>mathematics", harruummph.  Right, and in real mathematics ALL physical
>quanties that begin with the letters I through N are integers, right?
>And equations, they are ALWAYS written only in between columns 7 and
>72...in capital letters.  I keep forgetting.
>

I always write my equations in columns 7 to 72 - don't you? :) Of course,
you know that F90 has broken this rule don't you?

>I've written a few boxes full of genuine punch cards filled with Fortran
>(Fortran IV, yet) in my day and it isn't clear to me that I'd touch it
>again even if you DID back up a small truck and snatch Buttercup from my
>driveway (she's a wee bit overweight, bring a hoist).
>

Start coding in Fortran or the dog gets it! (lots of movie scense pop 
into my head
at this point including 'Vacation' where they dragged the dog behind the 
family
truckster).

You turn. :)

Jeff


-- 
Dr. Jeff Layton
Aerodynamics and CFD
Lockheed-Martin Aeronautical Company - Marietta


_______________________________________________
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 mailing list