Skip to content

Commit 8187b53

Browse files
forgot one bit of C code to use
1 parent 0f1833f commit 8187b53

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

selectiveInference/R/funs.randomized.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,16 @@ randomizedLasso = function(X,
158158
return(-Inf)
159159
}
160160

161-
A = opt_transform$linear_term %*% opt_state + observed_raw + opt_transform$offset_term
162-
D = -apply(A^2, 2, sum) / noise_scale^2
163-
# D = log_density_gaussian_conditional_(noise_scale,
164-
# opt_transform$linear_term,
165-
# as.matrix(opt_state),
166-
# observed_raw + opt_transform$offset_term)
161+
use_C_code = TRUE
162+
if (!use_C_code) {
163+
A = opt_transform$linear_term %*% opt_state + observed_raw + opt_transform$offset_term
164+
D = -apply(A^2, 2, sum) / noise_scale^2
165+
} else {
166+
D = log_density_gaussian_conditional_(noise_scale,
167+
opt_transform$linear_term,
168+
as.matrix(opt_state),
169+
observed_raw + opt_transform$offset_term)
170+
}
167171
return(D)
168172
}
169173

0 commit comments

Comments
 (0)