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

Re: performance for scientific computing



> Sadly there is no "initialize by calling a function with the collection
key"
> feature in standard dylan. I have loudly thought about it some time ago
and
> the syntax
>   make(<some-limited-array>, init-function: method(i, j, k) i + j / k
end);
> was found pretty by some people, but it is not implemented anywhere (yet).
> Current dylan only offers an init-value: keyword, which is not what you
want.

That is not a problem if one can write an extension of array to do that
efficiently.
But is it possible to extend Dylan in C or C++ ?
And what about active memory management ?
If I want to create a new class (like <array> or <vector>) <numerical-array>
which would be more
adapted to the situation, how do I write it ?

> > compute
> >         C = A*A+cos(A)     (to understand as C(i,j,k) =
A(i,j,k)*A(i,j,k) +
> > cos(A(i,j,k)))

> It is not recommended to add methods to the generic functions \+ and \* as
> defined in the dylan library, although it is possible on user defined
types.
> However you could define your array lib to exclude (or rename) them from
the
> dylan lib and define your own. This would allow the above idiomatic style.

In fact, "overloading" \+ or \* is not efficient because it involves lot of
loops (except if smart optimisation but with smart optimisation everything
is possible so... let's look at what is really feasible). Indeed, first is
computed A*A (loop over all indices + store in a temporary variable T1) then
cos(A) (loop over ... in T2) then T1 + T2 (loop over ... in T3) then C = T3
(loop... you know).
So this is not what I want.
I was thinking to a more functional view like: C = map(A, function(x) ->
x*x+cos(x)) (in pseudo code) or using macro to build at compile time the
loop and so inlining the function x*x+cos(x).

I think the last point should be feasible (computing C=A*A+cos(A)). The
point which disturbs me the most is the creation of new classes (where I
need to redefine the allocation of memory,etc...) in C or C++ and their
interface with Dylan

Seb






Follow-Ups: References: