Skip to content

Commit be84df2

Browse files
BF: KKT condition was wrong
1 parent aa515c9 commit be84df2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

selectiveInference/src/debias.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int check_KKT(double *theta, /* current theta */
9595

9696
int irow;
9797
int fail = 0;
98-
double tol = 1.e-4;
98+
double tol = 1.e-6;
9999
double *theta_ptr, *gradient_ptr_tmp;
100100
double gradient;
101101

@@ -111,10 +111,10 @@ int check_KKT(double *theta, /* current theta */
111111
}
112112

113113
if (*theta_ptr != 0) { // these coordinates of gradients should be equal to -bound
114-
if ((*theta_ptr > 0) && (fabs(gradient + bound) > (1. + tol) * bound)) {
114+
if ((*theta_ptr > 0) && (fabs(gradient + bound) > tol * bound)) {
115115
fail += 1;
116116
}
117-
else if ((*theta_ptr < 0) && (fabs(gradient - bound) > (1. + tol) * bound)) {
117+
else if ((*theta_ptr < 0) && (fabs(gradient - bound) > tol * bound)) {
118118
fail += 1;
119119
}
120120
}

0 commit comments

Comments
 (0)