@@ -83,7 +83,7 @@ function as_sub{T}(x::AbstractArray{T,3})
83
83
y
84
84
end
85
85
86
- bittest (f:: Function , ewf :: Function , a... ) = (@test ewf (a... ) == BitArray (broadcast (f, a... )))
86
+ bittest (f:: Function , a... ) = (@test f . (a... ) == BitArray (broadcast (f, a... )))
87
87
n1 = 21
88
88
n2 = 32
89
89
n3 = 17
@@ -97,7 +97,7 @@ for arr in (identity, as_sub)
97
97
@test broadcast (+ , arr ([1 , 0 ]), arr ([1 , 4 ])) == [2 , 4 ]
98
98
@test broadcast (+ , arr ([1 , 0 ]), 2 ) == [3 , 2 ]
99
99
100
- @test @inferred (arr (eye (2 )) .+ arr ([1 , 4 ])) == arr ([2 1 ; 4 5 ])
100
+ @test @inferred (broadcast ( + , arr (eye (2 )), arr ([1 , 4 ]) )) == arr ([2 1 ; 4 5 ])
101
101
@test arr (eye (2 )) .+ arr ([1 4 ]) == arr ([2 4 ; 1 5 ])
102
102
@test arr ([1 0 ]) .+ arr ([1 , 4 ]) == arr ([2 1 ; 5 4 ])
103
103
@test arr ([1 , 0 ]) .+ arr ([1 4 ]) == arr ([2 5 ; 1 4 ])
@@ -137,19 +137,16 @@ for arr in (identity, as_sub)
137
137
@test A == diagm (10 : 12 )
138
138
@test_throws BoundsError broadcast_setindex! (A, 7 , [1 ,- 1 ], [1 2 ])
139
139
140
- for (f, ewf) in (((== ), (.== )),
141
- ((< ) , (.< ) ),
142
- ((!= ), (.!= )),
143
- ((<= ), (.<= )))
144
- bittest (f, ewf, arr (eye (2 )), arr ([1 , 4 ]))
145
- bittest (f, ewf, arr (eye (2 )), arr ([1 4 ]))
146
- bittest (f, ewf, arr ([0 , 1 ]), arr ([1 4 ]))
147
- bittest (f, ewf, arr ([0 1 ]), arr ([1 , 4 ]))
148
- bittest (f, ewf, arr ([1 , 0 ]), arr ([1 , 4 ]))
149
- bittest (f, ewf, arr (rand (rb, n1, n2, n3)), arr (rand (rb, n1, n2, n3)))
150
- bittest (f, ewf, arr (rand (rb, 1 , n2, n3)), arr (rand (rb, n1, 1 , n3)))
151
- bittest (f, ewf, arr (rand (rb, 1 , n2, 1 )), arr (rand (rb, n1, 1 , n3)))
152
- bittest (f, ewf, arr (bitrand (n1, n2, n3)), arr (bitrand (n1, n2, n3)))
140
+ for f in ((== ), (< ) , (!= ), (<= ))
141
+ bittest (f, arr (eye (2 )), arr ([1 , 4 ]))
142
+ bittest (f, arr (eye (2 )), arr ([1 4 ]))
143
+ bittest (f, arr ([0 , 1 ]), arr ([1 4 ]))
144
+ bittest (f, arr ([0 1 ]), arr ([1 , 4 ]))
145
+ bittest (f, arr ([1 , 0 ]), arr ([1 , 4 ]))
146
+ bittest (f, arr (rand (rb, n1, n2, n3)), arr (rand (rb, n1, n2, n3)))
147
+ bittest (f, arr (rand (rb, 1 , n2, n3)), arr (rand (rb, n1, 1 , n3)))
148
+ bittest (f, arr (rand (rb, 1 , n2, 1 )), arr (rand (rb, n1, 1 , n3)))
149
+ bittest (f, arr (bitrand (n1, n2, n3)), arr (bitrand (n1, n2, n3)))
153
150
end
154
151
end
155
152
@@ -163,10 +160,8 @@ m = [1:2;]'
163
160
@test m./ r2 ≈ [ratio 2 ratio]
164
161
@test m./ [r2;] ≈ [ratio 2 ratio]
165
162
166
- @test @inferred ([0 ,1.2 ]. + reshape ([0 ,- 2 ],1 ,1 ,2 )) == reshape ([0 - 2 ; 1.2 - 0.8 ],2 ,1 ,2 )
167
- rt = Base. return_types (.+ , Tuple{Array{Float64, 3 }, Array{Int, 1 }})
168
- @test length (rt) == 1 && rt[1 ] == Array{Float64, 3 }
169
- rt = Base. return_types (broadcast, Tuple{typeof (.+ ), Array{Float64, 3 }, Array{Int, 3 }})
163
+ @test @inferred (broadcast (+ ,[0 ,1.2 ],reshape ([0 ,- 2 ],1 ,1 ,2 ))) == reshape ([0 - 2 ; 1.2 - 0.8 ],2 ,1 ,2 )
164
+ rt = Base. return_types (broadcast, Tuple{typeof (+ ), Array{Float64, 3 }, Array{Int, 1 }})
170
165
@test length (rt) == 1 && rt[1 ] == Array{Float64, 3 }
171
166
rt = Base. return_types (broadcast!, Tuple{Function, Array{Float64, 3 }, Array{Float64, 3 }, Array{Int, 1 }})
172
167
@test length (rt) == 1 && rt[1 ] == Array{Float64, 3 }
0 commit comments