Rev 4639 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#### Superclass Methods for all sparse logical matricesif(FALSE) ## bug? in 'methods' - see ./nsparseMatrix.R :setAs("CsparseMatrix", "lsparseMatrix",function(from) as(.Call(Csparse_to_nz_pattern, from,is(from, "triangularMatrix")), "lsparseMatrix"))## substitute:setAs("CsparseMatrix", "lsparseMatrix",function(from) {cld <- getClassDef(class(from))if(extends(cld, "lsparseMatrix"))fromelse if(extends(cld, "nsparseMatrix"))as(from, "lsparseMatrix")elseas(.Call(Csparse_to_nz_pattern, from,extends(cld, "triangularMatrix")),"lsparseMatrix")})setAs("lsparseMatrix", "matrix",function(from) as(as(from, "ldenseMatrix"), "matrix"))###------- Work via as(*, lgC) : ------------## For multiplication operations, sparseMatrix overrides other method## selections. Coerce a ddensematrix argument to a lsparseMatrix.setMethod("%*%", signature(x = "lsparseMatrix", y = "ldenseMatrix"),function(x, y) x %*% as(y, "lsparseMatrix"))setMethod("%*%", signature(x = "ldenseMatrix", y = "lsparseMatrix"),function(x, y) as(x, "lsparseMatrix") %*% y)setMethod("crossprod", signature(x = "lsparseMatrix", y = "ldenseMatrix"),function(x, y = NULL) crossprod(x, as(y, "lsparseMatrix")))setMethod("crossprod", signature(x = "ldenseMatrix", y = "lsparseMatrix"),function(x, y = NULL) crossprod(as(x, "lsparseMatrix"), y))## and coerce lsparse* to lgC*setMethod("%*%", signature(x = "lsparseMatrix", y = "lsparseMatrix"),function(x, y) as(x, "lgCMatrix") %*% as(y, "lgCMatrix"))setMethod("crossprod", signature(x = "lsparseMatrix", y = "lsparseMatrix"),function(x, y = NULL)crossprod(as(x, "lgCMatrix"), as(y, "lgCMatrix")))setMethod("all", signature(x = "lsparseMatrix"),function(x, ..., na.rm = FALSE) {d <- x@Diml.x <- length(x@x)if(l.x == prod(d)) ## fully non-zeroall(x@x, ..., na.rm = na.rm)else if(is(x, "symmetricMatrix") && l.x == choose(d[1]+1, 2)) {if(.Generic %in% summGener1)all(x@x, ..., na.rm = na.rm)else all(as(x, "generalMatrix")@x, ..., na.rm = na.rm)}else FALSE ## has at least one structural 0})## setMethod("any", ) ---> ./lMatrix.R