Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!um-math!sharkey!cfctech!teemc!hpftc!zardoz!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!usc!apple!sun-barr!newstop!sun!road!khb
From: khb@road.Sun.COM (Keith Bierman - Advanced Languages - Floating Point Group )
Newsgroups: comp.lang.fortran
Subject: Re: Extended Precision for real constants
Message-ID: <124003@sun.Eng.Sun.COM>
Date: 30 Aug 89 21:25:56 GMT
References: <282@unmvax.unm.edu>   <303@unmvax.unm.edu> <1598@convex.UUCP> <123897@sun.Eng.Sun.COM> <1621@convex.UUCP> <1068@cernvax.UUCP>
Sender: news@sun.Eng.Sun.COM
Reply-To: khb@sun.UUCP (Keith Bierman - Advanced Languages - Floating Point Group )
Organization: Sun Microsystems, Mountain View
Lines: 70

In article <1068@cernvax.UUCP> achille@cernvax.UUCP (achille petrilli) writes:

>
>Let get pragmatic, what should I rewrite under f8x ? do loops, ifs,
>I/O statements ? what ?
>

Back when I was in the business of crafting portable estimation
library software, I determined that most of the "bugs" reported to us
were misuse of the programatic interface. Most frequently someone
would make a mistake in the use of "scratch" memory which had to be
passed to the subroutines, e.g.

	call   WGSG(W,IMAXW,IW,JW,DW,F,V,U)

	F, and V are JW long ... must be non-overlapping, etc. 

Many "solve" this sort of problem with COMMON, but we chose to have
"clean" interfaces. In many modules the length of the scratch storage
required was a complex function, so even good compiler assistence for
range checking was not always feasible.

Use of dynamic memory clearly allows us to shorten the argument list,
reduce the errors, and otherwise make the world a better place.

Thanks to KEYWORD argument passing, and DEFAULT clauses, most calls to
WGSG would have become something like

	call wgsg(W=w,U=u)  ! or some such

Old code would still work, so by concentrating on certain types of
declaration magic in the library ONLY, all old user code can be
preserved.

In Kalman filtering (and many other applications), one has equations
of the sort

	U = PHI*U

to perform a deterministic time update. U is upper triangular, PHI is
a square transition matrix (though the special case of PHI being
triangular is key to performance in many applications ... or other
special structures of PHI are typically worth of exploitation).

In f77 the code to operate on a UT matrix (vector stored) * a
rectangular PHI looked something like

CALL PHIU(PHI,MAXPHI,IRPHI,JCPHI,U,N,W,IMAXW) !multiply into temp W
CALL U2D(U,NX,DW,1)                             ! save diagonal
CALL WGSG(W,MAXN,NX,NX,DW,F,V,U)                ! gram schmidt

I had proposed a phased f8x transition, phase #1 to employ every
device of the new standard to allow the old interfaces to work with
old code + allow simpiler usage (as above).

Phase #2 would have required the user to know about the new data
typing, and modules so that PHI and U would be typed appropriately,
then their code would devolve to

	U = PHI*U

Which makes the name Formula Translator really mean something! Of
course, the performance savvy might very well still call the
underlying phiu, u2d, wgsg in clever ways to minimize computation ...
but most users could get reference quality code trivially.

Keith H. Bierman    |*My thoughts are my own. !! kbierman@sun.com
It's Not My Fault   |	MTS --Only my work belongs to Sun* 
I Voted for Bill &  | Advanced Languages/Floating Point Group            
Opus                | "When the going gets Weird .. the Weird turn PRO"