Skip to content

Commit d61b238

Browse files
committed
Adjust to the fact that similar(v) does not allocate
1 parent 298820d commit d61b238

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

test/blockmap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ using LinearMaps: FiveArg
290290
@test mul!(copy(v), LinearMap(transform(L)), u, α, β) transform(M)*u*α + v*β
291291
if transform != adjoint
292292
transL = transform(L)
293-
alloc = @allocated similar(v)
293+
alloc = sizeof(v) + 64
294294
if L == L2 && α != false
295295
@test_broken (@allocated mul!(v, transL, u, α, β)) <= alloc
296296
else

test/functionmap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ using Test, LinearMaps, LinearAlgebra
8787
@test mul!(copy(v), LinearMap(transform(CS!)), u, α, β) transform(M)*u*α + v*β
8888
if transform != transpose
8989
transCS! = transform(CS!)
90-
alloc = @allocated similar(v)
90+
alloc = sizeof(v) + 64
9191
@test (@allocated mul!(v, transCS!, u, α, β)) <= alloc
9292
end
9393
end

test/linearcombination.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using LinearMaps: FiveArg, LinearMapTuple, LinearMapVector, FunctionMap
1212
mul!(u, CS!, v)
1313
@test (@allocated mul!(u, CS!, v)) == 0
1414
n = 10
15-
alloc = @allocated similar(v)
15+
alloc = sizeof(v) + 64
1616
Loop = @inferred CS + CS + CS
1717
@test Loop * v 3cumsum(v)
1818
@test (CS + CR + CS) * v 3cumsum(v)
@@ -60,7 +60,7 @@ using LinearMaps: FiveArg, LinearMapTuple, LinearMapVector, FunctionMap
6060
@test occursin("10×10 $LinearMaps.LinearCombination{$(eltype(L))}", sprint((t, s) -> show(t, "text/plain", s), L+CS!))
6161
@test mul!(u, L, v) n * cumsum(v)
6262
@test mul!(u, Lv, v) n * cumsum(v)
63-
alloc = @allocated similar(u)
63+
alloc = sizeof(u) + 64
6464
mul!(u, L, v, 2, 2)
6565
@test (@allocated mul!(u, L, v, 2, 2)) <= alloc
6666
mul!(u, Lv, v, 2, 2)

test/scaledmap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ using Test, LinearMaps, LinearAlgebra
104104
for (A, alloc) in ((A0, 1), (A1, 0), (B0, 1), (B1, 0), (A0', 3), (A1', 0), (B0', 3), (B1', 0))
105105
x = rand(N)
106106
y = similar(x)
107-
allocsize = @allocated similar(y)
107+
allocsize = sizeof(y)+72
108108
mul!(y, A, x)
109109
@test (@allocated mul!(y, A, x)) == alloc*allocsize
110110
end

0 commit comments

Comments
 (0)