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

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

[Octave-bug-tracker] [bug #42152] Overloaded vercat() not called in some


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #42152] Overloaded vercat() not called in some other cases
Date: Mon, 22 May 2017 18:31:48 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #2, bug #42152 (project octave):

I've started digging into this bug. Some notes so far:

* The syntax "[x; [1 2]]" is understood by the parser as three separate
concatenation operations. First, a 1×2 concatenation of the second row,
consisting entirely of 1×1 doubles, which results in a double row vector.
Second, a "vertcat" concatenation of the class value "x" with the double array
[1 2]. And third, the nested "vertcat" concatenation of double arrays that
happens inside the overloaded "vertcat" method of the A class.

* The syntax "[x; 1 2]" is understood by the parser as a single concatenation
operation which fails, as we know. The difference is the concatenation is
being done on the rows of the matrix as an overall class type, rather than
being done separately on the second row as a double type. Since the result
type is expected to be a class, the function do_class_concat is called on each
row. When do_class_concat gets a row that is entirely scalar doubles, it
doesn't know what to do with them and the error is thrown (at
libinterp/corefcn/data.cc line 1742). The conversion code assumes that because
there is no @double/vertcat method explicitly defined, it must try to convert
these objects to structs and concatenate them.

So this seems like a circular limitation, in that we do have a way to call
vertcat on a list of doubles, but it is not recognized as a class method, so
the class concatenation code can't operate on doubles.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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