I am a PhD student. 
In the introduction of my thesis, I am insterested by the compromise between expressivity and performances of Linear Algebra tools.

As a simple example, I use the computation of the norm of a vector expression.
The C code for my example is:

```
float normExpression3(float a, float *W, float b, float *X, float c, float*Y){
double norm = 0;
for (int i=0; i<n; ++i) // n in [3e6; 2e8]
{
    float tmp = a*W[i]+b*X[i]+c*Y[i];
    norm+=tmp*tmp;
}
return sqrtf(norm);

```

}

I compare the performances achieved with different techniques.
As the vectors are big (several million elements), the performances are limited by the memory bandwidth.
However, there are huge differences beetween the different approaches.

The optimized C version I wrote is not expressive (a new function has to be written to as a 4th vector) and very ugly (threaded and vectorized) but achieved 6.4 GFlops.
On the other hand, MATLAB code is very nice:

```
result = norm(a*W+b*X+c*Y)

```

but only achieves 0.28 GFlops.

C++ templates expressions *à la* Blitz++ provide both expressivity and performances to the user (6.5 GFlops).

As a part of my analysis, I would like to know how functionnal languages can compare to these approaches.
I thought about showing an example either in Haskell or in OCaml (AFAIK, both are reputed well suited for this kind of operation).

I know none of these languages. I could learn on of them to provide my example but this would'nt be a fair comparison: I am not sure to be able to provide an implementation allowing both expressivity and performances.

So my two questions are :
1) which language is best suited ?
2) how could the norm of vector expressions be computed efficiently without compromising the generality of the implementation ?

By advance, thank you !

Wilfried K.

---

Edit : corrected the type of the `norm` accumulator for `float` to `double`