SCM

SCM Repository

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

Diff of /pkg/R/Matrix.R

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

revision 848, Thu Aug 11 07:41:59 2005 UTC revision 868, Fri Aug 19 17:01:11 2005 UTC
# Line 97  Line 97 
97  setMethod("solve", signature(a = "Matrix", b = "numeric"),  setMethod("solve", signature(a = "Matrix", b = "numeric"),
98            function(a, b, ...) callGeneric(a, as.matrix(b)))            function(a, b, ...) callGeneric(a, as.matrix(b)))
99    
100    ## Subsetting : The "missing" cases can be dealt with here, "at the top":
101    
102    ## "x[]":
103    setMethod("[", signature(x = "Matrix",
104                             i = "missing", j = "missing", drop = "ANY"),
105              function (x, i, j, drop) x)
106    
107    ## missing 'drop' --> 'drop = TRUE'
108    ##                     -----------
109    ## select rows
110    setMethod("[", signature(x = "Matrix", i = "numeric", j = "missing",
111                             drop = "missing"),
112              function(x,i,j, drop) callGeneric(x, i=i, drop= TRUE))
113    ## select columns
114    setMethod("[", signature(x = "Matrix", i = "missing", j = "numeric",
115                             drop = "missing"),
116              function(x,i,j, drop) callGeneric(x, j=j, drop= TRUE))
117    setMethod("[", signature(x = "Matrix", i = "numeric", j = "numeric",
118                             drop = "missing"),
119              function(x,i,j, drop) callGeneric(x, i=i, j=j, drop= TRUE))
120    
121    
122    ## "FIXME:"
123    ## How can we get at   A[ ij ]  where ij is (i,j) 2-column matrix?
124    ##  and                A[ LL ]  where LL is a logical *vector*
125    
126    
127    
128    
129  if(FALSE) ## The following can't work as long as cbind is function(..., *)  if(FALSE) ## The following can't work as long as cbind is function(..., *)
130  setMethod("cbind", signature(a = "Matrix", b = "Matrix"),  setMethod("cbind", signature(a = "Matrix", b = "Matrix"),
131            function(a, b, ...) {            function(a, b, ...) {
# Line 105  Line 134 
134                if(da[1] != db[1])                if(da[1] != db[1])
135                    stop("Matrices must have same number of rows for cbind()ing")                    stop("Matrices must have same number of rows for cbind()ing")
136            })            })
137    
138    
139    

Legend:
Removed from v.848  
changed lines
  Added in v.868

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