Uw opmerkingen
No, Matlab was not tricked; I'm disappointed :); The result is according to the documentation!
The matrix, of course, is not positive defined but the documentation says:
"[R,p] = chol(A)for positive definite A, produces an upper triangular matrix R from the diagonal and upper triangle of matrix A, satisfying the equation R'*R=A and p is zero. If A is not positive definite, then p is a positive integer and MATLAB® does not generate an error. When A is full, R is an upper triangular matrix of order q=p-1 such that R'*R=A(1:q,1:q). ..."
% make matrix hermitian
% "... The chol function assumes that A is (complex Hermitian) symmetric. If it is not, chol uses the (complex conjugate) transpose of the upper triangle as the lower triangle ..."
m=triu(A); % [R,p] = chol(A) is the same as [R,p] = chol(A,'upper')
d = diag(m);
m = m + m';
s = size(m,1);
m(1:s+1:s*s) = d;
disp(m)
100 + 0i -1.0151 + 1.4042i -0.12828 + 0.94526i
-1.0151 - 1.4042i 100 + 0i -0.15982 + 1.622i
-0.12828 - 0.94526i -0.15982 - 1.622i -0.12722 + 0.70364i
>> [R,p] = chol(m)
R =
10 + 0i -0.10151 + 0.14042i
0 + 0i 9.9985 + 0i
p =
3
>> R'*R - m(1:p-1,1:p-1)
ans =
0 0
0 1.4211e-14
>> eps(A(p-1,p-1))
ans =
1.4211e-14
****
As implementation I guess that the algorithm used is the Bunch-Kaufman factorization of a symmetric matrix by ?sytrf routine ...
The matrix, of course, is not positive defined but the documentation says:
"[R,p] = chol(A)
% make matrix hermitian
% "... The chol function assumes that A is (complex Hermitian) symmetric. If it is not, chol uses the (complex conjugate) transpose of the upper triangle as the lower triangle ..."
m=triu(A); % [R,p] = chol(A) is the same as [R,p] = chol(A,'upper')
d = diag(m);
m = m + m';
s = size(m,1);
m(1:s+1:s*s) = d;
disp(m)
100 + 0i -1.0151 + 1.4042i -0.12828 + 0.94526i
-1.0151 - 1.4042i 100 + 0i -0.15982 + 1.622i
-0.12828 - 0.94526i -0.15982 - 1.622i -0.12722 + 0.70364i
>> [R,p] = chol(m)
R =
10 + 0i -0.10151 + 0.14042i
0 + 0i 9.9985 + 0i
p =
3
>> R'*R - m(1:p-1,1:p-1)
ans =
0 0
0 1.4211e-14
>> eps(A(p-1,p-1))
ans =
1.4211e-14
****
As implementation I guess that the algorithm used is the Bunch-Kaufman factorization of a symmetric matrix by ?sytrf routine ...
interesting! I like! I'll think about it ...
As for me, no hurry! my mp.m is already patched :)
P.S.
original Mathworks toolboxes rely on p value to check the positiveness definition of matrix.
P.S.
original Mathworks toolboxes rely on p value to check the positiveness definition of matrix.
[...] = lu(A,'vector') still not work; please take a look at my workaround (with 'vector' the third output MUST be VECTOR)
Certainly, my code is valid only for full matrices.
Certainly, my code is valid only for full matrices.
I used mail address :)
Thanks !
Thanks !
Customer support service by UserEcho
% make matrix hermitian
% ...
m = triu(A) + triu(A,1)'