Skip to content

Different circshift methods rotate in opposite directions #47466

Closed

Description

The circshift methods in abstractarraymath.jl and abstractarray.jl rotate in opposite directions. I would expect all methods to rotate in a consistent direction

julia> test = collect(1.0:10.0)
10-element Vector{Float64}:
  1.0
  2.0
  3.0
  4.0
  5.0
  6.0
  7.0
  8.0
  9.0
 10.0

julia> circshift(test, 3)
10-element Vector{Float64}:
  8.0
  9.0
 10.0
  1.0
  2.0
  3.0
  4.0
  5.0
  6.0
  7.0

julia> test
10-element Vector{Float64}:
  1.0
  2.0
  3.0
  4.0
  5.0
  6.0
  7.0
  8.0
  9.0
 10.0

julia> circshift!(test, 3)
10-element Vector{Float64}:
  4.0
  5.0
  6.0
  7.0
  8.0
  9.0
 10.0
  1.0
  2.0
  3.0

julia> @which circshift(test, 3)
circshift(a::AbstractArray, shiftamt::Real) in Base at abstractarraymath.jl:260

julia> @which circshift!(test, 3)
circshift!(a::AbstractVector, shift::Integer) in Base at abstractarray.jl:3185

version info

Julia Version 1.8.2
Commit 36034abf26 (2022-09-29 15:21 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, tigerlake)
  Threads: 16 on 16 virtual cores
Environment:
  JULIA_EDITOR = code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions