octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: negative zeros with ATLAS 3.8.4.x


From: Marco Caliari
Subject: Re: OT: negative zeros with ATLAS 3.8.4.x
Date: Tue, 12 Apr 2011 15:19:25 +0200 (CEST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Tue, 12 Apr 2011, John W. Eaton wrote:

On 12-Apr-2011, Marco Caliari wrote:

| I discovered that the problem is given by the fix described here:
|
| http://math-atlas.sourceforge.net/errata.html#scal0
|
| In few words, if you call the BLAS *scal functions with the scalar set
| to zero, ATLAS set the vector to zeros, whereas standard BLAS multiply the
| vector by zero (and -0*0=-0, NaN*0=NaN, etc.). If I initialize retval with
|
| for (int j = 0; j < a_nr; j++)
|    for (int i = 0; i < b_nc; i++)
|      retval.xelem (j,i) = 0.;
|
| in dMatrix.cc before the call to dgemm (around line 3180), everything is
| fine with ATLAS 3.8.4.x.

So the negative zeros were happening because some random negative
values were in the uninitialized retval array which was then
multiplied by 0, resulting in negative zeros?  And now we need to
initialize the result array so that it can be multiplied by zero so
that the expression

 C = alpha*op(A) * op(B) + beta*C,

that DGEMM is really calculating will correctly propagate or generate
NaN values if beta is zero?  OK, I agree that is the right thing to
do if the above expression is what you really want to compute, but we
just want

 C = A * B

so it would be nice if there were also way to use the BLAS to compute
this simpler expression without having to do the unnecessary (for our
purposes) initialization and multiplications.

In reference BLAS dgemm I see that if beta is zero, than C is set to zero (which is exactly what we want). So, the problem should be in ATLAS.

Marco

P.S. Why in my example was used the "general GEMM operation" and not the "column vector by row vector -> matrix operations" in dMatrix.cc?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]