How to force unitary Euclidean norm in a complex matrix by multiplication with a diagonal matrix I need to solve the following problem:
Suppose a non-sparse, non-singular complex matrix $\mathbf{P}$. If I want to force all rows in $\mathbf{P}$ to present unitary Euclidean norms by multiplying $\mathbf{P}$ with a diagonal matrix ($\mathbf{A}$) from the right side (it has to be on the right), such that:
\begin{align}
\mathbf{P} = \left[ 
\begin{array}{cc}
a & b\\
c & d
\end{array}
\right]
\end{align}
\begin{align}
\mathbf{A} = \left[ 
\begin{array}{cc}
x_1 & 0\\
0 & x_2
\end{array}
\right]
\end{align}
\begin{align}
\mathbf{P A} =
\left[ 
\begin{array}{cc}
a & b\\
c & d
\end{array}
\right]
\left[ 
\begin{array}{cc}
x_1 & 0\\
0 & x_2
\end{array}
\right] = 
\left[ 
\begin{array}{cc}
ax_1 & bx_2\\
cx_1 & dx_2
\end{array}
\right]
\end{align}
then, the following system must be solved:
\begin{cases}
\left| a \right|^2  x_1^2 + \left| b \right|^2 x_2^2 = 1\\
\left| c \right|^2  x_1^2 + \left| d \right|^2 x_2^2 = 1\\
\end{cases}
In matrix notation
\begin{align}
\left[ 
\begin{array}{cc}
\left| a \right|^2 & \left| b \right|^2\\
\left| c \right|^2 & \left| d \right|^2
\end{array}
\right]
\left[ 
\begin{array}{c}
x_1^2\\
x_2^2
\end{array}
\right]
&=
\left[ 
\begin{array}{c}
1\\
1
\end{array}
\right]\\
\mathbf{T}
\left[ 
\begin{array}{c}
x_1^2\\
x_2^2
\end{array}
\right]
&=
\left[ 
\begin{array}{c}
1\\
1
\end{array}
\right]
\end{align}
where $\mathbf{T} = \left| \mathbf{P} \right|^2$, considering $\left| \cdot \right|$ to be element-wise.
The solution for $x_1^2$ and $x_2^2$ is easy to state:
\begin{align}
\left[ 
\begin{array}{c}
x_1^2\\
x_2^2
\end{array}
\right] 
&=
\mathbf{T}^{-1}
\left[ 
\begin{array}{c}
1\\
1
\end{array}
\right]\\
&= 
\left[ 
\begin{array}{c}
\sum \limits_{j=0}^1 t_{0j}\\
\sum \limits_{j=0}^1 t_{1j}
\end{array}
\right]
\end{align}
where $t_{ij}$ is the element from $\mathbf{T}^{-1}$ in the $i$-th line and $j$-th column.
However, if any of $x_1^2$ or $x_2^2$ happen to be negative, $x_1$ or $x_2$ will be complex and the unitary Euclidean norm fails.
Am I making any mistake?

One way to look at this would be:
$$
|a|^2 x_1^2 + |b|^2 x_2^2 = 1
$$
is an ellipse. So is the other equation. Now, you have a valid solution when these ellipses intersect in a matching way. Since I am lazy, I used Wolfram Alpha to do this. In essence, the ellipses must intersect, and the resulting points' coordinates must provide a valid solution for the original system. That is, you may get a solution for an instance where $(x_1, x_2)$ work for $a = 2$, but not for $a = -2$, for example.
The cases where it would not work for any signs of $a, b, c$ and $d$ would be those where the ellipses don't intersect at all.
If someone can come up with a better intuition, I'd be happy to learn.
