SCM

SCM Repository

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

Diff of /pkg/R/ldenseMatrix.R

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

revision 1225, Mon Mar 13 14:06:17 2006 UTC revision 1226, Mon Mar 13 14:07:58 2006 UTC
# Line 62  Line 62 
62            else stop("not a symmetric matrix")            else stop("not a symmetric matrix")
63        })        })
64    
65    setAs("lgeMatrix", "ltrMatrix",
66          function(from) {
67              if(isT <- isTriangular(from))
68                  new("ltrMatrix", x = from@x, Dim = from@Dim,
69                      Dimnames = from@Dimnames, uplo = attr(isT, "kind"))
70              ## TODO: also check 'diag'
71              else stop("not a triangular matrix")
72          })
73    
74    
75  ###  ldense* <-> "matrix" :  ###  ldense* <-> "matrix" :
76    
# Line 81  Line 90 
90    
91  ## 2) base others on "lge*":  ## 2) base others on "lge*":
92    
 ## Useful if this was called e.g. for as(*, "lsyMatrix"), but it isn't:  
 setAs("matrix", "ldenseMatrix", function(from) as(from, "lgeMatrix"))  
93  setAs("matrix", "lsyMatrix",  setAs("matrix", "lsyMatrix",
94        function(from) as(as(from, "lgeMatrix"), "lsyMatrix"))        function(from) as(as(from, "lgeMatrix"), "lsyMatrix"))
95    setAs("matrix", "lspMatrix",
96          function(from) as(as(from, "lsyMatrix"), "lspMatrix"))
97    setAs("matrix", "ltrMatrix",
98          function(from) as(as(from, "lgeMatrix"), "ltrMatrix"))
99    setAs("matrix", "ltpMatrix",
100          function(from) as(as(from, "ltrMatrix"), "ltpMatrix"))
101    
102    ## Useful if this was called e.g. for as(*, "lsyMatrix"), but it isn't
103    setAs("matrix", "ldenseMatrix", function(from) as(from, "lgeMatrix"))
104    
105  setAs("ldenseMatrix", "matrix", ## uses the above l*M. -> lgeM.  setAs("ldenseMatrix", "matrix", ## uses the above l*M. -> lgeM.
106        function(from) as(as(from, "lgeMatrix"), "matrix"))        function(from) as(as(from, "lgeMatrix"), "matrix"))
# Line 142  Line 158 
158    
159  setMethod("as.vector", signature(x = "ldenseMatrix", mode = "missing"),  setMethod("as.vector", signature(x = "ldenseMatrix", mode = "missing"),
160            function(x) as(x, "lgeMatrix")@x)            function(x) as(x, "lgeMatrix")@x)
   

Legend:
Removed from v.1225  
changed lines
  Added in v.1226

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