Why would chol fail?

조회 수: 2 (최근 30일)
SingHua Tsai
SingHua Tsai 2018년 8월 25일
댓글: SingHua Tsai 2018년 8월 26일
I have a positive definite sparse array Ainv. When I do the chol like
L=chol(Ainv);
M = L*L';
isequal(M,Ainv)
I find that M is not equal to Ainv. How can I use chol to get a right answer?

채택된 답변

Stephan
Stephan 2018년 8월 25일
편집: Stephan 2018년 8월 25일
Hi,
L*L'
is not the same as
L'*L
The way you do use chol will fulfill the second equation.
You can test with this little example:
A = [7 3; 3 7]
ev = eig(A)
Ch = chol(A)
B1 = Ch'*Ch
B2 = Ch * Ch'
EDIT:
Is Ainv symmetric? If it is, consider that we are dealing with double precision numbers and the operations you perform have rounding errors. See this example:
A = [7 3; 3 7]
Ch = chol(A)
B1 = Ch' * Ch
same = isequal(A,B1)
diff = A-B1
B2 = round(Ch' * Ch)
same2 = isequal(A,B2)
diff2 = A-B2
So there is not a problem with chol, since this is a normal behavior.
Best regards
Stephan
  댓글 수: 1
SingHua Tsai
SingHua Tsai 2018년 8월 26일
Thank you for your help!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

SingHua Tsai
SingHua Tsai 2018년 8월 25일
Hi,Stephan, thank you for your help and advice. I already revise it as follow
L=chol(Ainv);
M = L'*L;
isequal(M,Ainv)
But M is still not equal to Ainv. I have no idea how to modify it.
Thank for your time.
  댓글 수: 1
Stephan
Stephan 2018년 8월 25일
편집: Stephan 2018년 8월 25일
See my edited answer

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by