want the weights to be less compliant than the code vectors.

Constraints and also the combination of and are a common form of *compound constraint*, where the projection seeks a consensus value that additionally satisfies a side constraint. Projections to this type of constraint make use of the following lemma, whose most general form we will need in the later sections:

\[compoundconstraint\] Consider variables $\{z_i\in \mathbb{R}^m: i\in I\}$ and $v\in \mathbb{R}^n$ subject to the constraints $$\begin{aligned}
\forall\, i\in I :&\quad z_i=\overline{z}\\
&\quad(\overline{z},v)\in S,\end{aligned}$$ where $S\subset \mathbb{R}^{m+n}$ is a set that specifies a side constraint. The projection to this constraint, minimizing $$d^2(z_i: i\in I,v)=\sum_{i\in I}\|z'_i-z_i\|^2+g^2\,\|v'-v\|^2,$$ is given by $z_i\to \overline{z}'$: $i\in I$, $v\to v'$, where $$(\overline{z}',v')=P_S\left(\overline{z},v\right),$$ $$\overline{z}=\frac{1}{|I|}\sum_{i\in I}z_i,$$ and $P_S$ is the projection to $S$ minimizing $$d^2(\overline{z},v)=|I|\,\|\overline{z}'-\overline{z}\|^2+g^2\,\|v'-v\|^2.$$

The proof is an elementary exercise in completing the square.

In plain terms the lemma states that, in the case of a set of variables subject to a constrained consensus constraint, the projection is performed in two stages. In the first stage a consensus value is obtained by a simple average. This is followed, when there is a side constraint, by projecting the average value to the side constraint taking care to weight its 