/// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class.
 /// </summary>
 /// <param name="curveInterpolator">The interpolation approach of the curve.</param>
 /// <param name="buildingDirection">The building direction of the curve extrapolation.</param>
 /// <param name="value">The individual value to take into account for the constant curve extrapolation.</param>
 /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param>
 public Extrapolator(ICurveDataFitting curveInterpolator, BuildingDirection buildingDirection, double value, GridPointCurve.Extrapolator extrapolatorFactory)
 {
     m_CurveInterpolator = curveInterpolator ?? throw new ArgumentNullException(nameof(curveInterpolator));
     m_BuildingDirection = buildingDirection;
     m_GridPointValue    = value;
     Factory             = extrapolatorFactory;
 }
 /// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class.
 /// </summary>
 /// <param name="curveInterpolator">The interpolation approach of the curve.</param>
 /// <param name="buildingDirection">The building direction of the curve extrapolation.</param>
 /// <param name="slope">The slope.</param>
 /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param>
 public Extrapolator(ICurveDataFitting curveInterpolator, BuildingDirection buildingDirection, double slope, GridPointCurve.Extrapolator extrapolatorFactory)
 {
     m_CurveInterpolator = curveInterpolator ?? throw new ArgumentNullException(nameof(curveInterpolator));
     m_BuildingDirection = buildingDirection;
     m_Slope             = slope;
     m_ReferencePoint    = Double.NaN;
     m_ReferenceValue    = Double.NaN;
     Factory             = extrapolatorFactory;
 }
                /// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class.
                /// </summary>
                /// <param name="curveInterpolator">The interpolation approach of the curve.</param>
                /// <param name="buildingDirection">The building direction of the curve extrapolation.</param>
                /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param>
                public Extrapolator(ICurveDataFitting curveInterpolator, BuildingDirection buildingDirection, GridPointCurve.Extrapolator extrapolatorFactory)
                {
                    if (curveInterpolator == null)
                    {
                        throw new ArgumentNullException(nameof(curveInterpolator));
                    }
                    if ((curveInterpolator is IDifferentiableRealValuedCurve) == false)
                    {
                        throw new ArgumentException(nameof(curveInterpolator));
                    }
                    m_CurveInterpolator = (IDifferentiableRealValuedCurve)curveInterpolator;

                    m_BuildingDirection = buildingDirection;
                    m_Slope             = Double.NaN;
                    m_ReferencePoint    = Double.NaN;
                    m_ReferenceValue    = Double.NaN;
                    Factory             = extrapolatorFactory;
                }
Beispiel #4
0
 /// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class.
 /// </summary>
 /// <param name="curveInterpolator">The interpolation approach of the curve.</param>
 /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param>
 public Extrapolator(ICurveDataFitting curveInterpolator, GridPointCurve.Extrapolator extrapolatorFactory)
 {
     m_CurveBuilder = curveInterpolator;
     Factory        = extrapolatorFactory;
 }
 /// <summary>Initializes a new instance of the <see cref="Differentiable"/> class.
 /// </summary>
 /// <param name="curveInterpolatorFactory">The curve interpolator factory.</param>
 /// <param name="curveInterpolator">The curve interpolator.</param>
 /// <param name="leftExtrapolatorFactory">The left extrapolator factory.</param>
 /// <param name="leftExtrapolator">The left extrapolator.</param>
 /// <param name="rightExtrapolatorFactory">The right extrapolator factory.</param>
 /// <param name="rightExtrapolator">The right extrapolator.</param>
 /// <param name="capacity">The number of elements that the new grid point curve can initially store.</param>
 internal Differentiable(GridPointCurve.Interpolator curveInterpolatorFactory, ICurveDataFitting curveInterpolator, GridPointCurve.Extrapolator leftExtrapolatorFactory, ICurveExtrapolator leftExtrapolator, GridPointCurve.Extrapolator rightExtrapolatorFactory, ICurveExtrapolator rightExtrapolator, int capacity)
     : base(curveInterpolatorFactory, curveInterpolator, leftExtrapolatorFactory, leftExtrapolator, rightExtrapolatorFactory, rightExtrapolator, capacity)
 {
 }
        /// <summary>Initializes a new instance of the <see cref="StandardGridPointCurve&lt;TLabel&gt;"/> class.
        /// </summary>
        /// <param name="curveInterpolatorFactory">The curve interpolator factory.</param>
        /// <param name="curveInterpolator">The curve interpolator.</param>
        /// <param name="leftExtrapolatorFactory">The left extrapolator factory.</param>
        /// <param name="leftExtrapolator">The left extrapolator.</param>
        /// <param name="rightExtrapolatorFactory">The right extrapolator factory.</param>
        /// <param name="rightExtrapolator">The right extrapolator.</param>
        /// <param name="capacity">The number of elements that the new grid point curve can initially store.</param>
        internal StandardGridPointCurve(GridPointCurve.Interpolator curveInterpolatorFactory, ICurveDataFitting curveInterpolator, GridPointCurve.Extrapolator leftExtrapolatorFactory, ICurveExtrapolator leftExtrapolator, GridPointCurve.Extrapolator rightExtrapolatorFactory, ICurveExtrapolator rightExtrapolator, int capacity = 20)
        {
            m_GridPointLabels    = new List <TLabel>(capacity);
            m_GridPointArguments = new List <double>(capacity);
            m_GridPointValues    = new List <double>(capacity);

            m_CurveBuilder      = curveInterpolator;
            m_LeftExtrapolator  = leftExtrapolator;
            m_RightExtrapolator = rightExtrapolator;

            m_State = GridPointCurve.State.GridPointChanged;

            m_ReadOnlyGridPointLabels    = new ReadOnlyCollection <TLabel>(m_GridPointLabels);
            m_ReadOnlyGridPointValues    = new ReadOnlyCollection <double>(m_GridPointValues);
            m_ReadOnlyGridPointArguments = new ReadOnlyCollection <double>(m_GridPointArguments);
        }
 /// <summary>Initializes a new instance of the <see cref="CurveExtrapolationConstant"/> class.
 /// </summary>
 internal CurveExtrapolationConstant()
 {
     First = new FirstGridPoint();
     Last  = new LastGridPoint();
 }
 /// <summary>Creates a specific grid point curve factory.
 /// </summary>
 /// <typeparam name="TLabel">The type of the label.</typeparam>
 /// <param name="curveInterpolator">The curve interpolator.</param>
 /// <param name="leftExtrapolator">The extrapolator on the left side, i.e. from the first grid point to -\infinity.</param>
 /// <param name="rightExtrapolator">The extrapolator on the right side, i.e. from the last grid point to \infinity.</param>
 /// <returns>A factory for <see cref="IGridPointCurve&lt;TLabel&gt;"/> objects with respect to the desired interpolation and extrapolation approaches.</returns>
 public static IGridPointCurveFactory <TLabel> Create <TLabel>(GridPointCurve.Interpolator curveInterpolator, GridPointCurve.Extrapolator leftExtrapolator, GridPointCurve.Extrapolator rightExtrapolator)
     where TLabel : IEquatable <TLabel>
 {
     return(new CurveFactory <TLabel>(
                () => GridPointCurve.Create <TLabel>(curveInterpolator, leftExtrapolator, rightExtrapolator),
                curveInterpolator,
                (gridPointCount, gridPointLabels, gridPointArguments, gridPointValues, gridPointArgumentStartIndex, gridPointValueStartIndex, gridPointArgumentIncrement, gridPointValueIncrement) => { return GridPointCurve.Create(curveInterpolator, leftExtrapolator, rightExtrapolator, gridPointCount, gridPointLabels, gridPointArguments, gridPointValues, gridPointArgumentStartIndex, gridPointValueStartIndex, gridPointArgumentIncrement, gridPointValueIncrement); }));
 }
Beispiel #9
0
 /// <summary>Initializes a new instance of the <see cref="CurveExtrapolationNone"/> class.
 /// </summary>
 internal CurveExtrapolationNone()
 {
     First = new FirstGridPoint();
     Last  = new LastGridPoint();
 }
Beispiel #10
0
 /// <summary>Initializes a new instance of the <see cref="Extrapolator"/> class.
 /// </summary>
 /// <param name="curveInterpolator">The interpolation approach of the curve.</param>
 /// <param name="extrapolatorFactory">The <see cref="GridPointCurve.Extrapolator"/> object that serves as factory for the current object.</param>
 public Extrapolator(ICurveDataFitting curveInterpolator, GridPointCurve.Extrapolator extrapolatorFactory)
 {
     m_CurveInterpolator = curveInterpolator ?? throw new ArgumentNullException(nameof(curveInterpolator));
     m_GridPointValue    = Double.NaN;
     Factory             = extrapolatorFactory;
 }