Is this matrix going to be real or complex?

72 Views Asked by At

I hope that this is the right forum where to post this question (and not here).

I have a Chi-Square Kernel Matrix (using the second version, which is positive-definite) K and this Matlab code:

[V_K,D_K] = eig(K);
d_k = diag(D_K);
ind_k = find(d_k > 1e-8);
d_k(ind_k) = d_k(ind_k).^(-1/2);
K_half = V_K*diag(d_k)*V_K';

K_Half is K^(-1/2).

My question is: K_half is going to be real or complex (since D_K could be complex)?

If it's complex, then can I discard the imaginary part during the following operation?

W(:,i) = sqrt((p-1)/t)*K_half*e_s;

Where e_s is a bit vector and of course p and t are real.

I need this because I'm writing this code in Eigen and I need to know if I can declare W as MatrixXf or MatrixXcf (so real or complex).

1

There are 1 best solutions below

0
On BEST ANSWER

Since $K$ is positive definite, the eigenvalues will all be positive. Then all the their reciprocal square roots will be real, so the resulting matrix K_half will be real. So you can declare it to be real without any problems.