From edef3c2c6261b335ef55a3fb1fd6d1da920755a0 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Thu, 29 Sep 2022 08:04:56 +0200 Subject: [PATCH] Remove temporary circshift direction workaround --- src/SparseArrays.jl | 4 ---- src/sparsematrix.jl | 8 ++++---- src/sparsevector.jl | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/SparseArrays.jl b/src/SparseArrays.jl index 27e1a601..9f56b650 100644 --- a/src/SparseArrays.jl +++ b/src/SparseArrays.jl @@ -11,10 +11,6 @@ using Base.Sort: Forward using LinearAlgebra using LinearAlgebra: AdjOrTrans, matprod -# Temporary workaround for simplifying SparseArrays.jl upgrade in JuliaLang/julia -# to workaround circshift! bug, see https://github.com/JuliaLang/julia/pull/46759 -const CIRCSHIFT_WRONG_DIRECTION = circshift!([1, 2, 3], 1) != circshift([1, 2, 3], 1) - import Base: +, -, *, \, /, &, |, xor, ==, zero import LinearAlgebra: mul!, ldiv!, rdiv!, cholesky, adjoint!, diag, eigen, dot, diff --git a/src/sparsematrix.jl b/src/sparsematrix.jl index f5c936b0..8f106683 100644 --- a/src/sparsematrix.jl +++ b/src/sparsematrix.jl @@ -4216,16 +4216,16 @@ function Base.swaprows!(A::AbstractSparseMatrixCSC, i, j) rows[rr[iidx]] = j jidx == 0 && continue rotate_range = rr[iidx]:jrange[jidx] - circshift!(@view(vals[rotate_range]), CIRCSHIFT_WRONG_DIRECTION ? -1 : 1) - circshift!(@view(rows[rotate_range]), CIRCSHIFT_WRONG_DIRECTION ? -1 : 1) + circshift!(@view(vals[rotate_range]), 1) + circshift!(@view(rows[rotate_range]), 1) else # Same as i, but in the opposite direction @assert has_j rows[jrange[jidx]] = i iidx > length(rr) && continue rotate_range = rr[iidx]:jrange[jidx] - circshift!(@view(vals[rotate_range]), CIRCSHIFT_WRONG_DIRECTION ? 1 : -1) - circshift!(@view(rows[rotate_range]), CIRCSHIFT_WRONG_DIRECTION ? 1 : -1) + circshift!(@view(vals[rotate_range]), -1) + circshift!(@view(rows[rotate_range]), -1) end end return nothing diff --git a/src/sparsevector.jl b/src/sparsevector.jl index e2a24a9e..6b32e44f 100644 --- a/src/sparsevector.jl +++ b/src/sparsevector.jl @@ -2272,8 +2272,8 @@ function subvector_shifter!(R::AbstractVector, V::AbstractVector, start::Integer end end # ...but rowval should be sorted within columns - circshift!(@view(R[start:fin]), (CIRCSHIFT_WRONG_DIRECTION ? (+) : (-))(split-start+1)) - circshift!(@view(V[start:fin]), (CIRCSHIFT_WRONG_DIRECTION ? (+) : (-))(split-start+1)) + circshift!(@view(R[start:fin]), -split+start-1) + circshift!(@view(V[start:fin]), -split+start-1) end function circshift!(O::SparseVector, X::SparseVector, (r,)::Base.DimsInteger{1})