As part of wrapping
ip_diffim with pybind11 on DM-8460 I changed the C++ API to longer use shared pointers to Eigen matrices and vectors, but instead pass such objects directly (e.g. by copy or reference).
Note that there is no visible difference in Python; only the C++ API is affected. Furthermore, this should only affect people editing the
ip_diffim package because no code outside of this package calls C++ from
The reason for this change is that the shared pointers were unnecessary and were causing problems with pybind11. Eigen is designed such that its objects can be passed directly without need of smart pointers. However, what precipitated the change was that pybind11 could not figure out how to return a Python object from a function that returned a shared pointer to an Eigen matrix. After some failed attempts to work around the problem we decided to clean up the C++ code.
At the same time I took the opportunity to make the code const safe. The existing code used
shared_ptr<Eigen::...> in situations where shared_ptr` should have been used. Thus it was easy to modify the internals of various objects in ways that were not intended.