Exemplo n.º 1
0
 /// <summary>Initialise spline with input data.</summary>
 public override void LoadData(ClWeightedPoint[] data)
 {
     // Check the number of data points
     if (data.Length < 4)
     {
         throw new ClEx("Number of data points must be >= 4");
     }
     // Check dimension of input data
     if (ClWeightedPoint.ArrayDimension(data) != 1)
     {
         throw new ClEx("The dimension of input data must be 1.");
     }
     // Deep copy.
     dataSpline_ = new ClWeightedPoint[data.Length];
     Array.Copy(data, dataSpline_, data.Length);
     // Pre-process input data.
     dataSpline_ = (ClWeightedPoint[])ClAbstractDataProcessor.ProcessDataArray(new ClDataMerge(), dataSpline_);
     // Set remaining fields.
     PointsNumber = dataSpline_.Length;
     if (PointsNumber < 4)
     {
         throw new ClEx("Minimum 4 points with different x-coordinates are required.");
     }
     ClWeightedPoint.Array1DToXY(dataSpline_, out points_, out values_);
     // Initialise underlying spline.
     splineMath_.Load(dataSpline_, params_);
     // Update status flags.
     IsInitialized = true;
     IsCalculated  = false;
 }
Exemplo n.º 2
0
 /// <summary>Initialise spline with weighted input data.</summary>
 public virtual void LoadData(ClWeightedPoint[] data)
 {
     // Check dimension of input data
     if (ClWeightedPoint.ArrayDimension(data) != 1)
     {
         throw new ClEx("The dimension of input data must be 1.");
     }
     // Deep copy.
     dataSpline_ = new ClWeightedPoint[data.Length];
     Array.Copy(data, dataSpline_, data.Length);
     // Set remaining fields.
     PointsNumber = dataSpline_.Length;
     ClWeightedPoint.Array1DToXY(dataSpline_, out points_, out values_);
 }
Exemplo n.º 3
0
 /// <summary>Initialise spline with unweighted input data.</summary>
 public virtual void LoadData(ClPoint[] data)
 {
     ClWeightedPoint[] dataWeighted = ClWeightedPoint.ToWeightedPointsArray(data);
     LoadData(dataWeighted);
 }