diff --git a/vignettes/Iterating_Over_Loci.Rmd b/vignettes/Iterating_Over_Loci.Rmd index 657c4ae..f8dafe2 100644 --- a/vignettes/Iterating_Over_Loci.Rmd +++ b/vignettes/Iterating_Over_Loci.Rmd @@ -20,30 +20,29 @@ Here show how to use \pkg{kalis} to efficiently iterate over loci sequentially. ```{r, results='hide'} require(kalis) -# -# total.nthreads <- 4 -# n.checkpoints <- 7 -# -# nthreads <- as.integer(0:(total.nthreads-1)) -# CacheHaplotypes(SmallHaps) -# -# m <- rbeta(L()-1,1,10)*1e-6 -# pars <- Parameters(CalcRho(cM = m, s = 1, gamma = 1), mu = 1e-8, use.speidel = TRUE) -# -# fwd <- MakeForwardTable(pars) -# bck <- MakeBackwardTable(pars) -# M <- matrix(0,N(),N()) -# -# Iter <- ForwardIterator(pars,n.checkpoints) -# -# start.time <- proc.time() -# -# for(t in L():1){ -# Iter(fwd,pars,t,nthreads = nthreads) -# Backward(bck,pars,t, nthreads = nthreads) -# # Optional: DistMat(fwd,bck,M,type="minus.min", nthreads = total.nthreads) -# print(paste("At locus",t)) -# } -# -# print(proc.time() - start.time) + +n.checkpoints <- 7 + +nthreads <- 4 +CacheHaplotypes(SmallHaps) + +m <- rbeta(L()-1,1,10)*1e-6 +pars <- Parameters(CalcRho(cM = m, s = 1, gamma = 1), mu = 1e-8, use.speidel = TRUE) + +fwd <- MakeForwardTable(pars) +bck <- MakeBackwardTable(pars) +M <- matrix(0,N(),N()) + +Iter <- ForwardIterator(pars,n.checkpoints) + +start.time <- proc.time() + +for(t in L():1){ + Iter(fwd,pars,t,nthreads = nthreads) + Backward(bck,pars,t, nthreads = nthreads) + if(t==200){plot(DistMat(fwd,bck,M,type="minus.min", nthreads = nthreads))} + print(paste("At locus",t)) +} + +print(proc.time() - start.time) ``` \ No newline at end of file