Commit 2381c5b
authored
* perf: optimize `permutations` by implementing it via `multiset_permutations`
As it currently stands, `multiset_permutations` is more efficient than
`permutations`; see #151. We can exploit it to optimize `permutations`.
* fix: use explicit NamedTuple notation tu support Julia 1.0
* fix: don't use `isnothing` to support Julia 1.0
* fix: collect the indices into a `Vector`
Without this fix there are issues with `OffsetArray`: `eachindex`
returns an `OffsetArrays.IdOffsetRange`, which causes troubles when
passed to `multiset_permutations` because
`f = [sum(c == x for c in a)::Int for x in m]`
becomes an `OffsetArray` instead of a Vector`.
1 parent 0ab0915 commit 2381c5b
1 file changed
+19
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
54 | 35 | | |
55 | | - | |
| 36 | + | |
| 37 | + | |
56 | 38 | | |
57 | 39 | | |
58 | 40 | | |
| |||
0 commit comments