@@ -10,7 +10,7 @@ using namespace Eigen;
1010using namespace eigenpy ;
1111
1212template <typename MatType>
13- void printMatrix (const Eigen::Ref<MatType> & mat)
13+ void printMatrix (const Eigen::Ref<const MatType> mat)
1414{
1515 if (MatType::IsVectorAtCompileTime)
1616 std::cout << " isVector" << std::endl;
@@ -19,7 +19,7 @@ void printMatrix(const Eigen::Ref<MatType> & mat)
1919}
2020
2121template <typename VecType>
22- void printVector (const Eigen::Ref<VecType> & vec)
22+ void printVector (const Eigen::Ref<const VecType> & vec)
2323{
2424 EIGEN_STATIC_ASSERT_VECTOR_ONLY (VecType);
2525 printMatrix (vec);
@@ -28,9 +28,13 @@ void printVector(const Eigen::Ref<VecType> & vec)
2828template <typename MatType>
2929void setOnes (Eigen::Ref<MatType> mat)
3030{
31- printMatrix (mat);
3231 mat.setOnes ();
33- printMatrix (mat);
32+ }
33+
34+ template <typename MatType>
35+ void fill (Eigen::Ref<MatType> mat, const typename MatType::Scalar & value)
36+ {
37+ mat.fill (value);
3438}
3539
3640BOOST_PYTHON_MODULE (eigen_ref)
@@ -48,4 +52,8 @@ BOOST_PYTHON_MODULE(eigen_ref)
4852 bp::def (" setOnes" , setOnes<Vector3d>);
4953 bp::def (" setOnes" , setOnes<VectorXd>);
5054 bp::def (" setOnes" , setOnes<MatrixXd>);
55+
56+ bp::def (" fillVec3" , fill<Vector3d>);
57+ bp::def (" fillVec" , fill<VectorXd>);
58+ bp::def (" fill" , fill<MatrixXd>);
5159}
0 commit comments