-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRBF.py
42 lines (30 loc) · 742 Bytes
/
RBF.py
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
"""
Different phi_{d,k} wendland functions.
"""
from Config.Options import options
register_rbf = options.get_type_register("rbf")
def safe_rbf(func):
def _rbf(x):
if x < 0:
raise ValueError("x should be > 0, not {}".format(x))
if x > 1:
return 0
else:
return func(x)
return _rbf
@register_rbf("wendland_1_0")
@safe_rbf
def wendland_1_0(x):
return 1 - x
@register_rbf("wendland_3_2")
@safe_rbf
def wendland_3_2(x):
return (35 * (x ** 2) + 18 * x + 3) * (1 - x) ** 6
@register_rbf("wendland_3_0")
@safe_rbf
def wendland_3_0(x):
return (1 - x) ** 2
@register_rbf("wendland_3_1")
@safe_rbf
def wendland_3_1(x):
return (1 + (4 * x)) * ((1 - x) ** 4)