[SciPy-Dev] QR-decomposition with Q but not Q

Martin Teichmann martin.teichmann at mbi-berlin.de
Fri Aug 12 03:07:30 EDT 2011


Hi List,
Hi Sturla,

> Some of these are exposed in SciPy or statmodels (I think, but I like to do
> it myself...) Anyway, I don't think it's worth the effort to duplicate these
> drivers with specialized QR code, if we only need the QR for least-squares.

so, I'm working on the Marquard-Levenberg fitting algorithm, and indeed,
I need not much more than least-squares solving. In princple, I think,
I could use the LAPACK routines for that.

However, I definitely prefer the readability of python over FORTRAN.
I'm not interested in the last bit of speed, my computer is fast enough.
Profiling my all-python (with numpy and scipy for sure) ML fit,
I realized that most time is spent in the QR factorization. By doing this
in FORTRAN, I would be able to speed up everything fast enough
to not have to wait for fit results anymore.

> If anyone is interested, I'm attaching some Fortran 95 code I've used for
> the purpose (porting to Python/NumPy is easy).

I personally do not think we should start writing our own FORTRAN code
in scipy. FORTRAN is ugly. Python is pretty. And with cython you can
get as fast as FORTRAN. Sure, it does make sense to use already existing
FORTRAN subroutines, it would be ridiculous to discard some 50 years
worth of optimization, and yes, calling FORTRAN code from cython is
not so simple, but that can be changed.

Greetings

Martin



More information about the SciPy-Dev mailing list