Пример #1
0
        public void GetValue_One_BenchmarkResult(
            [Values(100, 125)]
            int initialOrder,
            [Values(5, 10, 25)]
            int orderStepSize)
        {
            var gaussHermiteIntegrator = new GaussHermiteIntegrator(initialOrder, orderStepSize);
            var numericalIntegrator    = gaussHermiteIntegrator.Create();

            numericalIntegrator.FunctionToIntegrate = x => 1.0;

            double expected = Math.Sqrt(Math.PI);
            double actual   = numericalIntegrator.GetValue();

            Assert.That(actual, Is.EqualTo(expected).Within(1E-6), String.Format("1-dimensional integrator {0}.", numericalIntegrator.Factory.Name));
        }
Пример #2
0
 /// <summary>Initializes a new instance of the <see cref="Algorithm"/> class.
 /// </summary>
 /// <param name="gaussHermiteIntegrator">The <see cref="GaussHermiteIntegrator"/> object which serves as factory for the current object.</param>
 internal Algorithm(GaussHermiteIntegrator gaussHermiteIntegrator)
 {
     m_IntegratorFactory = gaussHermiteIntegrator;
     WeightFunction      = WeightFunction.Create(x => Math.Exp(-x * x));
 }