SCM

SCM Repository

[matrix] Diff of /pkg/tests/dtpMatrix.R
ViewVC logotype

Diff of /pkg/tests/dtpMatrix.R

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

revision 1166, Sun Jan 15 19:18:20 2006 UTC revision 1167, Sun Jan 15 21:13:54 2006 UTC
# Line 25  Line 25 
25  rc <- rcond(tp6)  rc <- rcond(tp6)
26  stopifnot(all.equal(c(D.$modulus), -6.579251212),  stopifnot(all.equal(c(D.$modulus), -6.579251212),
27            all.equal(rc, 1.791511257e-4),            all.equal(rc, 1.791511257e-4),
           rc == tp6@rcond,  
28            all.equal(norm(tp6, "I") , 2.45),            all.equal(norm(tp6, "I") , 2.45),
29            all.equal(norm(tp6, "1") , 1),            all.equal(norm(tp6, "1") , 1),
30            all.equal(norm(tp6, "F") , 1.37047826623)            all.equal(norm(tp6, "F") , 1.37047826623)
# Line 35  Line 34 
34  object.size(as(tp6, "matrix"))  object.size(as(tp6, "matrix"))
35  D6 <- as(diag(6), "dgeMatrix")  D6 <- as(diag(6), "dgeMatrix")
36  ge6 <- as(tp6, "dgeMatrix")  ge6 <- as(tp6, "dgeMatrix")
37  ## Direct all.equal() fails, because ge6 has 'rcond', but the product not:  stopifnot(all.equal(D6 %*% tp6, ge6),
38  mge6 <- as(ge6, "matrix")            all.equal(tp6 %*% D6, ge6))
 stopifnot(all.equal(as(D6 %*% tp6,"matrix"), mge6),  
           all.equal(as(tp6 %*% D6,"matrix"), mge6)  
           )  
39    
40  ## larger case  ## larger case
41  set.seed(123)  set.seed(123)
# Line 51  Line 47 
47  rcond(rl)# 0 !  rcond(rl)# 0 !
48  stopifnot(all.equal(as(rl %*% diag(1000),"matrix"),  stopifnot(all.equal(as(rl %*% diag(1000),"matrix"),
49                      as(rl, "matrix")))                      as(rl, "matrix")))
50  object.size(rl) ## 4 mio  object.size(rl) ## 4 MB
51  object.size(as(rl, "dtrMatrix"))# 8 mio  object.size(as(rl, "dtrMatrix"))# 8 MB
52  object.size(as(rl, "matrix"))# dito  object.size(as(rl, "matrix"))# ditto
53  determinant(rl)  determinant(rl)
54    
55    

Legend:
Removed from v.1166  
changed lines
  Added in v.1167

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