@@ -157,20 +157,29 @@ using LinearMaps: LinearMapVector, LinearMapTuple
157
157
@test P isa LinearMaps. CompositeMap{<: Any ,<: LinearMapVector }
158
158
@test P * ones (3 ) == (LowerTriangular (ones (3 ,3 ))^ i) * ones (3 )
159
159
end
160
- # test product of 2-arg FunctionMaps
161
- N = 100
162
- function plan ()
163
- y = zeros (N) # workspace
164
- A = LinearMap {Float64} (x -> (y .= x; y), N)
165
- return A, y
166
- end
167
- A, ya = plan ()
168
- B, yb = plan ()
169
- x = zeros (N)
170
- C = @inferred A* B
171
- @test C* x === ya
172
- @test (@allocated C* x) == 0
173
- mul! (deepcopy (ya), C, x)
174
- y = deepcopy (ya)
175
- @test (@allocated mul! (y, C, x)) == 0
176
160
end
161
+
162
+ # test product of 2-arg FunctionMaps
163
+ # the following tests don't work when wrapped in a testset
164
+ N = 100
165
+ function planA ()
166
+ y = zeros (N) # workspace
167
+ A = LinearMap {Float64} (x -> (y .= x .+ 1 ; y), N)
168
+ return A, y
169
+ end
170
+ function planB ()
171
+ y = zeros (N) # workspace
172
+ A = LinearMap {Float64} (x -> (y .= x ./ 2 ; y), N)
173
+ return A, y
174
+ end
175
+ A, ya = planA ()
176
+ B, yb = planB ()
177
+ x = zeros (N)
178
+ C = @inferred A* B; C* x
179
+ @test C* x === ya == ones (N)
180
+ D = @inferred B* A; D* x
181
+ @test D* x === yb == fill (0.5 , N)
182
+ @test (@allocated C* x) == 0
183
+ mul! (deepcopy (ya), C, x)
184
+ y = deepcopy (ya)
185
+ @test (@allocated mul! (y, C, x)) == 0
0 commit comments