How to solve the following system for $\mathbf{C}$ and $\mathbf{a}$:
$\min\|\mathbf{X-XC} \,\mbox{diag} (\mathbf{a})\|_F^2$ subject to $\mathbf{c}_{ik}\geq 0$, $1^T \mathbf{c}_k = 1$ and $1-\delta\leq\mathbf{a}_k\leq 1+\delta$
where $\delta$ is a small value, $\mathbf{c}_k$ is the kth column vector with nonnegative entries, $\mathbf{c}_{ik}$ is the ith element of vector $\mathbf{c}$ and $\mathbf{a}_k$ is the kth element of vector $\mathbf{a}$
We have a convex quadratic program
$$\begin{array}{ll} \text{minimize} & \|A X - A\|_F^2\\ \text{subject to} & (1 - \delta) 1_n \leq X^T 1_n \leq (1 + \delta) 1_n\\ & X \geq 0\\ & X \in \mathbb{R}^{n \times n}\end{array}$$
Vectorizing $X$, this QP can be written in a more standard form
$$\begin{array}{ll} \text{minimize} & \|(I_n \otimes A) \, \mbox{vec} (X) - \mbox{vec} (A)\|_2^2\\ \text{subject to} & (1 - \delta) 1_{n^2} \leq (I_n \otimes 1_n^T)\, \mbox{vec} (X) \leq (1 + \delta) 1_{n^2}\\ & \mbox{vec} (X) \geq 0\\ & \mbox{vec} (X) \in \mathbb{R}^{n^2}\end{array}$$