SCM

SCM Repository

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

Diff of /pkg/R/Tsparse.R

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

revision 1547, Mon Sep 11 14:49:39 2006 UTC revision 1548, Mon Sep 11 22:13:07 2006 UTC
# Line 18  Line 18 
18  setAs("dtTMatrix", "dtCMatrix",  setAs("dtTMatrix", "dtCMatrix",
19        function(from) .Call(Tsparse_to_Csparse, from, TRUE))        function(from) .Call(Tsparse_to_Csparse, from, TRUE))
20    
21    setAs("ngTMatrix", "ngCMatrix",
22          function(from) .Call(Tsparse_to_Csparse, from, FALSE))
23  setAs("lgTMatrix", "lgCMatrix",  setAs("lgTMatrix", "lgCMatrix",
24        function(from) .Call(Tsparse_to_Csparse, from, FALSE))        function(from) .Call(Tsparse_to_Csparse, from, FALSE))
25    
# Line 124  Line 126 
126                sel <- ip$m > 0                sel <- ip$m > 0
127                x@i <- ip$m[sel] - 1:1                x@i <- ip$m[sel] - 1:1
128                x@j <- x@j[sel]                x@j <- x@j[sel]
129                if (!is(x, "lsparseMatrix")) x@x <- x@x[sel]                if (!is(x, "nsparseMatrix")) x@x <- x@x[sel]
130                if (drop && any(x@Dim == 1:1)) drop(as(x,"matrix")) else x                if (drop && any(x@Dim == 1:1)) drop(as(x,"matrix")) else x
131            })            })
132    
# Line 139  Line 141 
141                sel <- ip$m > 0                sel <- ip$m > 0
142                x@i <- x@i[sel]                x@i <- x@i[sel]
143                x@j <- ip$m[sel] - 1:1                x@j <- ip$m[sel] - 1:1
144                if (!is(x, "lsparseMatrix")) x@x <- x@x[sel]                if (!is(x, "nsparseMatrix")) x@x <- x@x[sel]
145                if (drop && any(x@Dim == 1:1)) drop(as(x,"matrix")) else x                if (drop && any(x@Dim == 1:1)) drop(as(x,"matrix")) else x
146            })            })
147    
# Line 160  Line 162 
162            sel <- ip1$m > 0:0  &  ip2$m > 0:0            sel <- ip1$m > 0:0  &  ip2$m > 0:0
163            x@i <- ip1$m[sel] - 1:1            x@i <- ip1$m[sel] - 1:1
164            x@j <- ip2$m[sel] - 1:1            x@j <- ip2$m[sel] - 1:1
165            if (!is(x, "lsparseMatrix")) x@x <- x@x[sel]            if (!is(x, "nsparseMatrix")) x@x <- x@x[sel]
166            if (drop && any(nd == 1)) drop(as(x,"matrix")) else x            if (drop && any(nd == 1)) drop(as(x,"matrix")) else x
167        })        })
168    

Legend:
Removed from v.1547  
changed lines
  Added in v.1548

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