# SCM Repository

[matrix] Diff of /pkg/Matrix/tests/abIndex-tsts.R
 [matrix] / pkg / Matrix / tests / abIndex-tsts.R

# Diff of /pkg/Matrix/tests/abIndex-tsts.R

pkg/tests/abIndex-tsts.R revision 2507, Tue Dec 22 21:11:49 2009 UTC pkg/Matrix/tests/abIndex-tsts.R revision 2903, Tue Sep 10 16:21:29 2013 UTC
# Line 90  Line 90
90      for(ng in getGroupMembers(grMeth)) {      for(ng in getGroupMembers(grMeth)) {
91          cat(ng, ": ")          cat(ng, ": ")
92          G <- get(ng)          G <- get(ng)
93          t.tol <- if(ng == "/") 8e-16 else 0          t.tol <- if(ng == "/") 1e-12 else 0
94          ## now using special all.equal() method!          ## "/" with no long double (e.g. on Sparc Solaris): 1.125e-14
95          AEq <- function(a,b, ...) all.equal(a, b, tol=t.tol)          AEq <- function(a,b, ...) assert.EQ(a, b, tol=t.tol, giveRE=TRUE)
96          for(v in ex.) {          for(v in ex.) {
97              va <- as(v, "abIndex")              va <- as(v, "abIndex")
98              for(s in list(-1, 17L, TRUE, FALSE)) {# numeric *and* logical              for(s in list(-1, 17L, TRUE, FALSE)) # numeric *and* logical
99                  if(!(identical(s, FALSE) && ng == "/")) ## division by 0 often "fails"                  if(!((identical(s, FALSE) && ng == "/"))) { ## division by 0 may "fail"
100                  stopifnot(AEq(as(G(v, s), "abIndex"), G(va, s)),
101                            AEq(as(G(s, v), "abIndex"), G(s, va)))                      AEq(as(G(v, s), "abIndex"), G(va, s))
102                        AEq(as(G(s, v), "abIndex"), G(s, va))
103              }              }
104              cat(".")              cat(".")
105          }          }
# Line 106  Line 107
107      }      }
108  ##O }  ##O }
109
110    ## check the abIndex versions of  indDiag() and indTri() :
111    for(n in 1:7)
112        stopifnot(isValid(ii <- Matrix:::abIindDiag(n), "abIndex"),
113                  ii@kind == "rleDiff",
114                  Matrix:::indDiag(n) == as(ii, "numeric"))
115
116    for(n in 0:7)
117     for(diag in c(TRUE,FALSE))
118      for(upper in c(TRUE,FALSE))
119        stopifnot(isValid(ii <- Matrix:::abIindTri(n, diag=diag,upper=upper), "abIndex"),
120                  Matrix:::indTri(n, diag=diag,upper=upper) == as(ii, "numeric"))
121
122  cat('Time elapsed: ', (.pt <- proc.time()),'\n') # "stats"  cat('Time elapsed: ', (.pt <- proc.time()),'\n') # "stats"

Legend:
 Removed from v.2507 changed lines Added in v.2903

 root@r-forge.r-project.org ViewVC Help Powered by ViewVC 1.0.0
Thanks to: