diff octave_to_python.cc @ 352:eac35d84ef0d

Convert Octave numeric vectors into Python array.array * oct-py-types.cc, oct-py-types.h (pytave::make_py_array): New functions to convert an Octave numeric array into Python array object of appropriate type. * octave_to_python.cc (pytave::octvalue_to_pyobj): Add numeric vector case. * pycall.cc: Delete %!tests that relied on conversion to numpy array.
author Mike Miller <mtmiller@octave.org>
date Wed, 17 Aug 2016 21:19:58 -0700
parents e89a8a37fd8a
children b0677c492655
line wrap: on
line diff
--- a/octave_to_python.cc	Wed Aug 17 14:02:33 2016 -0700
+++ b/octave_to_python.cc	Wed Aug 17 21:19:58 2016 -0700
@@ -178,6 +178,12 @@
         PyObject *obj = make_py_tuple (octvalue.cell_value ());
         py_object = object (handle<PyObject> (obj));
       }
+    else if (octvalue.is_numeric_type () && octvalue.ndims () == 2
+             && (octvalue.columns () == 1 || octvalue.rows () == 1))
+      {
+        PyObject *obj = make_py_array (octvalue);
+        py_object = object (handle<PyObject> (obj));
+      }
     else if (octvalue.is_numeric_type () || octvalue.is_string ()
              || octvalue.is_bool_type ())
       octvalue_to_pyarr (py_object, octvalue);