| Line 21... |
Line 21... |
| 21 |
|
21 |
|
| 22 |
## For multiplication operations, sparseMatrix overrides other method
|
22 |
## For multiplication operations, sparseMatrix overrides other method
|
| 23 |
## selections. Coerce a ddensematrix argument to a lsparseMatrix.
|
23 |
## selections. Coerce a ddensematrix argument to a lsparseMatrix.
|
| 24 |
|
24 |
|
| 25 |
setMethod("%*%", signature(x = "nsparseMatrix", y = "ndenseMatrix"),
|
25 |
setMethod("%*%", signature(x = "nsparseMatrix", y = "ndenseMatrix"),
|
| 26 |
function(x, y) callGeneric(x, as(y, "nsparseMatrix")))
|
26 |
function(x, y) x %*% as(y, "nsparseMatrix"))
|
| 27 |
|
27 |
|
| 28 |
setMethod("%*%", signature(x = "ndenseMatrix", y = "nsparseMatrix"),
|
28 |
setMethod("%*%", signature(x = "ndenseMatrix", y = "nsparseMatrix"),
|
| 29 |
function(x, y) callGeneric(as(x, "nsparseMatrix"), y))
|
29 |
function(x, y) as(x, "nsparseMatrix") %*% y)
|
| 30 |
|
30 |
|
| 31 |
setMethod("crossprod", signature(x = "nsparseMatrix", y = "ndenseMatrix"),
|
31 |
setMethod("crossprod", signature(x = "nsparseMatrix", y = "ndenseMatrix"),
|
| 32 |
function(x, y = NULL) callGeneric(x, as(y, "nsparseMatrix")))
|
32 |
function(x, y = NULL) crossprod(x, as(y, "nsparseMatrix")))
|
| 33 |
|
33 |
|
| 34 |
setMethod("crossprod", signature(x = "ndenseMatrix", y = "nsparseMatrix"),
|
34 |
setMethod("crossprod", signature(x = "ndenseMatrix", y = "nsparseMatrix"),
|
| 35 |
function(x, y = NULL) callGeneric(as(x, "nsparseMatrix"), y))
|
35 |
function(x, y = NULL) crossprod(as(x, "nsparseMatrix"), y))
|
| 36 |
|
36 |
|
| 37 |
## and coerce lsparse* to lgC*
|
37 |
## and coerce lsparse* to lgC*
|
| 38 |
setMethod("%*%", signature(x = "nsparseMatrix", y = "nsparseMatrix"),
|
38 |
setMethod("%*%", signature(x = "nsparseMatrix", y = "nsparseMatrix"),
|
| 39 |
function(x, y) callGeneric(as(x, "ngCMatrix"), as(y, "ngCMatrix")))
|
39 |
function(x, y) as(x, "ngCMatrix") %*% as(y, "ngCMatrix"))
|
| 40 |
|
40 |
|
| 41 |
setMethod("crossprod", signature(x = "nsparseMatrix", y = "nsparseMatrix"),
|
41 |
setMethod("crossprod", signature(x = "nsparseMatrix", y = "nsparseMatrix"),
|
| 42 |
function(x, y = NULL)
|
42 |
function(x, y = NULL)
|
| 43 |
callGeneric(as(x, "ngCMatrix"), as(y, "ngCMatrix")))
|
43 |
crossprod(as(x, "ngCMatrix"), as(y, "ngCMatrix")))
|