scheinerman / Permutations.jl

Permutations class for Julia.
Other
51 stars 14 forks source link

Add CompiledPermutation #27

Closed LilithHafner closed 2 years ago

LilithHafner commented 2 years ago

This adds CompiledPermutation, useful for folks who want to repeatedly and quickly apply a permutation to multiple vectors in place. I also extended type signatures on some generic methods from Permutation to AbstractPermutation so that CompiledPermutation can get show and order for free.

I may have gone a little overboard with the complexity of the memory map for the compiled ordering. It first lists zero-terminated 3+ cycles and then lists consecutive 2-cycles. This is to maximize efficiency in general and in the special case where there are a lot of two cycles (e.g. reverse) that would otherwise be slow due to a short inner loop.

Closes #26

codecov[bot] commented 2 years ago

Codecov Report

Merging #27 (3c8bf85) into master (7e2a8d5) will decrease coverage by 1.56%. The diff coverage is 88.18%.

@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
- Coverage   81.23%   79.66%   -1.57%     
==========================================
  Files           4        5       +1     
  Lines         357      482     +125     
==========================================
+ Hits          290      384      +94     
- Misses         67       98      +31     
Impacted Files Coverage Δ
src/Permutations.jl 80.40% <25.00%> (-0.65%) :arrow_down:
src/CompiledPermutation.jl 90.24% <90.24%> (ø)
src/sqrt.jl 61.66% <0.00%> (-28.34%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7e2a8d5...3c8bf85. Read the comment docs.