Skip to content

Commit

Permalink
Switch to integer data type in Eigen test for default arguments.
Browse files Browse the repository at this point in the history
The `test10_eigen_scalar_default` test in `test_eigen.py` relies
unnecessarily on exact equality of floating point numbers. In my
environment, with a recent commit of Eigen, the addition in the test is
causing the equality check to fail. There might be other upstream issues
to consider here, but the specific test failure here seems to be a false
positive! This PR switches that test to use integer zeros to be less
sensitive to numerics. Let me know what you think - thanks!
  • Loading branch information
dfm committed Oct 3, 2024
1 parent f3e2796 commit ba3de61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_eigen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ NB_MODULE(test_eigen_ext, m) {
m.def("sparse_complex", []() -> Eigen::SparseMatrix<std::complex<double>> { return {}; });

/// issue #166
using Matrix1d = Eigen::Matrix<double,1,1>;
using Matrix1d = Eigen::Matrix<int,1,1>;
try {
m.def(
"default_arg", [](Matrix1d a, Matrix1d b) { return a + b; },
Expand Down

0 comments on commit ba3de61

Please sign in to comment.