Carnë and I are working with Barbara on porting gsvd from the linear-algebra package to core octave, as part of her GSoC project . As the documentation states, "The code is a wrapper to the corresponding Lapack dggsvd and zggsvd routines."
Starting with LAPACK 3.6 (released this year), *ggsvd.f are deprecated and *ggsvd3.f (which call Level 3 BLAS routines and hence presumably perform better) are to be used instead . I suppose we should wait another couple of years for 3.6 to percolate through the operating systems before we make the change in our gsvd, or is there a way of testing which LAPACK function is available in a given instance?
<< is there a way of testing which LAPACK function is available in a given instance?
I think you can test it in configuration time. In file configure.ac, after the check for LAPACK and BLAS library you can write something like:
AC_CHECK_FUNC([ggsvd3], AC_DEFINE(HAVE_LAPACK_WITH_GGSVD3, 1, [Define to 1 if you have LAPACK with
ggsvd3]), AC_DEFINE(HAVE_LAPACK_WITH_NO_GGSVD3, 1, [Define to 1 if you don't have LAPACK with
where OTHER_LIBS are LIBS flags of libraries LAPACK and BLAS.
You can try to use this and after configuration try to look in config.log to see if variable
HAVE_LAPACK_WITH_GGSVD3 or HAVE_LAPACK_WITH_NO_GGSVD3
is set. Then in your main file you can use this variables to choose the right function to call.
Probably there is a more elegant way to test that, but I hope to help.
On 08/05/2016 04:13 PM, Francesco Faccio wrote:
> Nir wrote:
> << is there a way of testing which LAPACK function is available in a
> given instance?
> Hi Nir,
> I think you can test it in configuration time. In file configure.ac,
> after the check for LAPACK and BLAS library you can write something like:
Yes, you can write a configure test, but LAPACK and BLAS are libraries
that people expect to be able to swap out at run time with other
versions. We can't know which ones those will be at configure time. So
we could test, but then Octave might fail if a different library were
used after installation. The mode of failure might be that it fails to
start because of a missing symbol (not too bad) or it just fails when
attempting to call the missing function (not so good). OTOH, maybe we
shouldn't care about that more than to document what subset of functions
from LAPACK and BLAS that Octave uses directly.