Boost logo

Ublas :

Subject: Re: [ublas] [bindings] LAPACK ?GESVD and minimum workspace size
From: sguazt (marco.guazzone_at_[hidden])
Date: 2011-04-07 08:04:39


On Thu, Apr 7, 2011 at 1:26 PM, Rutger ter Borg <rutger_at_[hidden]> wrote:
> On 04/07/2011 01:08 PM, sguazt wrote:
>>>
>>> minmn = min( m, n );
>>> if ( jobu=='N' || jobvt == 'N' ) {
>>>  return 5 * minmn;
>>> } else {
>>>  return max( 3 * minmn + max(m,n), 5 * minmn );
>>> }
>>>
>>> ?
>>
>> Sure, your's definitively better!! :)
>>
>> Cheers,
>>
>> -- Marco
>
> Looking at it a bit more, the first logical-or-condition is violating the
> logic in your code, so it might be wrong. Is it?
>

No, it's not.
In my case both JOBU and JOBVT are set to 'N'. So in this case the
code returns 5 which agrees with the value returned by LAPACK when
WORK==-1.

However, your right to say the code may be wrong.
Indeed, the code seems to be incorrect for cases such as:
  m < n && jobu == 'N' && jobvt != 'N'

In this case, the code above returns 5*m while the right answer is
::std::max(3*m+n,5*m).
So maybe we can return to the code I've posted earlier ;)

Cheers,

-- Marco