QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
cranknicolson.hpp
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
24#ifndef quantlib_crank_nicolson_hpp
25#define quantlib_crank_nicolson_hpp
26
27#include <ql/methods/finitedifferences/mixedscheme.hpp>
28
29namespace QuantLib {
30
32
66 template <class Operator>
67 class CrankNicolson : public MixedScheme<Operator> {
68 public:
69 // typedefs
73 typedef typename traits::bc_set bc_set;
75 // constructors
77 const bc_set& bcs)
78 : MixedScheme<Operator>(L, 0.5, bcs) {}
79 };
80
81}
82
83
84#endif
Crank-Nicolson scheme for finite difference methods.
traits::operator_type operator_type
CrankNicolson(const operator_type &L, const bc_set &bcs)
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
Definition: any.hpp:35