Verified Commit 8b03257b authored by Justin Carpentier's avatar Justin Carpentier
Browse files

test: add test of PlainObjectBase feature

parent 500401b3
......@@ -81,6 +81,12 @@ MatrixDerived base(const Eigen::MatrixBase<MatrixDerived> & m)
return m.derived();
}
template<typename MatrixDerived>
MatrixDerived plain(const Eigen::PlainObjectBase<MatrixDerived> & m)
{
return m.derived();
}
template<typename Scalar>
Eigen::Matrix<Scalar,6,6> matrix6(const Scalar & value)
{
......@@ -123,6 +129,9 @@ BOOST_PYTHON_MODULE(matrix)
bp::def("base", base<VectorXd>);
bp::def("base", base<MatrixXd>);
bp::def("plain", plain<VectorXd>);
bp::def("plain", plain<MatrixXd>);
bp::def("matrix6", matrix6<double>);
}
......@@ -36,6 +36,10 @@ Mref = np.reshape(np.array(range(64),np.double),[8,8])
Mref_from_base = eigenpy.base(Mref)
assert( np.array_equal(Mref,Mref_from_base) );
# Test plain function
Mref_from_plain = eigenpy.plain(Mref)
assert( np.array_equal(Mref,Mref_from_plain) );
if verbose: print("===> Matrix 8x8")
M = Mref
assert( np.array_equal(M,eigenpy.reflex(M,verbose)) );
......
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