For fixed $s$ and $n$, I need to find $\alpha$ which minimizes the following expression
$$h (I-2\alpha H + 2\alpha^2 H + \alpha^2 \mathcal{H})^s x0$$ where
$$ \begin{array}{lll} h&=&(1,\frac{1}{2},\frac{1}{3},\ldots,\frac{1}{n}) \\ H&=&\text{diag}(h)\\ \mathcal{H}&=& h\otimes h\\ x0&=& (1,1,\ldots,1)^T \end{array} $$
I got the straightforward solution by using NMinimize
, but it already takes 7 seconds for $n=5$, $s=10$, I'm wondering if there are Mathematica tricks to make this feasible for larger $n$ and $s$
CircleTimes = KroneckerProduct;
bestRate[n_, numSteps_] := Module[{},
ii = IdentityMatrix[n] // N;
h = Table[i^-1, {i, 1, n}] // N;
hh = h\[CircleTimes]h;
H = DiagonalMatrix[h];
M = ii - 2 alpha H + 2 alpha^2 H.H + alpha^2 hh;
x0 = ConstantArray[1., {n}];
xn = MatrixPower[M, numSteps].x0;
alpha /. Last@NMinimize[xn.h, alpha]
];
With[{n = 2},
Table[bestRate[n, s], {s, 1, 20}]
]
PS: this is the task of finding optimal rate for Least mean squares filter which runs for $s$ steps, with observations coming from Normal(0,H)