This dates back from 1988 and the initial BLAS specification of the Level 2
BLAS. The behavior you are describing (which you do not like) is actually
correct and follows the specification from 1988. Interestingly enough, the
behavior was changed for Level 3 BLAS in 1990 and the Level 3 BLAS follows the
behavior you would have liked to see. See below for historical references and
To address the issue, you could have an IF statement before calling Level 2
BLAS GEMV or you could use the Level 3 BLAS GEMM instead of the Level 2 BLAS
I understand that you probably have found a fix and made this work and your
comment was higher level than just "I want my code to work". Thanks for the
feedback, you are right, this behavior of Level 2 BLAS GEMV may appear quite
surprising / counter-intuitive indeed. I agree with you.
Julien.The Level 2 BLAS paper from 1988.
The Level 3 BLAS paper from 1990.
J. J. Dongarra, J. Du Croz, S. Hammarling, and R. J. Hanson, An extended set of
FORTRAN Basic Linear Algebra Subprograms, ACM Trans. Math. Soft., 14 (1988),
page 5 - section 4
The size of the matrix is determined by the arguments M and N for an m-by-n
rectangular matrix [...] Note it is permissible to call the routines with M or
N = 0, in which case the routines exit immediately without referencing their
vector or matrix arguments.
J. J. Dongarra, J. Du Croz, I. S. Duff, and S. Hammarling, A set of Level 3
Basic Linear Algebra Subprograms, ACM Trans. Math. Soft., 16 (1990), pp. 1--17.
page 6 - section 4
The sizes of the matrices are determined by the arguments M, N and K. It is
permissible to call the routines with M or N = 0, in which case the routines
exit immediately without referencing their arguments. If M and N > 0, but K =
0, the operation reduces to C := beta * C [ ... ]