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 2633, Sun Dec 12 21:23:17 2010 UTC revision 2674, Fri Jun 10 21:56:20 2011 UTC
# Line 619  Line 619 
619      dx <- dim(x <- .Call(Csparse_diagU2N, x))      dx <- dim(x <- .Call(Csparse_diagU2N, x))
620      dy <- dim(y)      dy <- dim(y)
621      if(dx[2] != dy[1]) stop("non-matching dimensions")      if(dx[2] != dy[1]) stop("non-matching dimensions")
622        if(y@diag == "N") {
623            if(!all(y@x[1L] == y@x[-1L]) && is(x, "symmetricMatrix"))
624                x <- as(x, "generalMatrix")
625      ind <- rep.int(seq_len(dx[2]), x@p[-1] - x@p[-dx[2]-1L])      ind <- rep.int(seq_len(dx[2]), x@p[-1] - x@p[-dx[2]-1L])
     if(y@diag == "N")  
626          x@x <- x@x * y@x[ind]          x@x <- x@x * y@x[ind]
627        }
628      if(is(x, "compMatrix") && length(xf <- x@factors)) {      if(is(x, "compMatrix") && length(xf <- x@factors)) {
629          ## instead of dropping all factors, be smart about some          ## instead of dropping all factors, be smart about some
630          ## TODO ......          ## TODO ......
# Line 634  Line 637 
637      dx <- dim(x)      dx <- dim(x)
638      dy <- dim(y <- .Call(Csparse_diagU2N, y))      dy <- dim(y <- .Call(Csparse_diagU2N, y))
639      if(dx[2] != dy[1]) stop("non-matching dimensions")      if(dx[2] != dy[1]) stop("non-matching dimensions")
640      if(x@diag == "N")      if(x@diag == "N") {
641            if(!all(x@x[1L] == x@x[-1L]) && is(y, "symmetricMatrix"))
642                y <- as(y, "generalMatrix")
643          y@x <- y@x * x@x[y@i + 1L]          y@x <- y@x * x@x[y@i + 1L]
644        }
645      if(is(y, "compMatrix") && length(yf <- y@factors)) {      if(is(y, "compMatrix") && length(yf <- y@factors)) {
646          ## instead of dropping all factors, be smart about some          ## instead of dropping all factors, be smart about some
647          ## TODO          ## TODO

Legend:
Removed from v.2633  
changed lines
  Added in v.2674

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