1 #ifndef LOG_INTERPOLATE_H 2 #define LOG_INTERPOLATE_H 5 #include <boost/shared_ptr.hpp> 6 #include <boost/foreach.hpp> 15 public Printable<LogLinearInterpolate<TX,TY> > {
34 std::vector<TX> xval(xstart, xend);
35 BOOST_FOREACH(TX &x ,xval)
42 return interp(std::log(x));
44 void print(std::ostream& Os)
const { Os <<
"LogLinearInterpolate"; }
54 public Printable<LogLogInterpolate<TX, TY> > {
69 for(; xstart != xend; ++xstart, ++ystart) {
70 xval.push_back(std::log(*xstart));
71 yval.push_back(std::log(*ystart));
78 return std::exp(interp(std::log(x)));
80 void print(std::ostream& Os)
const { Os <<
"LogLogInterpolate"; }
89 public Printable<LogLogInterpolate<AutoDerivative<double>, AutoDerivative<double> > > {
101 std::vector<AutoDerivative<double> > xval;
102 std::vector<AutoDerivative<double> > yval;
103 for(; xstart != xend; ++xstart, ++ystart) {
104 xval.push_back(std::log(*xstart));
105 yval.push_back(std::log(*ystart));
107 interp = LinearInterpolate<AutoDerivative<double>,
AutoDerivative<double> >(xval.begin(), xval.end(), yval.begin(),
112 return std::exp(interp(std::log(x)));
118 interp.interpolate(std::log(x), res);
122 void print(std::ostream& Os)
const { Os <<
"LogLogInterpolate"; }
132 public Printable<LinearLogInterpolate<TX, TY> > {
145 std::vector<TX> xval;
146 std::vector<TY> yval;
147 for(; xstart != xend; ++xstart, ++ystart) {
148 xval.push_back(*xstart);
149 yval.push_back(std::log(*ystart));
156 return std::exp(interp(x));
158 void print(std::ostream& Os)
const { Os <<
"LinearLogInterpolate"; }
167 public Printable<LinearLogInterpolate<AutoDerivative<double>, AutoDerivative<double> > > {
179 std::vector<AutoDerivative<double> > xval;
180 std::vector<AutoDerivative<double> > yval;
181 for(; xstart != xend; ++xstart, ++ystart) {
182 xval.push_back(*xstart);
183 yval.push_back(std::log(*ystart));
185 interp = LinearInterpolate<AutoDerivative<double>,
AutoDerivative<double> >(xval.begin(), xval.end(), yval.begin(),
190 return std::exp(interp(x));
196 interp.interpolate(x, res);
200 void print(std::ostream& Os)
const { Os <<
"LinearLogInterpolate"; }
LinearInterpolate< TX, TY >::BehaviorOutOfRange BehaviorOutOfRange
void print(std::ostream &Os) const
TY operator()(const TX &x) const
TY operator()(const TX &x) const
void print(std::ostream &Os) const
LinearInterpolate< TX, TY >::BehaviorOutOfRange BehaviorOutOfRange
LinearInterpolate< TX, TY >::BehaviorOutOfRange BehaviorOutOfRange
This class takes a set of points and values, and linearly interpolates between those values...
Wrapper around LinearInterpolate that uses log(y) rather than x and y when interpolating.
void print(std::ostream &Os) const
Wrapper around LinearInterpolate that uses log(x) rather than x in interpolating. ...
Helper class that gives us a reference that we can assign a AutoDerivative to and write into the corr...
LinearLogInterpolate(I1 xstart, I1 xend, I2 ystart, BehaviorOutOfRange Out_of_range=BehaviorOutOfRange(0))
AutoDerivative< double > operator()(const AutoDerivative< double > &x) const
This is a Mixin for classes that can be printed.
void interpolate(const AutoDerivative< double > &x, const AutoDerivativeRef< double > &res) const
LogLinearInterpolate(I1 xstart, I1 xend, I2 ystart, BehaviorOutOfRange Out_of_range=BehaviorOutOfRange(0))
LinearInterpolate< AutoDerivative< double >, AutoDerivative< double > >::BehaviorOutOfRange BehaviorOutOfRange
LinearInterpolate< AutoDerivative< double >, AutoDerivative< double > >::BehaviorOutOfRange BehaviorOutOfRange
There are a number of tools that can be used to do "Automatic Differentiation" (see for example http:...
void interpolate(const AutoDerivative< double > &x, const AutoDerivativeRef< double > &res) const
LogLogInterpolate(I1 xstart, I1 xend, I2 ystart, BehaviorOutOfRange Out_of_range=BehaviorOutOfRange(0))
AutoDerivative< double > operator()(const AutoDerivative< double > &x) const
TY operator()(const TX &x) const
void print(std::ostream &Os) const
LinearLogInterpolate(I1 xstart, I1 xend, I2 ystart, BehaviorOutOfRange Out_of_range=BehaviorOutOfRange(0))
Wrapper around LinearInterpolate that uses log(x) and log(y) rather than x and y when interpolating...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
LogLogInterpolate(I1 xstart, I1 xend, I2 ystart, BehaviorOutOfRange Out_of_range=BehaviorOutOfRange(0))
void print(std::ostream &Os) const
LogLinearInterpolate()
Constructor.