Hi,
I'm observing an unexpectedly drastic slowdown of mols() when switching
to SVD (with 'set svd on').
My toy benchmark is to regress a 200x10 LHS matrix on a 200x80 RHS
matrix 5000 times. The matrices are not redrawn in order to measure just
the mols speed, not the RNG. On an oldish machine I get:
~ 3 sec without svd
~ 60 sec with svd
For comparison, Python/Numpy's linalg.lstsq takes ~ 8 sec and is said to
use SVD always.
There are at least two possible differences between gretl/svd and numpy:
1) numpy might be using Intel's Math Kernel Library (MKL) in the
background instead of standard Lapack (coming from the conda/Anaconda
distro).
2) The web says that numpy uses Lapack's DGELSD
(
http://www.netlib.org/lapack/explore-html/d7/d3b/group__double_g_esolve_g...),
whereas judging from lib/src/gretl_matrix.c in the function
gretl_matrix_SVD_ols (and maybe gretl_matrix_multi_SVD_ols? - don't know
what that is for) it seems that gretl uses DGELSS.
On the Netlib Lapack page it says
(
https://www.netlib.org/lapack/lug/node27.html) that "The subroutine
xGELSD is significantly faster than its older counterpart xGELSS", and
it labels DGELSD with "solve LLS using divide-and-conquer SVD".
So, any negative side effects blocking the switch to DGELSD, or is it
something like a free lunch?
thanks
sven