29 const std::vector<Date>& dates,
30 std::vector<Real> strikes,
31 const Matrix& blackVolMatrix,
36 maxDate_(dates.back()), strikes_(
std::move(strikes)), lowerExtrapolation_(lowerEx),
37 upperExtrapolation_(upperEx) {
40 "mismatch between date vector and vol matrix colums");
42 "mismatch between money-strike vector and vol matrix rows");
45 "cannot have dates[0] < referenceDate");
48 times_ = std::vector<Time>(dates.size()+1);
51 for (i=0; i<blackVolMatrix.
rows(); i++) {
54 for (j=1; j<=blackVolMatrix.
columns(); j++) {
57 "dates must be sorted unique!");
58 for (i=0; i<blackVolMatrix.
rows(); i++) {
60 blackVolMatrix[i][j-1]*blackVolMatrix[i][j-1];
64 setInterpolation<Bilinear>();
69 if (
t==0.0)
return 0.0;
bilinear interpolation between discrete points
Black volatility surface modelled as variance surface.
Extrapolation upperExtrapolation_
std::vector< Real > strikes_
std::vector< Time > times_
Interpolation2D varianceSurface_
Real blackVarianceImpl(Time t, Real strike) const override
Black variance calculation.
BlackVarianceSurface(const Date &referenceDate, const Calendar &cal, const std::vector< Date > &dates, std::vector< Real > strikes, const Matrix &blackVolMatrix, DayCounter dayCounter, Extrapolation lowerExtrapolation=InterpolatorDefaultExtrapolation, Extrapolation upperExtrapolation=InterpolatorDefaultExtrapolation)
Extrapolation lowerExtrapolation_
Black variance term structure.
Matrix used in linear algebra.
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
Time timeFromReference(const Date &date) const
date/time conversion
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container