-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
It may be good to have a nodes (or perhaps blocks) method for symDMatrix()--a template is given below.
With this we could also generate a new interface for getG which uses task, nBlocks and task, as opposed to i and i2.
Gustavo
nodes.symDMatrix<-function(nBlocks,n){
chunkSize=ceiling(n/nBlocks)
nTasks=nBlocks*(nBlocks+1)/2
INDEX=matrix(nrow=nTasks,ncol=7,NA)
colnames(INDEX)=c('task','rowBlock','colBlock','rowIni','rowEnd','colIni','colEnd')
INDEX[,1]=1:nTasks
counter=0
for(i in 1:nBlocks){
for(j in i:nBlocks){
counter=counter+1
INDEX[counter,2]=i
INDEX[counter,3]=j
INDEX[counter,4]=(i-1)*chunkSize+1
INDEX[counter,5]=min(n,INDEX[counter,4]+chunkSize-1)
INDEX[counter,6]=(j-1)*chunkSize+1
INDEX[counter,7]=min(n,INDEX[counter,6]+chunkSize-1)
}
}
return(INDEX)
}
nodes.symDMatrix(5,21)
# And if we have the task
task=13
nodes.symDMatrix(5,13)[13,]