The first part here below is not an "answer" but an extended comment/followup-question to talonmies' previous answer/comment
I've extended your notation a bit and got a clearer exposition: First let us extend the X-matrix to be the inverse of the full R-matrix, such that $\small \mathbf A^{-1}= \mathbf B =\mathbf X^\tau \mathbf X $ and let us also extend the indexes for X , then
$\qquad \small \mathbf X_{00} =\mathbf R_{00}^{-1} $, $\small \qquad \mathbf X_{11} =\mathbf R_{11}^{-1} \quad $ but unfortunately $\small \mathbf X_{10} \ne \mathbf R_{10}^{-1} $ .
By the inverse-relation $\small \mathbf X =\mathbf R^{-1} $ we have, that $\small \mathbf X_{10} \mathbf R_{00}+ \mathbf X_{11} \mathbf R_{10} =\mathbf 0 $ and thus $\small \mathbf X_{10} = - \mathbf X_{11} \mathbf R_{10} \mathbf R_{00}^{-1} $ (from which we want to receive the top-left diagonal elements from B by $\small \mathbf X^\tau_{00} \mathbf X_{00} + \mathbf X^\tau_{10} \mathbf X_{10} = \mathbf B_{00} $ )
Here $\small \mathbf X_{11} $ represents the part of the problem for which we want to reduce the computational effort, because this is the inversion of the (huge) remaining part of the cholesky-factor.I thought to introduce the concept of the pseudoinverse pinv(X) by which we could proceed:
$\small \begin{array} {rcl}
\mathbf Y &=&
- ( \mathbf X_{11} \mathbf R_{10} \mathbf R_{00}^{-1} )^{-1} \\
&=& - \mathbf R_{00} \operatorname{pinv} (\mathbf R_{10}) \mathbf R_{11} \\
\mathbf X_{10} &=& \operatorname{pinv} ( \mathbf Y)
\end{array}$
This would allow to invert small matrices only, but although the pseudoinverse-operations works well in many cases I could not make it work correctly for the pinv(R10)-part; for all variants of my computations I always needed the full version R11 in this or that version. Do you see any general reason, why the pinv(R10) is not working sufficiently here?
A practical computation
Hmm, as far as we
accept that we need the full cholesky-decomposition anyway, the process might even be described shorter:
a) consider the symmetric SPD-matrix A , we look for the diagonal-elements of the 3x3-submatrix $\small \mathbf B_{00} $ of $ \small \mathbf B = \mathbf A^{-1} $
b) perform the cholesky-decomposition from bottom up into the matrix R; denote $\small \mathbf R_{00} $ the top left 3x3 upper triangular submatrix (thinking in terms of a correlation-matrix A this represents the partial or "unexplained" variance/covariance)
c) invert $\small \mathbf R_{00} $ to get $\small \mathbf X_{00} $ (this is also cheap because it's already triangular)
d) in $ \small \mathbf B_{00} = \mathbf X_{00}^\tau \mathbf X_{00} $ we find the required diagonal elements. (This last operation can even be replaced by a simple summing of squares along the columns in X )
Here is a complete example usable for Pari/GP. To have it as clear as possible no optimizations, errorchecks etc are done:
Crop(M,dim) = matrix(dim,dim,r,c,M[r,c]) \\ reduces size of a matrix
\\ procedure to show the first dim diagonal-entries of A^-1
{invdiag(A,dim=3)=local(rs=rows(A),lV,R,X);
\\ reduce A by a cholesky-process to a dim x dim-residual matrix A_00
\\ the cholesky-process goes bottom-up
forstep( d = rs, dim+1, -1,
lV = A[,d]/sqrt(A[d,d]);
A = Crop( A - lV*lV~ , d-1 );
);
\\after this A is the dim x dim residual-matrix
\\ compute the cholesky-factor of that A-residual into matrix R
\\ we just proceed working bottom up, but A is no more cropped now
R = matrix(dim,dim);
forstep( d = dim, 1, -1,
R[,d] = A[,d]/sqrt(A[d,d]);
A = A - R[,d] * R[,d]~;
);
X = R^-1; \\ inverse of R of size dim x dim
\\ and to extract values of diag(A^-1) =diag( R^-1~ * R^-1 )
\\ it suffices to sum the squares along the columns
lv = vector(dim,c,sum(r=1,c, X[r,c]^2) );
return(lv);
}
\\ create a sample matrix A
A = matrix(8,8,r,c,binomial(r-1,c-1)/2^(c-1))
A = A* A~ \\ make it a symmetric positive definite one
print(invdiag(A,3)) \\ show the first 3 results by the partial cholesky-method
print(diag(A^-1)) \\ show the true results by inversion of the full matrix
\\ output:
[21845.0000000, 980612.000000, 8259152.00000]
[21845, 980612, 8259152, 21815360, 21017856, 7373824, 806912, 16384]~