octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #29942] concatenating with an empty scalar giv


From: Jaroslav Hajek
Subject: [Octave-bug-tracker] [bug #29942] concatenating with an empty scalar gives an error
Date: Fri, 18 Jun 2010 12:52:53 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100317 SUSE/3.5.9-0.1.1 Firefox/3.5.9

Follow-up Comment #24, bug #29942 (project octave):

Ugh. That was hard, but this patch brings [] pretty close:
http://hg.savannah.gnu.org/hgweb/octave/rev/53253f796351

octave:1> load t.mat
octave:2> t1{1} = test_cat (@(x,y) [x,y]);
octave:3> t1{2} = test_cat (@(x,y) [x;y]);
octave:4> t1{3} = test_cat (@(x,y) [x;y;x]);
octave:5> t1{4} = test_cat (@(x,y) [x,y,x]);
octave:6> t1{5} = test_cat (@(x,y) horzcat (x, y));
octave:7> t1{6} = test_cat (@(x,y) vertcat (x, y));
octave:8> t1{7} = test_cat (@(x,y) cat (1, x, y));
octave:9> t1{8} = test_cat (@(x,y) cat (2, x, y));
octave:10> t1{9} = test_cat (@(x,y) cat (3, x, y));
octave:11> 
octave:11> t1 = cat (3, t1{:}); 
octave:12> m = cellfun (@isequal, t, t1);
octave:13> squeeze(all(all(m,1),2))
ans =

   1
   1
   0
   0
   0
   0
   1
   1
   1


Regarding the mismatches of 3, 4, they are:

octave:15> [i,j] = find(!m(:,:,3))
i =  3
j =  2
octave:16> [i,j] = find(!m(:,:,4))
i =  2
j =  3

Hmmm. This corresponds to this case:

octave:17> x = zeros(1,0); y = zeros(0,1);
octave:18> [x;y;x]
ans = [](1x0)
octave:19> [[x;y];x]
ans = [](1x0)

can you verify that these two expressions give a different result in Matlab?

This suggests that strictly incremental accumulation of the dimension vector
is not enough to mimick Matlab. Duh.

I hope everyone agrees that these corner cases are anal enough to be beyond
Octave's scope of Matlab compatibility.

The rest two mismatches (5 and 6) correspond to vertcat/horzcat, which now
simply call cat(). I'll address those in a separate changeset.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29942>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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