tags:

views:

38

answers:

2

I have a program that runs through R but uses the BLAS routines. It runs through correctly about 8 times but then throws an error:

BLAS/LAPACK routine 'DGEMV ' gave error code -6

What does this error code mean?

A: 

DGEMV does not return any error codes.

This bug implies that the error is coming from R itself.

Perhaps you should file a bug against R.

Kevin Panko
BLAS has an error handler called XERBLA. R overwrites XERBLA to pass on error messages. The error is called from the info variable, from what I can see.
Andrew Redd
Looks like you got the answer there.
Kevin Panko
+1  A: 

R defines the XERBLA function as

void F77_NAME(xerbla)(const char *srname, int *info)
{
   /* srname is not null-terminated.  It should be 6 characters. */
    char buf[7];
    strncpy(buf, srname, 6);
    buf[6] = '\0';
    error(_("BLAS/LAPACK routine '%6s' gave error code %d"), buf, -(*info));
}

from the src/main/print.c file.

the Netlib version of dgemv.f shows that only the input parameters are checked. A code of 6 shows a problem with either the LDA or M parameter.

*...
  ELSE IF (LDA.LT.MAX(1,M)) THEN
      INFO = 6
*...
  END IF
  IF (INFO.NE.0) THEN
      CALL XERBLA('DGEMV ',INFO)
      RETURN

So it appears that R takes the negative of the BLAS error code, which I think causes lots of confusion. I think this answers my question but not my problem, since it works several times with the same parameters before the error is thrown.

Andrew Redd