SCM

SCM Repository

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

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

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

revision 2362, Tue Apr 7 09:44:11 2009 UTC revision 2363, Thu Apr 9 20:45:32 2009 UTC
# Line 338  Line 338 
338      x <- if(missing(i))      x <- if(missing(i))
339          x[, j, drop=drop]          x[, j, drop=drop]
340      else if(missing(j))      else if(missing(j))
341          x[i, , drop=drop]          if(nargs() == 4) x[i, , drop=drop] else x[i, drop=drop]
342      else      else
343          x[i,j, drop=drop]          x[i,j, drop=drop]
344      if(isS4(x) && isDiagonal(x)) as(x, "diagonalMatrix") else x      if(isS4(x) && isDiagonal(x)) as(x, "diagonalMatrix") else x
# Line 348  Line 348 
348                           j = "index", drop = "logical"), subDiag)                           j = "index", drop = "logical"), subDiag)
349  setMethod("[", signature(x = "diagonalMatrix", i = "index",  setMethod("[", signature(x = "diagonalMatrix", i = "index",
350                          j = "missing", drop = "logical"),                          j = "missing", drop = "logical"),
351            function(x, i, j, ..., drop) subDiag(x, i=i, drop=drop))            function(x, i, j, ..., drop) {
352                  na <- nargs()
353                  Matrix.msg("diag[i,m,l] : nargs()=", na, .M.level = 2)
354                  if(na == 4)
355                       subDiag(x, i=i, , drop=drop)
356                  else subDiag(x, i=i,   drop=drop)
357              })
358  setMethod("[", signature(x = "diagonalMatrix", i = "missing",  setMethod("[", signature(x = "diagonalMatrix", i = "missing",
359                           j = "index", drop = "logical"),                           j = "index", drop = "logical"),
360            function(x, i, j, ..., drop) subDiag(x, j=j, drop=drop))            function(x, i, j, ..., drop) subDiag(x, j=j, drop=drop))
# Line 676  Line 682 
682          isNum <- (is.numeric(r) || is.numeric(r00))          isNum <- (is.numeric(r) || is.numeric(r00))
683          isLog <- (is.logical(r) || is.logical(r00))          isLog <- (is.logical(r) || is.logical(r00))
684    
685          if(getOption("verbose"))          Matrix.msg("exploding   <diag>  o  <diag>  into dense matrix")
             message("exploding  <diag>  o  <diag>  into dense matrix")  
686          d <- e1@Dim          d <- e1@Dim
687          n <- d[1]          n <- d[1]
688          stopifnot(length(r) == n)          stopifnot(length(r) == n)

Legend:
Removed from v.2362  
changed lines
  Added in v.2363

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