
At Tue, 22 Mar 2011 00:12:24 +0100, Mathias Gaunard wrote:
On 21/03/2011 18:45, Dave Abrahams wrote:
Typically what you do with a generic library is that you write generic algorithms for arbitrary datatypes and then specialize them to dispatch to LAPACK when the types can be handled directly. That way you can still get a reasonably-performant matrix-of-matrices or matrix-of-rationals and get screamin'-hot performance for floats and doubles.
From my experience I found that when efficiency is one of the main cocners, it often worked better the other way around: write the algorithm optimally, and then see how you can generalize it.
Well naturally; the generic programming process *starts* with multiple optimal non-general implementations, and lifts them repeatedly to higher levels of abstraction... [http://www.generic-programming.org/about/intro/lifting.php]
also, writing multiple implementations requires time, which is somewhat restricted during a GSoC.
...but as the generic programmer, you don't have to write them yourself; you generally look around and find examples that people smarter than you have written. Of course, that takes time too :-) -- Dave Abrahams BoostPro Computing http://www.boostpro.com