SCM

SCM Repository

[matrix] Diff of /pkg/R/Auxiliaries.R
ViewVC logotype

Diff of /pkg/R/Auxiliaries.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1654, Fri Oct 27 16:58:15 2006 UTC revision 1665, Fri Nov 3 23:18:07 2006 UTC
# Line 623  Line 623 
623  }  }
624    
625    
 ## FIXME? -- this should also work for "ltT", "ntT", ... :  
626  diagU2N <- function(x)  diagU2N <- function(x)
627  {  {
628      ## Purpose: Transform a *unit diagonal* sparse triangular matrix      ## Purpose: Transform a *unit diagonal* sparse triangular matrix
629      ##  into one with explicit diagonal entries '1'      ##  into one with explicit diagonal entries '1'
630        if(is(x, "CsparseMatrix"))
631            return(.Call(Csparse_diagU2N, x))
632        ## else
633    
634        ## FIXME! -- for "ltT", "ntT", ... :
635      xT <- as(x, "dgTMatrix")      xT <- as(x, "dgTMatrix")
636      ## leave it as  T* - the caller can always coerce to C* if needed:      ## leave it as  T* - the caller can always coerce to C* if needed:
637      new("dtTMatrix", x = xT@x, i = xT@i, j = xT@j, Dim = x@Dim,      new("dtTMatrix", x = xT@x, i = xT@i, j = xT@j, Dim = x@Dim,
638          Dimnames = x@Dimnames, uplo = x@uplo, diag = "N")          Dimnames = x@Dimnames, uplo = x@uplo, diag = "N")
639  }  }
640    
641  ## FIXME: this should probably be dropped / replaced by as_Csparse  ## Needed, e.g., in ./Csparse.R for colSums() etc:
642  .as.dgC.Fun <- function(x, na.rm = FALSE, dims = 1) {  .as.dgC.Fun <- function(x, na.rm = FALSE, dims = 1) {
643      x <- as(x, "dgCMatrix")      x <- as(x, "dgCMatrix")
644      callGeneric()      callGeneric()
645  }  }
646    
647    .as.dgC.0.factors <- function(x) {
648        if(!is(x, "dgCMatrix"))
649            as(x, "dgCMatrix") # will not have 'factors'
650        else ## dgCMatrix
651            if(!length(x@factors)) x else { x@factors <- list() ; x }
652    }
653    
654  .as.dgT.Fun <- function(x, na.rm = FALSE, dims = 1) {  .as.dgT.Fun <- function(x, na.rm = FALSE, dims = 1) {
655      ## used e.g. inside colSums() etc methods      ## used e.g. inside colSums() etc methods
656      x <- as(x, "dgTMatrix")      x <- as(x, "dgTMatrix")

Legend:
Removed from v.1654  
changed lines
  Added in v.1665

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge