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

Sébastien Villemot sebastien at debian.org
Wed Nov 28 15:23:39 UTC 2012


Christophe TROESTLER <Christophe.Troestler at umons.ac.be> writes:

> 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.

I understand your point, though one could argue that an object of
dimension M×0 is not a matrix. Indeed, Octave for example handles well
these corner cases.

>> 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.

Yes indeed. However it does not tell what it does in that case, though I
agree with you that doing y=beta*y would seem logical.

Do you have examples of other BLAS functions which handle
null-dimensions as you would expect?

-- 
 .''`.    Sébastien Villemot
: :' :    Debian Developer
`. `'     http://www.dynare.org/sebastien
  `-      GPG Key: 4096R/381A7594
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20121128/b14a32f3/attachment.pgp>


More information about the debian-science-maintainers mailing list