LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
Spline.h
Go to the documentation of this file.
1 #if !defined(LSST_AFW_MATH_DETAIL_SPLINE)
2 #define LSST_AFW_MATH_DETAIL_SPLINE 1
3 #include <cmath>
4 #include <vector>
5 
6 namespace lsst {
7 namespace afw {
8 namespace math {
9 namespace detail {
10 
11 /*
12  * Splines
13  */
14 class Spline {
15 public:
16  virtual ~Spline() = default;
17 
18  Spline(Spline const&) = default;
19  Spline(Spline&&) = default;
20  Spline& operator=(Spline const&) = default;
21  Spline& operator=(Spline&&) = default;
22 
36  void derivative(std::vector<double> const& x, std::vector<double>& dydx) const;
37 
46  std::vector<double> roots(double const value, double const x0, double const x1) const;
47 
48 protected:
49  Spline() = default;
53  void _allocateSpline(int const nknot);
54 
55  std::vector<double> _knots; // positions of knots
56  std::vector<std::vector<double> > _coeffs; // and associated coefficients
57 };
58 
59 class TautSpline : public Spline {
60 public:
61  enum Symmetry { Unknown, Odd, Even };
62 
133  TautSpline(std::vector<double> const& x, std::vector<double> const& y, double const gamma = 0,
134  Symmetry type = Unknown);
135 
136 private:
144  void calculateTautSpline(std::vector<double> const& x, std::vector<double> const& y, double const gamma0);
155  void calculateTautSplineEvenOdd(std::vector<double> const& x, std::vector<double> const& y,
156  double const gamma0, bool even);
157 };
158 
159 class SmoothedSpline : public Spline {
160 public:
229  double s, double* chisq = NULL, std::vector<double>* errs = NULL);
230 };
231 } // namespace detail
232 } // namespace math
233 } // namespace afw
234 } // namespace lsst
235 #endif
lsst::afw::math::detail::Spline::operator=
Spline & operator=(Spline const &)=default
y
int y
Definition: SpanSet.cc:49
lsst::afw::math::detail::Spline::derivative
void derivative(std::vector< double > const &x, std::vector< double > &dydx) const
Find the derivative of a Spline.
Definition: Spline.cc:57
lsst::afw::math::detail::Spline::Spline
Spline(Spline &&)=default
lsst::afw::math::detail::Spline::~Spline
virtual ~Spline()=default
lsst::afw::math::detail::Spline::interpolate
void interpolate(std::vector< double > const &x, std::vector< double > &y) const
Interpolate a Spline.
Definition: Spline.cc:29
lsst::afw::math::detail::TautSpline::Odd
@ Odd
Definition: Spline.h:61
std::vector< double >
lsst::afw::math::detail::TautSpline::Even
@ Even
Definition: Spline.h:61
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::math::detail::SmoothedSpline::SmoothedSpline
SmoothedSpline(std::vector< double > const &x, std::vector< double > const &y, std::vector< double > const &dy, double s, double *chisq=NULL, std::vector< double > *errs=NULL)
Cubic spline data smoother.
Definition: Spline.cc:534
lsst::afw::math::detail::Spline::Spline
Spline()=default
lsst::afw::math::detail::SmoothedSpline
Definition: Spline.h:159
lsst::afw::math::detail::Spline::operator=
Spline & operator=(Spline &&)=default
lsst::afw::math::detail::TautSpline
Definition: Spline.h:59
lsst::afw::math::detail::Spline::_knots
std::vector< double > _knots
Definition: Spline.h:55
x
double x
Definition: ChebyshevBoundedField.cc:277
lsst::afw::math::detail::TautSpline::TautSpline
TautSpline(std::vector< double > const &x, std::vector< double > const &y, double const gamma=0, Symmetry type=Unknown)
Construct cubic spline interpolant to given data.
Definition: Spline.cc:86
lsst::afw::math::detail::Spline::roots
std::vector< double > roots(double const value, double const x0, double const x1) const
Find the roots of Spline - val = 0 in the range [x0, x1).
Definition: Spline.cc:1226
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::afw::math::detail::Spline::_coeffs
std::vector< std::vector< double > > _coeffs
Definition: Spline.h:56
lsst::afw::math::detail::Spline
Definition: Spline.h:14
lsst::afw::math::detail::TautSpline::Symmetry
Symmetry
Definition: Spline.h:61
type
table::Key< int > type
Definition: Detector.cc:163
lsst::afw::math::detail::Spline::_allocateSpline
void _allocateSpline(int const nknot)
Allocate the storage a Spline needs.
Definition: Spline.cc:21
lsst::afw::math::detail::TautSpline::Unknown
@ Unknown
Definition: Spline.h:61
lsst::afw::math::detail::Spline::Spline
Spline(Spline const &)=default