R/symsolve.R

Defines functions symsolve

symsolve <- function(Asym, Bmat)
{
# The construction of this code is based on that by F. Ferraty, which is available on his website 
# https://www.math.univ-toulouse.fr/~ferraty/SOFTWARES/NPFDA/index.html.
n <- ncol(Asym)
if(max(abs(Asym - t(Asym)))/max(abs(Asym)) > 1e-10) stop("Argument not symmetric.")
Lmat <- chol(Asym, T)
if(attr(Lmat, "rank") < n) stop("Argument singular.")
Lmatinv <- solve(Lmat[, order(attr(Lmat, "pivot"))])
Xmat <- Lmatinv %*% t(Lmatinv) %*% Bmat
Xmat
}

Try the fsemipar package in your browser

Any scripts or data that you put into this service are public.

fsemipar documentation built on May 29, 2024, 1:31 a.m.