From bates at stat.wisc.edu  Thu Apr 24 13:03:21 2003
From: bates at stat.wisc.edu (Douglas Bates)
Date: Thu Apr 24 19:04:14 2003
Subject: [Rd] "LAPACK routine DGESDD gave error code -12" with Debian
	(PR#2822)
In-Reply-To: <x2u1co878q.fsf@biostat.ku.dk>
References: <200304221807.h3MI7apD014611@pubhealth.ku.dk>
	<20030423003246.GA27400@sonny.eddelbuettel.com>
	<54el3swyrk.fsf@intech19.enhanced.com> <x2u1co878q.fsf@biostat.ku.dk>
Message-ID: <6r7k9j25gm.fsf@bates4.stat.wisc.edu>

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

> Camm Maguire <camm@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).


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