QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
expliciteuler.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file expliciteuler.hpp
21 \brief explicit Euler scheme for finite difference methods
22*/
23
24#ifndef quantlib_explicit_euler_hpp
25#define quantlib_explicit_euler_hpp
26
28
29namespace QuantLib {
30
31 //! %Forward Euler scheme for finite difference methods
32 /*! See sect. \ref findiff for details on the method.
33
34 In this implementation, the passed operator must be derived
35 from either TimeConstantOperator or TimeDependentOperator.
36 Also, it must implement at least the following interface:
37
38 \code
39 typedef ... array_type;
40
41 // copy constructor/assignment
42 // (these will be provided by the compiler if none is defined)
43 Operator(const Operator&);
44 Operator& operator=(const Operator&);
45
46 // inspectors
47 Size size();
48
49 // modifiers
50 void setTime(Time t);
51
52 // operator interface
53 array_type applyTo(const array_type&);
54 static Operator identity(Size size);
55
56 // operator algebra
57 Operator operator*(Real, const Operator&);
58 Operator operator-(const Operator&, const Operator&);
59 \endcode
60
61 \todo add Richardson extrapolation
62
63 \ingroup findiff
64 */
65 template <class Operator>
66 class ExplicitEuler : public MixedScheme<Operator> {
67 public:
68 // typedefs
72 typedef typename traits::bc_type bc_type;
73 typedef typename traits::bc_set bc_set;
75 // constructors
77 const std::vector<ext::shared_ptr<bc_type> >& bcs)
78 : MixedScheme<Operator>(L, 0.0, bcs) {}
79 };
80
81}
82
83
84#endif
Abstract boundary condition class for finite difference problems.
Forward Euler scheme for finite difference methods
traits::operator_type operator_type
ExplicitEuler(const operator_type &L, const std::vector< ext::shared_ptr< bc_type > > &bcs)
traits::bc_type bc_type
traits::condition_type condition_type
OperatorTraits< Operator > traits
traits::array_type array_type
Mixed (explicit/implicit) scheme for finite difference methods.
Definition: mixedscheme.hpp:73
std::vector< ext::shared_ptr< bc_type > > bc_set
Operator::array_type array_type
condition to be applied at every time step
Mixed (explicit/implicit) scheme for finite difference methods.
Definition: any.hpp:35