[Prev][Next][Index][Thread]

Re: performance for scientific computing



> >> But I cannot really follow what you want to do. After all, calculation
> >> of A*A always requires allocation of a matrix holding the
> >> result. Maybe you should describe your requirements again.
> >>
> > That is true for A*A but when we want to compute C=A*A+cos(A), you need
> > only to allocate memory for C and nothing more:
>
> AFAIK optimizing away temporaries in such complex vector or matrix
> expressions is a hard problem and still a research topic. The APL
> vendors have struggled with it for ages. The SAC project:
> http://www.informatik.uni-kiel.de/~sacbase/ is working in that
> direction but the numerical market is probably too small for
> general-purposes languages like Dylan (or C, or Java etc) to
> pick up such optimizations.
>

For the general-purposes language C++, one can look at blitz++ which does
this "optimisation" via templates. I guess that programs like Matlab do the
same thing. The only need is to rewrite the expression
    C = A*A+cos(A)
in, if C as dimension (N1,N2)
    for (int i=0;i<N1;i++)
        for (int j=0;j<N2;j++)
            C(i,j) = A(i,j)*A(i,j)+cos(A(i,j))

Well, that's the basis. If one wants to optimise for cache hits or parallel
implementation, it is more complex but I only need the basis.
I think that with macro expression we can get the same things that with C++
templates (in an easier way due to a better macro conception in
Lisp/Scheme/Dylan than in C++ templates).

BUT, I just noted that GwydionDylan will *never* have macro ability (wow,
they have just dropped one of the essential features as if it was a detail
!!!).

BTW, does anyone know why they did not write Gwydion Dylan in Lisp/Scheme
instead of using a low-level language (C I think) ? These 3 languages are
quite similar and the little differencies could have been soften with
macros. I probably miss some point.

Sebastien





Follow-Ups: References: