Lau1DCubicSpline.cc
Go to the documentation of this file.
41 Lau1DCubicSpline::Lau1DCubicSpline(const std::vector<Double_t>& xs, const std::vector<Double_t>& ys,
66 std::cout << "WARNING in Lau1DCubicSpline::evaluate : function is only defined between " << x_[0] << " and " << x_[nKnots_-1] << std::endl;
149 std::cout << "ERROR in Lau1DCubicSpline::init : The number of y-values given does not match the number of x-values" << std::endl;
186 // this is solved using the tridiagonal matrix algorithm as on en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
224 d_[nKnots_-1] = 3.*(y_[nKnots_-1]-y_[nKnots_-2])/((x_[nKnots_-1]-x_[nKnots_-2])*(x_[nKnots_-1]-x_[nKnots_-2]));
229 Double_t deltanm1((y_[nKnots_-1]-y_[nKnots_-2])/hnm1), deltanm2((y_[nKnots_-2]-y_[nKnots_-3])/hnm2);
236 d_[nKnots_-1] = deltanm2*hnm1*hnm1/(hnm2+hnm1) + deltanm1*(2.*hnm2*hnm2 + 3.*hnm2*hnm1)/(hnm2+hnm1);
249 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]));
270 d_[nKnots_-1] = (d_[nKnots_-1] - a_[nKnots_-1]*d_[nKnots_-2]) / (b_[nKnots_-1] - a_[nKnots_-1]*c_[nKnots_-2]);
299 // method assumes that the additional points follow a quadratic defined by the last three points
300 // 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]
328 // 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 | )
329 // 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
341 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:186 Definition: Lau1DCubicSpline.hh:100 LauSplineBoundaryType Define the allowed boundary condition types. Definition: Lau1DCubicSpline.hh:98 ClassImp(LauAbsCoeffSet) std::vector< Double_t > b_ The 'b' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:184 Double_t dydxn_ The gradient at the right boundary for a clamped spline. Definition: Lau1DCubicSpline.hh:201 Double_t evaluate(Double_t x) const Evaluate the function at given point. Definition: Lau1DCubicSpline.cc:62 Definition: Lau1DCubicSpline.hh:99 void updateType(LauSplineType type) Update the type of interpolation to perform. Definition: Lau1DCubicSpline.cc:111 void calcDerivatives() Calculate the first derivative at each knot. Definition: Lau1DCubicSpline.cc:164 std::vector< Double_t > d_ The 'd' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:188 void calcDerivativesAkima() Calculate the first derivatives according to the Akima method. Definition: Lau1DCubicSpline.cc:284 std::vector< Double_t > a_ The 'a' coefficients used to determine the derivatives. Definition: Lau1DCubicSpline.hh:182 File containing declaration of Lau1DCubicSpline class. LauSplineBoundaryType leftBound_ The left-hand boundary condition on the spline. Definition: Lau1DCubicSpline.hh:194 Class for defining a 1D cubic spline based on a set of knots. Definition: Lau1DCubicSpline.hh:84 void updateYValues(const std::vector< Double_t > &ys) Update the y-values of the knots. Definition: Lau1DCubicSpline.cc:105 Double_t dydx0_ The gradient at the left boundary for a clamped spline. Definition: Lau1DCubicSpline.hh:199 LauSplineBoundaryType rightBound_ The right-hand boundary condition on the spline. Definition: Lau1DCubicSpline.hh:196 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:119 void calcDerivativesStandard() Calculate the first derivatives according to the standard method. Definition: Lau1DCubicSpline.cc:179 Generated by ![]() |