Bug#694625: libblas3gf: DGEMV does not handle properly N=0

Christophe TROESTLER Christophe.Troestler at umons.ac.be
Wed Nov 28 15:05:09 UTC 2012


On Wed, 28 Nov 2012 15:47:08 +0100, Sébastien Villemot wrote:
> 
> I have tested the three BLAS implementations available in Debian (netlib
> BLAS, ATLAS and OpenBLAS), and they all give the same result (bad from
> your point of view).
> 
> So I am not sure this is a bug. Maybe this is on purpose. If one
> considers this operation to be invalid (as I do), then it makes sense to
> do nothing.

If the operation is considered invalid, then it should return an error
instead of doing nothing silently.

However, I insist that the operation is perfectly valid from a
mathematical point of view.  Indeed, in mathematics, ∑_{i ∈ ∅} a_i = 0.
Therefore, A * x = 0 when A has dimensions M×0.  This corner case is
also useful in practice.  For a problem I have, I needed to compute

    t ↦ f(t₀ y + ∑ t_i a_i)

where a_i are vectors and t_i real numbers.  It so happens that in
some circumstances, the sum may be empty leading to a constant
function instead of the correct t ↦ f(t₀ y).  A very bad surprise
IMHO, incoherent with the semantics of the operation.

> Does the documentation clearly states that BLAS supports operations on
> objects with one dimension equal to zero?

Not the man pages.  To the contrary, for N, the man page clearly
includes the possibility that N = 0:

       N      - INTEGER.
              On  entry, N specifies the number of columns of the matrix A.  N
              must be at least zero.  Unchanged on exit.



More information about the debian-science-maintainers mailing list