I am implementing a projected gradient ascent technique. I suspect that the projection is computable in closed form but I am not able to derive it.
The projection can be formulated as
$$ \min_x \|x - x_0\| $$
$$\text{s.t.}\quad x^\intercal B x \leq k .$$
where $x \in \mathbb{R}^n$ and $B$ is an invertible matrix.
The Lagrangian is
$$\mathcal{L}(x,\lambda) = (x-x_0)^\intercal(x-x_0) + \lambda (x^\intercal Bx - k)$$,
hence, we have
$$\nabla_x \mathcal{L}(x,\lambda) = 0 \implies x = (I + \lambda B)^{-1}x_0$$ and
$$\frac{\mathrm{d}}{\mathrm{d}\lambda} \mathcal{L}(x,\lambda) = 0 \implies x^\intercal B x = k$$.
This leads to the following equation
$$x_0^\intercal(I + \lambda B)^{-\intercal} B (I + \lambda B)^{-1}x_0 = k$$.
The problem is that I cannot find an analytical solution for $\lambda$... I tried with the Woodburg identity (in my problem $B$ can be seen as $CC^\intercal$).