symbolic icon indicating copy to clipboard operation
symbolic copied to clipboard

Array construction fails with row of doubles

Open cbm755 opened this issue 12 years ago • 9 comments

A = [sym(0) 1; sym(2) 3];
B = [sym(0) 1; 2 3];

A works but B fails on Octave 3.6.4 and 3.8.1 with:

error: octave_base_value::map_value(): wrong type argument 'scalar'
error: octave_base_value::parent_class_name_list(): wrong type argument 'scalar'

It works in Matlab, maybe an Octave bug?

cbm755 avatar Apr 11 '14 03:04 cbm755

Looks like:

https://savannah.gnu.org/bugs/?38128

which is supposed to be solved by still see this on Octave dev. Will investigate further.

[updated comment, wrong link before]

cbm755 avatar Apr 20 '14 15:04 cbm755

https://savannah.gnu.org/bugs/index.php?42152

filled upstream. can't fix it here.

cbm755 avatar Apr 20 '14 16:04 cbm755

Workaround, extract brackets around the row vec:

B = [sym(0) 1; [2 3]];

cbm755 avatar Apr 21 '14 15:04 cbm755

maybe I should leave this open so people see it? E.g., this upstream

cbm755 avatar Jul 04 '15 09:07 cbm755

Same error here with v. 4.2.1 w64 for windows: syms d T=[1 d 0 0 0 1 0 0 0 0 1 d 0 0 0 1]

fails with: error: octave_base_value::map_value(): wrong type argument 'scalar'

johnnyontheweb avatar Apr 16 '17 19:04 johnnyontheweb

Thanks for confirming, but note there is nothing we can do here until this is fixed in upstream Octave---see https://github.com/cbm755/octsympy/issues/8#issuecomment-40898024, see also workaround noted above.

cbm755 avatar Apr 16 '17 20:04 cbm755

sorry, I read that page but I think it was a too old bug to not be solved yet. Thanks for the info.

johnnyontheweb avatar Apr 16 '17 21:04 johnnyontheweb

no problem! Any chance you want to take a deep dive into Octave's parsing, see if you can fix it? I'm sure someone like @mtmiller (who knows the internals better than me) would review such a fix.

cbm755 avatar Apr 16 '17 22:04 cbm755

just came across this. guess it's still an issue with Octave 5.2,0 symbolic 2.9.0

`>> syms a b c d

mattest = [a b ; c d] mattest = (sym 2x2 matrix)

[a b] [ ] [c d]

mattest = [a 1 ; c d] mattest = (sym 2x2 matrix)

[a 1] [ ] [c d]

mattest = [1 1 ; c d] error: octave_base_value::map_value(): wrong type argument 'scalar'

mattest = [[1 1] ; c d] mattest = (sym 2x2 matrix)

[1 1] [ ] [c d]

`

NRJank avatar Nov 12 '20 15:11 NRJank