SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/R/diagMatrix.R
ViewVC logotype

Diff of /pkg/Matrix/R/diagMatrix.R

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

revision 1682, Fri Dec 1 18:42:40 2006 UTC revision 1707, Thu Dec 21 08:03:05 2006 UTC
# Line 387  Line 387 
387            function(x, y = NULL) { y <- as(y, "sparseMatrix"); callGeneric() })            function(x, y = NULL) { y <- as(y, "sparseMatrix"); callGeneric() })
388    
389    
390    ## cbind/rbind:  preserve sparseness {not always optimal}
391    
392    ## hack to suppress the obnoxious dispatch ambiguity warnings:
393    diag2Sp <- function(x) suppressWarnings(as(x, "CsparseMatrix"))
394    
395    ## in order to evade method dispatch ambiguity, but still remain "general"
396    ## we use this hack instead of signature  x = "diagonalMatrix"
397    for(cls in names(getClass("diagonalMatrix")@subclasses)) {
398     setMethod("cbind2", signature(x = cls, y = "matrix"),
399               function(x,y) cbind2(diag2Sp(x), as_Csparse(y)))
400     setMethod("cbind2", signature(x = "matrix", y = cls),
401               function(x,y) cbind2(as_Csparse(x), diag2Sp(y)))
402     setMethod("rbind2", signature(x = cls, y = "matrix"),
403               function(x,y) rbind2(diag2Sp(x), as_Csparse(y)))
404     setMethod("rbind2", signature(x = "matrix", y = cls),
405               function(x,y) rbind2(as_Csparse(x), diag2Sp(y)))
406    }
407    
408    
409  ## similar to prTriang() in ./Auxiliaries.R :  ## similar to prTriang() in ./Auxiliaries.R :

Legend:
Removed from v.1682  
changed lines
  Added in v.1707

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