public void TestSingleAddsWithWindowWidth(int windowWidth)
		{
			if (null == vals)
				Initialize();

			var min = new Altaxo.Collections.Operations.MinimumOnSlidingWindow<double>(windowWidth, double.PositiveInfinity);
			for (int i = 0; i < vals.Length - 1; ++i)
			{
				min.Add(vals[i]);
				double naiveResult = GetMinimumOnSlidingWindowNaiveVersion(1 + i - windowWidth, windowWidth, vals);

				Assert.AreEqual(naiveResult, min.MinimumValue, string.Format("Difference between naive version and Altaxo's implementation at i={0}, windowWidth={1}", i, windowWidth));
			}
		}
Esempio n. 2
0
        public void TestSingleAddsWithWindowWidth(int windowWidth)
        {
            if (null == vals)
            {
                Initialize();
            }

            var min = new Altaxo.Collections.Operations.MinimumOnSlidingWindow <double>(windowWidth, double.PositiveInfinity);

            for (int i = 0; i < vals.Length - 1; ++i)
            {
                min.Add(vals[i]);
                double naiveResult = GetMinimumOnSlidingWindowNaiveVersion(1 + i - windowWidth, windowWidth, vals);

                Assert.AreEqual(naiveResult, min.MinimumValue, string.Format("Difference between naive version and Altaxo's implementation at i={0}, windowWidth={1}", i, windowWidth));
            }
        }