diff --git a/unittest/python/test_geometry.py b/unittest/python/test_geometry.py index c2bd1b1addced6caa76040b320a672d30ba74dfc..cbcdc8ec5d50881d48cc3e207e595f52104753b2 100644 --- a/unittest/python/test_geometry.py +++ b/unittest/python/test_geometry.py @@ -32,7 +32,8 @@ assert isapprox(np.linalg.norm(q.coeffs()), 1) # Coefficient-vector initialisation verbose and print("[Quaternion] Coefficient-vector initialisation") v = np.array([0.5, -0.5, 0.5, 0.5]) -qv = Quaternion(v) +for k in range(10000): + qv = Quaternion(v) assert isapprox(qv.coeffs(), v) # Angle axis initialisation diff --git a/unittest/python/test_std_vector.py b/unittest/python/test_std_vector.py index 52fd4c0d3cb623d178831f60f12e0551c1147959..8cd6ab76887e52ce95128c61edb4e00651379ddf 100644 --- a/unittest/python/test_std_vector.py +++ b/unittest/python/test_std_vector.py @@ -53,8 +53,8 @@ def checkZero(l): print("Check setZero() works:") -print("l1:") std_vector.setZero(l1) +print("l1:") print(l1) checkZero(l1) print("-----------------") diff --git a/unittest/std_vector.cpp b/unittest/std_vector.cpp index a3679917a61916f761d0202755f935192cd2a442..12bb9e2cecf88b0a8b451d6685c03bc3f2e7a692 100644 --- a/unittest/std_vector.cpp +++ b/unittest/std_vector.cpp @@ -7,22 +7,26 @@ #include "eigenpy/eigen-from-python.hpp" #include "eigenpy/std-vector.hpp" -template <typename MatType> -void printVectorOfMatrix(const std::vector<MatType> &Ms) { +template <typename MatType, + typename Allocator = Eigen::aligned_allocator<MatType> > +void printVectorOfMatrix(const std::vector<MatType, Allocator> &Ms) { const std::size_t n = Ms.size(); for (std::size_t i = 0; i < n; i++) { std::cout << "el[" << i << "] =\n" << Ms[i] << '\n'; } } -template <typename MatType> -std::vector<MatType> copy(const std::vector<MatType> &Ms) { - std::vector<MatType> out = Ms; +template <typename MatType, + typename Allocator = Eigen::aligned_allocator<MatType> > +std::vector<MatType, Allocator> copy( + const std::vector<MatType, Allocator> &Ms) { + std::vector<MatType, Allocator> out = Ms; return out; } -template <typename MatType> -void setZero(std::vector<MatType> &Ms) { +template <typename MatType, + typename Allocator = Eigen::aligned_allocator<MatType> > +void setZero(std::vector<MatType, Allocator> &Ms) { for (std::size_t i = 0; i < Ms.size(); i++) { Ms[i].setZero(); }