/// <summary>Initializes a new instance of the <see cref="Algorithm"/> class. /// </summary> /// <param name="gaussHermiteConstantAbscissasIntegrator">The <see cref="GaussHermiteConstAbscissaIntegrator"/> object which serves as factory for the current object.</param> internal Algorithm(GaussHermiteConstAbscissaIntegrator gaussHermiteConstantAbscissasIntegrator) { m_IntegratorFactory = gaussHermiteConstantAbscissasIntegrator; WeightFunction = OneDimNumericalIntegrator.WeightFunction.Create(x => Math.Exp(-x * x)); m_EvaluationPoints = GaussianQuadrature.Hermite.GetValue(m_IntegratorFactory.Order, out m_Weights); }
public void GetValue_One_BenchmarkResult( [Values(100, 125)] int order) { var gaussHermiteIntegrator = new GaussHermiteConstAbscissaIntegrator(order); var numericalIntegrator = gaussHermiteIntegrator.Create(); numericalIntegrator.FunctionToIntegrate = (x, k) => 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)); }