Skip to content

Commit 4239cda

Browse files
Fix minor oversight
1 parent 6cb2c58 commit 4239cda

File tree

2 files changed

+41
-19
lines changed

2 files changed

+41
-19
lines changed

src/vfindminmax.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,16 @@ function staticdim_findminmax_quote(OP, I, static_dims::Vector{Int}, N::Int)
209209
# postj = Expr(:(=), Cᵥ′, setc)
210210
# push!(rblock.args, postj)
211211
# # strides, offsets
212-
# t = Expr(:tuple)
213-
# for d = 1:N
214-
# push!(t.args, Symbol(:D_, d))
215-
# end
216-
# sz = Expr(:(=), t, Expr(:call, :size, :A))
217-
# # ∑ₖ₌₁ᴺ(∏ᵢ₌₁ᵏ⁻¹Dᵢ) : 1 + D₁ + D₁D₂ + ⋯ + D₁D₂⋯Dₖ₋₁
218-
# dstar = Expr(:call, :+, 1)
219-
# for d = 2:N
220-
# push!(dstar.args, d == 2 ? :D_1 : Expr(:call, :*, ntuple(i -> Symbol(:D_, i), d - 1)...))
221-
# end
212+
t = Expr(:tuple)
213+
for d = 1:N
214+
push!(t.args, Symbol(:D_, d))
215+
end
216+
sz = Expr(:(=), t, Expr(:call, :size, :A))
217+
# ∑ₖ₌₁ᴺ(∏ᵢ₌₁ᵏ⁻¹Dᵢ) : 1 + D₁ + D₁D₂ + ⋯ + D₁D₂⋯Dₖ₋₁
218+
dstar = Expr(:call, :+, 1)
219+
for d = 2:N
220+
push!(dstar.args, d == 2 ? :D_1 : Expr(:call, :*, ntuple(i -> Symbol(:D_, i), d - 1)...))
221+
end
222222
# Version which precomputes the unchanging components of setc.
223223
tl = Expr(:tuple)
224224
tr = Expr(:tuple)
@@ -783,15 +783,15 @@ function staticdim_tfindminmax_quote(OP, I, static_dims::Vector{Int}, N::Int)
783783
# postj = Expr(:(=), Cᵥ′, setc)
784784
# push!(rblock.args, postj)
785785
# # strides, offsets
786-
# t = Expr(:tuple)
787-
# for d = 1:N
788-
# push!(t.args, Symbol(:D_, d))
789-
# end
790-
# sz = Expr(:(=), t, Expr(:call, :size, :A))
791-
# dstar = Expr(:call, :+, 1)
792-
# for d = 2:N
793-
# push!(dstar.args, d == 2 ? :D_1 : Expr(:call, :*, ntuple(i -> Symbol(:D_, i), d - 1)...))
794-
# end
786+
t = Expr(:tuple)
787+
for d = 1:N
788+
push!(t.args, Symbol(:D_, d))
789+
end
790+
sz = Expr(:(=), t, Expr(:call, :size, :A))
791+
dstar = Expr(:call, :+, 1)
792+
for d = 2:N
793+
push!(dstar.args, d == 2 ? :D_1 : Expr(:call, :*, ntuple(i -> Symbol(:D_, i), d - 1)...))
794+
end
795795
# Version which precomputes the unchanging components of setc.
796796
tl = Expr(:tuple)
797797
tr = Expr(:tuple)

src/vfindminmax_vararg.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,17 @@ function staticdim_findminmax_vararg_quote(OP, I, static_dims::Vector{Int}, N::I
189189
push!(setc.args, 1, :Dstar)
190190
postj = Expr(:(=), Cᵥ′, setc)
191191
push!(rblock.args, postj)
192+
# strides, offsets
193+
td = Expr(:tuple)
194+
for d = 1:N
195+
push!(td.args, Symbol(:D_, d))
196+
end
197+
sz = Expr(:(=), td, Expr(:call, :size, :A_1))
198+
# ∑ₖ₌₁ᴺ(∏ᵢ₌₁ᵏ⁻¹Dᵢ) : 1 + D₁ + D₁D₂ + ⋯ + D₁D₂⋯Dₖ₋₁
199+
dstar = Expr(:call, :+, 1)
200+
for d = 2:N
201+
push!(dstar.args, d == 2 ? :D_1 : Expr(:call, :*, ntuple(i -> Symbol(:D_, i), d - 1)...))
202+
end
192203
return quote
193204
$t = As
194205
$sz
@@ -489,6 +500,17 @@ function staticdim_tfindminmax_vararg_quote(OP, I, static_dims::Vector{Int}, N::
489500
push!(setc.args, 1, :Dstar)
490501
postj = Expr(:(=), Cᵥ′, setc)
491502
push!(rblock.args, postj)
503+
# strides, offsets
504+
td = Expr(:tuple)
505+
for d = 1:N
506+
push!(td.args, Symbol(:D_, d))
507+
end
508+
sz = Expr(:(=), td, Expr(:call, :size, :A_1))
509+
# ∑ₖ₌₁ᴺ(∏ᵢ₌₁ᵏ⁻¹Dᵢ) : 1 + D₁ + D₁D₂ + ⋯ + D₁D₂⋯Dₖ₋₁
510+
dstar = Expr(:call, :+, 1)
511+
for d = 2:N
512+
push!(dstar.args, d == 2 ? :D_1 : Expr(:call, :*, ntuple(i -> Symbol(:D_, i), d - 1)...))
513+
end
492514
return quote
493515
$t = As
494516
$sz

0 commit comments

Comments
 (0)