add_one_mat | R Documentation |
Efficiently calculates the inverse of a super-matrix by adding an observation
add_one_mat(A, sigma_jj, f)
A |
Inverse matrix of dimensions 'n' |
sigma_jj |
The element of C corresponding to the element [j,j] in matrix C where j is the index of the row/column we want to add, see Details |
f |
A vector of dimension n x 1, corresponding to the elements [b,j] in C where b is the indexes that make up submatrix B |
Given matrix A = B^-1 where B is a submatrix of a matrix C, this function efficiently calculates the inverse the matrix B+, which is B adding another row/column from C. For example, if C is the covariance matrix of observations 1,...,N, and B the covariance matrix of observations 1,...,n where n<N, then this function will calculate the inverse of the covariance matrix of the observations 1,...,n+1.
A matrix of size dim(A)+1
B <- matrix(runif(16),nrow=4,ncol=4) diag(B) <- diag(B)+1 A <- solve(B[2:4,2:4]) add_one_mat(A,B[1,1],B[2:4,1]) #equal to solve(B)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.