Solve: Solve System of Linear Equations using Inverse of...

View source: R/vca.R

SolveR Documentation

Solve System of Linear Equations using Inverse of Cholesky-Root

Description

Function solves a system of linear equations, respectively, inverts a matrix by means of the inverse Cholesky-root.

Usage

Solve(X, quiet = FALSE)

Arguments

X

(matrix, Matrix) object to be inverted

quiet

(logical) TRUE = will suppress any warning, which will be issued otherwise

Details

This function is intended to reduce the computational time in function solveMME which computes the inverse of the square variance- covariance Matrix of observations. It is considerably faster than function solve (see example). Whenever an error occurs, which is the case for non positive definite matrices 'X', function MPinv is called automatically yielding a generalized inverse (Moore-Penrose inverse) of 'X'.

Value

(matrix, Matrix) corresponding to the inverse of X

Author(s)

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

Examples

## Not run: 
# following complex (nonsense) model takes pretty long to fit
system.time(res.sw <- anovaVCA(y~(sample+lot+device)/day/run, VCAdata1))
# solve mixed model equations (not automatically done to be more efficient)
system.time(res.sw <- solveMME(res.sw))
# extract covariance matrix of observations V
V1 <- getMat(res.sw, "V")
V2 <- as.matrix(V1)
system.time(V2i <- solve(V2))
system.time(V1i <- VCA:::Solve(V1))
V1i <- as.matrix(V1i)
dimnames(V1i) <- NULL
dimnames(V2i) <- NULL
all.equal(V1i, V2i)

## End(Not run) 

VCA documentation built on May 29, 2024, 1:48 a.m.