signature(a = "ANY", b = "ANY")
is simply the
base package's S3 generic solve
.
%% This is copy-paste in CHMfactor-class.Rd {FIXME ?}
signature(a = "CHMfactor", b = "...."), system= *
The
solve
methods for a "CHMfactor"
object
take an optional third argument system
whose value can be
one of the character strings "A"
, "LDLt"
, "LD"
,
"DLt"
, "L"
, "Lt"
, "D"
, "P"
or
"Pt"
. This argument describes the system to be solved. The
default, "A"
, is to solve \(Ax = b\) for \(x\) where
A
is sparse, positive-definite matrix that was factored to produce
a
. Analogously, system = "L"
returns the solution
\(x\), of \(Lx = b\); similarly, for all system codes
but "P"
and "Pt"
where, e.g., x <-
solve(a, b,system="P")
is equivalent to x <- P %*% b
.
If b
is a sparseMatrix
, system
is used as above the corresponding sparse CHOLMOD algorithm is called.
signature(a = "ddenseMatrix", b = "....")
(for all
b
) work via as(a, "dgeMatrix")
, using the its
methods, see below.
signature(a = "denseLU", b = "missing")
basically computes uses triangular forward- and back-solve.
signature(a = "dgCMatrix", b = "matrix")
, and
%% -> ../R/dgCMatrix.R
signature(a = "dgCMatrix", b = "ddenseMatrix")
with extra
argument list ( sparse = FALSE, tol = .Machine$double.eps )
:
Uses the sparse lu(a)
decomposition (which is cached
in a
's factor
slot).
By default, sparse=FALSE
, returns a
denseMatrix
, since \(U^{-1} L^{-1} B\) may
not be sparse at all, even when \(L\) and \(U\) are.
If sparse=TRUE
, returns a sparseMatrix
(which may not be very sparse at all, even if a
was sparse).
signature(a = "dgCMatrix", b = "dsparseMatrix")
, and
signature(a = "dgCMatrix", b = "missing")
with extra
argument list ( sparse=FALSE, tol = .Machine$double.eps )
:
Checks if a
is symmetric, and in that case, coerces it to
"symmetricMatrix"
, and then computes a
sparse solution via sparse Cholesky factorization,
independently of the sparse
argument. If a
is not
symmetric, the sparse lu
decomposition is used
and the result will be sparse or dense, depending on the
sparse
argument, exactly as for the above (b =
"ddenseMatrix"
) case.
signature(a = "dgeMatrix", b = ".....")
solve the system via internal LU, calling LAPACK routines
dgetri
or dgetrs
.
signature(a = "diagonalMatrix", b = "matrix")
and
other b
s: Of course this is trivially implemented, as
\(D^{-1}\) is diagonal with entries \(1 / D[i,i]\).
signature(a = "dpoMatrix", b = "....Matrix")
, and
signature(a = "dppMatrix", b = "....Matrix")
The Cholesky decomposition of a
is calculated (if
needed) while solving the system.
signature(a = "dsCMatrix", b = "....")
All these methods first try Cholmod's Cholesky factorization; if
that works, i.e., typically if a
is positive semi-definite,
it is made use of. Otherwise, the sparse LU decomposition is used
as for the “general” matrices of class "dgCMatrix"
.
signature(a = "dspMatrix", b = "....")
, and
signature(a = "dsyMatrix", b = "....")
all end up calling LAPACK routines dsptri
, dsptrs
,
dsytrs
and dsytri
.
signature(a = "dtCMatrix", b = "CsparseMatrix")
,
signature(a = "dtCMatrix", b = "dgeMatrix")
, etc
sparse triangular solve, in traditional S/R also known as
backsolve
, or forwardsolve
.
solve(a,b)
is a sparseMatrix
if
b
is, and hence a denseMatrix
otherwise.
signature(a = "dtrMatrix", b = "ddenseMatrix")
, and
signature(a = "dtpMatrix", b = "matrix")
, and
similar b
, including "missing"
, and
"diagonalMatrix"
:
all use LAPACK based versions of efficient triangular
backsolve
, or forwardsolve
.
signature(a = "Matrix", b = "diagonalMatrix")
works via as(b, "CsparseMatrix")
.
signature(a = "sparseQR", b = "ANY")
simply uses qr.coef(a, b)
.
signature(a = "pMatrix", b = ".....")
these methods typically use crossprod(a,b)
, as
the inverse of a permutation matrix is the same as its transpose.
signature(a = "TsparseMatrix", b = "ANY")
all work via as(a, "CsparseMatrix")
.