For a matrix $\mathbf{X} \in \mathbb{R}^{n\times l}$, we have the following problem of representing vectors in $\mathbf{X}$ as a convex combination of other vectors excluding the vector itself:


$\min\Vert\mathbf{X-XC}\Vert\_F^2 \;\; s.t.\;\; diag(\mathbf{C})=0, \;\mathbf{c}\_i\geq 0, \;\mathrm{and}\; \Vert\mathbf{c}\_i\Vert\_1=1$


where $\mathbf{c}\_i$, is a column of $\mathbf{C}$, and $diag()$ extracts the diagonal elements of a matrix. 


1) Do we have a unique solution or not?


2) What is an efficient way to solve this quadratic program?



Convex Decomposition of matrix
I guess, uniqueness depends on the rank of $X$.


I would also suggest to look at the reformulate with [vectorization](https://en.wikipedia.org/wiki/Vectorization_(mathematics)) as
$$\newcommand{\vec}{\operatorname{vec}}
\|X-XC\|\_F^2 = \|\vec(X) - (I\otimes X)\vec(C)\|\_2^2.
$$
The constraints are fairly simple to project on (it basically constrains the columns of $C$ to be in the simplex and projecting onto the simplex can be done fast). Depending on the size and further characteristics of the problem you may use a standard QP-solver (noting that the constraints are indeed linear equality and inequality constraints) or simple projected gradient descent.


