bugGNU Octave - Bugs: bug #51798, concatenate Java objects into Java...

 
 

bug #51798: concatenate Java objects into Java arrays using array bracket syntax

Submitter:  None
Submitted:  Sun 20 Aug 2017 02:13:20 AM UTC
   
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 23 Aug 2017 06:58:21 AM UTC, comment #5: 

If Octave is missing some option or feature, has always been missing it, then it is a new feature for Octave, even if it has been a built in part of Matlab for years.

The original post was about creating an array of Java objects with array bracket syntax, this would be done by adding support for horzcat and vertcat on Java objects.

Mike Miller <mtmiller>
Group Member
Tue 22 Aug 2017 09:08:18 PM UTC, comment #4: 

@philip
Well, I think javaArray is a kind of workaround.
The problem is, that according to
https://www.mathworks.com/help/matlab/matlab_external/how-matlab-represents-java-array.html

matlab treats nested java-arrays as one-dimensional,
whereas octave does not... Bad.
So this workaround does not really work.

In octave:
octave:8> size(javaArray ("java.math.BigDecimal", 3,4))
ans =

   3   4

size(...)

ans =
     3     1

which is according to the documentation.

Ernst Reissner <ernstreissner>
Tue 22 Aug 2017 09:05:24 PM UTC, comment #3: 

@mike I think one cannot just 'interprete' this as a feature request.
The question for me is whether matlab allows
[java_object java_object] or not.
If it does: this is a bug in octave; if not, it is a feature request. ... and if so, i can really drop it,
because i do not want to use octave features breaking matlab compatibility.

The problem is, that i do not have matlab at hand to really decide.

Ernst Reissner <ernstreissner>
Mon 21 Aug 2017 07:53:44 PM UTC, comment #2: 

I think this could be interpreted as a feature request to add support for horzcat and vertcat with Java objects, so that something like


x = javaObject ("java.lang.Double", 0);
y = [x, x];
z = [x; x];


would automatically create Java array objects.

That is briefly touched on in https://www.mathworks.com/help/matlab/matlab_external/concatenate-java-arrays.html, so I assume that Matlab supports bracket array construction, cat, horzcat, and vertcat.

Mike Miller <mtmiller>
Group Member
Mon 21 Aug 2017 07:45:50 PM UTC, comment #1: 

Have you looked at the javaArray function?

Just type:

help javaArray

in the Octave terminal.

Philip Nienhuis <philipnienhuis>
Group Member
Sun 20 Aug 2017 02:13:20 AM UTC, original submission:  


I suppose in matlab arrays of java-objects are allowed.
This is not true for octave
+verbatim+[javaObject("java.math.BigDecimal",3) javaObject("java.math.BigDecimal",3)]
-verbatim-

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ernstreissner (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-23 mtmiller Severity3 - Normal 1 - Wish
        Item GroupNone Matlab Compatibility
        StatusNone Confirmed
        SummaryArray of java objects concatenate Java objects into Java arrays using array bracket syntax

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code