How can i split a matrix into product of two matrices in matlab?

I am having a matrix A which is formed by multplying matrix X with it's conjugate transpose (A=X*X'),how can i find matrix X from A?

 채택된 답변

emehmetcik
emehmetcik 2015년 2월 15일
@John D'Errico
You are right about your comment on singularity of a matrix and positive definiteness.
I assumed that since it was a covariance matrix, it should be positive semi definite. Since the error message is `Matrix must be positive definite`, I concluded that the determinant of the matrix A should be equal to zero and therefore it is not positive definite (it is positive semi definite). So the conclusion must have been that the matrix A is singular, rather than it is not positive definite (although it is still a correct proposition).
What I should have said was:
If the A matrix is not positive definite, ...
"it means that the matrix A is singular, (because it is a covariance matrix, therefore it is positive semi definite)"
... which means that the solution you are looking for is not unique. That is to say, there are many X matrices satisfying A = X*X'.
Hence I was talking about this specific problem, rather than trying to point out a general fact. Sorry for the confusion that I created.
...
But I think the error here is not caused by a complex diagonal element, as you mentioned above, since A = X * X' and as I said many times already it is a covariance matrix. And the error message returned by chol can also be generated by real diagonal inputs as well, by using a singular matrix;
chol([1, 2; 3, 4])
Error using chol
Matrix must be positive definite.
Therefore, my suggestion to use svd will not fail for this problem, because we are dealing with a singular "A" matrix, which is a covariance matrix (A = X*X'), therefore it is Hermitian and is diagonalizable.
But in general, I agree that not every matrix can be decomposed into the form described above (A = X*X'), as your example of a matrix with complex diagonal entry suggests.

댓글 수: 4

@ emehmetcik,Thanks..yes since it is a covariance matrix diagonal elements are real and in my case also diagonal elements of A are real,i think the problem is with semi definite matrix A. btw the answer which you have suggested to use [s, v, d] = svd(A), x = v * sqrt(v), what is matrix v? is it the matrix containg singular values of A ?
Yes, v is a diagonal matrix with diagonal entries as the singular values of A.
I may not have used the best variable names :).
[s, v, d] = svd(A)
means that, A = s*v*d' where v is a diagonal matrix (See Matlab documentation for svd function).
Note that the solution I suggested, again presumes that the A matrix is Hermitian symmetric, which is true for covariance matrices. Because,
A = A'
s * v * d' = (s*v*d')' = d * v' * s',
which means that s = d and all singular values are real. And selecting the X matrix as X = s*sqrt(v) should produce the desired decomposition A = X*X'.
But in this case i require X of dimension 4x2, X = s*sqrt(v) is resulting a matrix of size 4x4.. So i'm considering only first two coloumns of the matrix v and finding my X,and it is satisfying the equation(since the last two singular values are almost equal to zero belonging to noise subspace).
And is there any possibility to get the unique solution for X ?
I will only repeat the statement that the error:
[R] = chol(WW)
Error using chol Matrix must be positive definite with real diagonal.
is generated ONLY when a complex diagonal element is present, and under apparently no other conditions that I can find. (Since chol is built-in, we cannot see the code.) If the matrix is merely singular, even if the off-diagonal elements are complex, you will see a different error.
Whether the matrix MAY be numerically singular in addition to that fact, I cannot know myself, since I have not seen the matrix. The last comment by Betha indicates the 4x4 matrix probably has numerical rank 2 since it has two tiny singular values.
And, no, there is no unique solution when you have a singular problem.

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

추가 답변 (1개)

John D'Errico
John D'Errico 2015년 2월 15일

0 개 추천

help chol

댓글 수: 5

Thanks for your reply.. Following error has been encountered,in my case A is complex matrix
[R] = chol(WW)
Error using chol Matrix must be positive definite with real diagonal.
A is a symmetric matrix
emehmetcik
emehmetcik 2015년 2월 15일
편집: emehmetcik 2015년 2월 15일
If the A matrix is not positive definite, it means that the solution you are looking for is not unique. That is to say, there are many X matrices satisfying A = X*X'.
You can find 'a' solution (not 'the' solution) by
- 'cholcov' function. help cholcov
- 'svd' function. [s, v, d] = svd(A), x = v * sqrt(v). % Since A is symmetric...
@emehmetcik - NO. Your statement is simply not correct. You are possibly confusing the idea of positive definite with singularity for a matrix.
A singular matrix will have infinitely many solutions.
A positive definite matrix M has the property that for any possible vector x, the product (x'*M*x) will be a positive number.
This is sometimes confused by people, because if M is a singular matrix, then there exists some vector x such that M*x will yield the zero vector.
The error message returned by chol is a reflection of the requirement for chol, that it requires a matrix with real diagonal.
Your suggestion to use SVD will fail. Why? Because that error message is returned when the matrix has a complex diagonal element.
As you can see, the error message that is generated indicates a complex diagonal element was supplied.
chol(diag([1 0]))
Error using chol
Matrix must be positive definite.
chol(diag([i 0]))
Error using chol
Matrix must be positive definite with real diagonal.
Only when a diagonal element was not real did chol produce that message.
So the question is, can you find a factorization using the scheme you propose using SVD (or any scheme) for a matrix with diagonal elements that are not real? The simple answer is no, and in fact, that is easily proven.
Consider what the diagonal elements of a matrix as a product X*X' are formed from. The diagonal element (so the (k,k) element) of the matrix:
M = X*X'
will be
X(k,:)*X(k,:)'
So the dot product of a vector with itself, conjugate transposed. Consider that this result will NEVER be a complex number.
Therefore SVD will NEVER yield a solution to a problem that has no solution possible.
In addition, your suggestion to use cholcov will also fail, as it must.
cholcov([i 0 ;0 1])
ans =
[]
@Betha - The answer to you is that IF this error has been returned, it is because no solution exists, or can exist. As I point out above, a matrix with complex diagonal elements cannot be factorized in the form
M = X*X'

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

카테고리

도움말 센터File Exchange에서 Linear Algebra에 대해 자세히 알아보기

질문:

2015년 2월 15일

댓글:

2015년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by