# Getting positive definite matrix for chol update

I am making a square-root UKF implementation. I also use cholupdate function in Matlab. However cholupdate needs a positive definite matrix. The positive definiteness is tested using [R,p] = chol(A) where p produces 0. Then after running cholupdate, generates an error saying A is not positive definite. My problem is.

1. Does [R,p] = chol(A) return p=0 means A is positive-definite always?

2. What is the best method for making a positive definite matrix. Note that here A is a square-root matrix where $AA^T$ gives a covariance matrix.

Any help is greatly appreciated.

-
the documentation (mathworks.com/help/matlab/ref/chol.html) indicates that p=0 means A is positive definite. For your second question, note that a Gram matrix ($AA^{\top}$) is positive semidefinite, and you can always 'boost' the eigenvalues of any matrix by adding $cI$ to it; for sufficiently large $c$, $cI+A$ will be positive definite. –  shabbychef Dec 3 '12 at 6:49