# SCM Repository

[matrix] Diff of /pkg/tests/group-methods.R
 [matrix] / pkg / tests / group-methods.R

# Diff of /pkg/tests/group-methods.R

revision 1225, Mon Mar 13 14:06:17 2006 UTC revision 1226, Mon Mar 13 14:07:58 2006 UTC
# Line 30  Line 30
30  m <- Matrix(c(0,0,2:0), 3,5)  m <- Matrix(c(0,0,2:0), 3,5)
31  (mC <- as(m, "dgCMatrix"))  (mC <- as(m, "dgCMatrix"))
32  sm <- sin(mC)  sm <- sin(mC)
33  stopifnot(class(sm) == class(mC),  stopifnot(class(sm) == class(mC), class(mC) == class(mC^2),
34            dim(sm) == dim(mC),            dim(sm) == dim(mC),
35            class(0 + 100*mC) == class(mC),            class(0 + 100*mC) == class(mC),
36            all.equal(0.1 * ((0 + 100*mC)/10), mC),            all.equal(0.1 * ((0 + 100*mC)/10), mC),
37            all.equal(sqrt(mC ^ 2), mC))            all.equal(sqrt(mC ^ 2), mC),
38              all.equal(m^m, mC^mC),
39              identical(mC^2, mC * mC),
40              identical(mC*2, mC + mC)
41              )
42
43  x <- Matrix(rbind(0,cbind(0, 0:3,0,0,-1:2,0),0))  x <- Matrix(rbind(0,cbind(0, 0:3,0,0,-1:2,0),0))
44  x  x # sparse
45  x + 10*t(x) # should be sparse {FIXME}  stopifnot(is(show(x + 10*t(x)), "sparseMatrix"))
46  (px <- Matrix(x^x - 1))#-> sparse again  (px <- Matrix(x^x - 1))#-> sparse again
47  stopifnot(px@i == c(3,4,1,4),  stopifnot(px@i == c(3,4,1,4),
48            px@x == c(3,26,-2,3))            px@x == c(3,26,-2,3))

Legend:
 Removed from v.1225 changed lines Added in v.1226