Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
InterpolatingFunctionALGLIB.cpp
1 #include "InterpolatingFunctionALGLIB.h"
2 
3 #ifndef NO_SERIALIZE
4  BOOST_CLASS_EXPORT_IMPLEMENT(Core::InterpolatingFunctionALGLIB)
5 #endif
6 
7 namespace Core {
8 
10  const double *x,
11  const double *y,
12  size_t num_points,
13  const double *yprime,
14  double smoothing,
15  int degrees_of_freedom
16  )
17  {
18  if(degrees_of_freedom<0) degrees_of_freedom=std::min(
19  -degrees_of_freedom, static_cast<int>(3 * num_points));
20 
21  alglib::real_1d_array alglib_x;
22  alglib_x.setcontent(num_points, x);
23  alglib::real_1d_array alglib_y;
24  alglib_y.setcontent(num_points, y);
25 
26  alglib::real_1d_array alglib_yprime;
27  if(yprime) alglib_yprime.setcontent(num_points, yprime);
28 
29  auto x_range = std::minmax_element(x, x + num_points);
30  __min_x = *x_range.first;
31  __max_x = *x_range.second;
32 
33  if(std::isnan(smoothing)) {
34  if(yprime)
35  alglib::spline1dbuildhermite(alglib_x,
36  alglib_y,
37  alglib_yprime,
38  __spline);
39  else
40  alglib::spline1dbuildcubic(alglib_x,
41  alglib_y,
42  __spline);
43  }
44  else {
45  if(yprime)
47  "Smoothing not supported when derivatives "
48  "are specified in InterpolatingFunctionALGLIB "
49  "constructor.");
50  alglib::ae_int_t fit_info;
51  alglib::spline1dfitreport fit_report;
52  alglib::spline1dfitpenalized(alglib_x,
53  alglib_y,
54  degrees_of_freedom,
55  smoothing,
56  fit_info,
57  __spline,
58  fit_report);
59  if(fit_info<=0) throw Error::ALGLIB("Spline fit failed.");
60  }
61  }
62 
64  double y
65  ) const
66  {
68  }
69 
70 
71 
72 } //End Core namespace.
Function arguments do not satisfy some requirement.
Definition: Error.h:73
SerializableSpline1dInterpolant __spline
The interpolating function information necessary to evaluate at any given point.
Error detected by the ALGLIB library.
Definition: Error.h:49
InterpolatingFunctionALGLIB()
Needed by the Boost serializer.
double __max_x
The largest abscissa covered by the spline points.
An iterator over a set of solutions to an interpolating function.
double __min_x
The smallest abscissa covered by the spline points.
Function which interpolates, with possible smoothing, between points.
InterpSolutionIterator crossings(double y=0) const
Iterator over the abscissas where the function takes the given y value.