I want to get a similar matrix B (i.e., B has the same eigenvalues as A) which is symmetric and real. So precisely I want to construct a nonsingular matrix X such that B = inv(X) A X.

So it will be extremely helpful if anyone can tell me how to get such X or at least give me some reference.

Alternatively:

A method is available to get a symmetric similar matrix for A from another nonsingular symmetric matrix Y if it satisfies A Y = Y A_tr. But such similar matrix obtained from Y will only be real if Y is positive definite. So alternatively, any help in getting a positive definite Y for given A will be extremely useful.