From b0fae0894f4440c6cd9cd74b5a3515baa8bd8c35 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 16 Feb 2025 00:22:30 +0100 Subject: arith: Fix cover calculation in stridesDense The calculation was incorrect for windowed arrays (as produced by RS.window) --- src/Data/Array/Mixed/Internal/Arith.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Data/Array') 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]) -- cgit v1.2.3-70-g09d2