| Line 27... |
Line 27... |
| 27 |
|
27 |
|
| 28 |
## For multiplication operations, sparseMatrix overrides other method
|
28 |
## For multiplication operations, sparseMatrix overrides other method
|
| 29 |
## selections. Coerce a ddensematrix argument to a lsparseMatrix.
|
29 |
## selections. Coerce a ddensematrix argument to a lsparseMatrix.
|
| 30 |
|
30 |
|
| 31 |
setMethod("%*%", signature(x = "lsparseMatrix", y = "ldenseMatrix"),
|
31 |
setMethod("%*%", signature(x = "lsparseMatrix", y = "ldenseMatrix"),
|
| 32 |
function(x, y) callGeneric(x, as(y, "lsparseMatrix")))
|
32 |
function(x, y) x %*% as(y, "lsparseMatrix"))
|
| 33 |
|
33 |
|
| 34 |
setMethod("%*%", signature(x = "ldenseMatrix", y = "lsparseMatrix"),
|
34 |
setMethod("%*%", signature(x = "ldenseMatrix", y = "lsparseMatrix"),
|
| 35 |
function(x, y) callGeneric(as(x, "lsparseMatrix"), y))
|
35 |
function(x, y) as(x, "lsparseMatrix") %*% y)
|
| 36 |
|
36 |
|
| 37 |
setMethod("crossprod", signature(x = "lsparseMatrix", y = "ldenseMatrix"),
|
37 |
setMethod("crossprod", signature(x = "lsparseMatrix", y = "ldenseMatrix"),
|
| 38 |
function(x, y = NULL) callGeneric(x, as(y, "lsparseMatrix")))
|
38 |
function(x, y = NULL) crossprod(x, as(y, "lsparseMatrix")))
|
| 39 |
|
39 |
|
| 40 |
setMethod("crossprod", signature(x = "ldenseMatrix", y = "lsparseMatrix"),
|
40 |
setMethod("crossprod", signature(x = "ldenseMatrix", y = "lsparseMatrix"),
|
| 41 |
function(x, y = NULL) callGeneric(as(x, "lsparseMatrix"), y))
|
41 |
function(x, y = NULL) crossprod(as(x, "lsparseMatrix"), y))
|
| 42 |
|
42 |
|
| 43 |
## and coerce lsparse* to lgC*
|
43 |
## and coerce lsparse* to lgC*
|
| 44 |
setMethod("%*%", signature(x = "lsparseMatrix", y = "lsparseMatrix"),
|
44 |
setMethod("%*%", signature(x = "lsparseMatrix", y = "lsparseMatrix"),
|
| 45 |
function(x, y) callGeneric(as(x, "lgCMatrix"), as(y, "lgCMatrix")))
|
45 |
function(x, y) as(x, "lgCMatrix") %*% as(y, "lgCMatrix"))
|
| 46 |
|
46 |
|
| 47 |
setMethod("crossprod", signature(x = "lsparseMatrix", y = "lsparseMatrix"),
|
47 |
setMethod("crossprod", signature(x = "lsparseMatrix", y = "lsparseMatrix"),
|
| 48 |
function(x, y = NULL)
|
48 |
function(x, y = NULL)
|
| 49 |
callGeneric(as(x, "lgCMatrix"), as(y, "lgCMatrix")))
|
49 |
crossprod(as(x, "lgCMatrix"), as(y, "lgCMatrix")))
|
| 50 |
|
50 |
|
| 51 |
|
51 |
|
| 52 |
setMethod("all", signature(x = "lsparseMatrix"),
|
52 |
setMethod("all", signature(x = "lsparseMatrix"),
|
| 53 |
function(x, ..., na.rm = FALSE) {
|
53 |
function(x, ..., na.rm = FALSE) {
|
| 54 |
d <- x@Dim
|
54 |
d <- x@Dim
|