[Rd] "LAPACK routine DGESDD gave error code -12" with Debian (PR#2822)

Douglas Bates bates at stat.wisc.edu
Thu Apr 24 13:03:21 MEST 2003


Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:

> Camm Maguire <camm at enhanced.com> writes:
> 
> > 2) Given the error code, and the scaling behavior with matrix size,
> >    I'd say the lwork parameter (size of the work array) passed to
> >    dgesdd is not always large enough, i.e. is not scaling properly
> >    with n,m.  Please see 'man dgesdd' for interpretations of the error
> >    code.  It is the responsibility of the calling routine to allocate
> >    and pass the work array to dgesdd.  With most lapack routines, one
> >    can make a 'workspace query' call first by setting lwork to -1, or
> >    some such.  check the man page for details.  This of course would
> >    have to be done with each change in n,m.  Alternatively, you could
> >    take the minimum workspace requirements from the manpage.  
> 
> Right, but that's actually what we do, use the workspace query. It's
> all very weird, because the -12 value indicates that the lwork
> parameter is wrong, but it is computed from an exactly identical call,
> except lwork=-l:
> 
>         lwork = -1;
> 
>         F77_CALL(dgesdd)(CHAR(STRING_ELT(jobu, 0)),
>                          &n, &p, xvals, &n, REAL(s),
>                          REAL(u), &ldu,
>                          REAL(v), &ldvt,
>                          &tmp, &lwork, iwork, &info);
>         lwork = (int) tmp;

It looks like a problem in ilaenv, the Lapack routine that returns the
tuning parameters, like the optimal temporary storage size, for
various Lapack routines.  The value returned in tmp will depend upon
the results of several calls to ilaenv.  These results can vary between
different implementations of the blas (or atlas).



More information about the R-devel mailing list