Skip to content

Commit b2e576e

Browse files
committed
desompositions/SVD: fix compatibility with Eigen 5
1 parent 7f6ccb7 commit b2e576e

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

include/eigenpy/decompositions/BDCSVD.hpp

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,27 @@ struct BDCSVDVisitor
3535

3636
.def("cols", &Solver::cols, bp::arg("self"),
3737
"Returns the number of columns. ")
38-
.def("compute",
39-
(Solver & (Solver::*)(const MatrixType &matrix)) & Solver::compute,
40-
bp::args("self", "matrix"),
41-
"Method performing the decomposition of given matrix. Computes "
42-
"Thin/Full "
43-
"unitaries U/V if specified using the Options template parameter "
44-
"or the class constructor. ",
45-
bp::return_self<>())
46-
.def("compute",
47-
(Solver & (Solver::*)(const MatrixType &matrix,
48-
unsigned int computationOptions)) &
49-
Solver::compute,
50-
bp::args("self", "matrix", "computationOptions"),
51-
"Method performing the decomposition of given matrix, as "
52-
"specified by the computationOptions parameter. ",
53-
bp::return_self<>())
38+
.def(
39+
"compute",
40+
+[](Solver &self, const MatrixType &matrix) -> Solver & {
41+
return self.compute(matrix);
42+
},
43+
bp::args("self", "matrix"),
44+
"Method performing the decomposition of given matrix. Computes "
45+
"Thin/Full "
46+
"unitaries U/V if specified using the Options template parameter "
47+
"or the class constructor. ",
48+
bp::return_self<>())
49+
.def(
50+
"compute",
51+
+[](Solver &self, const MatrixType &matrix,
52+
unsigned int computationOptions) -> Solver & {
53+
return self.compute(matrix, computationOptions);
54+
},
55+
bp::args("self", "matrix", "computationOptions"),
56+
"Method performing the decomposition of given matrix, as "
57+
"specified by the computationOptions parameter. ",
58+
bp::return_self<>())
5459
.def("rows", &Solver::rows, bp::arg("self"),
5560
"Returns the number of rows. ")
5661
.def("setSwitchSize", &Solver::setSwitchSize, bp::args("self", "s"))

include/eigenpy/decompositions/JacobiSVD.hpp

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ namespace eigenpy {
1818
template <typename JacobiSVD>
1919
struct JacobiSVDVisitor
2020
: public boost::python::def_visitor<JacobiSVDVisitor<JacobiSVD>> {
21+
typedef JacobiSVD Solver;
2122
typedef typename JacobiSVD::MatrixType MatrixType;
23+
typedef Eigen::MatrixBase<MatrixType> MatrixBaseType;
2224
typedef typename MatrixType::Scalar Scalar;
2325

2426
template <class PyClass>
@@ -34,23 +36,27 @@ struct JacobiSVDVisitor
3436

3537
.def("cols", &JacobiSVD::cols, bp::arg("self"),
3638
"Returns the number of columns. ")
37-
.def("compute",
38-
(JacobiSVD & (JacobiSVD::*)(const MatrixType &matrix)) &
39-
JacobiSVD::compute,
40-
bp::args("self", "matrix"),
41-
"Method performing the decomposition of given matrix. Computes "
42-
"Thin/Full "
43-
"unitaries U/V if specified using the Options template parameter "
44-
"or the class constructor. ",
45-
bp::return_self<>())
46-
.def("compute",
47-
(JacobiSVD & (JacobiSVD::*)(const MatrixType &matrix,
48-
unsigned int computationOptions)) &
49-
JacobiSVD::compute,
50-
bp::args("self", "matrix", "computationOptions"),
51-
"Method performing the decomposition of given matrix, as "
52-
"specified by the computationOptions parameter. ",
53-
bp::return_self<>())
39+
.def(
40+
"compute",
41+
+[](Solver &self, const MatrixType &matrix) -> Solver & {
42+
return self.compute(matrix);
43+
},
44+
bp::args("self", "matrix"),
45+
"Method performing the decomposition of given matrix. Computes "
46+
"Thin/Full "
47+
"unitaries U/V if specified using the Options template parameter "
48+
"or the class constructor. ",
49+
bp::return_self<>())
50+
.def(
51+
"compute",
52+
+[](Solver &self, const MatrixType &matrix,
53+
unsigned int computationOptions) -> Solver & {
54+
return self.compute(matrix, computationOptions);
55+
},
56+
bp::args("self", "matrix", "computation_options"),
57+
"Method performing the decomposition of given matrix, as "
58+
"specified by the computationOptions parameter. ",
59+
bp::return_self<>())
5460
.def("rows", &JacobiSVD::rows, bp::arg("self"),
5561
"Returns the number of rows.")
5662

0 commit comments

Comments
 (0)