Debian Bug report logs - #694625
libblas3gf: DGEMV does not handle properly N=0

version graph

Package: libblas3gf; Maintainer for libblas3gf is Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>; Source for libblas3gf is src:blas.

Reported by: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>

Date: Wed, 28 Nov 2012 14:15:01 UTC

Severity: normal

Found in version blas/1.2.20110419-5

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Christophe.Troestler@umons.ac.be, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 14:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christophe TROESTLER <Christophe.Troestler@umons.ac.be>:
New Bug report received and forwarded. Copy sent to Christophe.Troestler@umons.ac.be, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 14:15:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 15:05:45 +0100
[Message part 1 (text/plain, inline)]
Package: libblas3gf
Version: 1.2.20110419-5
Severity: important

Dear Maintainer,

The routine DGEMV (with TRANS = 'N') is supposed to perform the
operation

    y ← beta * y + alpha * A * x

where the matrix A has dimensions M×N.  In particular, if N=0 (and M >
0), A * x is the null vector (all elements are given by sums on an
empty set of indices).  Consequently, if N = 0, the operation should
be

    y ← beta * y

and NOT leave y untouched.  For your convenience, I have attached a
program demonstrating the latter (wrong) behavior.
   

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (900, 'testing'), (400, 'unstable'), (300, 'stable'), (100, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.6.6 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libblas3gf depends on:
ii  libblas3  1.2.20110419-5

libblas3gf recommends no packages.

libblas3gf suggests no packages.

-- no debconf information
[test_gemv.f (text/plain, inline)]
      Program test_gemv
      Implicit none

      Real*8 A(2,2)
      Real*8 X(2), Y(2), beta

      A(1,1) = 1.
      A(1,2) = 1.
      A(2,1) = 1.
      A(2,2) = 1.

      Y(1) = 1.
      Y(2) = 2.
      beta = 2.

c     Should perform: Y <- beta * Y (empty sums in the matrix product)
      call DGEMV('N', 2, 0,  0., A, 2,  X, 1,  beta, Y, 1)
      
      write(*,*) Y(1)
      write(*,*) Y(2)

      end
c$$$Local Variables:
c$$$compile-command: "gfortran -o test_gemv test_gemv.f -lblas"
c$$$End:

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 14:21:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sylvestre Ledru <sylvestre@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 14:21:06 GMT) Full text and rfc822 format available.

Message #10 received at 694625@bugs.debian.org (full text, mbox):

From: Sylvestre Ledru <sylvestre@debian.org>
To: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>, 694625@bugs.debian.org, control@bugs.debian.org
Subject: Re: Bug#694625: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 15:20:33 +0100
severity 694625 normal
thanks

Bonjour Christophe!

On 28/11/2012 15:05, Christophe TROESTLER wrote:

> Dear Maintainer,
> 
> The routine DGEMV (with TRANS = 'N') is supposed to perform the
> operation
> 
>     y ← beta * y + alpha * A * x
> 
> where the matrix A has dimensions M×N.  In particular, if N=0 (and M >
> 0), A * x is the null vector (all elements are given by sums on an
> empty set of indices).  Consequently, if N = 0, the operation should
> be
> 
>     y ← beta * y
> 
> and NOT leave y untouched.  For your convenience, I have attached a
> program demonstrating the latter (wrong) behavior.

I am getting:
   1.0000000000000000
   2.0000000000000000
What should I get ?
2 & 2 ?

Thanks
Sylvestre



Severity set to 'normal' from 'important' Request was from Sylvestre Ledru <sylvestre@debian.org> to control@bugs.debian.org. (Wed, 28 Nov 2012 14:21:08 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 14:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sébastien Villemot <sebastien@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 14:51:03 GMT) Full text and rfc822 format available.

Message #17 received at 694625@bugs.debian.org (full text, mbox):

From: Sébastien Villemot <sebastien@debian.org>
To: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>
Cc: 694625@bugs.debian.org
Subject: Re: Bug#694625: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 15:47:08 +0100
[Message part 1 (text/plain, inline)]
Christophe TROESTLER <Christophe.Troestler@umons.ac.be> writes:

> Package: libblas3gf
> Version: 1.2.20110419-5
> Severity: important

> The routine DGEMV (with TRANS = 'N') is supposed to perform the
> operation
>
>     y ← beta * y + alpha * A * x
>
> where the matrix A has dimensions M×N.  In particular, if N=0 (and M >
> 0), A * x is the null vector (all elements are given by sums on an
> empty set of indices).  Consequently, if N = 0, the operation should
> be
>
>     y ← beta * y
>
> and NOT leave y untouched.  For your convenience, I have attached a
> program demonstrating the latter (wrong) behavior.

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.

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

-- 
 .''`.    Sébastien Villemot
: :' :    Debian Developer
`. `'     http://www.dynare.org/sebastien
  `-      GPG Key: 4096R/381A7594
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 14:51:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sébastien Villemot <sebastien@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 14:51:04 GMT) Full text and rfc822 format available.

Message #22 received at 694625@bugs.debian.org (full text, mbox):

From: Sébastien Villemot <sebastien@debian.org>
To: Sylvestre Ledru <sylvestre@debian.org>
Cc: 694625@bugs.debian.org
Subject: Re: Bug#694625: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 15:49:09 +0100
[Message part 1 (text/plain, inline)]
Sylvestre Ledru <sylvestre@debian.org> writes:

> On 28/11/2012 15:05, Christophe TROESTLER wrote:
>
>> The routine DGEMV (with TRANS = 'N') is supposed to perform the
>> operation
>> 
>>     y ← beta * y + alpha * A * x
>> 
>> where the matrix A has dimensions M×N.  In particular, if N=0 (and M >
>> 0), A * x is the null vector (all elements are given by sums on an
>> empty set of indices).  Consequently, if N = 0, the operation should
>> be
>> 
>>     y ← beta * y
>> 
>> and NOT leave y untouched.  For your convenience, I have attached a
>> program demonstrating the latter (wrong) behavior.
>
> I am getting:
>    1.0000000000000000
>    2.0000000000000000
> What should I get ?
> 2 & 2 ?

Christophe is expecting 2 & 4 (Y=[1,2] and beta=2 in his example)

-- 
 .''`.    Sébastien Villemot
: :' :    Debian Developer
`. `'     http://www.dynare.org/sebastien
  `-      GPG Key: 4096R/381A7594
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 15:15:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christophe TROESTLER <Christophe.Troestler@umons.ac.be>:
Extra info received and forwarded to list. Copy sent to Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 15:15:09 GMT) Full text and rfc822 format available.

Message #27 received at 694625@bugs.debian.org (full text, mbox):

From: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>
To: <sylvestre@debian.org>
Cc: <694625@bugs.debian.org>
Subject: Re: Bug#694625: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 16:05:01 +0100
On Wed, 28 Nov 2012 15:20:33 +0100, Sylvestre Ledru wrote:
> 
> severity 694625 normal
> thanks
> 
> Bonjour Christophe!

Salut Sylvestre !

> On 28/11/2012 15:05, Christophe TROESTLER wrote:
> 
> > Dear Maintainer,
> > 
> > The routine DGEMV (with TRANS = 'N') is supposed to perform the
> > operation
> > 
> >     y ← beta * y + alpha * A * x
> > 
> > where the matrix A has dimensions M×N.  In particular, if N=0 (and M >
> > 0), A * x is the null vector (all elements are given by sums on an
> > empty set of indices).  Consequently, if N = 0, the operation should
> > be
> > 
> >     y ← beta * y
> > 
> > and NOT leave y untouched.  For your convenience, I have attached a
> > program demonstrating the latter (wrong) behavior.
> 
> I am getting:
>    1.0000000000000000
>    2.0000000000000000
> What should I get ?

2.
4.

(beta=2 in the code).



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 15:15:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christophe TROESTLER <Christophe.Troestler@umons.ac.be>:
Extra info received and forwarded to list. Copy sent to Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 15:15:10 GMT) Full text and rfc822 format available.

Message #32 received at 694625@bugs.debian.org (full text, mbox):

From: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>
To: <sebastien@debian.org>
Cc: <694625@bugs.debian.org>
Subject: Re: Bug#694625: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 16:05:09 +0100
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.



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>:
Bug#694625; Package libblas3gf. (Wed, 28 Nov 2012 15:27:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sébastien Villemot <sebastien@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>. (Wed, 28 Nov 2012 15:27:03 GMT) Full text and rfc822 format available.

Message #37 received at 694625@bugs.debian.org (full text, mbox):

From: Sébastien Villemot <sebastien@debian.org>
To: Christophe TROESTLER <Christophe.Troestler@umons.ac.be>
Cc: <694625@bugs.debian.org>
Subject: Re: Bug#694625: libblas3gf: DGEMV does not handle properly N=0
Date: Wed, 28 Nov 2012 16:23:39 +0100
[Message part 1 (text/plain, inline)]
Christophe TROESTLER <Christophe.Troestler@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
[Message part 2 (application/pgp-signature, inline)]

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 25 01:44:31 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.