R/symsolve.R

symsolve <-
function(Asym, Bmat)
{
    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
    return(Xmat)
}

Try the bbefkr package in your browser

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

bbefkr documentation built on May 2, 2019, 3:04 a.m.