[changeset] bug concatenating vectors in 3.1.51+

Ben Abbott bpabbott at mac.com
Mon Oct 13 19:56:10 CDT 2008


On Oct 12, 2008, at 3:51 PM, Jaroslav Hajek wrote:

> On Sun, Oct 12, 2008 at 8:59 PM, Ben Abbott <bpabbott at mac.com> wrote:
>> I attempted a fresh build last night. My tip is
>>
>> changeset:   8210:a10397d26114
>> tag:         tip
>> user:        John W. Eaton <jwe at octave.org>
>> date:        Fri Oct 10 15:10:58 2008 -0400
>> summary:     graphics.cc (base_graphics_properties::adopt): place new
>> child at front of list, not end; make children a column vector  
>> instead
>> of a row vector
>>
>> The bug is fairly easy to see
>>
>>       [ones(1,0); zeros(5,1)]
>>       error: number of columns must match (1 != 0)
>>
>> In Matlab
>>
>>>> [ones(1,0);zeros(5,1)]
>>
>> ans =
>>
>>     0
>>     0
>>     0
>>     0
>>     0
>>
>> Presently Octave will not build for me.
>>
>> if [ -f gplot.eps ] ; then gs -dBATCH -dEPSCrop -dNOPAUSE -q -
>> sDEVICE=pdfwrite -sOutputFile=gplot.pdf gplot.eps ; fi
>> ../../run-octave -f -q -H -p . --eval "sparseimages ('grid', 'eps');"
>> error: number of rows must match (79 != 1) near line 937, column 23
>> error: called from:
>> error:   /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
>> plot/__go_draw_axes__.m at line 937, column 6
>> error:   /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
>> plot/__go_draw_figure__.m at line 59, column 8
>> error:   /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
>> plot/gnuplot_drawnow.m at line 55, column 7
>> error:   /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
>> plot/print.m at line 447, column 7
>> error:   /Users/bpabbott/Development/mercurial/octave-3.1.51/doc/
>> interpreter/sparseimages.m at line 231, column 5
>> error:   /Users/bpabbott/Development/mercurial/octave-3.1.51/doc/
>> interpreter/sparseimages.m at line 33, column 2
>>
>> make[3]: *** [grid.eps] Error 1
>> make[2]: *** [interpreter] Error 2
>> make[1]: *** [doc] Error 2
>> make: *** [all] Error 2
>>
>> The offending line in __go_draw_axes__.m is
>>
>>       kids = [obj.children, kids];
>>
>> Which with John's change from row to column vector for handles needs
>> to be
>>
>>       kids = [obj.children; kids];
>>
>> However, in this instance an empty vector with size [1, 0] fails.
>>
>> I replaced the line with
>>
>>         if (isempty (kids))
>>           kids = obj.children;
>>         elseif (! isempty (obj.children))
>>           kids = [obj.children; kids];
>>         endif
>>
>> and "make" and "make check" completed without further problems.
>>
>> I could offer a changeset to resolve the problem with
>> __go_draw_axes__, but expect the the proper solution would to fix the
>> concatenation of column vectors.
>>
>> Might someone with c++ skill take care of this, or if there are
>> substantial problem with that, say the word and I'll submit a
>> changeset for __go_draw_axes__.
>>
>> Ben
>>
>
> Ben,
>
> I've just tried in Matlab 2007a:
>
> Matlab gives zeros(5,1), yet along with this warning:
>
> Warning: Concatenation involves an empty array with an incorrect
> number of columns. This may not be allowed in a future release.
>
> Why ones(1,0) does not gripe, I don't know. I guess it's a bug in  
> Matlab.
> Anyway, I think that in light of this fact it doesn't seem reasonable
> to bother with getting Matlab compatible here. And even if we do, I
> think that code relying on such a behaviour is a bad idea.
>
> regards

I'd thought I responded to this already, but I don't see it on Nabble,  
so ....

In Matlab 2008a

 >> [ones(2,0);zeros(5,1)]
Warning: Concatenation involves an empty array with an incorrect  
number of columns.
This may not be allowed in a future release.

ans =

      0
      0
      0
      0
      0

So Jaroslav you are a practical prophet ;-)

I've attached a changeset for __go_draw_axes__.m

Ben

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: changeset-__go_draw_axes__.txt
Url: https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20081013/cc95d89b/attachment-0001.txt 
-------------- next part --------------






More information about the Bug-octave mailing list