any(x,2) on sparse gives bad result
John W. Eaton
jwe at bevo.che.wisc.edu
Mon Jan 7 10:53:28 CST 2008
On 7-Jan-2008, David Bateman wrote:
| The issue is that as the sparse matrix is stored in a compressed column
| format and so the inner loop of the sparse indexing is over the rows and
| not the columns, the test macro in the any/all functions for dim = 2 can
| not break, as it could in the case of dim = 1 or full matrices.
| Therefore the attached patch is needed, and this fixes the issue for me.
| That is
|
| load x.gz
| all (any(full(x),2) == full(any(x,2)))
|
| ans = 1
|
| Kim, keep those bug reports coming, as your finding a lot of issues with
| the sparse code :-)
| 2008-01-07 David Bateman <dbateman at free.fr>
|
| * Sparse-op-defs.h (SPARSE_ANY_ALL_OP_ROW_CODE): Can't break from
| loop if this test successes as we are looping over the rows and
| not the columns in the inner loop.
Thanks, I applied this patch and checked in the changes.
I also shortened the ChangeLog entry to just say what was changed and
moved the comment about why to the code itself.
jwe
More information about the Bug-octave
mailing list