@@ -159,7 +159,8 @@ sigma=NULL, alpha=0.1,
159
159
hsigmaSinv <- solve(hsigmaS ) # pinv(hsigmaS)
160
160
161
161
# Approximate inverse covariance matrix for when (n < p) from lasso_Inference.R
162
- htheta <- InverseLinfty(hsigma , n , length(S ), verbose = FALSE )
162
+ useC = TRUE
163
+ htheta <- InverseLinfty(hsigma , n , length(S ), verbose = FALSE , useC = useC )
163
164
# htheta <- InverseLinfty(hsigma, n, verbose=FALSE)
164
165
165
166
FS = rbind(diag(length(S )),matrix (0 ,pp - length(S ),length(S )))
@@ -269,7 +270,7 @@ fixedLasso.poly=
269
270
# ## Functions borrowed and slightly modified from lasso_inference.R
270
271
271
272
# # Approximates inverse covariance matrix theta
272
- InverseLinfty <- function (sigma , n , e , resol = 1.5 , mu = NULL , maxiter = 50 , threshold = 1e-2 , verbose = TRUE ) {
273
+ InverseLinfty <- function (sigma , n , e , resol = 1.5 , mu = NULL , maxiter = 50 , threshold = 1e-2 , verbose = TRUE , useC = FALSE ) {
273
274
# InverseLinfty <- function(sigma, n, resol=1.5, mu=NULL, maxiter=50, threshold=1e-2, verbose = TRUE) {
274
275
isgiven <- 1 ;
275
276
if (is.null(mu )){
@@ -294,7 +295,11 @@ InverseLinfty <- function(sigma, n, e, resol=1.5, mu=NULL, maxiter=50, threshold
294
295
incr <- 0 ;
295
296
while ((mu.stop != 1 )&& (try.no < 10 )){
296
297
last.beta <- beta
297
- output <- InverseLinftyOneRow(sigma , i , mu , maxiter = maxiter , threshold = threshold )
298
+ if (useC == FALSE ) {
299
+ output <- InverseLinftyOneRow(sigma , i , mu , maxiter = maxiter , threshold = threshold )
300
+ } else {
301
+ output <- InverseLinftyOneRowC(sigma , i , mu , maxiter = maxiter )
302
+ }
298
303
beta <- output $ optsol
299
304
iter <- output $ iter
300
305
if (isgiven == 1 ){
@@ -334,7 +339,7 @@ InverseLinfty <- function(sigma, n, e, resol=1.5, mu=NULL, maxiter=50, threshold
334
339
return (M )
335
340
}
336
341
337
- InverseLinftyOneRowC <- function (Sigma , i , mu , maxiter = 50 , threshold = 1e-2 ) {
342
+ InverseLinftyOneRowC <- function (Sigma , i , mu , maxiter = 50 ) {
338
343
339
344
p = nrow(Sigma )
340
345
basis_vector = rep(0 , p )
0 commit comments