Skip to content

Commit f0927b3

Browse files
committed
fix sym check in estimate_minimal_eigen_value
1 parent 4552d80 commit f0927b3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

include/proxsuite/proxqp/dense/helpers.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ estimate_minimal_eigen_value_of_symmetric_matrix(
112112
T power_iteration_accuracy,
113113
isize nb_power_iteration)
114114
{
115-
PROXSUITE_THROW_PRETTY((!H.isApprox(H.transpose(), 0.0)),
116-
std::invalid_argument,
117-
"H is not symmetric.");
115+
PROXSUITE_THROW_PRETTY(
116+
(!H.isApprox(H.transpose(), std::numeric_limits<T>::epsilon())),
117+
std::invalid_argument,
118+
"H is not symmetric.");
118119
if (H.size()) {
119120
PROXSUITE_CHECK_ARGUMENT_SIZE(
120121
H.rows(),

include/proxsuite/proxqp/sparse/helpers.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ estimate_minimal_eigen_value_of_symmetric_matrix(SparseMat<T, I>& H,
119119
T power_iteration_accuracy,
120120
isize nb_power_iteration)
121121
{
122-
PROXSUITE_THROW_PRETTY((!H.isApprox(H.transpose(), 0.0)),
123-
std::invalid_argument,
124-
"H is not symmetric.");
122+
PROXSUITE_THROW_PRETTY(
123+
(!H.isApprox(H.transpose(), std::numeric_limits<T>::epsilon())),
124+
std::invalid_argument,
125+
"H is not symmetric.");
125126
PROXSUITE_CHECK_ARGUMENT_SIZE(
126127
H.rows(),
127128
H.cols(),

0 commit comments

Comments
 (0)