Boost logo

Ublas :

Subject: Re: [ublas] [bindings] New traits system
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-01-09 06:58:31

Thomas Klimpel wrote:

> These sort of "bugs" are normally inconsistencies in the documentation of
> the original lapack functions. In this case sgelsd.f says
> * A (input) REAL array, dimension (LDA,N)
> * On entry, the M-by-N matrix A.
> * On exit, A has been destroyed.
> but cgelsd.f says
> * A (input/output) COMPLEX array, dimension (LDA,N)
> * On entry, the M-by-N matrix A.
> * On exit, A has been destroyed.
> So the matrix A will be destroyed on output (as such cgelsd.f is probably
> correct to declare it as "input/output"), but sgelsd.f doesn't declare it
> as "input/output", so the overloaded templates gelsd have the same name,
> but generate incompatible overloads.

Good point -- I'll revert the fix I just applied, because now there's an
error in const correctness in the real specialization of gelsd. I thought
it was similar to computational/trevc, where select is mutable in the real
case but const in the complex case, and the opposite for T. In the case of
trevc, I added the possibility to override the permutation table for the
overloaded funtions. In case of gelsd, I see we have to be able to override
the constness of A in the real case...

Annoying... :-)

> I don't think that this has anything to do with MKL, and I think the crash
> happens earlier before you are in the MKL on an assert. This is again an
> inconsistency in the documentation, because the optimal workspace
> determined by lapack for gelsd is smaller than the minimal required
> workspace mentioned in the documentation. So I cheated when updating the
> regression tests, and did some hand-editing to gelsd.hpp. The updated
> bindings have of course reverted the hand editing, so it's no surprise
> that it no longer works.

What / how is gelsd fixed? I think workspace stuff can be overruled quite
easily through the template of gelsd. I guess I missed your fix.