예제 #1
0
        public void GetValue_GridPointArgument_GridPointValue(IGridPointCurve gridPointCurve)
        {
            Assume.That(gridPointCurve.FittingQuality == FittingQuality.Exact);

            for (int j = 0; j < gridPointCurve.GridPointCount; j++)
            {
                double expected = gridPointCurve.GridPointValues[j];
                double actual   = gridPointCurve.GetValue(gridPointCurve.GridPointArguments[j]);

                Assert.That(actual, Is.EqualTo(expected).Within(1E-6), String.Format("Grid Point argument: {0}; Grid Point value: {1}; null-based Grid Point index {2}.", gridPointCurve.GridPointArguments[j], gridPointCurve.GridPointValues[j], j));
            }
        }
예제 #2
0
 /// <summary>Adds a collection of grid points.
 /// </summary>
 /// <param name="gridPointCurve">The grid point curve object.</param>
 /// <param name="values">A collection of grid points, where the first component is the argument, i.e. the <see cref="System.Double"/> representation of the label,
 /// and the second component of the triple is the value.</param>
 /// <param name="isSorted">A value indicating whether the <see cref="System.Double"/> representation of the labels in <paramref name="values"/> are sorted in ascending order.</param>
 /// <exception cref="InvalidOperationException">Thrown, if <see cref="IGridPointCurve.IsReadOnly"/> is <c>true</c>.</exception>
 public static void AddRange(this IGridPointCurve <double> gridPointCurve, IEnumerable <Tuple <double, double> > values, bool isSorted = false)
 {
     gridPointCurve.AddRange(values.Select(xy => Tuple.Create(xy.Item1, xy.Item1, xy.Item2)), isSorted);
 }
예제 #3
0
 /// <summary>Adds a specific grid point.
 /// </summary>
 /// <param name="gridPointCurve">The grid point curve object.</param>
 /// <param name="argument">The argument, i.e. the <see cref="System.Double"/> representation of the label (x-coordinate).</param>
 /// <param name="value">The value (i.e. y-coordinate).</param>
 /// <returns>The null-based index of the grid point in the curve, the grid points should be ordered with respect to the argument.</returns>
 /// <exception cref="InvalidOperationException">Thrown, if <see cref="IGridPointCurve.IsReadOnly"/> is <c>true</c>.</exception>
 public static int Add(this IGridPointCurve <double> gridPointCurve, double argument, double value)
 {
     return(gridPointCurve.Add(argument, argument, value));
 }