@@ -98,12 +98,14 @@ TEST_SUBMODULE(eigen, m) {
9898
9999 // test_eigen_ref_to_python
100100 // Different ways of passing via Eigen::Ref; the first and second are the Eigen-recommended
101- // NOLINTNEXTLINE (performance-unnecessary-value-param)
102- m.def (" cholesky1" , [](Eigen::Ref<MatrixXdR> x) -> Eigen::MatrixXd { return x.llt ().matrixL (); });
101+ m.def (" cholesky1" ,
102+ // NOLINTNEXTLINE (performance-unnecessary-value-param)
103+ [](Eigen::Ref<MatrixXdR> x) -> Eigen::MatrixXd { return x.llt ().matrixL (); });
103104 m.def (" cholesky2" , [](const Eigen::Ref<const MatrixXdR> &x) -> Eigen::MatrixXd { return x.llt ().matrixL (); });
104105 m.def (" cholesky3" , [](const Eigen::Ref<MatrixXdR> &x) -> Eigen::MatrixXd { return x.llt ().matrixL (); });
105- // NOLINTNEXTLINE (performance-unnecessary-value-param)
106- m.def (" cholesky4" , [](Eigen::Ref<const MatrixXdR> x) -> Eigen::MatrixXd { return x.llt ().matrixL (); });
106+ m.def (" cholesky4" ,
107+ // NOLINTNEXTLINE (performance-unnecessary-value-param)
108+ [](Eigen::Ref<const MatrixXdR> x) -> Eigen::MatrixXd { return x.llt ().matrixL (); });
107109
108110 // test_eigen_ref_mutators
109111 // Mutators: these add some value to the given element using Eigen, but Eigen should be mapping into
@@ -260,7 +262,10 @@ TEST_SUBMODULE(eigen, m) {
260262 m.def (" dense_copy_r" , [](const DenseMatrixR &m) -> DenseMatrixR { return m; });
261263 m.def (" dense_copy_c" , [](const DenseMatrixC &m) -> DenseMatrixC { return m; });
262264 // test_sparse, test_sparse_signature
263- m.def (" sparse_r" , [mat]() -> SparseMatrixR { return Eigen::SparseView<Eigen::MatrixXf>(mat); }); // NOLINT(clang-analyzer-core.uninitialized.UndefReturn)
265+ m.def (" sparse_r" , [mat]() -> SparseMatrixR {
266+ // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)
267+ return Eigen::SparseView<Eigen::MatrixXf>(mat);
268+ });
264269 m.def (" sparse_c" , [mat]() -> SparseMatrixC { return Eigen::SparseView<Eigen::MatrixXf>(mat); });
265270 m.def (" sparse_copy_r" , [](const SparseMatrixR &m) -> SparseMatrixR { return m; });
266271 m.def (" sparse_copy_c" , [](const SparseMatrixC &m) -> SparseMatrixC { return m; });
@@ -284,9 +289,11 @@ TEST_SUBMODULE(eigen, m) {
284289 // that would allow copying (if types or strides don't match) for comparison:
285290 m.def (" get_elem" , &get_elem);
286291 // Now this alternative that calls the tells pybind to fail rather than copy:
287- // NOLINTNEXTLINE (performance-unnecessary-value-param)
288- m.def (" get_elem_nocopy" , [](Eigen::Ref<const Eigen::MatrixXd> m) -> double { return get_elem (m); },
289- py::arg{}.noconvert ());
292+ m.def (
293+ " get_elem_nocopy" ,
294+ // NOLINTNEXTLINE (performance-unnecessary-value-param)
295+ [](Eigen::Ref<const Eigen::MatrixXd> m) -> double { return get_elem (m); },
296+ py::arg{}.noconvert ());
290297 // Also test a row-major-only no-copy const ref:
291298 m.def (" get_elem_rm_nocopy" , [](Eigen::Ref<const Eigen::Matrix<long , -1 , -1 , Eigen::RowMajor>> &m) -> long { return m (2 , 1 ); },
292299 py::arg{}.noconvert ());
@@ -301,20 +308,26 @@ TEST_SUBMODULE(eigen, m) {
301308 // test_issue1105
302309 // Issue #1105: when converting from a numpy two-dimensional (Nx1) or (1xN) value into a dense
303310 // eigen Vector or RowVector, the argument would fail to load because the numpy copy would
304- // fail: numpy won't broadcast a Nx1 into a 1-dimensional vector. NOLINTNEXTLINE
311+ // fail: numpy won't broadcast a Nx1 into a 1-dimensional vector.
305312 // NOLINTNEXTLINE (performance-unnecessary-value-param)
306313 m.def (" iss1105_col" , [](Eigen::VectorXd) { return true ; });
307314 // NOLINTNEXTLINE (performance-unnecessary-value-param)
308315 m.def (" iss1105_row" , [](Eigen::RowVectorXd) { return true ; });
309316
310317 // test_named_arguments
311318 // Make sure named arguments are working properly:
312- // NOLINTNEXTLINE (performance-unnecessary-value-param)
313- m.def (" matrix_multiply" , [](const py::EigenDRef<const Eigen::MatrixXd> A, const py::EigenDRef<const Eigen::MatrixXd> B)
314- -> Eigen::MatrixXd {
315- if (A.cols () != B.rows ()) throw std::domain_error (" Nonconformable matrices!" );
316- return A * B;
317- }, py::arg (" A" ), py::arg (" B" ));
319+ m.def (
320+ " matrix_multiply" ,
321+ // NOLINTNEXTLINE (performance-unnecessary-value-param)
322+ [](const py::EigenDRef<const Eigen::MatrixXd> A,
323+ // NOLINTNEXTLINE (performance-unnecessary-value-param)
324+ const py::EigenDRef<const Eigen::MatrixXd> B) -> Eigen::MatrixXd {
325+ if (A.cols () != B.rows ())
326+ throw std::domain_error (" Nonconformable matrices!" );
327+ return A * B;
328+ },
329+ py::arg (" A" ),
330+ py::arg (" B" ));
318331
319332 // test_custom_operator_new
320333 py::class_<CustomOperatorNew>(m, " CustomOperatorNew" )
0 commit comments