diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-02-16 00:22:30 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-02-16 00:22:30 +0100 |
commit | b0fae0894f4440c6cd9cd74b5a3515baa8bd8c35 (patch) | |
tree | 1c182fa746bdd362a8fbb9ddd87f3d20a0070e08 /src/Data/Array/Mixed/Internal/Arith.hs | |
parent | c705bb4cf76d2e80f3e9ed900f901b697b378f79 (diff) |
arith: Fix cover calculation in stridesDense
The calculation was incorrect for windowed arrays (as produced by
RS.window)
Diffstat (limited to 'src/Data/Array/Mixed/Internal/Arith.hs')
-rw-r--r-- | src/Data/Array/Mixed/Internal/Arith.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Data/Array/Mixed/Internal/Arith.hs b/src/Data/Array/Mixed/Internal/Arith.hs index a24efd6..734c7cd 100644 --- a/src/Data/Array/Mixed/Internal/Arith.hs +++ b/src/Data/Array/Mixed/Internal/Arith.hs @@ -99,7 +99,7 @@ stridesDense sh offsetNeg stridesNeg = -- it does, return the number of elements in this prefix. checkCover :: Int -> [(Int, Int)] -> Maybe Int checkCover block [] = Just block - checkCover block ((s, n) : pairs) = guard (s <= block) >> checkCover (max block (n * s)) pairs + checkCover block ((s, n) : pairs) = guard (s <= block) >> checkCover ((n-1) * s + block) pairs -- Given shape, offset and strides, returns new (offset, strides) such that all strides are >=0 flipReverseds :: [Int] -> Int -> [Int] -> (Int, [Int]) |