Skip to content

Commit afb9fc0

Browse files
committed
Optional arguments with bp::optional
1 parent e387dcb commit afb9fc0

File tree

2 files changed

+10
-36
lines changed

2 files changed

+10
-36
lines changed

include/eigenpy/decompositions/BDCSVD.hpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,13 @@ struct BDCSVDVisitor
2525
template <class PyClass>
2626
void visit(PyClass &cl) const {
2727
cl.def(bp::init<>(bp::arg("self"), "Default constructor"))
28-
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex>(
29-
bp::args("self", "rows", "cols"),
30-
"Default Constructor with memory preallocation. "))
31-
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex, unsigned int>(
28+
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex,
29+
bp::optional<unsigned int>>(
3230
bp::args("self", "rows", "cols", "computationOptions "),
33-
"Default Constructor with memory preallocation. \n\n"
34-
"Like the default constructor but with preallocation of the "
35-
"internal "
36-
"data according to the specified problem size and the "
37-
"computationOptions. "))
38-
.def(bp::init<MatrixType>(
39-
bp::args("self", "matrix"),
40-
"Constructor performing the decomposition of given matrix. "))
41-
.def(bp::init<MatrixType, unsigned int>(
31+
"Default Constructor with memory preallocation. "))
32+
.def(bp::init<MatrixType, bp::optional<unsigned int>>(
4233
bp::args("self", "matrix", "computationOptions "),
43-
"Constructor performing the decomposition of given matrix. \n\n"
44-
"One cannot request unitiaries using both the Options template "
45-
"parameter "
46-
"and the constructor. If possible, prefer using the Options "
47-
"template parameter."))
34+
"Constructor performing the decomposition of given matrix."))
4835

4936
.def("cols", &Solver::cols, bp::arg("self"),
5037
"Returns the number of columns. ")

include/eigenpy/decompositions/JacobiSVD.hpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,13 @@ struct JacobiSVDVisitor
2424
template <class PyClass>
2525
void visit(PyClass &cl) const {
2626
cl.def(bp::init<>(bp::arg("self"), "Default constructor"))
27-
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex>(
28-
bp::args("self", "rows", "cols"),
29-
"Default Constructor with memory preallocation. "))
30-
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex, unsigned int>(
27+
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex,
28+
bp::optional<unsigned int>>(
3129
bp::args("self", "rows", "cols", "computationOptions "),
32-
"Default Constructor with memory preallocation. \n\n"
33-
"Like the default constructor but with preallocation of the "
34-
"internal "
35-
"data according to the specified problem size and the "
36-
"computationOptions. "))
37-
.def(bp::init<MatrixType>(
38-
bp::args("self", "matrix"),
39-
"Constructor performing the decomposition of given matrix. "))
40-
.def(bp::init<MatrixType, unsigned int>(
30+
"Default Constructor with memory preallocation."))
31+
.def(bp::init<MatrixType, bp::optional<unsigned int>>(
4132
bp::args("self", "matrix", "computationOptions "),
42-
"Constructor performing the decomposition of given matrix. \n\n"
43-
"One cannot request unitiaries using both the Options template "
44-
"parameter "
45-
"and the constructor. If possible, prefer using the Options "
46-
"template parameter."))
33+
"Constructor performing the decomposition of given matrix."))
4734

4835
.def("cols", &JacobiSVD::cols, bp::arg("self"),
4936
"Returns the number of columns. ")

0 commit comments

Comments
 (0)