octave-maintainers
[Top][All Lists]
Advanced

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

Different numerical results between sparse and full matrices


From: Michael Goffioul
Subject: Different numerical results between sparse and full matrices
Date: Fri, 17 Feb 2012 12:41:15 +0000

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.


reply via email to

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