[Solved] function for matrix
I’ve tried this, looking at wikipedia. http://en.wikipedia.org/wiki/Invertible_matrix#Blockwise_inversion getInverse <- function(mat) { if(nrow(mat) == 1) { return (matrix( 1.0/ mat[1,1] )) } idx <- nrow(mat) / 2 A <- mat[1:idx, 1:idx, drop=F] B <- mat[1:idx, -1:-idx, drop=F] C <- mat[-1:-idx, 1:idx, drop=F] D <- mat[-1:-idx, -1:-idx, drop=F] invA <- getInverse(A) temp <- getInverse(D – C %*% … Read more