Minimization using rotations with constraint Given angle $\phi \in [-\pi,\pi]$ and vector ${\bf a} \in \mathbb{C}^n$,
$$\begin{array}{ll} \underset{{\bf v} \in \mathbb{C}^n}{\text{minimize}} & \left| {\bf a}^H \bf{v} \right|^2\\ \text{subject to} & |v_1| = \cdots = |v_n| = 1\\ & \arg \left( {\bf a}^H {\bf v} \right) = \phi\end{array}$$
This minimization problem is part of beamforming design in wireless communications. I would like to ask you to please help me with this minimization problem.
 A: Calling
$$
\cases{
v_k = e^{i\theta_k}\\
a_k = x_k + i y_k
}
$$
we have
$$ 
p_r = \sum_k^nx_k \cos\theta_k-y_k\sin\theta_k\\
p_i = \sum_k^nx_k \sin\theta_k+y_k\cos\theta_k\\
$$
then the problem can be formulated as
$$
\min_{\theta_k}p_r^2+p_i^2\ \ \text{s. t.}\ \ p_i = \tan\phi p_r
$$
This problem can be posed as
$$
\min_{c_k,s_k}\left(\sum_k^nx_k c_k-y_k s_k\right)^2+\left(\sum_k^nx_k s_k+y_kc_k\right)^2 \ \ \text{s. t.}\ \ \cases{c_k^2+s_k^2=1, \ \ k = 1,\cdots, n\\ 
\sum_k^nx_k s_k+y_kc_k = \tan\phi\left(\sum_k^nx_k c_k-y_k s_k\right)}
$$
and can be successfully tackled using a Sequential Quadratic Programming approach.
Attached a MATHEMATICA script showing a typical procedure
n = 10;
ar = RandomReal[{-3, 3}, n];
ai = RandomReal[{-3, 3}, n];
ck = Table[c[k], {k, 1, n}];
sk = Table[s[k], {k, 1, n}];
re = Sum[ar[[k]] c[k] - ai[[k]] s[k], {k, 1, n}];
im = Sum[ar[[k]] s[k] + ai[[k]] c[k], {k, 1, n}];
obj = re^2 + im^2;
restr1 = Table[s[k]^2 + c[k]^2 - 1, {k, 1, n}];
restr2 = im - Tan[phi] re /. {phi -> Pi/4};
restrs = Join[restr1, {restr2}];
sol = NMinimize[{obj, restrs == 0}, Join[ck, sk]]
restrs /. sol[[2]]

