library: libGraf
#include "TSpline.h"

TSpline5


class description - source file - inheritance tree (.pdf)

class TSpline5 : public TSpline

Inheritance Chart:
TObject
<-
TNamed
TAttLine
TAttFill
TAttMarker
<-
TSpline
<-
TSpline5
    private:
void BoundaryConditions(const char* opt, Int_t& beg, Int_t& end, const char*& cb1, const char*& ce1, const char*& cb2, const char*& ce2) virtual void BuildCoeff() void SetBoundaries(Double_t b1, Double_t e1, Double_t b2, Double_t e2, const char* cb1, const char* ce1, const char* cb2, const char* ce2) public:
TSpline5() TSpline5(const char* title, Double_t* x, Double_t* y, Int_t n, const char* opt = "0", Double_t b1 = 0, Double_t e1 = 0, Double_t b2 = 0, Double_t e2 = 0) TSpline5(const char* title, Double_t xmin, Double_t xmax, Double_t* y, Int_t n, const char* opt = "0", Double_t b1 = 0, Double_t e1 = 0, Double_t b2 = 0, Double_t e2 = 0) TSpline5(const char* title, Double_t* x, const TF1* func, Int_t n, const char* opt = "0", Double_t b1 = 0, Double_t e1 = 0, Double_t b2 = 0, Double_t e2 = 0) TSpline5(const char* title, Double_t xmin, Double_t xmax, const TF1* func, Int_t n, const char* opt = "0", Double_t b1 = 0, Double_t e1 = 0, Double_t b2 = 0, Double_t e2 = 0) TSpline5(const char* title, const TGraph* g, const char* opt = "0", Double_t b1 = 0, Double_t e1 = 0, Double_t b2 = 0, Double_t e2 = 0) TSpline5(const TSpline5&) ~TSpline5() static TClass* Class() Double_t Derivative(Double_t x) const virtual Double_t Eval(Double_t x) const Int_t FindX(Double_t x) const void GetCoeff(Int_t i, Double_t& x, Double_t& y, Double_t& b, Double_t& c, Double_t& d, Double_t& e, Double_t& f) virtual void GetKnot(Int_t i, Double_t& x, Double_t& y) const virtual TClass* IsA() const TSpline5& operator=(const TSpline5&) virtual void SaveAs(const char* filename) const virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) static void Test()

Data Members

    private:
TSplinePoly5* fPoly [fNp] Array of polynomial terms

Class Description

                                                                      
 TSpline                                                              
                                                                      
 Base class for spline implementation containing the Draw/Paint       
 methods                                                              
                                                                      


TSpline5(const char *title, Double_t x[], Double_t y[], Int_t n, const char *opt, Double_t b1, Double_t e1, Double_t b2, Double_t e2) : TSpline(title,-1, x[0], x[n-1], n, kFALSE)
 Quintic natural spline creator given an array of
 arbitrary knots in increasing abscissa order and
 possibly end point conditions


TSpline5(const char *title, Double_t xmin, Double_t xmax, Double_t y[], Int_t n, const char *opt, Double_t b1, Double_t e1, Double_t b2, Double_t e2) : TSpline(title,(xmax-xmin)/(n-1), xmin, xmax, n, kTRUE)
 Quintic natural spline creator given an array of
 arbitrary function values on equidistant n abscissa
 values from xmin to xmax and possibly end point conditions


TSpline5(const char *title, Double_t x[], const TF1 *func, Int_t n, const char *opt, Double_t b1, Double_t e1, Double_t b2, Double_t e2) : TSpline(title,-1, x[0], x[n-1], n, kFALSE)
 Quintic natural spline creator given an array of
 arbitrary abscissas in increasing order and a function
 to interpolate and possibly end point conditions


TSpline5(const char *title, Double_t xmin, Double_t xmax, const TF1 *func, Int_t n, const char *opt, Double_t b1, Double_t e1, Double_t b2, Double_t e2) : TSpline(title,(xmax-xmin)/(n-1), xmin, xmax, n, kTRUE)
 Quintic natural spline creator given a function to be
 evaluated on n equidistand abscissa points between xmin
 and xmax and possibly end point conditions


TSpline5(const char *title, const TGraph *g, const char *opt, Double_t b1, Double_t e1, Double_t b2, Double_t e2) : TSpline(title,-1,0,0,g->GetN(),kFALSE)
 Quintic natural spline creator given a TGraph with
 abscissa in increasing order and possibly end
 point conditions


void BoundaryConditions(const char *opt,Int_t &beg,Int_t &end, const char *&cb1,const char *&ce1, const char *&cb2,const char *&ce2)
 Check the boundary conditions and the
 amount of extra double knots needed


void SetBoundaries(Double_t b1, Double_t e1, Double_t b2, Double_t e2, const char *cb1, const char *ce1, const char *cb2, const char *ce2)
 Set the boundary conditions at double/triple knots


Int_t FindX(Double_t x) const

Double_t Eval(Double_t x) const

Double_t Derivative(Double_t x) const

void SaveAs(const char *filename) const
 write this spline as a C++ function that can be executed without ROOT
 the name of the function is the name of the file up to the "." if any

void BuildCoeff()
     algorithm 600, collected algorithms from acm.
     algorithm appeared in acm-trans. math. software, vol.9, no. 2,
     jun., 1983, p. 258-259.

     TSpline5 computes the coefficients of a quintic natural quintic spli
     s(x) with knots x(i) interpolating there to given function values:
               s(x(i)) = y(i)  for i = 1,2, ..., n.
     in each interval (x(i),x(i+1)) the spline function s(xx) is a
     polynomial of fifth degree:
     s(xx) = ((((f(i)*p+e(i))*p+d(i))*p+c(i))*p+b(i))*p+y(i)    (*)
           = ((((-f(i)*q+e(i+1))*q-d(i+1))*q+c(i+1))*q-b(i+1))*q+y(i+1)
     where  p = xx - x(i)  and  q = x(i+1) - xx.
     (note the first subscript in the second expression.)
     the different polynomials are pieced together so that s(x) and
     its derivatives up to s"" are continuous.

        input:

     n          number of data points, (at least three, i.e. n > 2)
     x(1:n)     the strictly increasing or decreasing sequence of
                knots.  the spacing must be such that the fifth power
                of x(i+1) - x(i) can be formed without overflow or
                underflow of exponents.
     y(1:n)     the prescribed function values at the knots.

        output:

     b,c,d,e,f  the computed spline coefficients as in (*).
         (1:n)  specifically
                b(i) = s'(x(i)), c(i) = s"(x(i))/2, d(i) = s"'(x(i))/6,
                e(i) = s""(x(i))/24,  f(i) = s""'(x(i))/120.
                f(n) is neither used nor altered.  the five arrays
                b,c,d,e,f must always be distinct.

        option:

     it is possible to specify values for the first and second
     derivatives of the spline function at arbitrarily many knots.
     this is done by relaxing the requirement that the sequence of
     knots be strictly increasing or decreasing.  specifically:

     if x(j) = x(j+1) then s(x(j)) = y(j) and s'(x(j)) = y(j+1),
     if x(j) = x(j+1) = x(j+2) then in addition s"(x(j)) = y(j+2).

     note that s""(x) is discontinuous at a double knot and, in
     addition, s"'(x) is discontinuous at a triple knot.  the
     subroutine assigns y(i) to y(i+1) in these cases and also to
     y(i+2) at a triple knot.  the representation (*) remains
     valid in each open interval (x(i),x(i+1)).  at a double knot,
     x(j) = x(j+1), the output coefficients have the following values:
       y(j) = s(x(j))          = y(j+1)
       b(j) = s'(x(j))         = b(j+1)
       c(j) = s"(x(j))/2       = c(j+1)
       d(j) = s"'(x(j))/6      = d(j+1)
       e(j) = s""(x(j)-0)/24     e(j+1) = s""(x(j)+0)/24
       f(j) = s""'(x(j)-0)/120   f(j+1) = s""'(x(j)+0)/120
     at a triple knot, x(j) = x(j+1) = x(j+2), the output
     coefficients have the following values:
       y(j) = s(x(j))         = y(j+1)    = y(j+2)
       b(j) = s'(x(j))        = b(j+1)    = b(j+2)
       c(j) = s"(x(j))/2      = c(j+1)    = c(j+2)
       d(j) = s"'((x(j)-0)/6    d(j+1) = 0  d(j+2) = s"'(x(j)+0)/6
       e(j) = s""(x(j)-0)/24    e(j+1) = 0  e(j+2) = s""(x(j)+0)/24
       f(j) = s""'(x(j)-0)/120  f(j+1) = 0  f(j+2) = s""'(x(j)+0)/120


void Test()
 Test method for TSpline5


   n          number of data points.
   m          2*m-1 is order of spline.
                 m = 3 always for quintic spline.
   nn,nm1,mm,
   mm1,i,k,
   j,jj       temporary integer variables.
   z,p        temporary double precision variables.
   x[n]       the sequence of knots.
   y[n]       the prescribed function values at the knots.
   a[200][6]  two dimensional array whose columns are
                 the computed spline coefficients
   diff[5]    maximum values of differences of values and
                 derivatives to right and left of knots.
   com[5]     maximum values of coefficients.


   test of TSpline5 with nonequidistant knots and
      equidistant knots follows.



void Streamer(TBuffer &R__b)
 Stream an object of class TSpline5.



Inline Functions


               void ~TSpline5()
           TSpline5 TSpline5(const char* title, const TGraph* g, const char* opt = "0", Double_t b1 = 0, Double_t e1 = 0, Double_t b2 = 0, Double_t e2 = 0)
               void GetCoeff(Int_t i, Double_t& x, Double_t& y, Double_t& b, Double_t& c, Double_t& d, Double_t& e, Double_t& f)
               void GetKnot(Int_t i, Double_t& x, Double_t& y) const
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void StreamerNVirtual(TBuffer& b)
           TSpline5 TSpline5(const TSpline5&)
          TSpline5& operator=(const TSpline5&)


Author: Federico Carminati 28/02/2000
Last update: root/graf:$Name: $:$Id: TSpline.cxx,v 1.10 2004/10/21 09:48:57 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.