Boost logo

Ublas :

Subject: Re: [ublas] [bindings] Lapack generator update
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2008-12-16 16:50:46

Rutger wrote:
> > 1) It's probably a good moment to say goodbye to
> > BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS, or at least to VC-6.0 support for
> > the lapack bindings. I don't know where VC-7.0 and VC-7.1 stand in this
> > respect.
> Do you know what/where it was needed for?

It is definitively needed for VC-6.0 support, and is currently also used for VC-7.0 support. I worked with both VC-6.0 and VC-7.1. I often hit template limitations in VC-6.0, but can't remember having hit any real template limitation in VC-7.1. However, my own uses of templates are much more humble than what boost does, and I have the impression that even VC-7.1 is considered to be 'poor man' by boost standards.

starts with "On compilers which do not support partial template specialisation, ..."
but I don't know whether VC-7.1 falls into this category.

> > 2) The bindings currently fully support custom types, i.e.
> > complex_f can be anything (i.e. it's not valid to assume it's complex<
> > float >), as long as it has the correct memory layout for the lapack
> > routines. This only means that the user has to take care that is_real,
> > is_complex, ... is correctly specified for his type. Whether his type is
> > complex enough for other algorithms is his own problem.
> Cool, didn't know that. Is this a feature and/or really needed?

It is a feature. Sad as it is, C++ programms still end up with a nice zoo of different complex types. You will use std::complex<double> as long as nothing comes into your way. If you want to use FFTW, you will get fftw_complex for free. Another 3rd_party library might use _Complex double (the C99 type), and the library of your main supplier might use an own complex type inspired by the famous numerical recipes books.

The user could work around this, by defining BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR, and then use a reinterpret_cast when providing the constructor arguments to a shallow_array_adaptor. However, the usage of shallow_array_adaptor is discouraged (that's why the user is required to explicitly define BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR if he wants to use it).

> If not, we could suffice with
> std::tr1::is_complex< T >
> std::tr1::is_floating_point< T >
> because, after all, we are creating C++ bindings... On the other hand, it's
> not a big deal to create our own.

I'm still curious about the announced proposal of Karl Meerbergen. I'm in the nice position of not being a template metaprogramming expert, so I can wait for others to come up with good proposals.