-
Notifications
You must be signed in to change notification settings - Fork 905
/
Copy pathExceptions.cs
185 lines (157 loc) · 5.67 KB
/
Exceptions.cs
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
using System;
namespace MathNet.Numerics
{
/// <summary>
/// An algorithm failed to converge.
/// </summary>
[Serializable]
public class NonConvergenceException : Exception
{
public NonConvergenceException() : base("An algorithm failed to converge.")
{
}
public NonConvergenceException(string message) : base(message)
{
}
public NonConvergenceException(string message, Exception innerException) : base(message, innerException)
{
}
protected NonConvergenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
/// <summary>
/// An algorithm failed to converge due to a numerical breakdown.
/// </summary>
[Serializable]
public class NumericalBreakdownException : NonConvergenceException
{
public NumericalBreakdownException()
: base("Algorithm experience a numerical break down.")
{
}
public NumericalBreakdownException(string message)
: base(message)
{
}
public NumericalBreakdownException(string message, Exception innerException)
: base(message, innerException)
{
}
protected NumericalBreakdownException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
/// <summary>
/// An error occurred calling native provider function.
/// </summary>
[Serializable]
public abstract class NativeInterfaceException : Exception
{
protected NativeInterfaceException()
{
}
protected NativeInterfaceException(string message)
: base(message)
{
}
protected NativeInterfaceException(string message, Exception innerException)
: base(message, innerException)
{
}
protected NativeInterfaceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
/// <summary>
/// An error occurred calling native provider function.
/// </summary>
[Serializable]
public class InvalidParameterException : NativeInterfaceException
{
public InvalidParameterException()
: base("An invalid parameter was passed to a native method.")
{
}
public InvalidParameterException(int parameter)
: base($"An invalid parameter was passed to a native method, parameter number : {parameter}")
{
}
public InvalidParameterException(int parameter, Exception innerException)
: base($"An invalid parameter was passed to a native method, parameter number : {parameter}", innerException)
{
}
protected InvalidParameterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
/// <summary>
/// Native provider was unable to allocate sufficient memory.
/// </summary>
[Serializable]
public class MemoryAllocationException : NativeInterfaceException
{
public MemoryAllocationException()
: base("Unable to allocate native memory.")
{
}
public MemoryAllocationException(Exception innerException)
: base("Unable to allocate native memory.", innerException)
{
}
protected MemoryAllocationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
/// <summary>
/// Native provider failed LU inversion do to a singular U matrix.
/// </summary>
[Serializable]
public class SingularUMatrixException : NativeInterfaceException
{
public SingularUMatrixException()
: base("U is singular, and the inversion could not be completed.")
{
}
public SingularUMatrixException(int element)
: base($"U is singular, and the inversion could not be completed. The {element}-th diagonal element of the factor U is zero.")
{
}
public SingularUMatrixException(int element, Exception innerException)
: base($"U is singular, and the inversion could not be completed. The {element}-th diagonal element of the factor U is zero.", innerException)
{
}
protected SingularUMatrixException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
/// <summary>
/// Distance between point 't' and reference points is too large (can lead to inaccurate interpolation).
/// </summary>
[Serializable]
public class InterpolatingDistanceException : Exception
{
public InterpolatingDistanceException()
: base("Distace from 't' to the two closest points exceeds MaxDeltaT.")
{
}
public InterpolatingDistanceException(string message)
: base(message)
{
}
public InterpolatingDistanceException(string message, Exception innerException)
: base(message, innerException)
{
}
protected InterpolatingDistanceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context)
{
}
}
}