[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix null assignment
From: |
John W. Eaton |
Subject: |
fix null assignment |
Date: |
Thu, 18 Sep 2008 13:10:54 -0400 |
On 18-Sep-2008, Jaroslav Hajek wrote:
| hello,
|
| the attached patch fixes the following problems / Matlab
| incompatibilities with null assignment in Octave.
|
| 2. a = 1:5; a(1:5) = []
| --> a is 0-by-0 in Octave, 1-by-0 in Matlab
| 3. a = 1:5; a = a'; a(1:5) = []
| --> a is 0-by-0 in Octave, 0-by-1 in Matlab
| 4. a = ones (3); a(:,:) = []
| --> a is 0-by-0 in Octave, 0-by-3 in Matlab
| 5. a = ones (3); a(1:3,1:3) = []
| --> a is 0-by-0 in Octave, error in Matlab
| 6. a = ones (3); a(1:2,1:2) = []
| --> a is unaffected in Octave (! BUG), error in Matlab
|
| Further, it adds tests for these cases in test/test_null_assign.m.
I applied this patch, rebuilt Octave and ran make check and found the
following 4 failures:
>>>>> processing /export/home/jwe/src/octave/liboctave/Sparse.cc
***** test test_sparse_slice([2 0], 11, []);
!!!!! test failed
assert (full (s),f) expected
[](1x0)
but got
[](2x0)
Dimensions don't match ***** test test_sparse_slice([0 2], 11, []);
!!!!! test failed
assert (full (s),f) expected
[](1x0)
but got
[](0x2)
Dimensions don't match
>>>>> processing /export/home/jwe/src/octave/scripts/general/blkdiag.m
***** assert(blkdiag([],[],[]),[])
!!!!! test failed
a null assignment can have only one non-colon index *****
assert(blkdiag([],[1,2;3,4],[],5,[]),[1,2,0;3,4,0;0,0,5])
!!!!! test failed
a null assignment can have only one non-colon index
so I'm not checking it in until these are resolved.
Do the tests need to be updated? Does the change break Octave code
which relied on the previous behavior?
jwe
- fix null assignment, Jaroslav Hajek, 2008/09/18
- fix null assignment,
John W. Eaton <=
- Re: fix null assignment, Jaroslav Hajek, 2008/09/18
- Re: fix null assignment, Jaroslav Hajek, 2008/09/18
- Re: fix null assignment, John W. Eaton, 2008/09/18
- Re: fix null assignment, Jaroslav Hajek, 2008/09/19
- Re: fix null assignment, John W. Eaton, 2008/09/19
- Re: fix null assignment, Jaroslav Hajek, 2008/09/19
- Re: fix null assignment, Jaroslav Hajek, 2008/09/19
- Re: fix null assignment, John W. Eaton, 2008/09/20
- Re: fix null assignment, John W. Eaton, 2008/09/20
- Re: fix null assignment, Jaroslav Hajek, 2008/09/22