-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathNumericalMethod.cs
More file actions
75 lines (60 loc) · 2.32 KB
/
Copy pathNumericalMethod.cs
File metadata and controls
75 lines (60 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
Copyright (C) 2008 Siarhei Novik ([email protected])
This file is part of QLNet Project https://github.com/amaggiulli/qlnet
QLNet is free software: you can redistribute it and/or modify it
under the terms of the QLNet license. You should have received a
copy of the license along with this program; if not, license is
available at <https://github.com/amaggiulli/QLNet/blob/develop/LICENSE>.
QLNet is a based on QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
The QuantLib license is available online at http://quantlib.org/license.shtml.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;
namespace QLNet
{
/// <summary>
/// Lattice (tree, finite-differences) base class
/// </summary>
public abstract class Lattice
{
protected TimeGrid t_;
public TimeGrid timeGrid()
{
return t_;
}
protected Lattice(TimeGrid timeGrid)
{
t_ = timeGrid;
}
/* Numerical method interface
These methods are to be used by discretized assets and
must be overridden by developers implementing numerical
methods. Users are advised to use the corresponding
methods of DiscretizedAsset instead.
*/
/// <summary>
/// Initializes an asset at the given time.
/// </summary>
public abstract void initialize(DiscretizedAsset a, double time);
/// <summary>
/// Rolls back an asset to the given time, performing any needed adjustment.
/// </summary>
public abstract void rollback(DiscretizedAsset a, double to);
/// <summary>
/// Rolls back an asset to the given time without performing the final adjustment.
/// </summary>
public abstract void partialRollback(DiscretizedAsset a, double to);
/// <summary>
/// Computes the present value of an asset.
/// </summary>
public abstract double presentValue(DiscretizedAsset a);
// this is a smell, but we need it. We'll rethink it later.
public virtual Vector grid(double t)
{
throw new NotImplementedException();
}
}
}