The R Project SVN R-packages

Rev

Rev 1566 | Rev 1718 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1566 Rev 1582
Line 25... Line 25...
25
## the empty ones:
25
## the empty ones:
26
chk.matrix(new("dgeMatrix"))
26
chk.matrix(new("dgeMatrix"))
27
 
27
 
28
## "dge"
28
## "dge"
29
assertError( new("dgeMatrix", Dim = c(2,2), x= 1:4) )# double 'Dim'
29
assertError( new("dgeMatrix", Dim = c(2,2), x= 1:4) )# double 'Dim'
30
if(paste(R.version$major, R.version$minor, sep=".") >= "2.0.1")
-
 
31
assertError( new("dgeMatrix", Dim = as.integer(c(2,2)), x= 1:4) )# int 'x'
30
assertError( new("dgeMatrix", Dim = as.integer(c(2,2)), x= 1:4) )# int 'x'
32
assertError( new("dgeMatrix", Dim = 2:2, x=as.double(1:4)) )# length(Dim) !=2
31
assertError( new("dgeMatrix", Dim = 2:2, x=as.double(1:4)) )# length(Dim) !=2
33
assertError( new("dgeMatrix", Dim = as.integer(c(2,2)), x= as.double(1:5)))
32
assertError( new("dgeMatrix", Dim = as.integer(c(2,2)), x= as.double(1:5)))
34
 
33
 
35
chk.matrix(m1 <- Matrix(1:6, ncol=2))
34
chk.matrix(m1 <- Matrix(1:6, ncol=2))
Line 49... Line 48...
49
                    dimnames(as(t34N, "matrix"))))
48
                    dimnames(as(t34N, "matrix"))))
50
 
49
 
51
## "dpo"
50
## "dpo"
52
chk.matrix(cm <- crossprod(m1))
51
chk.matrix(cm <- crossprod(m1))
53
chk.matrix(as(cm, "dsyMatrix"))
52
chk.matrix(as(cm, "dsyMatrix"))
54
chk.matrix(as(cm, "dgeMatrix"))
53
chk.matrix(dcm <- as(cm, "dgeMatrix"))
55
chk.matrix(as(cm, "dMatrix"))
54
chk.matrix(mcm <- as(cm, "dMatrix"))
-
 
55
#BUG - FIXME: stopifnot(identical(dcm, mcm))
56
try( chk.matrix(as(cm, "Matrix")) )# gives an error: "Matrix" has NULL 'dim()'
56
try( chk.matrix(as(cm, "Matrix")) )# gives an error: "Matrix" has NULL 'dim()'
57
 
57
 
58
## Cholesky
58
## Cholesky
59
chk.matrix(ch <- chol(cm))
59
chk.matrix(ch <- chol(cm))
-
 
60
#if(FALSE)# fails for Doug in R-devel (2005-06-06) :
60
#chk.matrix(ch2 <- chol(as(cm, "dsyMatrix")))
61
chk.matrix(ch2 <- chol(as(cm, "dsyMatrix")))
61
#chk.matrix(ch3 <- chol(as(cm, "dgeMatrix")))
62
#not yet{FIXME}: chk.matrix(ch3 <- chol(as(cm, "dgeMatrix")))
-
 
63
#if(FALSE)# ...R-devel
62
#stopifnot(all.equal(as(ch, "matrix"), as(ch2, "matrix")))
64
stopifnot(all.equal(as(ch, "matrix"), as(ch2, "matrix")))
63
 
65
 
64
### Very basic  triangular matrix stuff
66
### Very basic  triangular matrix stuff
65
 
67
 
66
assertError( new("dtrMatrix", Dim = c(2,2), x= 1:4) )# double 'Dim'
68
assertError( new("dtrMatrix", Dim = c(2,2), x= 1:4) )# double 'Dim'
67
if(paste(R.version$major, R.version$minor, sep=".") >= "2.0.1")
69
if(paste(R.version$major, R.version$minor, sep=".") >= "2.0.1")