# 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

revision 2497, Sat Nov 14 21:36:25 2009 UTC revision 2500, Fri Nov 20 13:22:17 2009 UTC
# Line 7  Line 7
7  str(ab)  str(ab)
8
9  set.seed(1)  set.seed(1)
10  ex. <- list(2:1000, 0:10, sample(100), c(-3:40, 20:70))  ex. <- list(2:1000, 0:10, sample(100), c(-3:40, 20:70),
11                c(1:100,77L, 50:40, 10L), c(17L, 3L*(12:3)))
12  ## we know which kinds will come out: "compressed" for all but random:  ## we know which kinds will come out: "compressed" for all but random:
13  rD <- "rleDiff"; kinds <- c(rD,rD,"int32", rD)  rD <- "rleDiff"; kinds <- c(rD,rD,"int32", rD, rD, rD)
14  isCmpr <- kinds == rD  isCmpr <- kinds == rD
15  ab. <- lapply(ex., as, Class = "abIndex")  ab. <- lapply(ex., as, Class = "abIndex")
16  nu. <- lapply(ab., as, Class = "numeric")  nu. <- lapply(ab., as, Class = "numeric")
# Line 23  Line 24
24            ## Check that the relevant cases really *are* "compressed":            ## Check that the relevant cases really *are* "compressed":
25            sapply(ab., slot, "kind") == kinds,            sapply(ab., slot, "kind") == kinds,
26            ## Using rle(diff(.)) is equivalent to using our C code:            ## Using rle(diff(.)) is equivalent to using our C code:
27            identical(rles, r.x)            identical(rles, r.x),
28            )            ## Checking Group Methods - "Summary" :
29              sapply(ab., range) == sapply(ex., range),
30              sapply(ab., any) == sapply(ex., any),
31              TRUE)
32
33  for(n in 1:120) {  for(n in 1:120) {
34      cat(".")      cat(".")
# Line 45  Line 49
49  }  }
50
51  cat('Time elapsed: ', (.pt <- proc.time()),'\n') # "stats"  cat('Time elapsed: ', (.pt <- proc.time()),'\n') # "stats"

Legend:
 Removed from v.2497 changed lines Added in v.2500