News for hackers. Stuff that matters.
Re:Haskell Beats C Using Generalized Stream Fusion [pdf] by pbsd on Sunday April 07, 2013 @12:59PM (#5507790)
While 'Derived::Scalar' could very well be replaced by 'double' in that case, you need the templated function to catch the temporary type (expression template) that represents the u-v computation. This lets Eigen compute u[i]-v[i] and the dot product inside the same inner loop.

Without the templated function, the compiler would first generate the subtraction into a temporary vector, and then compute the dot product on that vector.

Re:Haskell Beats C Using Generalized Stream Fusion [pdf] by kevingadd on Sunday April 07, 2013 @03:52PM (#5508454)
That makes sense, thanks! I figured the template was being used to magically substitute some sort of meta-type or container for temporaries.