# SCM Repository

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

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

revision 2345, Wed Mar 11 18:41:28 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.2345 changed lines Added in v.2363