EOL BSpline Library  Version 1.6
BSpline.h
1 /* -*- mode: c++; c-basic-offset: 4; -*- */
2 /************************************************************************
3  * Copyright 2009 University Corporation for Atmospheric Research.
4  * All rights reserved.
5  *
6  * Use of this code is subject to the standard BSD license:
7  *
8  * http://www.opensource.org/licenses/bsd-license.html
9  *
10  * See the COPYRIGHT file in the source distribution for the license text,
11  * or see this web page:
12  *
13  * http://www.eol.ucar.edu/homes/granger/bspline/doc/
14  *
15  *************************************************************************/
16 
17 #ifndef BSPLINE_H
18 #define BSPLINE_H
19 
20 #include "BSplineBase.h"
21 #include <vector>
22 
23 template <class T> struct BSplineP;
24 
25 
32 template <class T>
33 class BSpline : public BSplineBase<T>
34 {
35 public:
59  BSpline (const T *x, int nx, /* independent variable */
60  const T *y, /* dependent values @ ea X */
61  double wl, /* cutoff wavelength */
62  int bc_type = BSplineBase<T>::BC_ZERO_SECOND,
63  int num_nodes = 0);
64 
69  BSpline (BSplineBase<T> &base, const T *y);
70 
78  bool solve (const T *y);
79 
84  T evaluate (T x);
85 
90  T slope (T x);
91 
96  T coefficient (int n);
97 
98  virtual ~BSpline();
99 
100  using BSplineBase<T>::Debug;
101  using BSplineBase<T>::Basis;
103 
104 protected:
105 
106  using BSplineBase<T>::OK;
107  using BSplineBase<T>::M;
108  using BSplineBase<T>::NX;
109  using BSplineBase<T>::DX;
110  using BSplineBase<T>::base;
111  using BSplineBase<T>::xmin;
112  using BSplineBase<T>::xmax;
113 
114  // Our hidden state structure
115  BSplineP<T> *s;
116  T mean; // Fit without mean and add it in later
117 
118 };
119 
120 #endif
The base class for a spline object containing the nodes for a given domain, cutoff wavelength...
Definition: BSplineBase.h:169
This file defines the BSpline library interface.
BSpline(const T *x, int nx, const T *y, double wl, int bc_type=BSplineBase< T >::BC_ZERO_SECOND, int num_nodes=0)
Create a single spline with the parameters required to set up the domain and subsequently smooth the ...
Definition: BSpline.cpp:53
T coefficient(int n)
Return the n-th basis coefficient, from 0 to M.
Definition: BSpline.cpp:141
Definition: BSpline.cpp:40
T slope(T x)
Return the first derivative of the spline curve at the given x.
Definition: BSpline.cpp:160
bool solve(const T *y)
Solve the spline curve for a new set of y values.
Definition: BSpline.cpp:75
T evaluate(T x)
Return the evaluation of the smoothed curve at a particular x value.
Definition: BSpline.cpp:148
Used to evaluate a BSpline.
Definition: BSpline.h:33