octave-maintainers
[Top][All Lists]
Advanced

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

Re: Sparse matrix problem


From: Dmitri A. Sergatskov
Subject: Re: Sparse matrix problem
Date: Thu, 4 Jan 2007 09:42:00 -0700

On 1/3/07, David Bateman <address@hidden> wrote:
address@hidden wrote:

> [1+i 2-i] ./ [0 0-i]
>
> gives under Octave
>
> [NaN + NaNi     1 +   2i]
>

>
> Michael.
>
No as that is a problem with the underlying C++ complex class and not
octave at all.. Try the attached test program, which for me using g++
4.0.1 returns

(1+i) / (0 + 0i) : (nan,nan)
(1+i) / 0 : (nan,nan)
1 / 0 : inf


Try to compile the test program with optimization on. On my computer
(gcc version 4.1.1 20061011 (Red Hat 4.1.1-30))
address@hidden test1]$ g++ -O0 test.cc -o test
test.cc: In function 'int main()':
test.cc:10: warning: division by zero in '1.0e+0 / 0.'
address@hidden test1]$ ./test
(1+i) / (0 + 0i) : (nan,nan)
(1+i) / 0 : (nan,nan)
1 / 0 : inf
address@hidden test1]$ g++ -O2 test.cc -o test
test.cc: In function 'int main()':
test.cc:10: warning: division by zero in '1.0e+0 / 0.'
address@hidden test1]$ ./test
(1+i) / (0 + 0i) : (inf,inf)
(1+i) / 0 : (inf,inf)
1 / 0 : inf
(The same result with -O1)
In octave I get:

octave:1> [1+i 2-i] ./ 0
warning: division by zero
ans =

  Inf + Infi   Inf - Infi

octave:2> [1+i 2-i] ./ [0, i]
ans =

  NaN - NaNi    -1 -   2i

Since Octave is compiled with -O2 this test program does not seems to
be a representative example ...

Sincerely,

Dmitri.
--


reply via email to

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