11/*
2- * Copyright 2020 INRIA
2+ * Copyright 2020-2021 INRIA
33 */
44
55#ifndef __eigenpy_decomposition_ldlt_hpp__
@@ -23,7 +23,8 @@ namespace eigenpy
2323 typedef _MatrixType MatrixType;
2424 typedef typename MatrixType::Scalar Scalar;
2525 typedef typename MatrixType::RealScalar RealScalar;
26- typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1 ,MatrixType::Options> VectorType;
26+ typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1 ,MatrixType::Options> VectorXs;
27+ typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic,MatrixType::Options> MatrixXs;
2728 typedef Eigen::LDLT<MatrixType> Solver;
2829
2930 template <class PyClass >
@@ -55,7 +56,7 @@ namespace eigenpy
5556 " Returns the LDLT decomposition matrix." ,
5657 bp::return_internal_reference<>())
5758
58- .def (" rankUpdate" ,(Solver & (Solver::*)(const Eigen::MatrixBase<VectorType > &, const RealScalar &))&Solver::template rankUpdate<VectorType >,
59+ .def (" rankUpdate" ,(Solver & (Solver::*)(const Eigen::MatrixBase<VectorXs > &, const RealScalar &))&Solver::template rankUpdate<VectorXs >,
5960 bp::args (" self" ," vector" ," sigma" ),
6061 bp::return_self<>())
6162
@@ -78,8 +79,10 @@ namespace eigenpy
7879#endif
7980 .def (" reconstructedMatrix" ,&Solver::reconstructedMatrix,bp::arg (" self" ),
8081 " Returns the matrix represented by the decomposition, i.e., it returns the product: L L^*. This function is provided for debug purpose." )
81- .def (" solve" ,&solve<VectorType >,bp::args (" self" ," b" ),
82+ .def (" solve" ,&solve<VectorXs >,bp::args (" self" ," b" ),
8283 " Returns the solution x of A x = b using the current decomposition of A." )
84+ .def (" solve" ,&solve<MatrixXs>,bp::args (" self" ," B" ),
85+ " Returns the solution X of A X = B using the current decomposition of A where B is a right hand side matrix." )
8386
8487 .def (" setZero" ,&Solver::setZero,bp::arg (" self" ),
8588 " Clear any existing decomposition." )
@@ -107,16 +110,16 @@ namespace eigenpy
107110
108111 static MatrixType matrixL (const Solver & self) { return self.matrixL (); }
109112 static MatrixType matrixU (const Solver & self) { return self.matrixU (); }
110- static VectorType vectorD (const Solver & self) { return self.vectorD (); }
113+ static VectorXs vectorD (const Solver & self) { return self.vectorD (); }
111114
112115 static MatrixType transpositionsP (const Solver & self)
113116 {
114117 return self.transpositionsP () * MatrixType::Identity (self.matrixL ().rows (),
115118 self.matrixL ().rows ());
116119 }
117120
118- template <typename VectorType >
119- static VectorType solve (const Solver & self, const VectorType & vec)
121+ template <typename MatrixOrVector >
122+ static MatrixOrVector solve (const Solver & self, const MatrixOrVector & vec)
120123 {
121124 return self.solve (vec);
122125 }
0 commit comments