Boost logo

Ublas :

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


On Thu, Apr 7, 2011 at 11:17 AM, Rutger ter Borg <rutger_at_[hidden]> wrote:
> On 04/07/2011 11:01 AM, sguazt wrote:
>>
>> Hmmm is not so trivial.
>
>>
>
> I do think it is not trivial, but also not impossible, looking at
>
> http://www.netlib.org/lapack/double/dgesvd.f
>
> and concentrating on the
>
> MINWRK = ****
>
> statements, there's not that much variation. I mean, if there are only N
> variations of MINWRK, we only need N-1 checks, not >20, to see what MINWRK
> should be. I.e., it's max( 3*m+n, 5*n ) in more than 80% of those >20 cases.
> I'm convinced it probably boils down to a short if-else-tree checking the m,
> n, and job* params.
>

I've tried to follow each path. I've end up with the following cases:

--- [code] ---
m = ...; // # rows of A
n = ...; // # columns of A
sz = 0; // will hold the min work size
/* k = ::std::min(m,n); */
if (m >= n /* && k > 0 */) {
  if (jobu == 'N') {
    //sz = ::std::max(4*n, 5*n);
    sz = 5*n;
  } else {
    sz = ::std::max(3*n+m,5*n);
  }
} else /* if (k > 0) */ {
  if (jobvt == 'N') {
    // sz = ::std::max(4*m, 5*m);
    sz = 5*m;
  } else {
    sz = ::std::max(3*m+n,5*m);
  }
}
return sz;
--- [code] ---

Do you agree?

Note: in the code above I've commented useless statements; I've just
kept them only for ease of reading.

Cheers,

-- Marco

> Cheers,
>
> Rutger
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: marco.guazzone_at_[hidden]
>