BLADE 0.2Alpha: Vector operations with mixins, expression templates, and asm

Bill Baxter dnewsgroup at billbaxter.com
Thu Apr 5 19:30:04 PDT 2007


Mikola Lysenko wrote:
> Excellent work!  I have to say that I've had my misgivings about mixin 
> statements, but I'm glad to see that BLADE and Don's hard work have 
> proven me wrong.  Compile time vector expressions are desperately 
> needed, and this library goes a long way to sorting things out.  As far 
> as meta-type tricks go, this is by far the coolest I've ever seen in any 
>  programming language.
> 
> One very interesting application I would like to see with this technique 
> would be a compile time geometric algebra library.  If no one writes one 
> by this summer, I will probably do it myself.  (Actually, when I heard 
> the name BLADE, my heart skipped a beat thinking it was a GA library, 
> but alas it is not...)  Maybe it is my unrestrained exuberance, I would 
> guess that a strong D implementation should easily crush the leading C++ 
> GA lib, GAIGEN in both performance and ease of use.
> 
> For reference, here is the GAIGEN homepage:
> http://www.science.uva.nl/ga/gaigen/content_gaigen.html
> 
> -Mikola Lysenko

Wow, that looks really sweet.  Last I heard on GA was that it was good 
for working out the math, but too slow for real use.  Now it's fast too 
apparently!  Now I've really got to learn GA.  And a D compile-time fu 
version would be neat.

One question: from the GAIGEN page it sounds almost like GAIGEN 
generates off-line a set of primitive operations that are efficient for 
the chosen specific GA domain (3D euclidean or whatever).  If so, then 
that sounds pretty good to me.  What's wrong with using an off-line 
approach?  Are there some expressions things that are just too difficult 
to optimize ahead of time without seeing the whole expression as it will 
actually used?  Or is it more like GAIGEN creates the primitives 
operations for a particular GA like dot product, cross product, and 
matrix multiplies?  If so then it still maybe leaves a lot of 
optimization opportunities on the floor.  Like evaluating A*B*C*vec as 
((A*B)*C)*vec vs. (A*(B*(C*vec))) can make a big difference if ABC are 
big matrices and vec is a small vector.

--bb



More information about the Digitalmars-d mailing list