SCM

SCM Repository

[matrix] Annotation of /pkg/tests/indexing.R
ViewVC logotype

Annotation of /pkg/tests/indexing.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1833 - (view) (download)

1 : maechler 1710 ## For both 'Extract' ("[") and 'Replace' ("[<-") Method testing
2 : maechler 687
3 :     library(Matrix)
4 :    
5 : maechler 907 source(system.file("test-tools.R", package = "Matrix"))# identical3() etc
6 : maechler 687
7 : maechler 873 ### Dense Matrices
8 :    
9 : maechler 1673 m <- Matrix(1:28 +0, nrow = 7)
10 :     validObject(m)
11 : maechler 873 stopifnot(identical(m, m[]),
12 :     identical(m[2, 3], 16), # simple number
13 :     identical(m[2, 3:4], c(16,23))) # simple numeric of length 2
14 : maechler 687
15 : maechler 873 m[2, 3:4, drop=FALSE] # sub matrix of class 'dgeMatrix'
16 :     m[-(4:7), 3:4] # dito; the upper right corner of 'm'
17 : maechler 687
18 : maechler 873 ## rows or columns only:
19 :     m[1,] # first row, as simple numeric vector
20 :     m[,2] # 2nd column
21 :     m[,1:2] # sub matrix of first two columns
22 :     m[-(1:6),, drop=FALSE] # not the first 6 rows, i.e. only the 7th
23 : maechler 1331 m[integer(0),] #-> 0 x 4 Matrix
24 :     m[2:4, numeric(0)] #-> 3 x 0 Matrix
25 : maechler 687
26 : maechler 873 ## logical indexing
27 :     stopifnot(identical(m[2,3], m[(1:nrow(m)) == 2, (1:ncol(m)) == 3]),
28 :     identical(m[2,], m[(1:nrow(m)) == 2, ]),
29 :     identical(m[,3:4], m[, (1:4) >= 3]))
30 :    
31 : maechler 886 ## dimnames indexing:
32 :     mn <- m
33 :     dimnames(mn) <- list(paste("r",letters[1:nrow(mn)],sep=""),
34 :     LETTERS[1:ncol(mn)])
35 :     mn["rd", "D"]
36 : maechler 1226 stopifnot(identical(mn["rc", "D"], mn[3,4]), mn[3,4] == 24,
37 :     identical(mn[, "A"], mn[,1]), mn[,1] == 1:7,
38 : maechler 886 identical(mn[c("re", "rb"), "B"], mn[c(5,2), 2])
39 :     )
40 : maechler 873
41 : maechler 886 mo <- m
42 :     m[2,3] <- 100
43 :     m[1:2, 4] <- 200
44 :     m[, 1] <- -1
45 :     m[1:3,]
46 :    
47 : maechler 1673 m. <- as.matrix(m)
48 :    
49 :     ## m[ cbind(i,j) ] indexing:
50 :     ij <- cbind(1:6, 2:3)
51 :     stopifnot(identical(m[ij], m.[ij]))
52 :    
53 : maechler 1599 ## testing operations on logical Matrices rather more than indexing:
54 : maechler 1226 g10 <- m [ m > 10 ]
55 :     stopifnot(18 == length(g10))
56 : maechler 1362 stopifnot(10 == length(m[ m <= 10 ]))
57 : maechler 1599 sel <- (20 < m) & (m < 150)
58 : maechler 1655 sel.<- (20 < m.)& (m.< 150)
59 : maechler 1599 nsel <-(20 >= m) | (m >= 150)
60 : maechler 1575 (ssel <- as(sel, "sparseMatrix"))
61 :     stopifnot(is(sel, "lMatrix"), is(ssel, "lsparseMatrix"),
62 : maechler 1655 identical3(as.mat(sel.), as.mat(sel), as.mat(ssel)),
63 :     identical3(!sel, !ssel, nsel), # !<sparse> is typically dense
64 : maechler 1599 identical3(m[ sel], m[ ssel], as.matrix(m)[as.matrix( ssel)]),
65 :     identical3(m[!sel], m[!ssel], as.matrix(m)[as.matrix(!ssel)])
66 : maechler 1575 )
67 : maechler 873
68 : maechler 1575 ## more sparse Matrices --------------------------------------
69 : maechler 873
70 : maechler 687 m <- 1:800
71 :     set.seed(101) ; m[sample(800, 600)] <- 0
72 :     m <- Matrix(m, nrow = 40)
73 :     mm <- as(m, "matrix")
74 :     dimnames(mm) <- NULL ## << workaround: as(<sparse>, "matrix") has NULL dimnames
75 :     str(mC <- as(m, "dgCMatrix"))
76 :     str(mT <- as(m, "dgTMatrix"))
77 :     stopifnot(identical(mT, as(mC, "dgTMatrix")),
78 :     identical(mC, as(mT, "dgCMatrix")))
79 :    
80 :     mC[,1]
81 :     mC[1:2,]
82 : maechler 925 mC[7, drop = FALSE]
83 : maechler 1226 assert.EQ.mat(mC[1:2,], mm[1:2,])
84 : maechler 1799
85 : maechler 1833 ## *repeated* (aka 'duplicated') indices - did not work at all ...
86 : maechler 1799 i <- rep(8:10,2)
87 :     j <- c(2:4, 4:3)
88 :     assert.EQ.mat(mC[i,], mm[i,])
89 :     assert.EQ.mat(mC[,j], mm[,j])
90 : maechler 1829 assert.EQ.mat(mC[i, 2:1], mm[i, 2:1])
91 : maechler 1833 assert.EQ.mat(mC[c(4,1,2:1), j], mm[c(4,1,2:1), j])
92 : maechler 1829 assert.EQ.mat(mC[i,j], mm[i,j])
93 :     set.seed(7)
94 :     for(n in 1:50) {
95 :     i <- sample(sample(nrow(mC), 7), 20, replace = TRUE)
96 :     j <- sample(sample(ncol(mC), 6), 17, replace = TRUE)
97 :     assert.EQ.mat(mC[i,j], mm[i,j])
98 :     }
99 : maechler 1833 ## symmetric index of symmetric matrix --- not yet ok
100 : maechler 1829 m. <- mC; m.[, c(2, 7:12)] <- 0
101 : maechler 1833 validObject(S <- crossprod(add.simpleDimnames(m.) %% 100))
102 : maechler 1829 ss <- as(S, "matrix")
103 :     T <- as(S, "TsparseMatrix")
104 : maechler 1833 ## non-repeated indices:
105 : maechler 1829 i <- c(7:5, 2:4);assert.EQ.mat(T[i,i], ss[i,i])
106 : maechler 1833 N <- nrow(T)
107 :     set.seed(11)
108 :     for(n in 1:50) {
109 :     i <- sample(N, max(2, sample(N,1)), replace = FALSE)
110 :     validObject(Tii <- T[i,i])
111 :     stopifnot(is(Tii, "dsTMatrix"), # remained symmetric Tsparse
112 :     identical(t(Tii), t(T)[i,i]))
113 :     assert.EQ.mat(Tii, ss[i,i])
114 :     }
115 :    
116 :     ## repeeated ones:
117 :     j <- c(4, 4, 9, 12, 9, 4, 17, 3, 18, 4, 12, 18, 4, 9)
118 : maechler 1799 if(FALSE) ## FIXME
119 : maechler 1829 assert.EQ.mat(T[j,j], ss[j,j])
120 : maechler 1799
121 : maechler 1829
122 : maechler 1673 stopifnot(all.equal(mC[,3], mm[,3]),
123 :     identical(mC[ij], mm[ij]))
124 : maechler 1226 assert.EQ.mat(mC[7, , drop=FALSE], mm[7, , drop=FALSE])
125 :    
126 : maechler 1331 stopifnot(dim(mC[numeric(0), ]) == c(0,20), # used to give warnings
127 :     dim(mC[, integer(0)]) == c(40,0),
128 :     identical(mC[, integer(0)], mC[, FALSE]),
129 :     identical(mC[7, drop = FALSE],
130 : maechler 925 mC[7,, drop = FALSE]))
131 : maechler 1269 validObject(print(mT[,c(2,4)]))
132 :     stopifnot(all.equal(mT[2,], mm[2,]),
133 :     ## row or column indexing in combination with t() :
134 :     identical(mT[2,], t(mT)[,2]),
135 :     identical(mT[-2,], t(t(mT)[,-2])),
136 :     identical(mT[c(2,5),], t(t(mT)[,c(2,5)]))
137 :     )
138 : maechler 1226 assert.EQ.mat(mT[4,, drop = FALSE], mm[4,, drop = FALSE])
139 : maechler 687 stopifnot(identical3(mm[,1], mC[,1], mT[,1]),
140 :     identical3(mm[3,], mC[3,], mT[3,]),
141 :     identical3(mT[2,3], mC[2,3], 0),
142 :     identical(mT[], mT),
143 : maechler 1665 identical4( mm[c(3,7), 2:4], as.mat( m[c(3,7), 2:4]),
144 :     as.mat(mT[c(3,7), 2:4]), as.mat(mC[c(3,7), 2:4]))
145 : bates 1367 )
146 : maechler 687
147 : maechler 1331 x.x <- crossprod(mC)
148 :     stopifnot(class(x.x) == "dsCMatrix",
149 : maechler 1673 class(x.x. <- round(x.x / 10000)) == "dsCMatrix",
150 :     identical(x.x[cbind(2:6, 2:6)],
151 :     diag(x.x [2:6, 2:6])))
152 : maechler 1331 head(x.x.) # Note the *non*-structural 0's printed as "0"
153 : maechler 1575 tail(x.x., -3) # all but the first three lines
154 : maechler 1331
155 :     lx.x <- as(x.x, "lsCMatrix") # FALSE only for "structural" 0
156 : maechler 1665 (l10 <- lx.x[1:10, 1:10])# "lsC"
157 :     (l3 <- lx.x[1:3, ])
158 :     m.x <- as(x.x, "matrix")
159 :     stopifnot(class(l10) == "lsCMatrix", # symmetric indexing -> symmetric !
160 :     identical(as.mat(lx.x), m.x != 0),
161 :     identical(as.logical(lx.x), as.logical(m.x)),
162 :     identical(as.mat(l10), m.x[1:10, 1:10] != 0),
163 :     identical(as.mat(l3 ), m.x[1:3, ] != 0)
164 :     )
165 : maechler 1331
166 : maechler 1833 ##-- Sub*assignment* with repeated / duplicated index:
167 :     A <- Matrix(0,4,3) ; A[c(1,2,1), 2] <- 1 ; A
168 :     B <- A; B[c(1,2,1), 2] <- 1:3; B
169 :     stopifnot(identical(unname(as.matrix(A)),
170 :     local({a <- matrix(0,4,3); a[c(1,2,1), 2] <- 1 ; a})),
171 :     identical(unname(as.matrix(B)),
172 :     local({a <- matrix(0,4,3); a[c(1,2,1), 2] <- 1:3; a})))
173 :    
174 :    
175 : maechler 1705 ## used to fail
176 :     n <- 5 ## or much larger
177 :     sm <- new("dsTMatrix", i=as.integer(1),j=as.integer(1),
178 :     Dim=as.integer(c(n,n)), x = 1)
179 :     (cm <- as(sm, "CsparseMatrix"))
180 :     sm[2,]
181 :     stopifnot(sm[2,] == c(0:1, rep.int(0,ncol(sm)-2)),
182 :     sm[2,] == cm[2,],
183 :     sm[,3] == sm[3,],
184 :     all(sm[,-(1:3)] == t(sm[-(1:3),])), # all(<lge.>)
185 :     all(sm[,-(1:3)] == 0)
186 :     )
187 : maechler 1665
188 : maechler 1710 ### Diagonal -- Sparse:
189 :     m0 <- Diagonal(5)
190 :     (m1 <- as(m0, "sparseMatrix")) # dtTMatrix
191 :     (m2 <- as(m0, "CsparseMatrix")) # dtCMatrix (with an irrelevant warning)
192 : maechler 1799 m1g <- as(m1, "generalMatrix")
193 :     stopifnot(is(m1g, "dgTMatrix"))
194 :     assert.EQ.mat(m2[1:3,], diag(5)[1:3,])
195 :     assert.EQ.mat(m2[,c(4,1)], diag(5)[,c(4,1)])
196 :     stopifnot(identical(m2[1:3,], as(m1[1:3,], "CsparseMatrix")),
197 :     identical(Matrix:::uniqTsparse(m1[, c(4,2)]),
198 :     Matrix:::uniqTsparse(as(m2[, c(4,2)], "TsparseMatrix")))
199 :     )## failed in 0.9975-11
200 : maechler 1705
201 : maechler 1710 M <- m0; M[1,] <- 0
202 :     stopifnot(identical(M, Diagonal(x=c(0, rep(1,4)))))
203 :     M <- m0; M[,3] <- 3 ; M ; stopifnot(is(M, "sparseMatrix"), M[,3] == 3)
204 :     validObject(M)
205 :     M <- m0; M[1:3, 3] <- 0 ;M
206 :     T <- m0; T[1:3, 3] <- 10
207 :     stopifnot(identical(M, Diagonal(x=c(1,1, 0, 1,1))),
208 :     is(T, "triangularMatrix"), identical(T[,3], c(10,10,10,0,0)))
209 :    
210 :     M <- m1; M[1,] <- 0 ; M ; assert.EQ.mat(M, diag(c(0,rep(1,4))), tol=0)
211 :     M <- m1; M[,3] <- 3 ; stopifnot(is(M,"sparseMatrix"), M[,3] == 3)
212 :     validObject(M)
213 :     M <- m1; M[1:3, 3] <- 0 ;M
214 :     assert.EQ.mat(M, diag(c(1,1, 0, 1,1)), tol=0)
215 :     T <- m1; T[1:3, 3] <- 10; validObject(T)
216 :     stopifnot(is(T, "dtTMatrix"), identical(T[,3], c(10,10,10,0,0)))
217 :    
218 :     M <- m2; M[1,] <- 0 ; M ; assert.EQ.mat(M, diag(c(0,rep(1,4))), tol=0)
219 :     M <- m2; M[,3] <- 3 ; stopifnot(is(M,"sparseMatrix"), M[,3] == 3)
220 :     validObject(M)
221 :     M <- m2; M[1:3, 3] <- 0 ;M
222 :     assert.EQ.mat(M, diag(c(1,1, 0, 1,1)), tol=0)
223 :     T <- m2; T[1:3, 3] <- 10; validObject(T)
224 :     stopifnot(is(T, "dtCMatrix"), identical(T[,3], c(10,10,10,0,0)))
225 :    
226 :    
227 : maechler 925 ## --- negative indices ----------
228 :     mc <- mC[1:5, 1:7]
229 :     mt <- mT[1:5, 1:7]
230 :     ## sub matrix
231 : maechler 1226 assert.EQ.mat(mC[1:2, 0:3], mm[1:2, 0:3]) # test 0-index
232 : maechler 925 stopifnot(identical(mc[-(3:5), 0:2], mC[1:2, 0:2]),
233 : maechler 1226 identical(mt[-(3:5), 0:2], mT[1:2, 0:2]),
234 :     identical(mC[2:3, 4], mm[2:3, 4]))
235 :     assert.EQ.mat(mC[1:2,], mm[1:2,])
236 : maechler 925 ## sub vector
237 :     stopifnot(identical4(mc[-(1:4), ], mC[5, 1:7],
238 :     mt[-(1:4), ], mT[5, 1:7]))
239 :     stopifnot(identical4(mc[-(1:4), -(2:4)], mC[5, c(1,5:7)],
240 :     mt[-(1:4), -(2:4)], mT[5, c(1,5:7)]))
241 :    
242 :     ## mixing of negative and positive must give error
243 :     assertError(mT[-1:1,])
244 :    
245 : maechler 1226 ## Sub *Assignment* ---- now works (partially):
246 :     mt0 <- mt
247 :     mt[1, 4] <- -99
248 :     mt[2:3, 1:6] <- 0
249 :     mt
250 :     m2 <- mt+mt
251 :     m2[1,4] <- -200
252 :     m2[c(1,3), c(5:6,2)] <- 1:6
253 :     stopifnot(m2[1,4] == -200,
254 :     as.vector(m2[c(1,3), c(5:6,2)]) == 1:6)
255 :     mt[,3] <- 30
256 :     mt[2:3,] <- 250
257 :     mt[1:5 %% 2 == 1, 3] <- 0
258 :     mt[3:1, 1:7 > 5] <- 0
259 :     mt
260 : maechler 1215
261 : maechler 1226 tt <- as(mt,"matrix")
262 :     ii <- c(0,2,5)
263 :     jj <- c(2:3,5)
264 :     tt[ii, jj] <- 1:6 # 0 is just "dropped"
265 :     mt[ii, jj] <- 1:6
266 :     assert.EQ.mat(mt, tt)
267 : maechler 1215
268 : maechler 1226 mt[1:5, 2:6]
269 :     as((mt0 - mt)[1:5,], "dsparseMatrix")# [1,5] and lines 2:3
270 :    
271 : maechler 1315 mt[c(2,4), ] <- 0; stopifnot(as(mt[c(2,4), ],"matrix") == 0)
272 : maechler 1226 mt[2:3, 4:7] <- 33
273 :     validObject(mt)
274 :     mt
275 :    
276 : maechler 1315 mc[1,4] <- -99 ; stopifnot(mc[1,4] == -99)
277 :     mc[1,4] <- 00 ; stopifnot(mc[1,4] == 00)
278 :     mc[1,4] <- -99 ; stopifnot(mc[1,4] == -99)
279 :     mc[1:2,4:3] <- 4:1; stopifnot(as.matrix(mc[1:2,4:3]) == 4:1)
280 :    
281 : maechler 1226 mc[-1, 3] <- -2:1 # 0 should not be entered; 'value' recycled
282 :     mt[-1, 3] <- -2:1
283 : maechler 1315 stopifnot(mc@x != 0, mt@x != 0,
284 : maechler 1707 mc[-1,3] == -2:1, mt[-1,3] == -2:1) ## failed earlier
285 : maechler 1315
286 : maechler 1707 mc0 <- mc
287 : maechler 1724 mt0 <- as(mc0, "TsparseMatrix")
288 :     m0 <- as(mc0, "matrix")
289 : maechler 1707 set.seed(1)
290 : maechler 1724 for(i in 1:50) {
291 :     mc <- mc0; mt <- mt0 ; m <- m0
292 : maechler 1707 ev <- 1:5 %% 2 == round(runif(1))# 0 or 1
293 :     j <- sample(ncol(mc), 1 + round(runif(1)))
294 :     nv <- rpois(sum(ev) * length(j), lambda = 1)
295 :     mc[ev, j] <- nv
296 : maechler 1724 m[ev, j] <- nv
297 :     mt[ev, j] <- nv
298 :     if(i %% 10 == 1) print(mc[ev,j, drop = FALSE])
299 :     stopifnot(as.vector(mc[ev, j]) == nv, ## failed earlier...
300 :     as.vector(mt[ev, j]) == nv)
301 :     validObject(mc) ; assert.EQ.mat(mc, m)
302 :     validObject(mt) ; assert.EQ.mat(mt, m)
303 : maechler 1707 }
304 :    
305 :     mc # no longer has non-structural zeros
306 : maechler 1226 mc[ii, jj] <- 1:6
307 :     mc[c(2,5), c(3,5)] <- 3.2
308 :     validObject(mc)
309 : maechler 1600 m. <- mc
310 :     mc[4,] <- 0
311 :     mc
312 : maechler 1226
313 : maechler 1331 H <- Hilbert(9)
314 : maechler 1374 Hc <- as(round(H, 3), "dsCMatrix")# a sparse matrix with no 0 ...
315 :     (trH <- tril(Hc[1:5, 1:5]))
316 :     stopifnot(is(trH, "triangularMatrix"), trH@uplo == "L")
317 : maechler 1331
318 : maechler 1374 i <- c(1:2, 4, 6:7); j <- c(2:4,6)
319 :     H[i,j] <- 0
320 : maechler 1331 (H. <- round(as(H, "sparseMatrix"), 3)[ , 2:7])
321 :     Hc. <- Hc
322 : maechler 1374 Hc.[i,j] <- 0 ## now "works", but setting "non-structural" 0s
323 :     stopifnot(as.matrix(Hc.[i,j]) == 0)
324 : maechler 1331 Hc.[, 1:6]
325 :    
326 : maechler 1724 ## an example that failed for a long time
327 : maechler 1673 sy3 <- new("dsyMatrix", Dim = as.integer(c(2, 2)), x = c(14, -1, 2, -7))
328 : maechler 1825 validObject(dm <- kronecker(Diagonal(2), sy3))# now sparse with new kronecker
329 :     dm <- Matrix(as.matrix(dm))# -> "dsyMatrix"
330 : maechler 1673 (s2 <- as(dm, "sparseMatrix"))
331 :     validObject(st <- as(s2, "TsparseMatrix"))
332 : maechler 1725 stopifnot(is(s2, "symmetricMatrix"),
333 :     is(st, "symmetricMatrix"))
334 : maechler 1673 validObject(s.32 <- st[1:3,1:2]) ## 3 x 2 - and *not* dsTMatrix
335 :     validObject(s2.32 <- s2[1:3,1:2])
336 :     I <- c(1,4:3)
337 :     stopifnot(is(s2.32, "generalMatrix"),
338 :     is(s.32, "generalMatrix"),
339 :     identical(as.mat(s.32), as.mat(s2.32)),
340 :     identical3(dm[1:3,-1], asD(s2[1:3,-1]), asD(st[1:3,-1])),
341 :     identical4(2, dm[4,3], s2[4,3], st[4,3]),
342 :     identical3(diag(dm), diag(s2), diag(st)),
343 :     is((cI <- s2[I,I]), "dsCMatrix"),
344 :     is((tI <- st[I,I]), "dsTMatrix"),
345 :     identical4(as.mat(dm)[I,I], as.mat(dm[I,I]), as.mat(tI), as.mat(cI))
346 :     )
347 :    
348 :     ## now sub-assign and check for consistency
349 :     ## symmetric subassign should keep symmetry
350 :     st[I,I] <- 0; validObject(st); stopifnot(is(st,"symmetricMatrix"))
351 :     s2[I,I] <- 0; validObject(s2); stopifnot(is(s2,"symmetricMatrix"))
352 : maechler 1724 ##
353 : maechler 1673 m <- as.mat(st)
354 :     m[2:1,2:1] <- 4:1
355 :     st[2:1,2:1] <- 4:1
356 :     s2[2:1,2:1] <- 4:1
357 :     stopifnot(identical(m, as.mat(st)),
358 :     1:4 == as.vector(s2[1:2,1:2]),
359 :     identical(m, as.mat(s2)))
360 :    
361 : maechler 1724 ## now a slightly different situation for 's2' (had bug)
362 :     s2 <- as(dm, "sparseMatrix")
363 :     s2[I,I] <- 0; diag(s2)[2:3] <- -(1:2)
364 :     stopifnot(is(s2,"symmetricMatrix"), diag(s2) == c(0:-2,0))
365 :     t2 <- as(s2, "TsparseMatrix")
366 :     m <- as.mat(s2)
367 :     s2[2:1,2:1] <- 4:1
368 :     t2[2:1,2:1] <- 4:1
369 :     m[2:1,2:1] <- 4:1
370 :     assert.EQ.mat(t2, m)
371 :     assert.EQ.mat(s2, m)
372 :     ## and the same (for a different s2 !)
373 :     s2[2:1,2:1] <- 4:1
374 :     t2[2:1,2:1] <- 4:1
375 :     assert.EQ.mat(t2, m)# ok
376 :     assert.EQ.mat(s2, m)# failed in 0.9975-8
377 :    
378 :    
379 : maechler 1673 ## m[cbind(i,j)] <- value:
380 :     m.[ cbind(3:5, 1:3) ] <- 1:3
381 :     stopifnot(m.[3,1] == 1, m.[4,2] == 2)
382 :     x.x[ cbind(2:6, 2:6)] <- 12:16
383 :     validObject(x.x)
384 :     stopifnot(class(x.x) == "dsCMatrix",
385 :     12:16 == as.mat(x.x)[cbind(2:6, 2:6)])
386 : maechler 1725 (ne1 <- (mc - m.) != 0)
387 :     stopifnot(identical(ne1, 0 != abs(mc - m.)))
388 :     (ge <- m. >= mc) # contains "=" -> result is dense
389 :     ne. <- mc != m. # was wrong (+ warning)
390 :     stopifnot(identical(!(m. < mc), m. >= mc),
391 :     identical(m. < mc, as(!ge, "sparseMatrix")),
392 :     identical(ne., Matrix:::drop0(ne1)))
393 : maechler 1673
394 : maechler 1751 (M3 <- Matrix(upper.tri(matrix(, 3, 3)))) # ltC; indexing used to fail
395 :     T3 <- as(M3, "TsparseMatrix")
396 :     stopifnot(identical(drop(M3), M3),
397 :     identical4(drop(M3[,2, drop = FALSE]), M3[,2, drop = TRUE],
398 :     drop(T3[,2, drop = FALSE]), T3[,2, drop = TRUE]),
399 :     is(T3, "triangularMatrix"),
400 :     !is(T3[,2, drop=FALSE], "triangularMatrix")
401 :     )
402 : maechler 1725
403 : maechler 1226 cat('Time elapsed: ', proc.time(),'\n') # for ``statistical reasons''

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