Given, a vector of observations $\mathbf{y}=(y_1, y_2,\ldots,y_n)$ I am trying to find the soltuion to the following optimization problem: $$ \min{ (1/2) \|\mathbf{y-x}\|_2^2 + \lambda \|\mathbf{Dx}\|_1} $$
where $\mathbf{D}$ is a Toeplitz matrix withe first row given by $(1, -2, 1, 0, \ldots,0)$ or
$$ \mathbf{D}=\left[\begin{matrix} 1 & -2 & 1 &0 &\cdots &0 &0\\ 0 &1 & -2 & 1 &0 &\cdots &0\\ \vdots & \vdots &\vdots &\vdots &\vdots &&\vdots \\ 0 &0 &\cdots &0 &1 & -2 & 1\\ \end{matrix}\right] $$
The objective function given is convex and coercive and has a unique global minimizer $x^*$. However trying to code the probelm in Mathematica using ConvexOptimization[]
gives an error. Here is what I am trying:
winlen = 10;
lambda = 10;
MatD = ToeplitzMatrix[Join[{1.}, ConstantArray[0, {winlen - 3}] ],
Join[{1., -2., 1.}, ConstantArray[0, winlen - 3]]];
and
ConvexOptimization[
1/2 Norm[Range[10] - x]^2 + lambda Norm[MatD . x, 1], True, x \[Element] Vectors[10, Reals]];
which gives the error:
ConvexOptimization::scobj: The objective function 1/2 (Abs[1-x]^2+Abs[2-x]^2+Abs[3-x]^2+Abs[4-x]^2+Abs[5-x]^2+Abs[6-x]^2+Abs[7-x]^2+Abs[8-x]^2+Abs[9-x]^2+Abs[10-x]^2)
+Norm[{{1.,-2.,1.,0.,0.,0.,0.,0.,0.,0.},<<6>>,{<<1>>}}.x,1] should be scalar valued.
Any work around for this? (using subscripts does not work).
MatD
andmatD
,lambda
andlamdba
. $\endgroup$