32 const ext::shared_ptr<FdmMesher>& mesher,
33 const Date& referenceDate,
36 :
x_(mesher->layout()->dim()[equityDirection]),
38 equityDirection_(equityDirection) {
43 for (
const auto& iter : schedule) {
50 Size spacing =
mesher_->layout()->spacing()[equityDirection];
52 x_[i] = std::exp(tmp[i*spacing]);
76 if (
mesher_->layout()->dim().size() == 1) {
79 a[k] = interp(std::max(
x_[0],
x_[k]-dividend),
true);
86 for (
Size i=0; i<
mesher_->layout()->dim().size(); ++i) {
89 for (
Size j=0; j<
mesher_->layout()->dim()[i]; ++j) {
91 Size index = j*ySpacing + k*xSpacing;
92 tmp[k] = aCopy[index];
97 Size index = j*ySpacing + k*xSpacing;
99 std::max(
x_[0],
x_[k]-dividend),
true);
1-D array used in linear algebra.
const_iterator end() const
Size size() const
dimension of the array
const_iterator begin() const
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.
FdmDividendHandler(const DividendSchedule &schedule, const ext::shared_ptr< FdmMesher > &mesher, const Date &referenceDate, const DayCounter &dayCounter, Size equityDirection)
std::vector< Date > dividendDates_
const Size equityDirection_
const std::vector< Time > & dividendTimes() const
std::vector< Time > dividendTimes_
const ext::shared_ptr< FdmMesher > mesher_
std::vector< Real > dividends_
void applyTo(Array &a, Time t) const override
const std::vector< Date > & dividendDates() const
const std::vector< Real > & dividends() const
Linear interpolation between discrete points
dividend handler for fdm method for one equity direction
memory layout of a fdm linear operator
const ext::shared_ptr< FdmMesher > mesher_
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
linear interpolation between discrete points
std::vector< ext::shared_ptr< Dividend > > DividendSchedule