[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.
--
- Re: Sparse matrix problem, David Bateman, 2007/01/03
- Re: Sparse matrix problem, Michael Goffioul, 2007/01/03
- Re: Re: Sparse matrix problem, Dmitri A. Sergatskov, 2007/01/04
- Re: Sparse matrix problem, David Bateman, 2007/01/04
- Re: Re: Sparse matrix problem, John W. Eaton, 2007/01/04
- Re: Re: Sparse matrix problem, Dmitri A. Sergatskov, 2007/01/04