MATLAB: How to generate B-orthonormal matrix X, which means X’*B*X=I

b-orthonormal

Now I need to generate the initial value for random matrix X, which satisfies X'*B*X=I (not orthogonal X'*X=I). B is Hermitian positive. It is called B-orthonormal. But I don't know how to do it, I only know "orth" can find X'*X=I. But what I need is B-orthonormal, X'*B*X=I. Anyone knows can to do it in Matlab? Thank you in advance!

Best Answer

% Assuming B is Hermitian sdp
n = length(B);
[Q,~] = qr(randn(n));
C = chol(B)
X = C\Q
% Check
X'*B*X
Related Question