Mercurial > pytave
comparison 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 |
comparison
equal
deleted
inserted
replaced
351:040aff46e4db | 352:eac35d84ef0d |
---|---|
176 else if (octvalue.is_cell ()) | 176 else if (octvalue.is_cell ()) |
177 { | 177 { |
178 PyObject *obj = make_py_tuple (octvalue.cell_value ()); | 178 PyObject *obj = make_py_tuple (octvalue.cell_value ()); |
179 py_object = object (handle<PyObject> (obj)); | 179 py_object = object (handle<PyObject> (obj)); |
180 } | 180 } |
181 else if (octvalue.is_numeric_type () && octvalue.ndims () == 2 | |
182 && (octvalue.columns () == 1 || octvalue.rows () == 1)) | |
183 { | |
184 PyObject *obj = make_py_array (octvalue); | |
185 py_object = object (handle<PyObject> (obj)); | |
186 } | |
181 else if (octvalue.is_numeric_type () || octvalue.is_string () | 187 else if (octvalue.is_numeric_type () || octvalue.is_string () |
182 || octvalue.is_bool_type ()) | 188 || octvalue.is_bool_type ()) |
183 octvalue_to_pyarr (py_object, octvalue); | 189 octvalue_to_pyarr (py_object, octvalue); |
184 else if (octvalue.is_map () && octvalue.numel () == 1) | 190 else if (octvalue.is_map () && octvalue.numel () == 1) |
185 { | 191 { |