@@ -7,6 +7,7 @@ namespace aligator::python {
77using namespace gar ;
88
99using context::Scalar;
10+ using context::VectorXs;
1011using lqr_t = LQRProblemTpl<context::Scalar>;
1112
1213bp::dict lqr_sol_initialize_wrap (const lqr_t &problem) {
@@ -20,6 +21,15 @@ bp::dict lqr_sol_initialize_wrap(const lqr_t &problem) {
2021 return out;
2122}
2223
24+ bp::tuple lqr_create_sparse_wrap (const lqr_t &problem, const Scalar mudyn,
25+ const Scalar mueq, bool update) {
26+ Eigen::SparseMatrix<Scalar> mat;
27+ VectorXs rhs;
28+ lqrCreateSparseMatrix (problem, mudyn, mueq, mat, rhs, update);
29+ mat.makeCompressed ();
30+ return bp::make_tuple (mat, rhs);
31+ }
32+
2333void exposeGarUtils () {
2434
2535 bp::def (
@@ -30,8 +40,8 @@ void exposeGarUtils() {
3040 },
3141 (" problem" _a, " mudyn" , " mueq" ));
3242
33- bp::def (" lqrCreateSparseMatrix" , lqrCreateSparseMatrix<Scalar> ,
34- (" problem" _a, " mudyn" , " mueq" , " mat " , " rhs " , " update" ),
43+ bp::def (" lqrCreateSparseMatrix" , lqr_create_sparse_wrap ,
44+ (" problem" _a, " mudyn" , " mueq" , " update" ),
3545 " Create or update a sparse matrix from an LQRProblem." );
3646
3747 bp::def (" lqrInitializeSolution" , lqr_sol_initialize_wrap, (" problem" _a));
0 commit comments