Skip to content

Commit 1ed6c91

Browse files
committed
const in lambdas: Use convention const ReturnType &arg
1 parent 06b1ed3 commit 1ed6c91

31 files changed

+113
-105
lines changed

include/nanoeigenpy/decompositions/bdcsvd.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ void exposeBDCSVD(nb::module_ m, const char *name) {
5151

5252
.def(
5353
"compute",
54-
[](Solver &c, MatrixType const &matrix) -> Solver & {
54+
[](Solver &c, const MatrixType &matrix) -> Solver & {
5555
return c.compute(matrix);
5656
},
5757
"matrix"_a, "Computes the SVD of given matrix.",
5858
nb::rv_policy::reference)
5959
.def(
6060
"compute",
61-
[](Solver &c, MatrixType const &matrix, unsigned int) -> Solver & {
61+
[](Solver &c, const MatrixType &matrix, unsigned int) -> Solver & {
6262
return c.compute(matrix);
6363
},
6464
"matrix"_a, "computationOptions"_a,
@@ -68,15 +68,15 @@ void exposeBDCSVD(nb::module_ m, const char *name) {
6868

6969
.def(
7070
"solve",
71-
[](Solver const &c, VectorType const &b) -> VectorType {
71+
[](const Solver &c, const VectorType &b) -> VectorType {
7272
return solve(c, b);
7373
},
7474
"b"_a,
7575
"Returns the solution x of A x = b using the current "
7676
"decomposition of A.")
7777
.def(
7878
"solve",
79-
[](Solver const &c, MatrixType const &B) -> MatrixType {
79+
[](const Solver &c, const MatrixType &B) -> MatrixType {
8080
return solve(c, B);
8181
},
8282
"B"_a,

include/nanoeigenpy/decompositions/col-piv-householder-qr.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void exposeColPivHouseholderQR(nb::module_ m, const char *name) {
127127

128128
.def(
129129
"setThreshold",
130-
[](Solver &c, RealScalar const &threshold) {
130+
[](Solver &c, const RealScalar &threshold) {
131131
return c.setThreshold(threshold);
132132
},
133133
"threshold"_a,
@@ -166,28 +166,28 @@ void exposeColPivHouseholderQR(nb::module_ m, const char *name) {
166166

167167
.def(
168168
"compute",
169-
[](Solver &c, MatrixType const &matrix) -> Solver & {
169+
[](Solver &c, const MatrixType &matrix) -> Solver & {
170170
return c.compute(matrix);
171171
},
172172
"matrix"_a, "Computes the QR factorization of given matrix.",
173173
nb::rv_policy::reference)
174174

175175
.def(
176-
"inverse", [](Solver const &c) -> MatrixType { return inverse(c); },
176+
"inverse", [](const Solver &c) -> MatrixType { return inverse(c); },
177177
"Returns the inverse of the matrix associated with the QR "
178178
"decomposition.")
179179

180180
.def(
181181
"solve",
182-
[](Solver const &c, VectorType const &b) -> VectorType {
182+
[](const Solver &c, const VectorType &b) -> VectorType {
183183
return solve(c, b);
184184
},
185185
"b"_a,
186186
"Returns the solution x of A x = B using the current "
187187
"decomposition of A where b is a right hand side vector.")
188188
.def(
189189
"solve",
190-
[](Solver const &c, MatrixType const &B) -> MatrixType {
190+
[](const Solver &c, const MatrixType &B) -> MatrixType {
191191
return solve(c, B);
192192
},
193193
"B"_a,

include/nanoeigenpy/decompositions/complete-orthogonal-decomposition.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void exposeCompleteOrthogonalDecomposition(nb::module_ m, const char *name) {
135135

136136
.def(
137137
"setThreshold",
138-
[](Solver &c, RealScalar const &threshold) {
138+
[](Solver &c, const RealScalar &threshold) {
139139
return c.setThreshold(threshold);
140140
},
141141
"threshold"_a,
@@ -178,29 +178,29 @@ void exposeCompleteOrthogonalDecomposition(nb::module_ m, const char *name) {
178178

179179
.def(
180180
"compute",
181-
[](Solver &c, MatrixType const &matrix) { return c.compute(matrix); },
181+
[](Solver &c, const MatrixType &matrix) { return c.compute(matrix); },
182182
"matrix"_a,
183183
"Computes the complete orthogonal factorization of given matrix.",
184184
nb::rv_policy::reference)
185185

186186
.def(
187187
"pseudoInverse",
188-
[](Solver const &c) -> MatrixType { return pseudoInverse(c); },
188+
[](const Solver &c) -> MatrixType { return pseudoInverse(c); },
189189
"Returns the pseudo-inverse of the matrix associated with the "
190190
"complete orthogonal "
191191
"decomposition.")
192192

193193
.def(
194194
"solve",
195-
[](Solver const &c, VectorType const &b) -> VectorType {
195+
[](const Solver &c, const VectorType &b) -> VectorType {
196196
return solve(c, b);
197197
},
198198
"b"_a,
199199
"Returns the solution x of A x = B using the current "
200200
"decomposition of A where b is a right hand side vector.")
201201
.def(
202202
"solve",
203-
[](Solver const &c, MatrixType const &B) -> MatrixType {
203+
[](const Solver &c, const MatrixType &B) -> MatrixType {
204204
return solve(c, B);
205205
},
206206
"B"_a,

include/nanoeigenpy/decompositions/complex-eigen-solver.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ void exposeComplexEigenSolver(nb::module_ m, const char *name) {
3535

3636
.def(
3737
"compute",
38-
[](Solver &c, MatrixType const &matrix) -> Solver & {
38+
[](Solver &c, const MatrixType &matrix) -> Solver & {
3939
return c.compute(matrix);
4040
},
4141
"matrix"_a, "Computes the eigendecomposition of given matrix.",
4242
nb::rv_policy::reference)
4343
.def(
4444
"compute",
45-
[](Solver &c, MatrixType const &matrix, bool computeEigenvectors)
45+
[](Solver &c, const MatrixType &matrix, bool computeEigenvectors)
4646
-> Solver & { return c.compute(matrix, computeEigenvectors); },
4747
"matrix"_a, "computeEigenvectors"_a,
4848
"Computes the eigendecomposition of given matrix.",

include/nanoeigenpy/decompositions/complex-schur.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ void exposeComplexSchur(nb::module_ m, const char *name) {
3434

3535
.def(
3636
"compute",
37-
[](Solver &c, MatrixType const &matrix) -> Solver & {
37+
[](Solver &c, const MatrixType &matrix) -> Solver & {
3838
return c.compute(matrix);
3939
},
4040
"matrix"_a, "Computes Schur decomposition of given matrix. ",
4141
nb::rv_policy::reference)
4242
.def(
4343
"compute",
44-
[](Solver &c, MatrixType const &matrix, bool computeU) -> Solver & {
44+
[](Solver &c, const MatrixType &matrix, bool computeU) -> Solver & {
4545
return c.compute(matrix, computeU);
4646
},
4747
"matrix"_a, "computeU"_a,
@@ -50,7 +50,7 @@ void exposeComplexSchur(nb::module_ m, const char *name) {
5050

5151
.def(
5252
"computeFromHessenberg",
53-
[](Solver &c, MatrixType const &matrixH, MatrixType const &matrixQ,
53+
[](Solver &c, const MatrixType &matrixH, const MatrixType &matrixQ,
5454
bool computeU) -> Solver & {
5555
return c.computeFromHessenberg(matrixH, matrixQ, computeU);
5656
},

include/nanoeigenpy/decompositions/eigen-solver.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ void exposeEigenSolver(nb::module_ m, const char *name) {
3333

3434
.def(
3535
"compute",
36-
[](Solver &c, MatrixType const &matrix) -> Solver & {
36+
[](Solver &c, const MatrixType &matrix) -> Solver & {
3737
return c.compute(matrix);
3838
},
3939
"matrix"_a, "Computes the eigendecomposition of given matrix.",
4040
nb::rv_policy::reference)
4141
.def(
4242
"compute",
43-
[](Solver &c, MatrixType const &matrix, bool compute_eigen_vectors)
43+
[](Solver &c, const MatrixType &matrix, bool compute_eigen_vectors)
4444
-> Solver & { return c.compute(matrix, compute_eigen_vectors); },
4545
"matrix"_a, "compute_eigen_vectors"_a,
4646
"Computes the eigendecomposition of given matrix.",

include/nanoeigenpy/decompositions/full-piv-householder-qr.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void exposeFullPivHouseholderQR(nb::module_ m, const char *name) {
125125

126126
.def(
127127
"setThreshold",
128-
[](Solver &c, RealScalar const &threshold) {
128+
[](Solver &c, const RealScalar &threshold) {
129129
return c.setThreshold(threshold);
130130
},
131131
"threshold"_a,
@@ -161,28 +161,28 @@ void exposeFullPivHouseholderQR(nb::module_ m, const char *name) {
161161

162162
.def(
163163
"compute",
164-
[](Solver &c, MatrixType const &matrix) -> Solver & {
164+
[](Solver &c, const MatrixType &matrix) -> Solver & {
165165
return c.compute(matrix);
166166
},
167167
"matrix"_a, "Computes the QR factorization of given matrix.",
168168
nb::rv_policy::reference)
169169

170170
.def(
171-
"inverse", [](Solver const &c) -> MatrixType { return inverse(c); },
171+
"inverse", [](const Solver &c) -> MatrixType { return inverse(c); },
172172
"Returns the inverse of the matrix associated with the QR "
173173
"decomposition.")
174174

175175
.def(
176176
"solve",
177-
[](Solver const &c, VectorType const &b) -> VectorType {
177+
[](const Solver &c, const VectorType &b) -> VectorType {
178178
return solve(c, b);
179179
},
180180
"b"_a,
181181
"Returns the solution x of A x = B using the current "
182182
"decomposition of A where b is a right hand side vector.")
183183
.def(
184184
"solve",
185-
[](Solver const &c, MatrixType const &B) -> MatrixType {
185+
[](const Solver &c, const MatrixType &B) -> MatrixType {
186186
return solve(c, B);
187187
},
188188
"B"_a,

include/nanoeigenpy/decompositions/full-piv-lu.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void exposeFullPivLU(nb::module_ m, const char *name) {
6363

6464
.def(
6565
"compute",
66-
[](Solver &c, MatrixType const &matrix) -> Solver & {
66+
[](Solver &c, const MatrixType &matrix) -> Solver & {
6767
return c.compute(matrix);
6868
},
6969
"matrix"_a, "Computes the LU of given matrix.",
@@ -98,7 +98,7 @@ void exposeFullPivLU(nb::module_ m, const char *name) {
9898
"Computes the LU of given matrix.")
9999
.def(
100100
"image",
101-
[](Solver &c, MatrixType const &originalMatrix) -> MatrixType {
101+
[](Solver &c, const MatrixType &originalMatrix) -> MatrixType {
102102
return c.image(originalMatrix);
103103
},
104104
"Computes the LU of given matrix.")
@@ -112,7 +112,7 @@ void exposeFullPivLU(nb::module_ m, const char *name) {
112112

113113
.def(
114114
"setThreshold",
115-
[](Solver &c, RealScalar const &threshold) {
115+
[](Solver &c, const RealScalar &threshold) {
116116
return c.setThreshold(threshold);
117117
},
118118
"threshold"_a,
@@ -173,7 +173,7 @@ void exposeFullPivLU(nb::module_ m, const char *name) {
173173
"you can control by calling setThreshold(threshold).")
174174

175175
.def(
176-
"inverse", [](Solver const &c) -> MatrixType { return c.inverse(); },
176+
"inverse", [](const Solver &c) -> MatrixType { return c.inverse(); },
177177
"Returns the inverse of the matrix associated with the LU "
178178
"decomposition.")
179179
.def("reconstructedMatrix", &Solver::reconstructedMatrix,
@@ -186,15 +186,15 @@ void exposeFullPivLU(nb::module_ m, const char *name) {
186186

187187
.def(
188188
"solve",
189-
[](Solver const &c, VectorType const &b) -> VectorType {
189+
[](const Solver &c, const VectorType &b) -> VectorType {
190190
return solve(c, b);
191191
},
192192
"b"_a,
193193
"Returns the solution x of A x = b using the current "
194194
"decomposition of A.")
195195
.def(
196196
"solve",
197-
[](Solver const &c, MatrixType const &B) -> MatrixType {
197+
[](const Solver &c, const MatrixType &B) -> MatrixType {
198198
return solve(c, B);
199199
},
200200
"B"_a,

include/nanoeigenpy/decompositions/generalized-eigen-solver.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ void exposeGeneralizedEigenSolver(nb::module_ m, const char *name) {
4040

4141
.def(
4242
"compute",
43-
[](Solver &c, MatrixType const &A, MatrixType const &B) -> Solver & {
43+
[](Solver &c, const MatrixType &A, const MatrixType &B) -> Solver & {
4444
return c.compute(A, B);
4545
},
4646
"A"_a, "B"_a,
4747
"Computes generalized eigendecomposition of given matrix.",
4848
nb::rv_policy::reference)
4949
.def(
5050
"compute",
51-
[](Solver &c, MatrixType const &A, MatrixType const &B,
51+
[](Solver &c, const MatrixType &A, const MatrixType &B,
5252
bool computeEigenvectors) -> Solver & {
5353
return c.compute(A, B, computeEigenvectors);
5454
},

include/nanoeigenpy/decompositions/generalized-self-adjoint-eigen-solver.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ void exposeGeneralizedSelfAdjointEigenSolver(nb::module_ m, const char *name) {
3030

3131
.def(
3232
"compute",
33-
[](Solver &c, MatrixType const &matA, MatrixType const &matB)
33+
[](Solver &c, const MatrixType &matA, const MatrixType &matB)
3434
-> Solver & { return c.compute(matA, matB); },
3535
"matA"_a, "matB"_a,
3636
"Computes the generalized eigendecomposition of given matrix.",
3737
nb::rv_policy::reference)
3838
.def(
3939
"compute",
40-
[](Solver &c, MatrixType const &matA, MatrixType const &matB,
40+
[](Solver &c, const MatrixType &matA, const MatrixType &matB,
4141
int options) -> Solver & {
4242
return c.compute(matA, matB, options);
4343
},
@@ -47,18 +47,20 @@ void exposeGeneralizedSelfAdjointEigenSolver(nb::module_ m, const char *name) {
4747

4848
.def(
4949
"eigenvalues",
50-
[](Solver &c) -> const VectorType & { return c.eigenvalues(); },
50+
[](const Solver &c) -> const VectorType & { return c.eigenvalues(); },
5151
"Returns the eigenvalues of given matrix.",
5252
nb::rv_policy::reference_internal)
5353
.def(
5454
"eigenvectors",
55-
[](Solver &c) -> const MatrixType & { return c.eigenvectors(); },
55+
[](const Solver &c) -> const MatrixType & {
56+
return c.eigenvectors();
57+
},
5658
"Returns the eigenvectors of given matrix.",
5759
nb::rv_policy::reference_internal)
5860

5961
.def(
6062
"computeDirect",
61-
[](Solver &c, MatrixType const &matrix) -> Solver & {
63+
[](Solver &c, const MatrixType &matrix) -> Solver & {
6264
return static_cast<Solver &>(c.computeDirect(matrix));
6365
},
6466
"matrix"_a,
@@ -67,7 +69,7 @@ void exposeGeneralizedSelfAdjointEigenSolver(nb::module_ m, const char *name) {
6769
nb::rv_policy::reference)
6870
.def(
6971
"computeDirect",
70-
[](Solver &c, MatrixType const &matrix, int options) -> Solver & {
72+
[](Solver &c, const MatrixType &matrix, int options) -> Solver & {
7173
return static_cast<Solver &>(c.computeDirect(matrix, options));
7274
},
7375
"matrix"_a, "options"_a,

0 commit comments

Comments
 (0)