QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
impliciteuler.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 impliciteuler.hpp
21 \brief implicit Euler scheme for finite difference methods
22*/
23
24#ifndef quantlib_implicit_euler_hpp
25#define quantlib_implicit_euler_hpp
26
28
29namespace QuantLib {
30
31 //! Backward Euler scheme for finite difference methods
32 /*! In this implementation, the passed operator must be derived
33 from either TimeConstantOperator or TimeDependentOperator.
34 Also, it must implement at least the following interface:
35
36 \code
37 typedef ... array_type;
38
39 // copy constructor/assignment
40 // (these will be provided by the compiler if none is defined)
41 Operator(const Operator&);
42 Operator& operator=(const Operator&);
43
44 // inspectors
45 Size size();
46
47 // modifiers
48 void setTime(Time t);
49
50 // operator interface
51 array_type solveFor(const array_type&);
52 static Operator identity(Size size);
53
54 // operator algebra
55 Operator operator*(Real, const Operator&);
56 Operator operator+(const Operator&, const Operator&);
57 \endcode
58
59 \ingroup findiff
60 */
61 template <class Operator>
62 class ImplicitEuler : public MixedScheme<Operator> {
63 public:
64 // typedefs
68 typedef typename traits::bc_set bc_set;
70 // constructors
72 const bc_set& bcs)
73 : MixedScheme<Operator>(L, 1.0, bcs) {}
74 };
75
76}
77
78
79#endif
Backward Euler scheme for finite difference methods.
traits::operator_type operator_type
traits::condition_type condition_type
ImplicitEuler(const operator_type &L, const bc_set &bcs)
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