- #TODO: parameter ncores (chaque tâche peut aussi demander du parallélisme...)
- cl = parallel::makeCluster( parallel::detectCores() / 4 )
- parallel::clusterExport(cl=cl,
- varlist=c("phiInit","rhoInit","gamInit","mini","maxi","glambda","X","Y","seuil","tau"),
- envir=environment())
- #Pour chaque lambda de la grille, on calcule les coefficients
- out = parLapply( seq_along(glambda), function(lambdaindex)
+ if (ncores > 1)
+ {
+ cl = parallel::makeCluster(ncores)
+ parallel::clusterExport(cl=cl,
+ varlist=c("phiInit","rhoInit","gamInit","mini","maxi","glambda","X","Y","thresh","tau"),
+ envir=environment())
+ }
+
+ # Calcul pour un lambda
+ computeCoefs <-function(lambda)