27 std::vector<Time> exerciseTimes,
28 ext::shared_ptr<FdmMesher> mesher,
29 ext::shared_ptr<FdmInnerValueCalculator> calculator,
32 : exerciseTimes_(
std::move(exerciseTimes)),
mesher_(
std::move(mesher)),
34 swingDirection_(swingDirection) {}
38 const std::vector<Time>::const_iterator iter
48 "inconsistent array dimensions");
50 for (
const auto& iter : *
mesher_->layout()) {
52 const std::vector<Size>& coor = iter.coordinates();
56 if (exercisesUsed < maxExerciseValue) {
58 const Real currentValue = a[iter.index()];
59 const Real valuePlusOneExercise
62 if ( currentValue < valuePlusOneExercise + cashflow
64 retVal[iter.index()] = valuePlusOneExercise + cashflow;
1-D array used in linear algebra.
Size size() const
dimension of the array
FdmSimpleSwingCondition(std::vector< Time > exerciseTimes, ext::shared_ptr< FdmMesher > mesher, ext::shared_ptr< FdmInnerValueCalculator > calculator, Size swingDirection, Size minExercises=0)
const Size swingDirection_
const std::vector< Time > exerciseTimes_
const ext::shared_ptr< FdmMesher > mesher_
const ext::shared_ptr< FdmInnerValueCalculator > calculator_
void applyTo(Array &a, Time t) const override
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
const ext::shared_ptr< CEVCalculator > calculator_
memory layout of a fdm linear operator
simple swing step condition
const ext::shared_ptr< FdmMesher > mesher_
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container