SCM

SCM Repository

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

Diff of /pkg/R/dspMatrix.R

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

revision 1279, Tue May 23 08:01:11 2006 UTC revision 1280, Tue May 23 08:01:44 2006 UTC
# Line 1  Line 1 
1   ### Coercion and Methods for Symmetric Matrices   ### Coercion and Methods for Symmetric Matrices
2    
3  setAs("dspMatrix", "dsyMatrix",  setAs("dspMatrix", "dsyMatrix",
4        function(from) .Call("dspMatrix_as_dsyMatrix", from, PACKAGE = "Matrix"))        function(from) .Call(dspMatrix_as_dsyMatrix, from))
5    
6  ## dge <--> dsp   via  dsy  ## dge <--> dsp   via  dsy
7  setAs("dspMatrix", "dgeMatrix",  setAs("dspMatrix", "dgeMatrix",
# Line 19  Line 19 
19    
20  setMethod("rcond", signature(x = "dspMatrix", type = "character"),  setMethod("rcond", signature(x = "dspMatrix", type = "character"),
21            function(x, type, ...)            function(x, type, ...)
22            .Call("dspMatrix_rcond", x, type, PACKAGE = "Matrix"),            .Call(dspMatrix_rcond, x, type),
23            valueClass = "numeric")            valueClass = "numeric")
24    
25  setMethod("rcond", signature(x = "dspMatrix", type = "missing"),  setMethod("rcond", signature(x = "dspMatrix", type = "missing"),
26            function(x, type, ...)            function(x, type, ...)
27            .Call("dspMatrix_rcond", x, "O", PACKAGE = "Matrix"),            .Call(dspMatrix_rcond, x, "O"),
28            valueClass = "numeric")            valueClass = "numeric")
29    
30  setMethod("%*%", signature(x = "dspMatrix", y = "dgeMatrix"),  setMethod("%*%", signature(x = "dspMatrix", y = "dgeMatrix"),
31            function(x, y)            function(x, y)
32            .Call("dspMatrix_matrix_mm", x, y, TRUE, PACKAGE = "Matrix"),            .Call(dspMatrix_matrix_mm, x, y, TRUE),
33            valueClass = "dgeMatrix")            valueClass = "dgeMatrix")
34    
35  setMethod("%*%", signature(x = "dspMatrix", y = "matrix"),  setMethod("%*%", signature(x = "dspMatrix", y = "matrix"),
36            function(x, y)            function(x, y)
37            .Call("dspMatrix_matrix_mm", x, y, FALSE, PACKAGE = "Matrix"),            .Call(dspMatrix_matrix_mm, x, y, FALSE),
38            valueClass = "dgeMatrix")            valueClass = "dgeMatrix")
39    
40  ##setMethod("%*%", signature(x = "dspMatrix", y = "numeric"),  ##setMethod("%*%", signature(x = "dspMatrix", y = "numeric"),
41  ##          function(x, y)  ##          function(x, y)
42  ##          .Call("dspMatrix_matrix_mm", x, as.matrix(y), FALSE, PACKAGE = "Matrix"),  ##          .Call(dspMatrix_matrix_mm, x, as.matrix(y), FALSE),
43  ##          valueClass = "dgeMatrix")  ##          valueClass = "dgeMatrix")
44    
45  setMethod("%*%", signature(x = "dspMatrix", y = "integer"),  setMethod("%*%", signature(x = "dspMatrix", y = "integer"),
46            function(x, y) {            function(x, y) {
47                storage.mode(y) <- "double"                storage.mode(y) <- "double"
48                .Call("dspMatrix_matrix_mm", x, as.matrix(y), FALSE, PACKAGE = "Matrix")                .Call(dspMatrix_matrix_mm, x, as.matrix(y), FALSE)
49            }, valueClass = "dgeMatrix")            }, valueClass = "dgeMatrix")
50    
51  setMethod("solve", signature(a = "dspMatrix", b = "missing"),  setMethod("solve", signature(a = "dspMatrix", b = "missing"),
52            function(a, b, ...) .Call("dspMatrix_solve", a, PACKAGE = "Matrix"),            function(a, b, ...) .Call(dspMatrix_solve, a),
53            valueClass = "dspMatrix")            valueClass = "dspMatrix")
54    
55  setMethod("solve", signature(a = "dspMatrix", b = "matrix"),  setMethod("solve", signature(a = "dspMatrix", b = "matrix"),
56            function(a, b, ...)            function(a, b, ...)
57            .Call("dspMatrix_matrix_solve", a, b, FALSE, PACKAGE = "Matrix"),            .Call(dspMatrix_matrix_solve, a, b, FALSE),
58            valueClass = "dgeMatrix")            valueClass = "dgeMatrix")
59    
60  setMethod("solve", signature(a = "dspMatrix", b = "dgeMatrix"),  setMethod("solve", signature(a = "dspMatrix", b = "dgeMatrix"),
61            function(a, b, ...)            function(a, b, ...)
62            .Call("dspMatrix_matrix_solve", a, as(b,"matrix"), TRUE, PACKAGE = "Matrix"),            .Call(dspMatrix_matrix_solve, a, as(b,"matrix"), TRUE),
63            valueClass = "dgeMatrix")            valueClass = "dgeMatrix")
64    
65  ##setMethod("solve", signature(a = "dspMatrix", b = "numeric"),  ##setMethod("solve", signature(a = "dspMatrix", b = "numeric"),
66  ##        function(a, b, ...)  ##        function(a, b, ...)
67  ##        .Call("dspMatrix_matrix_solve", a, as.matrix(b), FALSE, PACKAGE = "Matrix"),  ##        .Call(dspMatrix_matrix_solve, a, as.matrix(b), FALSE),
68  ##        valueClass = "dgeMatrix")  ##        valueClass = "dgeMatrix")
69    
70  setMethod("solve", signature(a = "dspMatrix", b = "integer"),  setMethod("solve", signature(a = "dspMatrix", b = "integer"),
71            function(a, b, ...) {            function(a, b, ...) {
72                storage.mode(b) <- "double"                storage.mode(b) <- "double"
73                .Call("dspMatrix_matrix_solve", a, as.matrix(b), FALSE, PACKAGE = "Matrix")                .Call(dspMatrix_matrix_solve, a, as.matrix(b), FALSE)
74            }, valueClass = "dgeMatrix")            }, valueClass = "dgeMatrix")
75    
76  setMethod("norm", signature(x = "dspMatrix", type = "character"),  setMethod("norm", signature(x = "dspMatrix", type = "character"),
77            function(x, type, ...) .Call("dspMatrix_norm", x, type, PACKAGE = "Matrix"),            function(x, type, ...) .Call(dspMatrix_norm, x, type),
78            valueClass = "numeric")            valueClass = "numeric")
79    
80  setMethod("norm", signature(x = "dspMatrix", type = "missing"),  setMethod("norm", signature(x = "dspMatrix", type = "missing"),
81            function(x, type, ...) .Call("dspMatrix_norm", x, "O", PACKAGE = "Matrix"),            function(x, type, ...) .Call(dspMatrix_norm, x, "O"),
82            valueClass = "numeric")            valueClass = "numeric")
83    
84  setMethod("t", signature(x = "dspMatrix"),  setMethod("t", signature(x = "dspMatrix"),
# Line 95  Line 95 
95  ## FIXME: This gives an error for singular pos.SEMI-def. matrices:  ## FIXME: This gives an error for singular pos.SEMI-def. matrices:
96  setIs("dspMatrix", "dppMatrix",  setIs("dspMatrix", "dppMatrix",
97        test = function(obj)        test = function(obj)
98            "try-error" != class(try(.Call("dppMatrix_chol", obj, PACKAGE = "Matrix"), TRUE)),            "try-error" != class(try(.Call(dppMatrix_chol, obj), TRUE)),
99        replace = function(obj, value) {        replace = function(obj, value) {
100            ## copy all slots            ## copy all slots
101            for(n in slotNames(obj)) slot(obj, n) <- slot(value, n)            for(n in slotNames(obj)) slot(obj, n) <- slot(value, n)

Legend:
Removed from v.1279  
changed lines
  Added in v.1280

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