Repository navigation
Expand file tree
/
Copy pathmathdecl.py
More file actions
152 lines (127 loc) · 4.38 KB
/
Copy pathmathdecl.py
File metadata and controls
152 lines (127 loc) · 4.38 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
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
import math
import sys
from numba.core import types, utils
from numba.core.typing.templates import (AttributeTemplate, ConcreteTemplate,
signature, Registry)
registry = Registry()
infer_global = registry.register_global
@infer_global(math.exp)
@infer_global(math.expm1)
@infer_global(math.fabs)
@infer_global(math.sqrt)
@infer_global(math.log)
@infer_global(math.log1p)
@infer_global(math.log10)
@infer_global(math.log2)
@infer_global(math.sin)
@infer_global(math.cos)
@infer_global(math.tan)
@infer_global(math.sinh)
@infer_global(math.cosh)
@infer_global(math.tanh)
@infer_global(math.asin)
@infer_global(math.acos)
@infer_global(math.atan)
@infer_global(math.asinh)
@infer_global(math.acosh)
@infer_global(math.atanh)
@infer_global(math.degrees)
@infer_global(math.radians)
@infer_global(math.erf)
@infer_global(math.erfc)
@infer_global(math.gamma)
@infer_global(math.lgamma)
class Math_unary(ConcreteTemplate):
cases = [
signature(types.float64, types.int64),
signature(types.float64, types.uint64),
signature(types.float32, types.float32),
signature(types.float64, types.float64),
]
if sys.version_info >= (3, 11):
Math_unary = infer_global(math.exp2)(Math_unary)
@infer_global(math.atan2)
class Math_atan2(ConcreteTemplate):
cases = [
signature(types.float64, types.int64, types.int64),
signature(types.float64, types.uint64, types.uint64),
signature(types.float32, types.float32, types.float32),
signature(types.float64, types.float64, types.float64),
]
@infer_global(math.trunc)
class Math_converter(ConcreteTemplate):
cases = [
signature(types.intp, types.intp),
signature(types.int64, types.int64),
signature(types.uint64, types.uint64),
signature(types.int64, types.float32),
signature(types.int64, types.float64),
]
@infer_global(math.floor)
@infer_global(math.ceil)
class Math_floor_ceil(Math_converter):
pass
@infer_global(math.copysign)
class Math_copysign(ConcreteTemplate):
cases = [
signature(types.float32, types.float32, types.float32),
signature(types.float64, types.float64, types.float64),
]
@infer_global(math.hypot)
class Math_hypot(ConcreteTemplate):
cases = [
signature(types.float64, types.int64, types.int64),
signature(types.float64, types.uint64, types.uint64),
signature(types.float32, types.float32, types.float32),
signature(types.float64, types.float64, types.float64),
]
@infer_global(math.nextafter)
class Math_nextafter(ConcreteTemplate):
cases = [
signature(types.float64, types.float64, types.float64),
signature(types.float32, types.float32, types.float32),
]
@infer_global(math.isinf)
@infer_global(math.isnan)
class Math_predicate(ConcreteTemplate):
cases = [
signature(types.boolean, types.int64),
signature(types.boolean, types.uint64),
signature(types.boolean, types.float32),
signature(types.boolean, types.float64),
]
@infer_global(math.isfinite)
class Math_isfinite(Math_predicate):
pass
@infer_global(math.pow)
class Math_pow(ConcreteTemplate):
cases = [
signature(types.float64, types.float64, types.int64),
signature(types.float64, types.float64, types.uint64),
signature(types.float32, types.float32, types.float32),
signature(types.float64, types.float64, types.float64),
]
@infer_global(math.gcd)
class Math_gcd(ConcreteTemplate):
cases = [
signature(types.int64, types.int64, types.int64),
signature(types.int32, types.int32, types.int32),
signature(types.int16, types.int16, types.int16),
signature(types.int8, types.int8, types.int8),
signature(types.uint64, types.uint64, types.uint64),
signature(types.uint32, types.uint32, types.uint32),
signature(types.uint16, types.uint16, types.uint16),
signature(types.uint8, types.uint8, types.uint8),
]
@infer_global(math.frexp)
class Math_frexp(ConcreteTemplate):
cases = [
signature(types.Tuple((types.float64, types.intc)), types.float64),
signature(types.Tuple((types.float32, types.intc)), types.float32),
]
@infer_global(math.ldexp)
class Math_ldexp(ConcreteTemplate):
cases = [
signature(types.float64, types.float64, types.intc),
signature(types.float32, types.float32, types.intc),
]