@@ -180,26 +180,32 @@ function precomputeOneNodeBlocking(winLin, winTensor::Nothing, winPoly::Nothing,
180180 return (y, tmpWin)
181181end
182182
183- @generated function shiftedWindowEntries (winLin:: Vector , idx, scale, d, L:: Val{Z} ) where {Z}
183+ @generated function shiftedWindowEntries (winLin:: Vector , idx:: T , scale, d, L:: Val{Z} ) where {T, Z}
184184 quote
185- idxL = floor (Int,idx)
186- idxInt = Int (idxL)
187- α = ( idx- idxL )
188-
189- tmpWin = @ntuple $ (Z) l -> begin
190- # Uncommented code: This is the version where we pull in l into the abs.
191- # We pulled this out of the iteration.
192- # idx = abs((kscale - (l-1) - off)*LUTSize)/(m)
193-
194- # The second +1 is because Julia has 1-based indexing
195- # The first +1 is part of the index calculation and needs(!)
196- # to be part of the abs. The abs is shifting to the positive interval
197- # and this +1 matches the `floor` above, which rounds down. In turn
198- # for positive and negative indices a different neighbour is calculated
199- idxInt1 = abs ( idxInt - (l- 1 )* scale ) + 1
200- idxInt2 = abs ( idxInt - (l- 1 )* scale + 1 ) + 1
201-
202- (winLin[idxInt1] + α * (winLin[idxInt2] - winLin[idxInt1]))
185+ idxInt = floor (Int,idx)
186+ α = ( idx- idxInt )
187+
188+ if α != zero (T)
189+ tmpWin = @ntuple $ (Z) l -> begin
190+ # Uncommented code: This is the version where we pull in l into the abs.
191+ # We pulled this out of the iteration.
192+ # idx = abs((kscale - (l-1) - off)*LUTSize)/(m)
193+
194+ # The second +1 is because Julia has 1-based indexing
195+ # The first +1 is part of the index calculation and needs(!)
196+ # to be part of the abs. The abs is shifting to the positive interval
197+ # and this +1 matches the `floor` above, which rounds down. In turn
198+ # for positive and negative indices a different neighbour is calculated
199+ idxInt1 = abs ( idxInt - (l- 1 )* scale ) + 1
200+ idxInt2 = abs ( idxInt - (l- 1 )* scale + 1 ) + 1
201+
202+ (winLin[idxInt1] + α * (winLin[idxInt2] - winLin[idxInt1]))
203+ end
204+ else
205+ tmpWin = @ntuple $ (Z) l -> begin
206+ idxInt1 = abs ( idxInt - (l- 1 )* scale ) + 1
207+ winLin[idxInt1]
208+ end
203209 end
204210 return tmpWin
205211 end
0 commit comments