octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix null assignment


From: Jaroslav Hajek
Subject: Re: fix null assignment
Date: Thu, 18 Sep 2008 22:05:54 +0200

On Thu, Sep 18, 2008 at 7:10 PM, John W. Eaton <address@hidden> wrote:
> 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
>

Apparently, Matlab never changes lhs if the index set is empty, i.e.
it does not even reshape the matrix to row vector when you do A([]) =
[] for a matrix A. An updated changeset is attached. With this, only 2
tests are failing. These are caused by blkdiag relying on
Matlab-incompatible behaviour. The second changeset addresses this.


-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

Attachment: delete_fix.diff
Description: Text Data

Attachment: blkdiag_fix.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]