SCM

SCM Repository

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

Diff of /pkg/R/dtCMatrix.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  setMethod("t", signature(x = "dtCMatrix"),  setMethod("t", signature(x = "dtCMatrix"),
2            function(x) {            function(x) {
3                tg <- .Call("csc_transpose", x, PACKAGE = "Matrix")                tg <- .Call(csc_transpose, x)
4                new("dtCMatrix", Dim = tg@Dim, Dimnames = x@Dimnames[2:1],                new("dtCMatrix", Dim = tg@Dim, Dimnames = x@Dimnames[2:1],
5                    p = tg@p, i = tg@i, x = tg@x, diag = x@diag,                    p = tg@p, i = tg@i, x = tg@x, diag = x@diag,
6                    uplo = ifelse(x@uplo == "U", "L", "U"))                    uplo = ifelse(x@uplo == "U", "L", "U"))
# Line 32  Line 32 
32    
33  setAs("dtCMatrix", "dgTMatrix",  setAs("dtCMatrix", "dgTMatrix",
34        function(from)        function(from)
35        .Call("tsc_to_dgTMatrix", from, PACKAGE = "Matrix"))        .Call(tsc_to_dgTMatrix, from))
36    
37  setAs("dtCMatrix", "dgeMatrix",  setAs("dtCMatrix", "dgeMatrix",
38        function(from) as(as(from, "dgTMatrix"), "dgeMatrix"))        function(from) as(as(from, "dgTMatrix"), "dgeMatrix"))
# Line 63  Line 63 
63            function(a, b, ...) {            function(a, b, ...) {
64                if (a@diag == "U") {                if (a@diag == "U") {
65                    if (a@uplo == "U")                    if (a@uplo == "U")
66                        return(.Call("dtCMatrix_upper_solve", a,                        return(.Call(dtCMatrix_upper_solve, a,
67                                     PACKAGE = "Matrix"))                                     PACKAGE = "Matrix"))
68                    else                    else
69                        return(t(.Call("dtCMatrix_upper_solve", t(a),                        return(t(.Call(dtCMatrix_upper_solve, t(a),
70                                       PACKAGE = "Matrix")))                                       PACKAGE = "Matrix")))
71                }                }
72                .Call("dtCMatrix_solve", a, PACKAGE = "Matrix")                .Call(dtCMatrix_solve, a)
73            }, valueClass = "dtCMatrix")            }, valueClass = "dtCMatrix")
74    
75  setMethod("solve", signature(a = "dtCMatrix", b = "dgeMatrix"),  setMethod("solve", signature(a = "dtCMatrix", b = "dgeMatrix"),
76            function(a, b, ...) {            function(a, b, ...) {
77                if (a@diag == "U") a <- as(diagU2N(a), "dtCMatrix")                if (a@diag == "U") a <- as(diagU2N(a), "dtCMatrix")
78                .Call("dtCMatrix_matrix_solve", a, b, TRUE, PACKAGE = "Matrix")                .Call(dtCMatrix_matrix_solve, a, b, TRUE)
79            }, valueClass = "dgeMatrix")            }, valueClass = "dgeMatrix")
80    
81  setMethod("solve", signature(a = "dtCMatrix", b = "matrix"),  setMethod("solve", signature(a = "dtCMatrix", b = "matrix"),
82            function(a, b, ...) {            function(a, b, ...) {
83                if (a@diag == "U") a <- as(diagU2N(a), "dtCMatrix")                if (a@diag == "U") a <- as(diagU2N(a), "dtCMatrix")
84                storage.mode(b) <- "double"                storage.mode(b) <- "double"
85                .Call("dtCMatrix_matrix_solve", a, b, FALSE, PACKAGE = "Matrix")                .Call(dtCMatrix_matrix_solve, a, b, FALSE)
86            }, valueClass = "dgeMatrix")            }, valueClass = "dgeMatrix")
87    
88  setMethod("solve", signature(a = "dtCMatrix", b = "numeric"),  setMethod("solve", signature(a = "dtCMatrix", b = "numeric"),
89            function(a, b, ...) {            function(a, b, ...) {
90                if (a@diag == "U") a <- as(diagU2N(a), "dtCMatrix")                if (a@diag == "U") a <- as(diagU2N(a), "dtCMatrix")
91                .Call("dtCMatrix_matrix_solve", a, as.matrix(as.double(b)),                .Call(dtCMatrix_matrix_solve, a, as.matrix(as.double(b)),
92                      FALSE, PACKAGE = "Matrix")                      FALSE)
93            }, valueClass = "dgeMatrix")            }, valueClass = "dgeMatrix")

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 Powered By FusionForge