
On Mon, Jul 18, 2011 at 11:54 PM, Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung@gmail.com> wrote:
I just ran through a quick count of the number of multiplies, and for 4x4 matrices, dynamic programming will reduce the number of multiplications from 40 to 28 over straightforward recursion, while for 5x5 matrices, the reduction from 205 to 75 (or so).
I welcome any optimization like this. Is it possible to write a generic code generator for this algorithm, similarly to the other code generators in libs/qvm/gen/gen.cpp?
I think it is, but it's certainly more challenging than the straightforward algorithm. Lemme look at this gen.cpp to see what you do.
I'm curious, what are you reasons for not using the preprocessor for code generation? Is it not possible in this case? Too much of a maintenance problem? Compile-time speed? Haven't tried?
Compile-time speed and readability of the generated code. I often step through this kind of code trying to figure out what's wrong with my matrices; the last thing I want is to have to look at preprocessor or template meta programs. What's the downside anyway?
Well, when you get that far, it seems you'll need to revisit your (documented) scalar requirements. It's possible that could be a precondition for review.
That's fine. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode