QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
numericalmethod.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2001, 2002, 2003 Sadruddin Rejeb
5 Copyright (C) 2004, 2005 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_lattice_hpp
26#define quantlib_lattice_hpp
27
28#include <ql/math/array.hpp>
29#include <ql/timegrid.hpp>
30#include <utility>
31
32namespace QuantLib {
33
34 class DiscretizedAsset;
35
37 class Lattice {
38 public:
39 explicit Lattice(TimeGrid timeGrid) : t_(std::move(timeGrid)) {}
40 virtual ~Lattice() = default;
41
43 //{
44 const TimeGrid& timeGrid() const { return t_; }
46
59 Time time) const = 0;
60
65 Time to) const = 0;
66
85 Time to) const = 0;
86
88 virtual Real presentValue(DiscretizedAsset&) const = 0;
89
91
92 // this is a smell, but we need it. We'll rethink it later.
93 virtual Array grid(Time) const = 0;
94 protected:
96 };
97
98}
99
100
101#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Discretized asset class used by numerical methods.
Lattice (tree, finite-differences) base class
virtual void partialRollback(DiscretizedAsset &, Time to) const =0
virtual Real presentValue(DiscretizedAsset &) const =0
computes the present value of an asset.
virtual Array grid(Time) const =0
virtual void initialize(DiscretizedAsset &, Time time) const =0
initialize an asset at the given time.
virtual ~Lattice()=default
const TimeGrid & timeGrid() const
virtual void rollback(DiscretizedAsset &, Time to) const =0
Lattice(TimeGrid timeGrid)
time grid class
Definition: timegrid.hpp:43
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
STL namespace.