Skip to content

Commit 6ff9502

Browse files
authored
Fix allocation in ApplyArray (#380)
* Fix allocation in ApplyArray * Update paddedtests.jl
1 parent f7eb99a commit 6ff9502

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
version:
1515
- 'lts'
1616
- '1'
17+
- 'pre'
1718
os:
1819
- ubuntu-latest
1920
- macOS-latest

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LazyArrays"
22
uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02"
3-
version = "2.6.3"
3+
version = "2.6.4"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/linalg/mul.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ sublayout(::ApplyLayout{typeof(*)}, ::Type{<:Tuple{AbstractVector{<:CartesianInd
228228
call(::ApplyLayout{typeof(*)}, V::SubArray) = *
229229

230230
function _mat_mul_arguments(args, (kr,jr)::Tuple{Any,Any})
231-
kjr = intersect.(_mul_args_rows(kr, args...), _mul_args_cols(jr, reverse(args)...))
231+
kjr = map(intersect, _mul_args_rows(kr, args...), _mul_args_cols(jr, reverse(args)...))
232232
map(view, args, (kr, kjr...), (kjr..., jr))
233233
end
234234

@@ -237,8 +237,8 @@ _vec_mul_view(a::AbstractVector, kr, ::Colon) = view(a, kr)
237237

238238
# this is a vector view of a MulVector
239239
function _vec_mul_arguments(args, (kr,)::Tuple{Any})
240-
kjr = intersect.(_mul_args_rows(kr, args...), _mul_args_cols(Base.OneTo(1), reverse(args)...))
241-
_vec_mul_view.(args, (kr, kjr...), (kjr..., :))
240+
kjr = map(intersect, _mul_args_rows(kr, args...), _mul_args_cols(Base.OneTo(1), reverse(args)...))
241+
map(_vec_mul_view, args, (kr, kjr...), (kjr..., :))
242242
end
243243

244244
# this is a vector view of a MulMatrix

test/multests.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,17 +1051,16 @@ end
10511051
M = ApplyArray(*,A,b)
10521052

10531053
V = view(M,2:300)
1054+
c = similar(V)
10541055
@test MemoryLayout(typeof(V)) isa ApplyLayout{typeof(*)}
10551056
@test arguments(V) == (view(A,2:300,Base.OneTo(500)),view(b, Base.OneTo(500)))
10561057
@test Applied(V) isa Applied{MulStyle}
10571058
@test ApplyArray(V) (A*b)[2:300]
1058-
c = similar(V)
10591059
copyto!(c,Applied(V))
10601060
@test @allocated(copyto!(c,Applied(V))) 200
10611061
copyto!(c, V)
10621062

1063-
# This test fails intermittently on GitHub Actions
1064-
# @test @allocated(copyto!(c, V)) ≤ 500
1063+
@test @allocated(copyto!(c, V)) == 0
10651064

10661065
@test all(c .=== apply(*, arguments(V)...))
10671066

test/paddedtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ paddeddata(a::PaddedPadded) = a
404404
@test simplifiable(*, b', a) == Val(true)
405405

406406
D = Diagonal(Fill(2,8))
407-
@test D*b isa Vcat
407+
@test MemoryLayout(D*b) isa PaddedColumns
408408
@test simplifiable(*, D, b) == Val(true)
409409

410410
B = BroadcastArray(+, 1:8, (2:9)')

0 commit comments

Comments
 (0)