gnu-octave / symbolic

A Symbolic Package for Octave using SymPy
https://octave.sourceforge.io/symbolic/
GNU General Public License v3.0
151 stars 36 forks source link

vertcat: does not show error message for incompatible columns #1238

Open cbm755 opened 1 year ago

cbm755 commented 1 year ago

In Array_and_Matrix branch:

%!error
%! z03 = sym (zeros (0, 3));
%! z04 = sym (zeros (0, 4));
%! [z03; z04]

This test passes. It is an error. But the error message is not shown:

octave:43> [z03; z04]
pydebug: vertcat: all inputs must have the same number of columns
error: sym/vertcat method failed
error: called from
    pycall_sympy__ at line 179 column 7
    vertcat at line 67 column 5

The thing shown in pydebug should be the error message---here just hacked to show up:

          'ncols = [number_of_columns(x) for x in args]'
          'if not all_equal(*ncols):'
          '    msg = "vertcat: all inputs must have the same number of columns"'
+        '    dbout(msg)'
          '    raise ShapeError(msg)'
          'CCC = [as_list_of_list(x) for x in args]'
          'CC = flatten(CCC, levels=1)'
cbm755 commented 1 year ago

Hmmm, it does give the error when run as vertcat(z03, z04) but not as [z03; z04]. Sounds like "Someone Else's Problem" (upstream). I'll add this zero case to the existing tests for vertcat error message

alexvong243f commented 1 year ago

Should we file a bug upstream? Does octave behave this way because of compat?

cbm755 commented 1 year ago

I didn't dig any deeper. Do you mean "compatibility with Matlab"? I don't know, have not tried it in Matlab.

You can certainly file upsteam if you'd like.

alexvong243f commented 1 year ago

------- Original Message ------- On Thursday, September 15th, 2022 at 8:19 PM, Colin B. Macdonald @.***> wrote:

I didn't dig any deeper. Do you mean "compatibility with Matlab"? I don't know, have not tried it in Matlab.

Yes, I mean so.

You can certainly file upsteam if you'd like.

Good, I'll ask upstream devs whether this is for compat then.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.