Skip to content

Commit 08356a7

Browse files
committed
Fix MulStyle of CompositeMaps
1 parent 45cd3fa commit 08356a7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/composition.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,22 @@ using LinearMaps: LinearMapVector, LinearMapTuple
157157
@test P isa LinearMaps.CompositeMap{<:Any,<:LinearMapVector}
158158
@test P * ones(3) == (LowerTriangular(ones(3,3))^i) * ones(3)
159159
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
160176
end
161177

162178
# test product of 2-arg FunctionMaps

0 commit comments

Comments
 (0)