+ list("llh"=llh, "phi"=phi)
+ }
+
+ #Pour chaque lambda de la grille, on calcule les coefficients
+ out =
+ if (ncores > 1)
+ parLapply(cl, seq_along(glambda), computeAtLambda)
+ else
+ lapply(seq_along(glambda), computeAtLambda)
+
+ if (ncores > 1)
+ parallel::stopCluster(cl)
+
+ # TODO: this is a bit ugly. Better use bigmemory and fill llh/phi in-place
+ # (but this also adds a dependency...)
+ llh <- do.call( rbind, lapply(out, function(model) model$llh) )
+ phi <- do.call( rbind, lapply(out, function(model) model$phi) )
+ list("llh"=llh, "phi"=phi)