I would like to find a numerical solution to the following quadratic matrix programming problem. Square matrix A has thousands of rows, so I need a algorithm which works fast. I looked into Python but couldnt find much there. Is there something in Matlab, Mathematica, or elsewhere.
$A$ is an $n\times n$ matrix of coefficients represented by $a_{ij}$. I know the zero entries (see constraint 4). The optimization problem is to compute the coefficients of matrix A.
\begin{aligned} \underset{\{a_{ij}\}}{\text{minimize}} & & \sum_{i=1}^n \sum_{j=1}^n (a_{ij})^2 \\\\ & \text{constraint 1} & & Ax = x \\\\ & \text{constraint 2} & & a_{ij} \geq 0 \text{ } \forall i,j \\\\ & \text{constraint 3} & & \sum_{j=1}^n a_{ij} = 1 \text{ } \forall i \\\\ & \text{constraint 4} & & a_{ij} = 0 \text{ } \forall a_{ij} \in B \end{aligned}
Where B is a collection of tuples indicating which elements of A is zero. For example, $B=[a_{01}, a_{02}, a_{31} ]$, means $a_{01}, a_{02}, a_{31}$ are zeros in $A$.
And x is fixed vector.