11using SpecialFunctions
22const 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 ))
3535)
3636
3737const 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 )),
4040 # (getfield(Base, :./), (-1000, 1000), (-1000, 1000)),
4141 # (getfield(Base, :.^), (0, 100), (-5, 20))
4242)
4343
4444const 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 )),
5555 # (atan, (-50, 50)),
5656 # (cos, (-10, 10)),
5757 # (sin, (-10, 10)),
@@ -74,22 +74,13 @@ function randindomain(t::Type{T}, n, domain) where {T<:Real}
7474 d2 = convert (t, domain[2 ])
7575 ddiff = d2 - d1
7676 @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
8278end
8379
8480function randindomain (t:: Type{T} , n, domain) where {T<: Complex }
8581 d1 = convert (t, domain[1 ])
8682 d2 = convert (t, domain[2 ])
8783 ddiff = d2 - d1
8884 @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
9586end
0 commit comments