Boost logo

Ublas :

Subject: Re: [ublas] [numeric-bindings] NumericBindings conflicts with LAPACKE
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2015-09-03 07:02:17


On Thu, Sep 3, 2015 at 12:21 PM, Thomas Klimpel <thomas.klimpel_at_[hidden]> wrote:
> Hi Marco,
>
>
> the prototypes from lapacke.h seem to lack const qualifiers.
>
> One option could be to extend the python script to create a lapacke.h with const qualifiers from a given lapacke.h.
>
> Another option would be to allow the python script to generate bindings which use a "given" lapacke.h, and generate appropriate const_cast<>s in the
> // Overloaded function for dispatching to
> // * netlib-compatible LAPACK backend (the default)
>
> A nicer variant of this option would be to have lapacke as another backend, and switch between the different backends via macros like BOOST_NUMERIC_BINDINGS_LAPACK_CLAPACK for switching from the
> // * netlib-compatible LAPACK backend (the default)
> to
> // * ATLAS's CLAPACK backend
>
> What would you prefer? A macro like BOOST_NUMERIC_BINDINGS_LAPACK_LAPACKE for switching to a lapacke backend, or some possibility to generate lapacke.h with const qualifiers, with the possible option to directly incorporate such an improved lapacke.h into future versions of lapacke?
>

Hi Thomas,

Thank you for the reply.

My first "no-brain" answer would be: I choose the fastest option :)
Instead, thinking a little bit more, I'm not sure but maybe the option
that uses BOOST_NUMERIC_BINDINGS_LAPACK_LAPACKE is the most flexible,
do you?

By the way, I've tried to manually add the new backend by looking at
what has been done for CLAPACK.

After a "grep -ri CLAPACK" command,

I've added these files:
boost/numeric/bindings/lapack/detail/lapacke.h
boost/numeric/bindings/lapack/detail/lapacke_options.hpp

I've changed these files:
boost/numeric/bindings/detail/config/fortran.hpp
boost/numeric/bindings/lapack/driver/gesv.hpp
boost/numeric/bindings/lapack/driver/posv.hpp
boost/numeric/bindings/lapack/computational/trtri.hpp
boost/numeric/bindings/lapack/computational/potri.hpp
boost/numeric/bindings/lapack/computational/potrs.hpp
boost/numeric/bindings/lapack/computational/getrs.hpp
boost/numeric/bindings/lapack/computational/potrf.hpp
boost/numeric/bindings/lapack/computational/getri.hpp
boost/numeric/bindings/lapack/detail/lapacke_option.hpp

But probably I've done it wrong as I still get errors about constness.
Also, I get errors about complex arguments since NumericBindings uses
void* while LAPACKE uses "by default" _Complex.
I've quoted "by default" because the type can be changed via macro
definition. So I've tried:

* -Dlapack_complex_float="std::complex<float>"
-Dlapack_complex_double="std::complex<double>"

* -Dlapack_complex_float="void" -Dlapack_complex_double="void"

Both of them fail to work. In particular the last one fails since
LAPACKE declares variable of complex type thus resulting in an error
(a void variable cannot be declared)

If you are interested I can send you or share in some way the changed files.

Cheers,

Marco