Accord.Tests.Math.AbsoluteConvergenceTest.AbsoluteConvergenceConstructorTest C# (CSharp) Method

AbsoluteConvergenceConstructorTest() private method

private AbsoluteConvergenceConstructorTest ( ) : void
return void
        public void AbsoluteConvergenceConstructorTest()
        {
            var criteria = new AbsoluteConvergence(iterations: 10, tolerance: 0.1);

            int progress = 1;

            do
            {
                // Do some processing...


                // Update current iteration information:
                criteria.NewValue = 12345.6 / progress++;

            } while (!criteria.HasConverged);


            // The method will converge after reaching the 
            // maximum of 10 iterations with a final value
            // of 1371.73:

            int iterations = criteria.CurrentIteration; // 10
            double value = criteria.OldValue; // 1371.7333333


            Assert.AreEqual(10, criteria.CurrentIteration);
            Assert.AreEqual(1371.7333333333333, criteria.OldValue);
        }
    }
AbsoluteConvergenceTest