1
1
using SpecialFunctions
2
2
const base_unary_real = (
3
- (: Base , :acos , (- 1 , 1 )),
4
- (: Base , :asin , (- 1 , 1 )),
5
- (: Base , :atan , (- 50 , 50 )),
6
- (: Base , :cos , (- 1000 , 1000 )),
7
- (: Base , :sin , (- 1000 , 1000 )),
8
- (: Base , :tan , (- 1000 , 1000 )),
9
- (: Base , :acosh , (1 , 1000 )),
10
- (: Base , :asinh , (- 1000 , 1000 )),
11
- (: Base , :atanh , (- 1 , 1 )),
12
- (: Base , :cosh , (0 , 89.415985f0 )),
13
- (: Base , :sinh , (- 89.415985f0 , 89.415985f0 )),
14
- (: Base , :tanh , (- 8.66434f0 , 8.66434f0 )),
15
- (: Base , :cbrt , (- 1000 , 1000 )),
16
- (: Base , :sqrt , (0 , 1000 )),
17
- (: Base , :exp , (- 88.72284f0 , 88.72284f0 )),
18
- (: Base , :expm1 , (- 88.72284f0 , 88.72284f0 )),
19
- (: Base , :log , (0 , 1000 )),
20
- (: Base , :log10 , (0 , 1000 )),
21
- (: Base , :log1p , (- 1 , 1000 )),
22
- (: Base , :abs , (- 1000 , 1000 )),
23
- (: Base , :abs2 , (- 1000 , 1000 )),
24
- (: Base , :ceil , (- 1000 , 1000 )),
25
- (: Base , :floor , (- 1000 , 1000 )),
26
- (: Base , :round , (- 1000 , 1000 )),
27
- (: Base , :trunc , (- 1000 , 1000 )),
28
- (: Base , :cis , (- 1000 , 1000 )),
29
- (: SpecialFunctions , :erf , (- 3.8325067f0 , 3.8325067f0 )),
30
- (: SpecialFunctions , :erfc , (- 3.7439213f0 , 10.019834f0 )),
31
- (: SpecialFunctions , :erfinv , (- 1 , 1 )),
32
- (: SpecialFunctions , :erfcinv , (0 , 2 )),
33
- (: SpecialFunctions , :lgamma , (0 , 1000 )),
34
- (: SpecialFunctions , :gamma , (0 , 36 ))
3
+ (Base, :acos , (- 1 , 1 )),
4
+ (Base, :asin , (- 1 , 1 )),
5
+ (Base, :atan , (- 50 , 50 )),
6
+ (Base, :cos , (- 1000 , 1000 )),
7
+ (Base, :sin , (- 1000 , 1000 )),
8
+ (Base, :tan , (- 1000 , 1000 )),
9
+ (Base, :acosh , (1 , 1000 )),
10
+ (Base, :asinh , (- 1000 , 1000 )),
11
+ (Base, :atanh , (- 1 , 1 )),
12
+ (Base, :cosh , (0 , 89.415985f0 )),
13
+ (Base, :sinh , (- 89.415985f0 , 89.415985f0 )),
14
+ (Base, :tanh , (- 8.66434f0 , 8.66434f0 )),
15
+ (Base, :cbrt , (- 1000 , 1000 )),
16
+ (Base, :sqrt , (0 , 1000 )),
17
+ (Base, :exp , (- 88.72284f0 , 88.72284f0 )),
18
+ (Base, :expm1 , (- 88.72284f0 , 88.72284f0 )),
19
+ (Base, :log , (0 , 1000 )),
20
+ (Base, :log10 , (0 , 1000 )),
21
+ (Base, :log1p , (- 1 , 1000 )),
22
+ (Base, :abs , (- 1000 , 1000 )),
23
+ (Base, :abs2 , (- 1000 , 1000 )),
24
+ (Base, :ceil , (- 1000 , 1000 )),
25
+ (Base, :floor , (- 1000 , 1000 )),
26
+ (Base, :round , (- 1000 , 1000 )),
27
+ (Base, :trunc , (- 1000 , 1000 )),
28
+ (Base, :cis , (- 1000 , 1000 )),
29
+ (SpecialFunctions, :erf , (- 3.8325067f0 , 3.8325067f0 )),
30
+ (SpecialFunctions, :erfc , (- 3.7439213f0 , 10.019834f0 )),
31
+ (SpecialFunctions, :erfinv , (- 1 , 1 )),
32
+ (SpecialFunctions, :erfcinv , (0 , 2 )),
33
+ (SpecialFunctions, :lgamma , (0 , 1000 )),
34
+ (SpecialFunctions, :gamma , (0 , 36 ))
35
35
)
36
36
37
37
const base_binary_real = (
38
- (: Base , :atan , (- 1 , 1 ), (- 1 , 1 )),
39
- (: Base , :hypot , (- 1000 , 1000 ), (- 1000 , 1000 )),
38
+ (Base, :atan , (- 1 , 1 ), (- 1 , 1 )),
39
+ (Base, :hypot , (- 1000 , 1000 ), (- 1000 , 1000 )),
40
40
# (getfield(Base, :./), (-1000, 1000), (-1000, 1000)),
41
41
# (getfield(Base, :.^), (0, 100), (-5, 20))
42
42
)
43
43
44
44
const base_unary_complex = (
45
- (: Base , :acos , (- 1 , 1 )),
46
- (: Base , :asin , (- 1 , 1 )),
47
- (: Base , :acosh , (1 , 1000 )),
48
- (: Base , :asinh , (- 1000 , 1000 )),
49
- (: Base , :sqrt , (0 , 1000 )),
50
- (: Base , :exp , (- 88.72284f0 , 88.72284f0 )),
51
- (: Base , :log , (0 , 1000 )),
52
- (: Base , :abs , (- 1000 , 1000 )),
53
- (: Base , :angle , (- 1000 , 1000 )),
54
- (: Base , :conj , (- 1000 , 1000 )),
45
+ (Base, :acos , (- 1 , 1 )),
46
+ (Base, :asin , (- 1 , 1 )),
47
+ (Base, :acosh , (1 , 1000 )),
48
+ (Base, :asinh , (- 1000 , 1000 )),
49
+ (Base, :sqrt , (0 , 1000 )),
50
+ (Base, :exp , (- 88.72284f0 , 88.72284f0 )),
51
+ (Base, :log , (0 , 1000 )),
52
+ (Base, :abs , (- 1000 , 1000 )),
53
+ (Base, :angle , (- 1000 , 1000 )),
54
+ (Base, :conj , (- 1000 , 1000 )),
55
55
# (atan, (-50, 50)),
56
56
# (cos, (-10, 10)),
57
57
# (sin, (-10, 10)),
@@ -74,22 +74,13 @@ function randindomain(t::Type{T}, n, domain) where {T<:Real}
74
74
d2 = convert (t, domain[2 ])
75
75
ddiff = d2 - d1
76
76
@assert isfinite (ddiff)
77
- v = rand (t, n)
78
- for i = 1 : length (v)
79
- v[i] = v[i]* ddiff+ d1
80
- end
81
- v
77
+ return rand (t, n) .* ddiff .+ d1
82
78
end
83
79
84
80
function randindomain (t:: Type{T} , n, domain) where {T<: Complex }
85
81
d1 = convert (t, domain[1 ])
86
82
d2 = convert (t, domain[2 ])
87
83
ddiff = d2 - d1
88
84
@assert isfinite (ddiff)
89
- v = rand (t, 2 * n)
90
- for i = 1 : length (v)
91
- v[i] = v[i]* ddiff+ d1
92
- end
93
- v
94
- # reinterpret(t, v)
85
+ return rand (t, 2 * n) .* ddiff .+ d1
95
86
end
0 commit comments