Calculation of Schur complement returns matrix which is not positive semidefinite

12 views (last 30 days)
I'm trying to implement some basic Gaussian process regression. I know Matlab has functions that do this but I want to do a bit by hand so I feel more comfortable with the methods.
I'm using the following code to calculate the Schur complement to generate a covariance matrix for the data conditioned on the observations yObserv.
A = K(1:end-nObserv,1:end-nObserv);
B = K(1:end-nObserv,end-(nObserv-1):end);
C = K(end-(nObserv-1):end,end-(nObserv-1):end);
KSchur = A - B*(C\B');
mu = B*(C\(yObserv'));
Unfortunately, in some cases this expression returns a matrix which is not positive semidefinite, apparently due to numerical factors. The alternate strategy:
KSchur = A - B*inv(C)*B';
Has the same problem. I'm not experienced with such issues, so I'm hoping someone can suggest a way to formulate this operation to avoid the problem. Any suggestions?

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!