octave-maintainers
[Top][All Lists]
Advanced

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

Re: Different numerical results between sparse and full matrices


From: fotios
Subject: Re: Different numerical results between sparse and full matrices
Date: Fri, 17 Feb 2012 14:58:05 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111229 Thunderbird/9.0

On 02/17/2012 02:41 PM, Michael Goffioul wrote:
Hi,

While investigating some the remaining test errors I have when
building octave with MSVC, I found a behavior difference between
sparse and full matrices, which boils down to the following example
(see result of "sparse(x)./sparse(0)"):

========

octave.exe:26>  x = 1+1i
x =  1 + 1i

octave.exe:27>  x/0
warning: division by zero
ans = Inf + Infi

octave.exe:28>  sparse(x)./sparse(0)
ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

   (1, 1) ->  NaN + NaNi<<<<<<<<  THIS IS WHERE THE PROBLEM IS

octave.exe:29>  sparse(x)./0
warning: division by zero
ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

   (1, 1) ->  Inf + Infi

octave.exe:31>  sparse(real(x))./sparse(0)
ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

   (1, 1) ->  Inf

========

In other words, complex division by 0 in sparse matrices gives NaN
instead of Inf. Does anybody know where I should look at to find where
this could come from?

Michael.


octave:9> ver
----------------------------------------------------------------------
GNU Octave Version 3.6.0
GNU Octave License: GNU General Public License
Operating System: Linux 3.0.0-16-generic-pae #28-Ubuntu SMP Fri Jan 27 19:24:01 UTC 2012 i686
----------------------------------------------------------------------
no packages installed.
octave:10> x = 1 + 1i
x =  1 + 1i
octave:11> sparse(x)./sparse(0)
ans = Compressed Column Sparse (rows = 1, cols = 1, nnz = 1 [100%])

  (1, 1) -> Inf + Infi

/Fotis


reply via email to

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