AdaptiveSingularSpectrumSequenceModeler.cs (60)
526Contracts.Assert(1 <= rank && rank <= tMat.WindowSize);
527Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * rank);
530var k = tMat.SeriesLength - tMat.WindowSize + 1;
542tMat.MultiplyTranspose(singularVectors, v, false, tMat.WindowSize * i, 0);
543tMat.RankOneHankelization(singularVectors, v, 1, output, true, tMat.WindowSize * i, 0, 0);
550Contracts.Assert(1 <= rank && rank <= tMat.WindowSize);
551Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * rank);
553int len = 2 * tMat.WindowSize - 1;
564int offset1 = tMat.SeriesLength - 2 * tMat.WindowSize + 1;
565int offset2 = tMat.SeriesLength - tMat.WindowSize;
574for (j = offset1; j < offset1 + tMat.WindowSize; ++j)
575v += series[j] * singularVectors[tMat.WindowSize * i - offset1 + j];
577for (j = 0; j < tMat.WindowSize - 1; ++j)
578output[j] += v * singularVectors[tMat.WindowSize * i + j];
580temp = v * singularVectors[tMat.WindowSize * (i + 1) - 1];
583for (j = offset2; j < offset2 + tMat.WindowSize; ++j)
584v += series[j] * singularVectors[tMat.WindowSize * i - offset2 + j];
586for (j = tMat.WindowSize; j < 2 * tMat.WindowSize - 1; ++j)
587output[j] += v * singularVectors[tMat.WindowSize * (i - 1) + j + 1];
589temp += v * singularVectors[tMat.WindowSize * i];
590output[tMat.WindowSize - 1] += (temp / 2);
648Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * tMat.WindowSize);
649Contracts.Assert(Utils.Size(singularValues) >= tMat.WindowSize);
650Contracts.Assert(1 <= maxRank && maxRank <= tMat.WindowSize - 1);
653var k = inputSeriesLength - tMat.WindowSize + 1;
658var alpha = new Single[tMat.WindowSize - 1];
664int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k);
666TrajectoryMatrix xTM = new TrajectoryMatrix(null, x, tMat.WindowSize - 1, inputSeriesLength - 1);
677FixedSizeQueue<Single> window = new FixedSizeQueue<float>(tMat.WindowSize - 1);
679for (i = 0; i < tMat.WindowSize; ++i)
685lambda = singularVectors[tMat.WindowSize * i + tMat.WindowSize - 1];
686for (j = 0; j < tMat.WindowSize - 1; ++j)
687alpha[j] += lambda * singularVectors[tMat.WindowSize * i + j];
693tMat.MultiplyTranspose(singularVectors, v, false, tMat.WindowSize * i, 0);
694tMat.RankOneHankelization(singularVectors, v, 1, x, true, tMat.WindowSize * i, 0, 0);
701for (j = inputSeriesLength - evaluationLength - tMat.WindowSize + 1; j < inputSeriesLength - evaluationLength; ++j)
708for (n = 0; n < tMat.WindowSize - 1; ++n)
742Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * tMat.WindowSize);
743Contracts.Assert(Utils.Size(singularValues) >= tMat.WindowSize);
744Contracts.Assert(1 <= maxRank && maxRank <= tMat.WindowSize - 1);
747var k = inputSeriesLength - tMat.WindowSize + 1;
750var x = new Single[tMat.WindowSize - 1];
751var alpha = new Single[tMat.WindowSize - 1];
757int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k);
768FixedSizeQueue<Single> window = new FixedSizeQueue<float>(tMat.WindowSize - 1);
773lambda = singularVectors[tMat.WindowSize * i + tMat.WindowSize - 1];
774for (j = 0; j < tMat.WindowSize - 1; ++j)
775alpha[j] += lambda * singularVectors[tMat.WindowSize * i + j];
782offset = inputSeriesLength - evaluationLength - tMat.WindowSize + 1;
785v += series[j] * singularVectors[tMat.WindowSize * i - offset + j];
787for (j = 0; j < tMat.WindowSize - 1; ++j)
788x[j] += v * singularVectors[tMat.WindowSize * i + j];
794observationNoiseMean /= (tMat.WindowSize - 1);
796for (j = 0; j < tMat.WindowSize - 1; ++j)
803for (n = 0; n < tMat.WindowSize - 1; ++n)