Giter VIP home page Giter VIP logo

Comments (5)

agrueneberg avatar agrueneberg commented on June 7, 2024

Another option, instead of manually adding chunks to an existing mmMatrix, would be to create a whole new one that combines all input parameters of rbind or cbind. This would allow for both functions to be easily implemented and for multiple mmMatrix arguments, and also result in leaner chunking (our main overhead).

from bgdata.

agrueneberg avatar agrueneberg commented on June 7, 2024

We also have to decide whether to get the current storage location of an mmMatrix via an attribute of the mmMatrix (which impacts portability as we cannot always guarantee accuracy of that value since an mmMatrix can be loaded directly using load) or as a separate parameter (which would be unusual for an *bind method).

from bgdata.

agrueneberg avatar agrueneberg commented on June 7, 2024

Looks like additional parameters can be added to the *bind methods. vmode, folderOut, nChunks, and dimorder would be nice.

from bgdata.

agrueneberg avatar agrueneberg commented on June 7, 2024

Here's an initial draft for rbind for rmmMatrix:

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.

from bgdata.

agrueneberg avatar agrueneberg commented on June 7, 2024

I'll reopen this in the LinkedMatrix repository.

from bgdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.