Skip to content

circshift!(x, n) and circshift(x, n) shift in different directions #46533

Closed
@artemsolod

Description

@artemsolod

circshift!(vec, n) rotation direction is inconsistent with copying circshift(vec, n) and mutating destination circshift!(dest, source, n) versions. Judging by #46016 it appears that in-place circshift!(vec, n) was introduced in 1.8 and implemented in #42678

julia> circshift(collect(1:3), 1)
3-element Vector{Int64}:
 3
 1
 2

julia> circshift!(collect(1:3), 1)
3-element Vector{Int64}:
 2
 3
 1

julia> circshift!(collect(1:3), collect(1:3), 1) # with destination and source
3-element Vector{Int64}:
 3
 1
 2
Julia Version 1.8.0
Commit 5544a0fab76 (2022-08-17 13:38 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, ivybridge)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions