From 8dc8b0b471b3c6d9df7d7392654fb80b09fa1d1c Mon Sep 17 00:00:00 2001 From: Jutho Haegeman Date: Tue, 6 Aug 2024 13:57:44 +0200 Subject: [PATCH] fix indexorder for negative strides --- Project.toml | 2 +- src/mapreduce.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 10ac9c8..5445373 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Strided" uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67" authors = ["Lukas Devos ", "Maarten Van Damme ", "Jutho Haegeman "] -version = "2.1.0" +version = "2.1.1" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/mapreduce.jl b/src/mapreduce.jl index 7eb6d1e..6b33274 100644 --- a/src/mapreduce.jl +++ b/src/mapreduce.jl @@ -428,11 +428,11 @@ function indexorder(strides::NTuple{N,Int}) where {N} # returns order such that strides[i] is the order[i]th smallest element of strides, not # counting zero strides zero strides have order 1 return ntuple(Val(N)) do i - si = strides[i] + si = abs(strides[i]) si == 0 && return 1 k = 1 for s in strides - if s != 0 && s < si + if s != 0 && abs(s) < si k += 1 end end