Lau1DCubicSpline.cc
Go to the documentation of this file.
24 Lau1DCubicSpline::Lau1DCubicSpline(const std::vector<Double_t>& xs, const std::vector<Double_t>& ys,
49 std::cout << "WARNING in Lau1DCubicSpline::evaluate : function is only defined between " << x_[0] << " and " << x_[nKnots_-1] << std::endl;
132 std::cout << "ERROR in Lau1DCubicSpline::init : The number of y-values given does not match the number of x-values" << std::endl;
169 // this is solved using the tridiagonal matrix algorithm as on en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
207 d_[nKnots_-1] = 3.*(y_[nKnots_-1]-y_[nKnots_-2])/((x_[nKnots_-1]-x_[nKnots_-2])*(x_[nKnots_-1]-x_[nKnots_-2]));
212 Double_t deltanm1((y_[nKnots_-1]-y_[nKnots_-2])/hnm1), deltanm2((y_[nKnots_-2]-y_[nKnots_-3])/hnm2);
219 d_[nKnots_-1] = deltanm2*hnm1*hnm1/(hnm2+hnm1) + deltanm1*(2.*hnm2*hnm2 + 3.*hnm2*hnm1)/(hnm2+hnm1);
232 d_[i] = 3.*(y_[i]-y_[i-1])/((x_[i]-x_[i-1])*(x_[i]-x_[i-1])) + 3.*(y_[i+1]-y_[i])/((x_[i+1]-x_[i])*(x_[i+1]-x_[i]));
253 d_[nKnots_-1] = (d_[nKnots_-1] - a_[nKnots_-1]*d_[nKnots_-2]) / (b_[nKnots_-1] - a_[nKnots_-1]*c_[nKnots_-2]);
282 // method assumes that the additional points follow a quadratic defined by the last three points
283 // this leads to the relations a[2] - a[1] = a[1] - a[0] = a[0] - a[-1] and a[n-1] - a[n-2] = a[n] - a[n-1] = a[n+1] - a[n]
311 // dy/dx_i = ( | a_i+2 - a_i+1 | a_i + | a_i - a_i-1 | a_i+1 ) / ( | a_i+2 - a_i+1 | + | a_i - a_i-1 | )
312 // in the special case a_i-1 == a_i != a_i+1 == a_i+2 this function is undefined so dy/dx is then defined as (a_i + a_i+1) / 2
324 dydx_[nKnots_-1] = ( b_[nKnots_-1] * a_[nKnots_-1] + c_[nKnots_-1] * an ) / ( b_[nKnots_-1] + c_[nKnots_-1] );
std::vector< Double_t > c_ The 'c' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:172 Definition: Lau1DCubicSpline.hh:86 LauSplineBoundaryType Define the allowed boundary condition types. Definition: Lau1DCubicSpline.hh:84 Definition: Lau1DCubicSpline.hh:87 std::vector< Double_t > b_ The 'b' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:170 Double_t dydxn_ The gradient at the right boundary for a clamped spline. Definition: Lau1DCubicSpline.hh:187 Double_t evaluate(Double_t x) const Evaluate the function at given point. Definition: Lau1DCubicSpline.cc:45 Definition: Lau1DCubicSpline.hh:85 void updateType(LauSplineType type) Update the type of interpolation to perform. Definition: Lau1DCubicSpline.cc:94 void calcDerivatives() Calculate the first derivative at each knot. Definition: Lau1DCubicSpline.cc:147 std::vector< Double_t > d_ The 'd' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:174 void calcDerivativesAkima() Calculate the first derivatives according to the Akima method. Definition: Lau1DCubicSpline.cc:267 std::vector< Double_t > a_ The 'a' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:168 File containing declaration of Lau1DCubicSpline class. LauSplineBoundaryType leftBound_ The left-hand boundary condition on the spline. Definition: Lau1DCubicSpline.hh:180 void updateYValues(const std::vector< Double_t > &ys) Update the y-values of the knots. Definition: Lau1DCubicSpline.cc:88 Lau1DCubicSpline(const std::vector< Double_t > &xs, const std::vector< Double_t > &ys, LauSplineType type=Lau1DCubicSpline::StandardSpline, LauSplineBoundaryType leftBound=Lau1DCubicSpline::NotAKnot, LauSplineBoundaryType rightBound=Lau1DCubicSpline::NotAKnot, Double_t dydx0=0.0, Double_t dydxn=0.0) Constructor. Definition: Lau1DCubicSpline.cc:24 Double_t dydx0_ The gradient at the left boundary for a clamped spline. Definition: Lau1DCubicSpline.hh:185 LauSplineBoundaryType rightBound_ The right-hand boundary condition on the spline. Definition: Lau1DCubicSpline.hh:182 void updateBoundaryConditions(LauSplineBoundaryType leftBound, LauSplineBoundaryType rightBound, Double_t dydx0=0.0, Double_t dydxn=0.0) Update the boundary conditions for the spline. Definition: Lau1DCubicSpline.cc:102 void calcDerivativesStandard() Calculate the first derivatives according to the standard method. Definition: Lau1DCubicSpline.cc:162 Generated by 1.8.5 |