Live data from Hacker News

Outperforming LAPACK with C++ metaprogramming

wordsandbuttons.online

81–82 of 82 posts

Re: Outperforming LAPACK with C++ metaprogramming

#81
post #7
post #4

Please check with array initialized from file or other dynamic source. With maximal inlining, there's a risk of constant propagation resulting in a lot of computation happening at compile time rather than run time.

As an anecdote of just how powerful this can be, I once wrote a prototype of a simulation (written in C) that used a lot of integer divisions and needed to be run many times with different parameters. As a quick and dirty hack that took about half hour to implement, I decided to just have the program as a template string and the parameters be substituted in by a python script that called GCC. To the amazement of a ve…

Next time you're considering something like this, have a look at D: It has nearly the same syntax as C but with some seriously awesome power features. You could've easily written the whole python/c mess entirely in D, generating the code to compile at compile time e.g. from a config file.

Re: Outperforming LAPACK with C++ metaprogramming

#82
post #34

Earlier quoted context omitted.

Yes, Cramer’s rule (referred to in the article) does not give numerically stable results AFAIK - which is yet another can of worms. Good catch.

I don't think I have heard Cramer's rule mentioned without the caveat "but don't use this for real problems".

It’s useful for certain theoretical proofs in analytic math - or so I’ve heard. Not all math is well suited to be coded into reliable software.
Post reply on HN