https://github.com/cran/Matrix
Raw File
Tip revision: eb4c20765b4b752635d8622a4a369347b4b69bbf authored by Douglas Bates on 11 July 2005, 00:00:00 UTC
version 0.97-3
Tip revision: eb4c207
dppMatrix.R
#### Positive-definite Symmetric Packed Matrices -- Coercion and Methods

setAs("dppMatrix", "dpoMatrix",
      function(from) as(as(from, "dsyMatrix"), "dpoMatrix"))

setMethod("chol", signature(x = "dppMatrix"),
          function(x, pivot, LINPACK)
          .Call("dppMatrix_chol", x))

setMethod("rcond", signature(x = "dppMatrix", type = "character"),
          function(x, type, ...)
          .Call("dppMatrix_rcond", x, type),
          valueClass = "numeric")

setMethod("rcond", signature(x = "dppMatrix", type = "missing"),
          function(x, type, ...)
          .Call("dppMatrix_rcond", x, "O"),
          valueClass = "numeric")

setMethod("solve", signature(a = "dppMatrix", b = "missing"),
          function(a, b, ...) .Call("dppMatrix_solve", a),
          valueClass = "dppMatrix")

setMethod("solve", signature(a = "dppMatrix", b = "dgeMatrix"),
          function(a, b, ...)
          .Call("dppMatrix_matrix_solve", a, b, TRUE),
          valueClass = "dgeMatrix")

setMethod("solve", signature(a = "dppMatrix", b = "matrix"),
          function(a, b, ...)
          .Call("dppMatrix_matrix_solve", a, b, FALSE),
          valueClass = "dgeMatrix")

##setMethod("solve", signature(a = "dppMatrix", b = "numeric"),
##          function(a, b, ...)
##          .Call("dppMatrix_matrix_solve", a, as.matrix(b), FALSE),
##          valueClass = "dgeMatrix")

setMethod("solve", signature(a = "dppMatrix", b = "integer"),
          function(a, b, ...) {
              storage.mode(b) <- "double"
              .Call("dppMatrix_matrix_solve", a, as.matrix(b), FALSE)
          }, valueClass = "dgeMatrix")
back to top