Skip to content
Snippets Groups Projects
Verified Commit a28bcaae authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: update test to account for alignment issues

parent a85b2f66
No related branches found
No related tags found
No related merge requests found
Pipeline #24315 passed with warnings
......@@ -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
......
......@@ -53,8 +53,8 @@ def checkZero(l):
print("Check setZero() works:")
print("l1:")
std_vector.setZero(l1)
print("l1:")
print(l1)
checkZero(l1)
print("-----------------")
......
......@@ -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();
}
......
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