Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consolidate ror/rol and circshift #19923

Closed
StefanKarpinski opened this issue Jan 7, 2017 · 12 comments
Closed

consolidate ror/rol and circshift #19923

StefanKarpinski opened this issue Jan 7, 2017 · 12 comments
Assignees
Labels
kind:deprecation This change introduces or involves a deprecation status:help wanted Indicates that a maintainer wants help on an issue or pull request
Milestone

Comments

@StefanKarpinski
Copy link
Sponsor Member

http:https://stackoverflow.com/questions/41517318/rotate-non-bit-arrays-in-julia

These are basically the same functions.

@StefanKarpinski StefanKarpinski added this to the 1.0 milestone Jan 7, 2017
@ararslan
Copy link
Member

ararslan commented Jan 7, 2017

If I may, I'd like to specifically propose the following consolidation:

  • Deprecate ror(A, i) in favor of circshift(A, i)
  • Deprecate rol(A, i) in favor of circshift(A, -i)
  • Add a method circshift!(A, i) (currently we just have circshift!(A, B, i))
  • Similarly deprecate the in-place ror! and rol! in favor of circshift!

That to me seems like a fairly straightforward change.

@simonbyrne simonbyrne added the status:help wanted Indicates that a maintainer wants help on an issue or pull request label Jan 9, 2017
@stevengj
Copy link
Member

stevengj commented Jan 9, 2017

See also #16032 and #9822 regarding in-place circshift!(A, i).

@kshyatt kshyatt added the kind:deprecation This change introduces or involves a deprecation label Jan 9, 2017
@StefanKarpinski
Copy link
Sponsor Member Author

How about calling these all rotate and rotate! instead of circshift?

@StefanKarpinski
Copy link
Sponsor Member Author

Note also that efficient implementations of these for various integer bits types would be useful. The various shenanigans we've layered on top of shift operators make it fairly hard to coax LLVM into generating actual rotate instructions. Using llvm_call or intrinsics might be necessary.

@akaysh
Copy link
Contributor

akaysh commented Jan 11, 2017

@StefanKarpinski I am new to Julia and would like to work on this. By deprecating a function, do you mean removing it from the base source, documentation and imports/exports it is involved in? Is there anything else which should be done?
And also I did not understand your last comment about efficient implementation and llvm_call. Please help me in getting this started.
Thanks

@yuyichao
Copy link
Contributor

Ref #11592 (comment) No llvmcall should be necessary.

@JeffreySarnoff
Copy link
Contributor

+5 > efficient implementations of these for various integer bits types would be useful.

@stevengj
Copy link
Member

I assigned performance-optimization of in-place circshift!, both of a 1d array and of all the rows of a matrix, in problem-set 1 of our 18.S096 course at MIT this January. The solutions compare several algorithms and might be informative here.

@JKrehl
Copy link
Contributor

JKrehl commented Feb 26, 2017

I've posted an n-dimensional circshift! over at #20696. It is not optimised to the end (e.g. not-shifted axes could be left alone) but complicated enough already.
Tell me what you think.

mdavezac pushed a commit to CryptaLabs/ExtractRandom.jl that referenced this issue May 30, 2017
Mostly because Julia does not create optimal code when doing cyclic bit
shifts, see JuliaLang/julia#11592 and JuliaLang/julia#19923
@StefanKarpinski
Copy link
Sponsor Member Author

The ror and rol functions do the exact same thing as circshift on any other array type, so they should just be deprecated in favor of methods of circshift. Any change of name or whatever else can be discussed separately.

@JeffBezanson
Copy link
Sponsor Member

Resolved: deprecate BitArray ror and rol to be methods of circshift.

@StefanKarpinski
Copy link
Sponsor Member Author

I'm also fine with calling it rotate and rotate!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:deprecation This change introduces or involves a deprecation status:help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

No branches or pull requests

10 participants