25#ifndef quantlib_discretized_asset_hpp
26#define quantlib_discretized_asset_hpp
51 const ext::shared_ptr<Lattice>&
method()
const {
66 void initialize(
const ext::shared_ptr<Lattice>&,
151 std::vector<Time>
mandatoryTimes()
const override {
return std::vector<Time>(); }
164 std::vector<Time> exerciseTimes)
183 const ext::shared_ptr<Lattice>& method,
194 method_->partialRollback(*
this, to);
198 return method_->presentValue(*
this);
223 "option and underlying were initialized on "
224 "different methods");
230 std::vector<Time> times =
underlying_->mandatoryTimes();
233 [](
Time t){ return t >= 0.0; });
1-D array used in linear algebra.
Size size() const
dimension of the array
Discretized asset class used by numerical methods.
virtual void preAdjustValuesImpl()
virtual std::vector< Time > mandatoryTimes() const =0
bool isOnTime(Time t) const
virtual void postAdjustValuesImpl()
ext::shared_ptr< Lattice > method_
virtual ~DiscretizedAsset()=default
const Array & values() const
virtual void reset(Size size)=0
void partialRollback(Time to)
Time latestPostAdjustment_
const ext::shared_ptr< Lattice > & method() const
void initialize(const ext::shared_ptr< Lattice > &, Time t)
Time latestPreAdjustment_
Useful discretized discount bond asset.
DiscretizedDiscountBond()=default
std::vector< Time > mandatoryTimes() const override
void reset(Size size) override
Discretized option on a given asset.
DiscretizedOption(ext::shared_ptr< DiscretizedAsset > underlying, Exercise::Type exerciseType, std::vector< Time > exerciseTimes)
void postAdjustValuesImpl() override
std::vector< Time > mandatoryTimes() const override
std::vector< Time > exerciseTimes_
Exercise::Type exerciseType_
void applyExerciseCondition()
void reset(Size size) override
ext::shared_ptr< DiscretizedAsset > underlying_
Size index(Time t) const
returns the index i such that grid[i] = t
floating-point comparisons
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
bool close_enough(const Quantity &m1, const Quantity &m2, Size n)