Skip to content
Snippets Groups Projects
Commit af82eeef authored by Olivier Stasse's avatar Olivier Stasse
Browse files

Merge remote-tracking branch 'origin/devel' into jm

parents a70469a5 f136a056
No related branches found
No related tags found
No related merge requests found
...@@ -31,14 +31,14 @@ namespace dynamicgraph { ...@@ -31,14 +31,14 @@ namespace dynamicgraph {
namespace convert { namespace convert {
void fillMatrixRow(Matrix& m, unsigned iRow, PyObject* tuple) void fillMatrixRow(Matrix& m, unsigned iRow, PyObject* sequence)
{ {
if (PyTuple_Size(tuple) != (int)m.cols()) { if (PySequence_Size(sequence) != (int)m.cols()) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"lines of matrix have different sizes."); "lines of matrix have different sizes.");
} }
for (int iCol=0; iCol < m.cols(); iCol++) { for (int iCol=0; iCol < m.cols(); iCol++) {
PyObject* pyDouble = PyTuple_GetItem(tuple, iCol); PyObject* pyDouble = PySequence_GetItem(sequence, iCol);
if (PyFloat_Check(pyDouble)) if (PyFloat_Check(pyDouble))
m(iRow, iCol) = PyFloat_AsDouble(pyDouble); m(iRow, iCol) = PyFloat_AsDouble(pyDouble);
else if(PyInt_Check(pyDouble)) else if(PyInt_Check(pyDouble))
...@@ -49,14 +49,14 @@ namespace dynamicgraph { ...@@ -49,14 +49,14 @@ namespace dynamicgraph {
"a floating point number."); "a floating point number.");
} }
} }
void fillMatrixRow(Eigen::Matrix4d& m, unsigned iRow, PyObject* tuple) void fillMatrixRow(Eigen::Matrix4d& m, unsigned iRow, PyObject* sequence)
{ {
if (PyTuple_Size(tuple) != (int)m.cols()) { if (PySequence_Size(sequence) != (int)m.cols()) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"lines of matrix have different sizes."); "lines of matrix have different sizes.");
} }
for (int iCol=0; iCol < m.cols(); iCol++) { for (int iCol=0; iCol < m.cols(); iCol++) {
PyObject* pyDouble = PyTuple_GetItem(tuple, iCol); PyObject* pyDouble = PySequence_GetItem(sequence, iCol);
if (PyFloat_Check(pyDouble)) if (PyFloat_Check(pyDouble))
m(iRow, iCol) = PyFloat_AsDouble(pyDouble); m(iRow, iCol) = PyFloat_AsDouble(pyDouble);
else if(PyInt_Check(pyDouble)) else if(PyInt_Check(pyDouble))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment