Error using chol Matrix must be positive definite.

27 ビュー (過去 30 日間)
Francois
Francois 2014 年 6 月 16 日
コメント済み: Junho Kweon 2023 年 2 月 22 日
I have a positive definite matrix C for which R=chol(C) works well. I want to apply the chol function to a new matrix A = U*C*U' where U is a unitary matrix obtained as output from SVD, i.e. from [V,S,U] = dvd(T); but I get an error telling me that A is not positive definite. I checked that det(U) = 1.0 so I don't understand why the symmetric matrix A is not positive definite.
Given that C is positive definite then y'*C*y>0 and if I let y = U'*x then x'*U*C*U'*x>0 which implies that U*C*U'is also positive definite.
Is this problem due to round off or am I missing some important linear algebra concept. If not is there a way around this problem?
  8 件のコメント
John D'Errico
John D'Errico 2016 年 6 月 18 日
The most common reason for this is NOT the difference in code, which should not be, but how you pass the array between. Too often people think they can pass an ascii file between the two machines, that this is sufficient.
Unless the array is passed EXACTLY between machines as a .mat file, you are NOT making a proper comparison. Without use of a .mat file, there will be tiny errors in the least significant bits.
Zhiyong Niu
Zhiyong Niu 2017 年 11 月 10 日
編集済み: Zhiyong Niu 2017 年 11 月 10 日
The diagnal of a positive definite matrix is real. However, if you obtain A by A = U*C*U' ,the diagnal of A may have imagenary parts, even though they are extremely tiny, on the order of 1e-17i. if so, the chol() may give you an error when the elements of diagnal was checked.

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2014 年 6 月 17 日
One solution is to use my nearestSPD code as found on the file exchange. It handles the semi-definite matrix, finding the smallest perturbation into a positive definite matrix, one that will be ASSUREDLY factorizable using chol.
  1 件のコメント
Junho Kweon
Junho Kweon 2023 年 2 月 22 日
I totally agree with this. Due to the limitation of the computation in MATLAB, sometimes minor computational error cause sight asymmetric or slightly-not-positive-definite matrix. I had same issue with @Francois, but the code as @John D'Errico showed solved this problem very well.

サインインしてコメントする。

その他の回答 (1 件)

Youssef  Khmou
Youssef Khmou 2014 年 6 月 16 日
this an interesting problem,
Generally, the matrix C must contain some negative and positive eigenvalues ( eig(C)) according the description, in the other hand, the matrix A is positive semi definite only if C is diagonal matrix with the diagonal elements being the eigenvalues corresponding the eigenvectors U(:,1),....U(:,N).
In this case you multiply C whether diagonal or not with non corresponding eigenvectors, so A can not be positive semi definite .
  1 件のコメント
Matt J
Matt J 2014 年 6 月 17 日
編集済み: Matt J 2014 年 6 月 17 日
A is positive semi definite only if C is diagonal matrix with the diagonal elements being the eigenvalues corresponding the eigenvectors U(:,1),....U(:,N).
Not true. Suppose U=eye(N). Then A=C and both are positive (semi) definite simultaneously, regardless of whether C is diagonal.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by