Пример #1
0
        /// <summary> Spline initialisation from X, Y input arrays and boundary conditions (slopes at end points)
        /// X must be in ascending order. </summary>
        public override void Load(ClWeightedPoint[] data, Spline1DBuilder parameters)
        {
            // if left or right slope is not set calculate it from first or last two points
            if (parameters.SlopeRight.IsEmpty)
            {
                slopeRight_ = (data[data.Length - 1].Value - data[data.Length - 2].Value) /
                              (data[data.Length - 1].X[0] - data[data.Length - 2].X[0]);
            }
            else
            {
                slopeRight_ = parameters.SlopeRight;
            }

            if (parameters.SlopeLeft.IsEmpty)
            {
                slopeLeft_ = (data[1].Value - data[0].Value) / (data[1].X[0] - data[0].X[0]);
            }
            else
            {
                slopeLeft_ = parameters.SlopeLeft;
            }

            base.Load(data);

            // Number of unknown b_i.
            equationSize_ = pointsNumber_;
        }
Пример #2
0
        /// <summary> Spline initialisation from X, Y input arrays and boundary conditions (slopes and values at end points)
        /// X must be in ascending order. </summary>
        public override void Load(ClWeightedPoint[] data, Spline1DBuilder parameters)
        {
            // if left or right end value is not set take value from first or last point
            if (parameters.ValueRight.IsEmpty)
            {
                valueRight_ = data[data.Length - 1].Value;
            }
            else
            {
                valueRight_ = parameters.ValueRight;
            }

            if (parameters.ValueLeft.IsEmpty)
            {
                valueLeft_ = data[0].Value;
            }
            else
            {
                valueLeft_ = parameters.ValueLeft;
            }

            base.Load(data);

            // Number of unknown b_i.
            equationSize_ = pointsNumber_;
        }
Пример #3
0
        /// <summary> Spline initialisation from X, Y input arrays.
        /// u is array of uncertainties.
        /// X must be in ascending order. </summary>
        virtual public void Load(ClWeightedPoint[] data, Spline1DBuilder parameters = null)
        {
            // Number of points.
            pointsNumber_ = data.Length;

            // Number of unknown b_i.
            equationSize_ = pointsNumber_ - 2;

            // Initialise spline sections (input points are (x_0, y_0), ..., (x_n, y_n)).
            splineSections_ = new ClSplineCubicSection[pointsNumber_];
            for (int i = 0; i < pointsNumber_; ++i)
            {
                splineSections_[i] = new ClSplineCubicSection {
                    X = data[i].X[0], Y = data[i].Value, Weight = 1
                };
                // TODO Fix NaN problem with weigths.
                //splineSections_[i].Weight = data[i].Weight;
            }

            // Calculate spline helper variables.
            CalculateHelperVariables();
        }
Пример #4
0
 public ClSplineCubicSmoothEndValue1D(Spline1DBuilder parameters) : base(parameters)
 {
     splineMath_ = new SplineCubicSmoothEndValue1DUtils();
 }
Пример #5
0
 public ClSplineCubicSmooth1D(Spline1DBuilder parameters)
 {
     params_ = parameters;
 }