[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58745] Conversion between matrices and Java a
From: |
Benjamin Moody |
Subject: |
[Octave-bug-tracker] [bug #58745] Conversion between matrices and Java arrays |
Date: |
Mon, 20 Jul 2020 17:28:01 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0 |
Follow-up Comment #1, bug #58745 (project octave):
Here is a patch for handling two-dimensional return values.
Like the existing code in box_more, this works by copying the entire matrix
into an NDArray and then transposing it - I don't know if this is better or
worse, for large matrices, than copying one element at a time.
Of course, it'd be better to handle arbitrary N-dimensional arrays. But
handling 2D arrays is still a significant improvement. :)
In contrast to what I wrote before, I think it would be better *not* to
introduce a new value for java_matrix_autoconversion. For return values,
there's no conflict in auto-converting both Matrix objects and
multidimensional arrays. Arguments are more complicated, and I think it would
be better to convert argument values at the ClassHelper level, and avoid
picking a particular data format before deciding which method to call. (This
is closely related to bug #53524.)
The overall conversion logic is already somewhat complicated and fragile, so
I'd like to add some test cases. What would be the best way to write a test
case that includes both Octave and Java code (so the test should only be run
if Java is supported, and the Java code must be compiled first)?
(file #49526)
_______________________________________________________
Additional Item Attachment:
File name: box_primitive_2d_array.patch Size:3 KB
<https://file.savannah.gnu.org/file/box_primitive_2d_array.patch?file_id=49526>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58745>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/