Let $S$ be a sphere centered at origin in $\Bbb R^{2n}$ of radius $\sqrt{2n}$. Let $D$ be a diagonal matrix. Let $U$ be an orthogonal matrix. Let $r\in\Bbb Z_+$ be a fixed integer.
Let vector $v\in\Bbb Z^{2n}$ on the sphere at origin which gives $Uv$ as another vector on the sphere at the origin and such that $\langle Uv,Uv\rangle=\langle v,v\rangle\in\Bbb Z$.
How do you characterize all the vectors $v\in\Bbb Z^{2n}$ on the sphere at origin such that $$\langle DUv,DUv\rangle=r\langle Uv,Uv\rangle=r\langle v,v\rangle\in r\Bbb Z$$ $$\langle\tilde{D}Uv,\tilde{D}Uv\rangle=\langle Uv,Uv\rangle=\langle v,v\rangle\in\Bbb Z\mbox{ with } \tilde{D}=\frac{1}{\sqrt{r}}D?$$
How do you find a vector among all such vectors such that $|v|$ is maximized ($|v|$ is sum of entries of vector $v$)?
A general procedure by relaxing $v$ to $\Bbb R^{2n}$ would be a good starting help.