31 #include <catch2/catch.hpp> 37 (Eigen::Matrix<double, 2, 3, Eigen::RowMajor>), Eigen::VectorXd, Eigen::RowVectorXd)
39 int rows = TestType::RowsAtCompileTime;
44 int cols = TestType::ColsAtCompileTime;
51 TestType eigen_mat = TestType::Random(rows, cols);
54 MatNd* rcs_mat = NULL;
55 MatNd_fromStack(rcs_mat, rows, cols)
57 SECTION(
"Eigen to MatNd") {
62 for (
int r = 0; r < rows; r++) {
63 for (
int c = 0; c < cols; c++) {
64 DYNAMIC_SECTION(
"Entry [" << r <<
", " << c <<
"]") {
65 CHECK(eigen_mat(r, c) == MatNd_get2(rcs_mat, r, c));
71 SECTION(
"MatNd to Eigen") {
72 TestType new_eigen_mat;
78 for (
int r = 0; r < rows; r++) {
79 for (
int c = 0; c < cols; c++) {
80 DYNAMIC_SECTION(
"Entry [" << r <<
", " << c <<
"]") {
81 CHECK(MatNd_get2(rcs_mat, r, c) == new_eigen_mat(r, c));
88 TEMPLATE_TEST_CASE(
"Wrapping Eigen as MatNd",
"[matrix]", Eigen::VectorXd, Eigen::Vector4d, Eigen::RowVectorXd,
89 (Eigen::Matrix<double, 2, 3, Eigen::RowMajor>))
91 int rows = TestType::RowsAtCompileTime;
96 int cols = TestType::ColsAtCompileTime;
103 TestType eigen_mat = TestType::Random(rows, cols);
109 for (
int r = 0; r < rows; r++) {
110 for (
int c = 0; c < cols; c++) {
111 DYNAMIC_SECTION(
"Entry [" << r <<
", " << c <<
"]") {
112 CHECK(eigen_mat(r, c) == MatNd_get2((&rcs_mat), r, c));
void copyMatNd2Eigen(M &dst, const MatNd *src)
void copyEigen2MatNd(MatNd *dst, const M &src)
TEMPLATE_TEST_CASE("Eigen/MatNd conversion", "[matrix]", Eigen::MatrixXd, Eigen::Matrix4d,(Eigen::Matrix< double, 2, 3, Eigen::RowMajor >), Eigen::VectorXd, Eigen::RowVectorXd)
MatNd viewEigen2MatNd(M &src)