On Saturday, 23 July 2016 at 12:09:18 UTC, Etranger wrote:
On Saturday, 23 July 2016 at 11:19:34 UTC, rikki cattermole wrote:
On 23/07/2016 11:05 PM, Etranger wrote:
[snip]

[...]

My goodness that code is awful.

I have a fair idea what you are attempting to do here.
So I'm going to point you directly to gl3n. Its meant for game dev so won't provide you a 100% solution. But it should give you ideas of how to do it.

https://github.com/Dav1dde/gl3n/blob/master/gl3n/linalg.d#L49

If you have any questions and want somebody to talk with you instead of write, reply cycle. Please hop on to Freenode #d channel.

Hi and thanks for your quick replay.

A looked to the gl3n code, although the code is clear and clean, it is not really what I want to do in my example.

The gl3n is eager evaluation. If I write "v = v1+v2+v3;", then it will create a temporary variable "tmp1=v1+v2;" then a second temp "tmp2=tmp1+v3;" and finally "v=tmp2;".

what I'm trying to do to use lazy evaluation in order to create only one tmp that will that will directly hold the result of v1[i]+v2[i]+v3[i]. That concept is then generalized in order to perform more optimization based on entire expression trees, no just tow operands.

And thanks for the suggestion regarding the channel, I'll try to use it as soon as I have the time. I feel on advantage of the forum is that it stays for other people and not just for me.

best regards

You should definitely have a look at mir - the upcoming library for numerical computing in D.
https://github.com/libmir/mir

There is a lot of working going on recently, for example Ilya is working on building the fattest BLAS library thanks to CTFE introspection etc.

You might know Ndslice (in Phobos), the first result of the mir project.

Reply via email to