Re: Request for comment: follow-up to Summer of Code
- From: beliavsky@xxxxxxx
- Date: 29 Jun 2005 15:05:34 -0700
Eric Lavigne wrote:
> >Fortran 95 and 2003 are higher level languages than C or assembler, and
> >are arguably higher-level than Python or Lisp in the area of scientific
> >computing.
>
> I don't know anything about 2003 (except that it doesn't really exist
> yet), but I use FORTRAN 95 all the time. I would say it is a lower
> level language than C++ (regardless of which field you are working in)
> and comes nowhere close to Lisp.
In my earlier message I compared Fortran to C, not C++. I think the
functionality of Fortran's multidimensional arrays (elemental
functions, array slices) is more extensive than that of C++, whose
arrays have the same properties as those of C. C++ does have the
higher-level vector for 1-D arrays in the Standard Library, but I don't
see it used that much in numerical work. The C++ valarray seems to be
an orphan.
I don't know Lisp, but looking at the number of lines of code to
implement various algorithms in the Language Shootout at
http://shootout.alioth.debian.org/ , it seems that the ratio of lines
of code of Lisp to Fortran ranges from about 0.5 to 1.0 . By this
measure, "nowhere close to Lisp" may be an exagerration .
> I'd love to hear why you feel
> differently. From what I have seen, any FORTRAN 95 program can be
> translated line for line into Lisp (skipping some lines in the FORTRAN
> program that are redundant but keep the FORTRAN 95 compiler happy).
Since Fortran compilers produce pretty efficient code, in part because
companies such as Intel, IBM, and SUN (as well as independent compiler
vendors) have devoted considerable resources to Fortran compiler
performance tuning, there are a few projects to translate code from
functional languages to Fortran, for example
MathCode90 (Mathematica to Fortran 90)
http://www.wolfram.com/products/applications/mathcodef90/
Parametric Fortran (using Haskell)
http://web.engr.oregonstate.edu/~erwig/pf/
> Maybe you are thinking about library availability rather than the
> language itself? If so, you might find this page interesting:
>
> http://www.nhplace.com/kent/Papers/Fortran-to-Lisp.html
At that site, comparing the Fortran code
SUBROUTINE MATMUL (X, Y, IDIM)
REAL X(IDIM,1),Y(IDIM,1),Z(100)
DO 100 I=1,IDIM
Z(I)=0.
DO 200 J=1,IDIM
200 Z(I)=X(I,J)*Y(J,I)+Z(I)
DO 100 J=1,IDIM
100 X(I)=Z(I)
RETURN
END
to the Lisp
(FORTRAN (MATMUL X Y IDIM)
(SUBROUTINE (REAL (X 1) (Y 1) (Z 100)) (INTEGER IDIM I J))
(: I 1)
DO-I-100 (: (Z I) 0.0)
(: J 1)
DO-J-200
/200 (: (Z I) (+$ (Z I) (*$ (X I J) (Y J I))))
(COND ((<= (: J (1+ J)) IDIM) (GO DO-J-200)))
DO-J-100 (: (X I) (Z I))
(COND ((<= (: J (1+ J)) IDIM) (GO DO-J-100)))
(COND ((<= (: I (1+ I)) IDIM) (GO DO-I-100)))
(RETURN T))
it's not obvious to me what the benefit of translation is, unless you
just prefer Lisp (as most readers here probably do). Fortran has had
proper loops since the 1990 standard so the numbered lines could be
replaced with ENDDO's (Yes, 1990 was too late. Many compilers had it as
an extension years earlier.). Furthermore, Fortran 90 added an
intrinsic function MATMUL for matrix multiplication.
.
- Follow-Ups:
- Re: Request for comment: follow-up to Summer of Code
- From: David Golden
- Re: Request for comment: follow-up to Summer of Code
- From: Kent M Pitman
- Re: Request for comment: follow-up to Summer of Code
- References:
- Request for comment: follow-up to Summer of Code
- From: matthewknox
- Re: Request for comment: follow-up to Summer of Code
- From: beliavsky
- Re: Request for comment: follow-up to Summer of Code
- From: Eric Lavigne
- Request for comment: follow-up to Summer of Code
- Prev by Date: Re: Accelerando
- Next by Date: Re: Request for comment: follow-up to Summer of Code
- Previous by thread: Re: Request for comment: follow-up to Summer of Code
- Next by thread: Re: Request for comment: follow-up to Summer of Code
- Index(es):
Relevant Pages
|