SCM

SCM Repository

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

Diff of /pkg/tests/dpoMatrix.R

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

revision 656, Wed Mar 16 16:55:32 2005 UTC revision 657, Wed Mar 16 16:57:52 2005 UTC
# Line 2  Line 2 
2    
3  library(Matrix)  library(Matrix)
4    
 stopifnot(c(0,0) == dim(Hilbert(0)))  
5    
6  h9 <- Hilbert(9)  h9 <- Hilbert(9)
7    stopifnot(c(0,0) == dim(Hilbert(0)),
8              c(9,9) == h9)
9  str(h9)  str(h9)
10  all.equal(determinant(h9)$modulus, -96.7369450737858, tol= 1e-15)  all.equal(determinant(h9)$modulus, -96.7369450737858, tol= 1e-15)
11    ##-> TRUE only on some platforms; seen relative difference of 10^-8
12  stopifnot(0 == length(h9@factors))# nothing yet  stopifnot(0 == length(h9@factors))# nothing yet
13  str(f9 <- as(chol(h9), "dtrMatrix"))  str(f9 <- as(chol(h9), "dtrMatrix"))
14  ## h9 now has factorization  ## h9 now has factorization
15  stopifnot(names(h9@factors) == "Cholesky")  stopifnot(names(h9@factors) == "Cholesky",
16  stopifnot(all.equal(rcond(h9), 9.0938e-13))            all.equal(rcond(h9), 9.0938e-13),
17  stopifnot(all.equal(rcond(f9), 9.1272e-7, tol = 1e-6))# more precision fails            all.equal(rcond(f9), 9.1272e-7, tol = 1e-6))# more precision fails
18  str(h9)# has 'rcond' and 'factors'  str(h9)# has 'rcond' and 'factors'
19  options(digits=4)  options(digits=4)
20  (cf9 <- crossprod(f9))# looks the same as  h9 :  (cf9 <- crossprod(f9))# looks the same as  h9 :
# Line 20  Line 22 
22                      as(cf9,"matrix"), tol= 1e-15))                      as(cf9,"matrix"), tol= 1e-15))
23    
24  str(hp9 <- as(h9, "dppMatrix"))  str(hp9 <- as(h9, "dppMatrix"))
25    
26  (s9 <- solve(hp9, seq(nrow(hp9))))  (s9 <- solve(hp9, seq(nrow(hp9))))
27  hp9 %*% s9  hp9 %*% s9
28    

Legend:
Removed from v.656  
changed lines
  Added in v.657

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