![]() |
Project
|
#include <Spline.h>
Inherits o2::gpu::SplineSpec< DataT, XdimT, YdimT, SpecT >.
Public Types | |
typedef TVeryBase::SafetyLevel | SafetyLevel |
typedef TVeryBase::Knot | Knot |
Public Member Functions | |
Spline & | operator= (const Spline &v) |
Assignment operator. | |
ClassDefNV (Spline, 0) | |
Static Public Member Functions | |
static Spline * | readFromFile (TFile &inpf, const char *name) |
read a class object from the file | |
The Spline class performs a cubic spline interpolation on an two-dimensional nonunifom grid. The class is an extension of the Spline1D class. See Spline1D.h for more details.
The spline S(x) approximates a function F(x):R^n->R^m, with multi-dimensional domain and multi-dimensional codomain. x belongs to [xmin,xmax].
— Example of creating a spline —
constexpr int32_t nDimX = 2, nDimY = 1; int32_t nKnots[nDimX] = {2, 3}; // 2 x 3 knots int32_t knotsU1[] = {0, 1}; // relative knot positions int32_t knotsU2[] = {0, 2, 5}; int32_t *knotsU[nDimX] = {knotsU1, knotsU2};
o2::gpu::Spline<float, nDimX, nDimY> spline(nKnots, knotsU);
auto F = [&](const double x[], double f[]) { f[0] = 1.f + x[0] + x[1] * x[1]; // F(x) }; double xMin[nDimX] = {0.f, 0.f}; double xMax[nDimX] = {1.f, 1.f}; spline.approximateFunction( xMin, xMax, F); // initialize spline to approximate F on [0., 1.]x[0., 1.] area
float x[] = {.1, .3}; float S = spline.interpolate(x); // interpolated value at (.1,.3)
– another way to create of the spline is:
o2::gpu::Spline<float> spline(nDimX, nDimY, nKnots, knotsU ); spline.interpolate(x, &S);
— See also SplineHelper::test(); ==================================================================================================
Declare the Spline class as a template with two optional parameters.
Class specializations depend on the XdimT, YdimT values. They can be found in SplineSpecs.h
DataT | data type: float or double |
XdimT | XdimT > 0 : the number of X dimensions is known at the compile time and is equal to XdimT XdimT = 0 : the number of X dimensions will be set in the runtime XdimT < 0 : the number of X dimensions will be set in the runtime, and it will not exceed abs(XdimT) |
YdimT | same for the Y dimensions |
typedef TVeryBase::Knot o2::gpu::Spline< DataT, XdimT, YdimT >::Knot |
typedef TVeryBase::SafetyLevel o2::gpu::Spline< DataT, XdimT, YdimT >::SafetyLevel |
o2::gpu::Spline< DataT, XdimT, YdimT >::ClassDefNV | ( | Spline< DataT, XdimT, YdimT > | , |
0 | |||
) |
|
inline |
|
inlinestatic |