I wonder how to solve the following constrained problem
${\rm Minimize}_{\vec{A}}$ $\parallel Z\vec{A}-Y\parallel^2_2$ , $\quad\vec{A}\in\mathbb{R}^{n^2}$
such that: $A\in\mathbb{R}^{5\times 5}$ is positive definite
where $\vec{A}=vec(A)$. For the unconstrained case, which has a closed form solution, I used MATLAB command lsqlin(). With constraints, in MATLAB, I am stuck as the constraints should be in terms of the variable that is minimized $\vec{A}$. However, my constraint is in terms of the matrix form $A$.
I can also say
${\rm Minimize}_{A}$ $\parallel X^{\rm T}AX-Y\parallel^2_2$ ,
such that: $A\in\mathbb{R}^{5\times 5}$ and $X^{\rm T}AX >0$, where $X\in\mathbb{R}^5$
This is a convex semi-definite optimization problem which can be readily formulated (and solved, if not too gigantic) in MATLAB using either CVX or YALMIP, both free. You just have to specify A as being positive semi-definite. If you want A to be strictly positive definite, then specify $A - cI$ to be positive semi-definite, where c is as small positive number, such as 1e-6, and I is the Identity matrix of the appropriate dimension.
For this problem, CVX should be adequate, and has a lower learning curve and less installation hassle (semidefinite solvers are included).
Edit: CVX solution might be something like:
At the conclusion of which, if successfully solved, A will contain the optimal solution, avaialable for you use in the MATLAB session.