Verified Commit 5a6f4804 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: test registration of a new type

parent cec1bd83
......@@ -81,12 +81,22 @@ MatrixDerived base(const Eigen::MatrixBase<MatrixDerived> & m)
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)
{
using namespace Eigen;
namespace bp = boost::python;
eigenpy::enableEigenPy();
typedef Eigen::Matrix<double,6,6> Matrix6;
eigenpy::enableEigenPySpecific<Matrix6>();
Eigen::MatrixXd (*naturalsXX)(int,int,bool) = naturals;
Eigen::VectorXd (*naturalsX)(int,bool) = naturals;
Eigen::Matrix3d (*naturals33)(bool) = naturals;
......@@ -108,4 +118,6 @@ BOOST_PYTHON_MODULE(matrix)
bp::def("base", base<VectorXd>);
bp::def("base", base<MatrixXd>);
bp::def("matrix6", matrix6<double>);
}
......@@ -126,3 +126,7 @@ assert(mat1x1[0,0] == value)
vec1x1 = eigenpy.vector1x1(value)
assert(vec1x1.size == 1)
assert(vec1x1[0] == value)
# test registration of matrix6
mat6 = eigenpy.matrix6(0.)
assert(mat6.size == 36)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment