[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Seg fault with test_sparse.m
From: |
Joe Koski |
Subject: |
Re: Seg fault with test_sparse.m |
Date: |
Fri, 18 Aug 2006 21:50:49 -0600 |
User-agent: |
Microsoft-Entourage/11.2.5.060620 |
on 8/18/06 1:00 PM, John W. Eaton at address@hidden wrote:
> On 18-Aug-2006, David Bateman wrote:
>
> | I don't think any element should be NaN, I wonder what
> |
> | sm(find(am == NaN))
> | fm(find(am == NaN))
>
> I think you mean "isnan (am)" instead of "am == NaN" as the latter
> will always return false, even for NaN == NaN.
>
> jwe
David, John,
I applied David's second patch applied to the original 2.9.7 version of
sparse-xpow.cc, and after a "make" and "make install" which appeared to
update the correct files, I got the same number of errors (20) in
test_sparse with "make check".
I put together a simple test script:
more off
sm = sprandn(8,8,0.2)
fm = rand(8,8);
am = sm .^ fm;
am2 = am(find(am != 0))
sm(find(isnan(am)))
fm(find(isnan(am)))
Based on my understanding of your e-mails. Here is the result:
octave:1> simple_test
sm =
Compressed Column Sparse (rows = 8, cols = 8, nnz = 10)
(7, 3) -> -0.20528
(1, 4) -> 0.52878
(6, 4) -> -1.6364
(8, 4) -> 0.71973
(2, 6) -> -0.86258
(2, 7) -> 0.31408
(1, 8) -> 2.9854
(2, 8) -> -0.41373
(5, 8) -> 1.0497
(7, 8) -> -0.24487
am2 =
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
NaN
1.00000
0.72530
1.00000
1.00000
1.00000
1.00000
NaN
1.00000
0.84385
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
NaN
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
0.78928
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
2.24594
NaN
1.00000
1.00000
1.04579
1.00000
NaN
1.00000
ans =
-0.20528
-1.63636
-0.86258
-0.41373
-0.24487
ans =
0.432480
0.738106
0.432212
0.715780
0.023236
octave:2>
They are all negative numbers in sm, raised to a fractional power. I would
have trouble doing that with my slide rule, but maybe octave knows about the
use of complex numbers or something. If it doesn't, it should trap an error
there. It's been a while since I have worried about such things.
For comparison, I changed sm = sprandn(8,8,0.2) to sm = sprand(8,8,0.2), and
reran. Now there are no errors:
octave:2> simple_test
sm =
Compressed Column Sparse (rows = 8, cols = 8, nnz = 12)
(1, 2) -> 0.22919
(4, 2) -> 0.53610
(5, 3) -> 0.83304
(6, 3) -> 0.30199
(3, 4) -> 0.49321
(5, 4) -> 0.63936
(6, 4) -> 0.68086
(4, 5) -> 0.90476
(2, 6) -> 0.025662
(3, 7) -> 0.60419
(2, 8) -> 0.10574
(3, 8) -> 0.61785
am2 =
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
0.31655
1.00000
1.00000
0.95488
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
0.90509
0.39894
1.00000
1.00000
1.00000
1.00000
0.53409
1.00000
0.67176
0.73835
1.00000
1.00000
1.00000
1.00000
1.00000
0.91455
1.00000
1.00000
1.00000
1.00000
1.00000
0.11973
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
0.86136
1.00000
1.00000
1.00000
1.00000
1.00000
1.00000
0.15426
0.96515
1.00000
1.00000
1.00000
1.00000
1.00000
ans = Compressed Column Sparse (rows = 0, cols = 1, nnz = 0)
ans = [](0x1)
octave:3>
Hope this helps.
Joe
- Seg fault with test_sparse.m, Joe Koski, 2006/08/03
- Re: Seg fault with test_sparse.m, John W. Eaton, 2006/08/21
- RE: Seg fault with test_sparse.m, Joe Koski, 2006/08/21
- Re: Seg fault with test_sparse.m, John W. Eaton, 2006/08/21
- FW: Seg fault with test_sparse.m, Joe Koski, 2006/08/21
- Re: Seg fault with test_sparse.m, David Bateman, 2006/08/22