SCM

SCM Repository

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

Diff of /pkg/Matrix/R/Matrix.R

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

revision 3019, Sat Oct 11 20:51:53 2014 UTC revision 3020, Tue Oct 14 16:14:02 2014 UTC
# Line 110  Line 110 
110  setMethod("isDiagonal", signature(object = "matrix"), .is.diagonal)  setMethod("isDiagonal", signature(object = "matrix"), .is.diagonal)
111    
112  ## The "catch all" methods -- far from optimal:  ## The "catch all" methods -- far from optimal:
113  setMethod("symmpart", signature(x = "Matrix"),  setMethod("symmpart", signature(x = "Matrix"), function(x)
114            function(x) as((x + t(x))/2, "symmetricMatrix"))      as(symmetrizeDimnames(x + t(x))/2, "symmetricMatrix"))
115  setMethod("skewpart", signature(x = "Matrix"),  setMethod("skewpart", signature(x = "Matrix"), function(x) symmetrizeDimnames(x - t(x))/2)
           function(x) (x - t(x))/2)  
116    
117  ## FIXME: do this (similarly as for "ddense.." in C  ## FIXME: do this (similarly as for "ddense.." in C
118  setMethod("symmpart", signature(x = "matrix"), function(x) (x + t(x))/2)  setMethod("symmpart", signature(x = "matrix"), function(x) symmetrizeDimnames(x + t(x))/2)
119  setMethod("skewpart", signature(x = "matrix"), function(x) (x - t(x))/2)  setMethod("skewpart", signature(x = "matrix"), function(x) symmetrizeDimnames(x - t(x))/2)
120    
121    
122  if(getRversion() >= "3.1.0")  if(getRversion() >= "3.1.0")
# Line 143  Line 142 
142          !(is.null(v2 <- value[[2]]) || length(v2) == d[2]))          !(is.null(v2 <- value[[2]]) || length(v2) == d[2]))
143          stop(gettextf("invalid dimnames given for %s object", dQuote(class(x))),          stop(gettextf("invalid dimnames given for %s object", dQuote(class(x))),
144               domain=NA)               domain=NA)
145      x@Dimnames <- list(if(!is.null(v1)) as.character(v1),      x@Dimnames <- # preserve names(value)!
146                         if(!is.null(v2)) as.character(v2))          lapply(value, function(v) if(!is.null(v)) as.character(v))
147      x      x
148  }  }
149  setMethod("dimnames<-", signature(x = "Matrix", value = "list"),  setMethod("dimnames<-", signature(x = "Matrix", value = "list"),

Legend:
Removed from v.3019  
changed lines
  Added in v.3020

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