Skip to content

Commit f401316

Browse files
committed
Add const in some lambda functions on Solver& to stick to definition
1 parent 4996734 commit f401316

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

include/eigenpy/decompositions/SelfAdjointEigenSolver.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ struct SelfAdjointEigenSolverVisitor
3535

3636
.def(
3737
"eigenvalues",
38-
+[](Solver& c) -> const VectorType& { return c.eigenvalues(); },
38+
+[](const Solver& c) -> const VectorType& {
39+
return c.eigenvalues();
40+
},
3941
"Returns the eigenvalues of given matrix.",
4042
bp::return_internal_reference<>())
4143
.def(
4244
"eigenvectors",
43-
+[](Solver& c) -> const MatrixType& { return c.eigenvectors(); },
45+
+[](const Solver& c) -> const MatrixType& {
46+
return c.eigenvectors();
47+
},
4448
"Returns the eigenvectors of given matrix.",
4549
bp::return_internal_reference<>())
4650

include/eigenpy/decompositions/Tridiagonalization.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ struct TridiagonalizationVisitor : public boost::python::def_visitor<
4949
+[](const Solver &c) -> MatrixType { return c.matrixQ(); },
5050
"Returns the unitary matrix Q in the decomposition.")
5151
.def(
52-
"matrixT", +[](Solver &c) -> MatrixType { return c.matrixT(); },
52+
"matrixT",
53+
+[](const Solver &c) -> MatrixType { return c.matrixT(); },
5354
"Returns an expression of the tridiagonal matrix T in the "
5455
"decomposition.")
5556

include/eigenpy/solvers/IncompleteCholesky.hpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,40 @@ struct IncompleteCholeskyVisitor : public boost::python::def_visitor<
6363

6464
.def(
6565
"matrixL",
66-
+[](Solver& self) -> const FactorType& { return self.matrixL(); },
66+
+[](const Solver& self) -> const FactorType& {
67+
return self.matrixL();
68+
},
6769
bp::return_value_policy<bp::copy_const_reference>())
6870
.def(
6971
"scalingS",
70-
+[](Solver& self) -> const VectorRx& { return self.scalingS(); },
72+
+[](const Solver& self) -> const VectorRx& {
73+
return self.scalingS();
74+
},
7175
bp::return_value_policy<bp::copy_const_reference>())
7276
.def(
7377
"permutationP",
74-
+[](Solver& self) -> const PermutationType& {
78+
+[](const Solver& self) -> const PermutationType& {
7579
return self.permutationP();
7680
},
7781
bp::return_value_policy<bp::copy_const_reference>())
7882

7983
.def(
8084
"solve",
81-
+[](Solver const& self, const Eigen::Ref<DenseVectorXs const>& b)
85+
+[](const Solver& self, const Eigen::Ref<DenseVectorXs const>& b)
8286
-> DenseVectorXs { return self.solve(b); },
8387
bp::arg("b"),
8488
"Returns the solution x of A x = b using the current decomposition "
8589
"of A, where b is a right hand side vector.")
8690
.def(
8791
"solve",
88-
+[](Solver const& self, const Eigen::Ref<DenseMatrixXs const>& B)
92+
+[](const Solver& self, const Eigen::Ref<DenseMatrixXs const>& B)
8993
-> DenseMatrixXs { return self.solve(B); },
9094
bp::arg("b"),
9195
"Returns the solution X of A X = B using the current decomposition "
9296
"of A where B is a right hand side matrix.")
9397
.def(
9498
"solve",
95-
+[](Solver const& self, const MatrixType& B) -> MatrixType {
99+
+[](const Solver& self, const MatrixType& B) -> MatrixType {
96100
DenseMatrixXs B_dense = DenseMatrixXs(B);
97101
DenseMatrixXs X_dense = self.solve(B_dense);
98102
return MatrixType(X_dense.sparseView());

include/eigenpy/solvers/IncompleteLUT.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ struct IncompleteLUTVisitor
6363

6464
.def(
6565
"solve",
66-
+[](Solver const& self, const Eigen::Ref<DenseVectorXs const>& b)
66+
+[](const Solver& self, const Eigen::Ref<DenseVectorXs const>& b)
6767
-> DenseVectorXs { return self.solve(b); },
6868
bp::arg("b"),
6969
"Returns the solution x of A x = b using the current decomposition "
7070
"of A, where b is a right hand side vector.")
7171
.def(
7272
"solve",
73-
+[](Solver const& self, const Eigen::Ref<DenseMatrixXs const>& B)
73+
+[](const Solver& self, const Eigen::Ref<DenseMatrixXs const>& B)
7474
-> DenseMatrixXs { return self.solve(B); },
7575
bp::arg("b"),
7676
"Returns the solution X of A X = B using the current decomposition "
7777
"of A where B is a right hand side matrix.")
7878
.def(
7979
"solve",
80-
+[](Solver const& self, const MatrixType& B) -> MatrixType {
80+
+[](const Solver& self, const MatrixType& B) -> MatrixType {
8181
DenseMatrixXs B_dense = DenseMatrixXs(B);
8282
DenseMatrixXs X_dense = self.solve(B_dense);
8383
return MatrixType(X_dense.sparseView());

0 commit comments

Comments
 (0)