From b063e64b19ee89cbdafc3d2a82c3324e57e8e83f Mon Sep 17 00:00:00 2001 From: Ben North Date: Tue, 5 Jul 2016 20:01:11 +0100 Subject: [PATCH] Eigen tests: '2*' functions for col-, row-vectors --- example/eigen.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/example/eigen.cpp b/example/eigen.cpp index b6fa24a42..81c1f0bf4 100644 --- a/example/eigen.cpp +++ b/example/eigen.cpp @@ -10,6 +10,12 @@ #include "example.h" #include +Eigen::VectorXf double_col(const Eigen::VectorXf& x) +{ return 2.0f * x; } + +Eigen::RowVectorXf double_row(const Eigen::RowVectorXf& x) +{ return 2.0f * x; } + void init_eigen(py::module &m) { typedef Eigen::Matrix FixedMatrixR; typedef Eigen::Matrix FixedMatrixC; @@ -23,6 +29,9 @@ void init_eigen(py::module &m) { mat << 0, 3, 0, 0, 0, 11, 22, 0, 0, 0, 17, 11, 7, 5, 0, 1, 0, 11, 0, 0, 0, 0, 0, 11, 0, 0, 14, 0, 8, 11; + m.def("double_col", &double_col); + m.def("double_row", &double_row); + m.def("fixed_r", [mat]() -> FixedMatrixR { return FixedMatrixR(mat); });