I am a PhD student. In introducing my thesis, the compromise between expressiveness and the characteristics of linear algebra tools undermines me.
As a simple example, I use the calculation of the norm of a vector expression. C code for my example:
float normExpression3(float a, float *W, float b, float *X, float c, float*Y){ double norm = 0; for (int i=0; i<n; ++i)
}
I compare the results achieved with different tricks. Since vectors are large (several million elements), the characteristics are limited by the memory bandwidth. However, there are huge differences between the various approaches.
The optimized version of C that I wrote is not expressive (the new function should be written as the 4th vector) and very ugly (stream and vectorized), but reached 6.4 GFlops. MATLAB code, on the other hand, is very nice:
result = norm(a*W+b*X+c*Y)
but only reaches 0.28 GFlops.
The expressions of C ++ templates in la Blitz ++ provide both expressiveness and results for the user (6.5 GFlops).
As part of my analysis, I would like to know how functional languages ββcan compare with these approaches. I thought of showing an example in either Haskell or OCaml (AFAIK, both are well suited for this kind of operation).
I do not know any of these languages. I could learn about them to present my example, but that would not be a fair comparison: I am not sure that I can provide an implementation that allows both expressiveness and speech.
So my two questions are: 1) which language is best suited? 2) how can we efficiently calculate the norm of vector expressions without compromising the generality of implementation?
Thank you in advance!
Wilfried K.
Edit: adjusted battery type norm for float to double