11/*
2- * Copyright 2014, Nicolas Mansard, LAAS-CNRS
2+ * Copyright 2014-2018 , Nicolas Mansard and Justin Carpentier , LAAS-CNRS
33 *
44 * This file is part of eigenpy.
55 * eigenpy is free software: you can redistribute it and/or
@@ -140,6 +140,8 @@ namespace eigenpy
140140 // Determine if obj_ptr can be converted in a Eigenvec
141141 static void * convertible (PyArrayObject* obj_ptr)
142142 {
143+ std::cout << " call convertible" << std::endl;
144+
143145 if (!PyArray_Check (obj_ptr))
144146 {
145147#ifndef NDEBUG
@@ -148,8 +150,15 @@ namespace eigenpy
148150 return 0 ;
149151 }
150152
153+ std::cout << " PyArray_DIMS(obj_ptr)[0]: " << PyArray_DIMS (obj_ptr)[0 ] << std::endl;
154+ std::cout << " PyArray_DIMS(obj_ptr)[1]: " << PyArray_DIMS (obj_ptr)[1 ] << std::endl;
155+
151156 if (MatType::IsVectorAtCompileTime)
152157 {
158+ // Special care of scalar matrix of dimension 1x1.
159+ if (PyArray_DIMS (obj_ptr)[0 ] == 1 && PyArray_DIMS (obj_ptr)[1 ] == 1 )
160+ return obj_ptr;
161+
153162 if (PyArray_DIMS (obj_ptr)[0 ] > 1 && PyArray_DIMS (obj_ptr)[1 ] > 1 )
154163 {
155164#ifndef NDEBUG
@@ -162,6 +171,7 @@ namespace eigenpy
162171 || ((PyArray_DIMS (obj_ptr)[1 ] == 1 ) && (MatType::RowsAtCompileTime == 1 )))
163172 {
164173#ifndef NDEBUG
174+ std::cout << " MatType::ColsAtCompileTime: " << MatType::ColsAtCompileTime << std::endl;
165175 if (MatType::ColsAtCompileTime == 1 )
166176 std::cerr << " The object is not a column vector" << std::endl;
167177 else
0 commit comments