[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new test failures
From: |
David Bateman |
Subject: |
Re: new test failures |
Date: |
Tue, 27 Nov 2007 01:54:03 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
In fact there aren't 700 odd tests to fix. The previous patch uncovered
a bug in the any and all functions that allowed a sparse matrix with
zeros in it to be returned. This caused issues elsewhere as Octave is
not expected to do this. There were then only a few tests to fix. I
believe the attached patch addresses all of the new failures
D.
Index: liboctave/Sparse-op-defs.h
===================================================================
RCS file: /usr/local/cvsroot/octave/liboctave/Sparse-op-defs.h,v
retrieving revision 1.20
diff -c -r1.20 Sparse-op-defs.h
*** liboctave/Sparse-op-defs.h 12 Oct 2007 21:27:15 -0000 1.20
--- liboctave/Sparse-op-defs.h 27 Nov 2007 00:49:25 -0000
***************
*** 1634,1668 ****
} \
else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \
{ \
! retval = RET_TYPE (static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (1)); \
! retval.cidx(0) = 0; \
! retval.cidx(1) = 1; \
! retval.ridx(0) = 0; \
! retval.data(0) = MT_RESULT; \
} \
else if (nr == 0 && (dim == 0 || dim == -1)) \
{ \
! retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nc); \
! retval.cidx (0) = 0; \
! for (octave_idx_type i = 0; i < nc ; i++) \
{ \
! retval.ridx (i) = 0; \
! retval.cidx (i+1) = i; \
! retval.data (i) = MT_RESULT; \
! } \
} \
else if (nc == 0 && dim == 1) \
{ \
! retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nr); \
! retval.cidx(0) = 0; \
! retval.cidx(1) = nr; \
! for (octave_idx_type i = 0; i < nr; i++) \
! { \
! retval.ridx(i) = i; \
! retval.data(i) = MT_RESULT; \
! } \
} \
else \
retval.resize (nr > 0, nc > 0); \
--- 1634,1687 ----
} \
else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \
{ \
! if (MT_RESULT) \
! { \
! retval = RET_TYPE (static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (1)); \
! retval.cidx(0) = 0; \
! retval.cidx(1) = 1; \
! retval.ridx(0) = 0; \
! retval.data(0) = MT_RESULT; \
! } \
! else \
! retval = RET_TYPE (static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (0)); \
} \
else if (nr == 0 && (dim == 0 || dim == -1)) \
{ \
! if (MT_RESULT) \
{ \
! retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nc); \
! retval.cidx (0) = 0; \
! for (octave_idx_type i = 0; i < nc ; i++) \
! { \
! retval.ridx (i) = 0; \
! retval.cidx (i+1) = i; \
! retval.data (i) = MT_RESULT; \
! } \
! } \
! else \
! retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, \
! static_cast<octave_idx_type> (0)); \
} \
else if (nc == 0 && dim == 1) \
{ \
! if (MT_RESULT) \
! { \
! retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nr); \
! retval.cidx(0) = 0; \
! retval.cidx(1) = nr; \
! for (octave_idx_type i = 0; i < nr; i++) \
! { \
! retval.ridx(i) = i; \
! retval.data(i) = MT_RESULT; \
! } \
! } \
! else \
! retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), \
! static_cast<octave_idx_type> (0)); \
} \
else \
retval.resize (nr > 0, nc > 0); \
Index: scripts/sparse/spstats.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/sparse/spstats.m,v
retrieving revision 1.10
diff -c -r1.10 spstats.m
*** scripts/sparse/spstats.m 9 Nov 2007 19:34:18 -0000 1.10
--- scripts/sparse/spstats.m 27 Nov 2007 00:49:26 -0000
***************
*** 59,64 ****
%!test
%! [n,m,v] = spstats([1 2 1 2 3 4],[2 2 1 1 1 1]);
! %! assert(n,[4,2]);
! %! assert(m,[10/4,3/2],10*eps);
! %! assert(v,[5/3,1/2],10*eps);
--- 59,64 ----
%!test
%! [n,m,v] = spstats([1 2 1 2 3 4],[2 2 1 1 1 1]);
! %! assert(n,sparse([4,2],1));
! %! assert(m,sparse([10/4,3/2],1),10*eps);
! %! assert(v,sparse([5/3,1/2],1),10*eps);
Index: scripts/statistics/base/mode.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/statistics/base/mode.m,v
retrieving revision 1.4
diff -c -r1.4 mode.m
*** scripts/statistics/base/mode.m 12 Oct 2007 21:27:26 -0000 1.4
--- scripts/statistics/base/mode.m 27 Nov 2007 00:49:26 -0000
***************
*** 105,110 ****
%! a = sprandn (32, 32, 0.05);
%! [m, f, c] = mode (a);
%! [m2, f2, c2] = mode (full (a));
! %! assert (m, m2);
! %! assert (f, f2);
! %! assert (c, c2);
--- 105,110 ----
%! a = sprandn (32, 32, 0.05);
%! [m, f, c] = mode (a);
%! [m2, f2, c2] = mode (full (a));
! %! assert (m, sparse (m2, 1));
! %! assert (f, sparse (f2, 1));
! %! assert (c, cellfun (@(x) sparse (1, 1), c2, 'UniformOutput', false));
Index: test/build_sparse_tests.sh
===================================================================
RCS file: /usr/local/cvsroot/octave/test/build_sparse_tests.sh,v
retrieving revision 1.10
diff -c -r1.10 build_sparse_tests.sh
*** test/build_sparse_tests.sh 30 Oct 2007 19:52:50 -0000 1.10
--- test/build_sparse_tests.sh 27 Nov 2007 00:49:27 -0000
***************
*** 215,221 ****
%!test
%! wdbz = warning ("query", "Octave:divide-by-zero");
%! warning ("off", "Octave:divide-by-zero");
! %! assert(sparse(eye(3))/0,sparse(eye(3)/0,1));
%! warning (wdbz.state, "Octave:divide-by-zero");
EOF
--- 215,221 ----
%!test
%! wdbz = warning ("query", "Octave:divide-by-zero");
%! warning ("off", "Octave:divide-by-zero");
! %! assert(full(sparse(eye(3))/0),eye(3)/0);
%! warning (wdbz.state, "Octave:divide-by-zero");
EOF
***************
*** 547,560 ****
%!assert(spcumprod(as,2),sparse(cumprod(af,2),true))
%!assert(spmin(as),sparse(min(af),true))
! %!assert(spmin(as(:)),min(af(:)))
%!assert(spmin(as,[],1),sparse(min(af,[],1),true))
%!assert(spmin(as,[],2),sparse(min(af,[],2),true))
%!assert(spmin(as,[],1),sparse(min(af,[],1),true))
%!assert(spmin(as,0),sparse(min(af,0),true))
%!assert(spmin(as,bs),sparse(min(af,bf),true))
%!assert(spmax(as),sparse(max(af),true))
! %!assert(spmax(as(:)),max(af(:)))
%!assert(spmax(as,[],1),sparse(max(af,[],1),true))
%!assert(spmax(as,[],2),sparse(max(af,[],2),true))
%!assert(spmax(as,[],1),sparse(max(af,[],1),true))
--- 547,560 ----
%!assert(spcumprod(as,2),sparse(cumprod(af,2),true))
%!assert(spmin(as),sparse(min(af),true))
! %!assert(full(spmin(as(:))),min(af(:)))
%!assert(spmin(as,[],1),sparse(min(af,[],1),true))
%!assert(spmin(as,[],2),sparse(min(af,[],2),true))
%!assert(spmin(as,[],1),sparse(min(af,[],1),true))
%!assert(spmin(as,0),sparse(min(af,0),true))
%!assert(spmin(as,bs),sparse(min(af,bf),true))
%!assert(spmax(as),sparse(max(af),true))
! %!assert(full(spmax(as(:))),max(af(:)))
%!assert(spmax(as,[],1),sparse(max(af,[],1),true))
%!assert(spmax(as,[],2),sparse(max(af,[],2),true))
%!assert(spmax(as,[],1),sparse(max(af,[],1),true))
***************
*** 832,841 ****
%! assert(ts,sparse(tf,true));
%% Test 'end' keyword
! %!assert(as(end),af(end))
! %!assert(as(1,end), af(1,end))
! %!assert(as(end,1), af(end,1))
! %!assert(as(end,end), af(end,end))
%!assert(as(2:end,2:end), sparse(af(2:end,2:end),true))
%!assert(as(1:end-1,1:end-1), sparse(af(1:end-1,1:end-1),true))
EOF
--- 832,841 ----
%! assert(ts,sparse(tf,true));
%% Test 'end' keyword
! %!assert(full(as(end)), af(end))
! %!assert(full(as(1,end)), af(1,end))
! %!assert(full(as(end,1)), af(end,1))
! %!assert(full(as(end,end)), af(end,end))
%!assert(as(2:end,2:end), sparse(af(2:end,2:end),true))
%!assert(as(1:end-1,1:end-1), sparse(af(1:end-1,1:end-1),true))
EOF
Index: test/test_range.m
===================================================================
RCS file: /usr/local/cvsroot/octave/test/test_range.m,v
retrieving revision 1.2
diff -c -r1.2 test_range.m
*** test/test_range.m 12 Oct 2007 06:41:26 -0000 1.2
--- test/test_range.m 27 Nov 2007 00:49:27 -0000
***************
*** 35,42 ****
%!assert([ r ; z ], expect)
%!assert([ r ; logical(z) ], expect)
! %!assert([ r ; sparse(z) ], expect)
! %!assert([ r ; sparse(logical(z)) ], expect)
%!assert([ r ; int8(z) ], int8(expect))
%!assert([ r ; int16(z) ], int16(expect))
--- 35,42 ----
%!assert([ r ; z ], expect)
%!assert([ r ; logical(z) ], expect)
! %!assert([ r ; sparse(z) ], sparse (expect, true))
! %!assert([ r ; sparse(logical(z)) ], sparse (expect, true))
%!assert([ r ; int8(z) ], int8(expect))
%!assert([ r ; int16(z) ], int16(expect))
***************
*** 58,65 ****
%!assert([ r ; z ], expect)
%!assert([ r ; logical(z) ], expect)
! %!assert([ r ; sparse(z) ], expect)
! %!assert([ r ; sparse(logical(z)) ], expect)
%!assert([ r ; int8(z) ], int8(expect))
%!assert([ r ; int16(z) ], int16(expect))
--- 58,65 ----
%!assert([ r ; z ], expect)
%!assert([ r ; logical(z) ], expect)
! %!assert([ r ; sparse(z) ], sparse (expect, true))
! %!assert([ r ; sparse(logical(z)) ], sparse (expect, true))
%!assert([ r ; int8(z) ], int8(expect))
%!assert([ r ; int16(z) ], int16(expect))
2007-11-26 David Bateman <address@hidden>
* Sparse-op-defs.h (SPARSE_BASE_REDUCTION_OP): Check that the fill
value is not zero before creating the matrices.
2007-11-26 David Bateman <address@hidden>
* sparse/spstats.m, statistics/base/mode.m: More care with sparse
return values.
2007-11-26 David Bateman <address@hidden>
* build_sparse_tests.sh: More care with sparse return values.