I have the following code (showing an insignificant simplification) that I really need to run many times for different ps (its length can be 10^7 or so) and wSize. Is there a way to speed this up using the fact that I have a special function inside MovingMap?
ps = RandomReal[{-1, 1}, 100000];
wSize = 100;
Σinv = Inverse@ToeplitzMatrix@CovarianceFunction[ps, {wSize - 1}];
MovingMap[#.Σinv.# &, ps, wSize - 1, "Periodic"];
tmp = Partition[ps, wSize, 1, -1]; MapThread[Dot, {tmp, tmp.Transpose[Σinv]}]
? $\endgroup$Inverse[]
andCovarianceFunction[]
withinCompile[]
, which you now know to be pointless. $\endgroup$