24#ifndef quantlib_interpolated_curve_hpp
25#define quantlib_interpolated_curve_hpp
40 template <
class Interpolator>
49 std::vector<Real> data,
50 const Interpolator& i = Interpolator())
54 const Interpolator& i = Interpolator())
58 const Interpolator& i = Interpolator())
89 times_ = std::move(c.times_);
90 data_ = std::move(c.data_);
102 times_.resize(dates.size());
104 for (
Size i = 1; i < dates.size(); i++) {
106 "dates not sorted: " << dates[i] <<
" passed after " << dates[i-1]);
110 "two passed dates (" << dates[i-1] <<
" and " << dates[i]
111 <<
") correspond to the same time "
112 <<
"under this curve's day count convention (" << dayCounter <<
")");
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Helper class to build interpolated term structures.
~InterpolatedCurve()=default
InterpolatedCurve(const Interpolator &i=Interpolator())
InterpolatedCurve(Size n, const Interpolator &i=Interpolator())
InterpolatedCurve(std::vector< Time > times, std::vector< Real > data, const Interpolator &i=Interpolator())
Interpolator interpolator_
std::vector< Time > times_
Interpolation interpolation_
void setupTimes(const std::vector< Date > &dates, Date referenceDate, const DayCounter &dayCounter)
void setupInterpolation()
InterpolatedCurve(InterpolatedCurve &&c) noexcept
InterpolatedCurve(std::vector< Time > times, const Interpolator &i=Interpolator())
InterpolatedCurve(const InterpolatedCurve &c)
InterpolatedCurve & operator=(const InterpolatedCurve &c)
InterpolatedCurve & operator=(InterpolatedCurve &&c) noexcept
std::vector< Real > data_
base class for 1-D interpolations.
date- and time-related classes, typedefs and enumerations
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container
base class for 1-D interpolations
bool close(const Quantity &m1, const Quantity &m2, Size n)