/// <summary> /// Creates a new instance of the <see cref="T:SmallDoubleInterpolable"/> class with a specified number of points and a provided interpolator. /// </summary> /// <param name="nPoints">The n points.</param> /// <param name="idi">The doubleInterpolator that this <see cref="T:SmallDoubleInterpolable"/> will use.</param> public SmallDoubleInterpolable(int nPoints, IDoubleInterpolator idi) : this(nPoints){ m_interpolator = idi; if (!m_interpolator.HasData) { m_interpolator.SetData(m_xVals, m_yVals); } }
/// <summary> /// Creates a new instance of the <see cref="T:SmallDoubleInterpolable"/> class which will contain a specified number of data points. /// </summary> /// <param name="nPoints">The number of data points.</param> public SmallDoubleInterpolable(int nPoints) { m_xVals = new double[nPoints]; m_yVals = new double[nPoints]; foreach (double[] da in new[] { m_xVals, m_yVals }) { for (int i = 0; i < da.Length; i++) { da[i] = double.NaN; } } m_nEntries = 0; m_interpolator = new LinearDoubleInterpolator(); m_interpolator.SetData(m_xVals, m_yVals); }
/// <summary> /// Creates and initializes a SmallDoubleInterpolablefrom two arrays of correlated /// X and Y values. /// </summary> /// <param name="xVals">The correlated x values.</param> /// <param name="yVals">The correlated y values.</param> /// <param name="idi">The IDoubleInterpolator to be used to discern Y values between known x values.</param> public SmallDoubleInterpolable(double[] xVals, double[] yVals, IDoubleInterpolator idi) : this(xVals, yVals) { m_interpolator = idi; m_interpolator.SetData(xVals, yVals); }