| Line 92... |
Line 92... |
| 92 |
b <- as(b, "dgCMatrix")
|
92 |
b <- as(b, "dgCMatrix")
|
| 93 |
.Call(dsCMatrix_Csparse_solve, a, b)
|
93 |
.Call(dsCMatrix_Csparse_solve, a, b)
|
| 94 |
})
|
94 |
})
|
| 95 |
|
95 |
|
| 96 |
|
96 |
|
| 97 |
setMethod("chol", signature(x = "dsCMatrix", pivot = "missing"),
|
97 |
setMethod("chol", signature(x = "dsCMatrix"),
|
| 98 |
function(x, pivot, ...) .Call(dsCMatrix_chol, x, FALSE),
|
- |
|
| 99 |
valueClass = "dtCMatrix")
|
- |
|
| 100 |
|
- |
|
| 101 |
setMethod("chol", signature(x = "dsCMatrix", pivot = "logical"),
|
- |
|
| 102 |
function(x, pivot, ...) .Call(dsCMatrix_chol, x, pivot),
|
98 |
function(x, pivot = FALSE, ...) .Call(dsCMatrix_chol, x, pivot),
|
| 103 |
valueClass = "dtCMatrix")
|
99 |
valueClass = "dtCMatrix")
|
| 104 |
|
100 |
|
| 105 |
setMethod("Cholesky", signature(A = "dsCMatrix"),
|
101 |
setMethod("Cholesky", signature(A = "dsCMatrix"),
|
| 106 |
function(A, perm = TRUE, LDL = !super, super = FALSE, Imult = 0, ...)
|
102 |
function(A, perm = TRUE, LDL = !super, super = FALSE, Imult = 0, ...)
|
| 107 |
.Call(dsCMatrix_Cholesky, A, perm, LDL, super, Imult))
|
103 |
.Call(dsCMatrix_Cholesky, A, perm, LDL, super, Imult))
|
| Line 141... |
Line 137... |
| 141 |
## Chx <- Cholesky(x, LDL=TRUE)
|
137 |
## Chx <- Cholesky(x, LDL=TRUE)
|
| 142 |
## ldet <- .Call(diag_tC, Chx@p, Chx@x, Chx@perm, res.kind = "sumLog")
|
138 |
## ldet <- .Call(diag_tC, Chx@p, Chx@x, Chx@perm, res.kind = "sumLog")
|
| 143 |
## or
|
139 |
## or
|
| 144 |
## ldet <- .Call("CHMfactor_ldetL2", Chx) # which would also work
|
140 |
## ldet <- .Call("CHMfactor_ldetL2", Chx) # which would also work
|
| 145 |
## when Chx <- Cholesky(x, super=TRUE)
|
141 |
## when Chx <- Cholesky(x, super=TRUE)
|
| - |
|
142 |
|
| - |
|
143 |
### FIXME: not okay when the matrix is *NOT* pos.def.
|
| 146 |
ldet <- .Call(dsCMatrix_LDL_D, x, perm=TRUE, "sumLog")
|
144 |
ldet <- .Call(dsCMatrix_LDL_D, x, perm=TRUE, "sumLog")
|
| 147 |
modulus <- if (logarithm) ldet else exp(ldet)
|
145 |
modulus <- if (logarithm) ldet else exp(ldet)
|
| 148 |
attr(modulus, "logarithm") <- logarithm
|
146 |
attr(modulus, "logarithm") <- logarithm
|
| 149 |
structure(list(modulus = modulus, sign = as.integer(1)),
|
147 |
structure(list(modulus = modulus, sign = as.integer(1)),
|
| 150 |
class = "det")
|
148 |
class = "det")
|