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

test: test registration of a new type

parent cec1bd83
No related branches found
No related tags found
No related merge requests found
...@@ -81,12 +81,22 @@ MatrixDerived base(const Eigen::MatrixBase<MatrixDerived> & m) ...@@ -81,12 +81,22 @@ MatrixDerived base(const Eigen::MatrixBase<MatrixDerived> & m)
return m.derived(); return m.derived();
} }
template<typename Scalar>
Eigen::Matrix<Scalar,6,6> matrix6(const Scalar & value)
{
typedef Eigen::Matrix<Scalar,6,6> ReturnType;
return ReturnType::Constant(value);
}
BOOST_PYTHON_MODULE(matrix) BOOST_PYTHON_MODULE(matrix)
{ {
using namespace Eigen; using namespace Eigen;
namespace bp = boost::python; namespace bp = boost::python;
eigenpy::enableEigenPy(); eigenpy::enableEigenPy();
typedef Eigen::Matrix<double,6,6> Matrix6;
eigenpy::enableEigenPySpecific<Matrix6>();
Eigen::MatrixXd (*naturalsXX)(int,int,bool) = naturals; Eigen::MatrixXd (*naturalsXX)(int,int,bool) = naturals;
Eigen::VectorXd (*naturalsX)(int,bool) = naturals; Eigen::VectorXd (*naturalsX)(int,bool) = naturals;
Eigen::Matrix3d (*naturals33)(bool) = naturals; Eigen::Matrix3d (*naturals33)(bool) = naturals;
...@@ -108,4 +118,6 @@ BOOST_PYTHON_MODULE(matrix) ...@@ -108,4 +118,6 @@ BOOST_PYTHON_MODULE(matrix)
bp::def("base", base<VectorXd>); bp::def("base", base<VectorXd>);
bp::def("base", base<MatrixXd>); bp::def("base", base<MatrixXd>);
bp::def("matrix6", matrix6<double>);
} }
...@@ -126,3 +126,7 @@ assert(mat1x1[0,0] == value) ...@@ -126,3 +126,7 @@ assert(mat1x1[0,0] == value)
vec1x1 = eigenpy.vector1x1(value) vec1x1 = eigenpy.vector1x1(value)
assert(vec1x1.size == 1) assert(vec1x1.size == 1)
assert(vec1x1[0] == value) assert(vec1x1[0] == value)
# test registration of matrix6
mat6 = eigenpy.matrix6(0.)
assert(mat6.size == 36)
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