The R Project SVN R

Rev

Rev 84489 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 84489 Rev 88059
Line 8... Line 8...
8
c2 <- chol(sy2)
8
c2 <- chol(sy2)
9
stopifnot(is(c2, "dtrMatrix"),
9
stopifnot(is(c2, "dtrMatrix"),
10
          all.equal(as.matrix(c2), tol = 7e-7, # see 2.7e-7
10
          all.equal(as.matrix(c2), tol = 7e-7, # see 2.7e-7
11
                    matrix(c(3.74166, 0, 8.55236, 1.96396), 2))
11
                    matrix(c(3.74166, 0, 8.55236, 1.96396), 2))
12
          )
12
          )
13
clM <- getClass("Cholesky")
13
clM <- getClass("pMatrix")
14
cM <- new(clM)
14
cM <- new(clM)
15
 
15
 
16
## an*other* "Cholesky" class:
16
## an*other* "pMatrix" class:
17
setClass("Cholesky", contains = "numeric", representation(size = "integer"))
17
setClass("pMatrix", contains = "numeric", representation(size = "integer"))
18
 
18
 
19
clG <- getClass("Cholesky", where = .GlobalEnv)
19
clG <- getClass("pMatrix", where = .GlobalEnv)
20
 
20
 
21
stopifnot(exprs = {
21
stopifnot(exprs = {
22
    identical(clM, getClass("Cholesky", where = asNamespace("Matrix")))
22
    identical(clM, getClass("pMatrix", where = asNamespace("Matrix")))
23
    identical(evalq(getClass("Cholesky"), asNamespace("Matrix")), clM)
23
    identical(evalq(getClass("pMatrix"), asNamespace("Matrix")), clM)
24
    identical(getClass(class(cM)),  clM)
24
    identical(getClass(class(cM)),  clM)
25
    identical(getClass("Cholesky"), clG)
25
    identical(getClass("pMatrix"), clG)
26
})
26
})
27
 
27
 
28
## Second:  tests of methods defined for the same generic
28
## Second:  tests of methods defined for the same generic
29
## (NOT YET!)
29
## (NOT YET!)
30
 
30