@@ -7,6 +7,7 @@ namespace aligator::python {
7
7
using namespace gar ;
8
8
9
9
using context::Scalar;
10
+ using context::VectorXs;
10
11
using lqr_t = LQRProblemTpl<context::Scalar>;
11
12
12
13
bp::dict lqr_sol_initialize_wrap (const lqr_t &problem) {
@@ -20,6 +21,15 @@ bp::dict lqr_sol_initialize_wrap(const lqr_t &problem) {
20
21
return out;
21
22
}
22
23
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
+
23
33
void exposeGarUtils () {
24
34
25
35
bp::def (
@@ -30,8 +40,8 @@ void exposeGarUtils() {
30
40
},
31
41
(" problem" _a, " mudyn" , " mueq" ));
32
42
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" ),
35
45
" Create or update a sparse matrix from an LQRProblem." );
36
46
37
47
bp::def (" lqrInitializeSolution" , lqr_sol_initialize_wrap, (" problem" _a));
0 commit comments