-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rbind and cbind methods for mmMatrix #5
Comments
Another option, instead of manually adding chunks to an existing |
We also have to decide whether to get the current storage location of an |
Looks like additional parameters can be added to the |
Here's an initial draft for rbind.rmmMatrix<-function(...,vmode='byte',folderOut=NULL,nChunks=NULL,dimorder=c(2,1),deparse.level=1){
allargs<-list(...)
alldims<-unique(sapply(allargs,function(arg){
dims<-dim(arg)
if(is.null(dims)){
c(1, length(arg))
}else{
dims
}
}))
numcols<-unique(alldims[2,])
if(length(numcols)>1){
stop('all params need the same number of columns')
}
numrows<-sum(alldims[1,])
mmmatrix<-rmmMatrix(nrow=numrows,ncol=numcols,vmode=vmode,folderOut=folderOut,nChunks=nChunks,dimorder=dimorder)
currow<-1
for(arg in 1:ncol(alldims)){
argrows<-alldims[1,arg]
for(argrow in 1:argrows){
if(argrows>1){
mmmatrix[currow,]<-allargs[[arg]][argrow,]
}else{
mmmatrix[currow,]<-allargs[[arg]]
}
currow<-currow+1
}
}
mmmatrix
} Let me know what you think. In the meantime I will time it out for larger matrices. There is are some possible performance improvements when copying more than one row at the same time. |
I'll reopen this in the LinkedMatrix repository. |
rbind
will be easy forrmmMatrix
,cbind
forcmmMatrix
. The other ones will be tricky and probably involve creating new chunks.The text was updated successfully, but these errors were encountered: