sparse indexing issue
David Bateman
adb014 at gmail.com
Tue Dec 18 15:40:16 CST 2007
John W. Eaton wrote:
> On 18-Dec-2007, David Bateman wrote:
>
> | The attached patch fixes all the bugs reported in this thread. These
> | bugs are either only recent (Change from 9th Oct to speed up the sparse
> | indexing) or only became obvious due to recent changes (cf
> | sparse_auto_mutate) for the sparse(42)([1,1]) case. I added test cases
> | for them so that they shouldn't creep back.
>
> Thanks, I applied the patch and checked in the change.
>
> | *** ./test/build_sparse_tests.sh.orig9 2007-12-18 21:34:24.452169877 +0100
> | --- ./test/build_sparse_tests.sh 2007-12-18 21:08:44.963865073 +0100
> | ***************
> | *** 811,816 ****
> | --- 811,823 ----
> | %!assert(as((size(as,1):-1:1),:),sparse(af((size(af,1):-1:1),:)))
> | %!assert(as(:,(size(as,2):-1:1)),sparse(af(:,(size(af,2):-1:1))))
> |
> | + %% Indexing tests
> | + %!assert(full(as([1,1],:)), af([1,1],:))
> | + %!assert(full(as(:,[1,1])), af(:,[1,1]))
> | + %!test
> | + %! [i,j,v] = find (as);
> | + %! assert (as(i(1),j(1))([1,1]), sparse([v(1),v(1)]))
>
> Maybe we should also test the indexing against a value constructed
> without indexing, like
>
> as = sparse (42);
> assert (as([1,1]), sparse([42,42]))
>
> to avoid the possibility that the code for indexing full matrices has
> the same bug?
>
> jwe
Sure if you like.. Do you want a patch? In any case the reason I did it
like the above is that "as" can be real or complex and so the above
implicitly treats both cases with the manner this script works..
D.
More information about the Bug-octave
mailing list