|
28 | 28 | infinity = float('inf') |
29 | 29 |
|
30 | 30 |
|
31 | | - |
32 | 31 | class PermSpaceType(abc.ABCMeta): |
33 | 32 | ''' |
34 | 33 | Metaclass for `PermSpace` and `CombSpace`. |
@@ -82,55 +81,37 @@ class PermSpace(sequence_tools.CuteSequenceMixin, collections.Sequence, |
82 | 81 | of a second as well. |
83 | 82 | |
84 | 83 | There are several variations that a perm space could have: |
85 | | - - Rapplied (Range-applied): having an arbitrary sequence as a range. To |
86 | | - make one, pass your sequence as the first argument. |
87 | | - - Dapplied (Domain-applied): having an arbitrary sequence as a domain. To make one, pass a sequence into the `domain` argument. |
| 84 | + - Rapplied (Range-applied): having an arbitrary sequence as a range. |
| 85 | + To make one, pass your sequence as the first argument. |
| 86 | + - Dapplied (Domain-applied): having an arbitrary sequence as a domain. |
| 87 | + To make one, pass a sequence into the `domain` argument. |
88 | 88 | - Fixed: Having a specified number of indices always pointing at certain |
89 | | - values, making the space smaller. To make one, pass a dict from each key to the value it should be fixed to to argument `fixed_map` |
| 89 | + values, making the space smaller. To make one, pass a dict from each |
| 90 | + key to the value it should be fixed to as the argument `fixed_map`. |
90 | 91 | - Sliced: A perm space can be sliced like any Python sequence (except you |
91 | | - can't change the step.) To make one, use slice notation on an existing perm space. |
| 92 | + can't change the step.) To make one, use slice notation on an existing |
| 93 | + perm space, e.g. perm_space[56:100] |
92 | 94 | - Degreed: A perm space can be limited to perms of a certain degree. (A |
93 | 95 | perm's degree is the number of transformations it takes to make it.) |
94 | | - - Partialled: A perm space can be partial, in which case not all elements |
| 96 | + To make one, pass into the `degrees` argument either a single degree |
| 97 | + (like `5`) or a tuple of different degrees (like `(1, 3, 7)`) |
| 98 | + - Partial: A perm space can be partial, in which case not all elements |
95 | 99 | are used in perms. E.g. you can have a perm space of a sequence of |
96 | | - length 5 but with `n_elements=3`, so every perm will have only 3 |
| 100 | + length 5 but with `n_elements=3`, so every perm will have only 3 items. |
| 101 | + To make one, pass a number as the argument `n_elements`. |
97 | 102 | - Combination: If you pass in `is_combination=True` or use the subclass |
98 | 103 | `CombSpace`, then you'll have a space of combinations (combs) instead of |
99 | 104 | perms. Combs are like perms except there's no order to the elements. |
100 | 105 |
|
101 | | - |
102 | | - Instead of a number, you can also pass a sequence as the first argument, |
103 | | - and the `PermSpace` will use that rather than a range. Such a `PermSpace` |
104 | | - is called "rapplied", which is short for range-applied. It'll have a |
105 | | - property `.unrapplied` which'll give you a non-rapplied version of that |
106 | | - perm space. You can also take any perm space and use the `.get_rapplied` |
107 | | - method on it to get that space range-applied to a sequence that you |
108 | | - provide. |
109 | | - |
110 | | - You may pass a sequence as the `domain` argument, and it'll be used as the |
111 | | - indices for the permutations. (i.e., if the permutations are seen as a |
112 | | - function, `domain` is the domain of the function.) |
113 | | - |
114 | | - You may pass a number as `n_elements` in order to make a partial |
115 | | - permutation space. That number must be smaller than the size of the |
116 | | - sequence, and every permutation will have only that number of items. This |
117 | | - means that permutations will not use all the items in `sequence` but just |
118 | | - some of them. |
119 | | - |
120 | | - You may pass in a `dict` for the argument `fixed_map` that'll map between |
121 | | - indices and values that should remain fixed in the permutation space. Only |
122 | | - the non-fixed items will be allowed to change between permutations. |
123 | | - |
124 | | - You may pass in a list of integers as `degrees`, and then only permutations |
125 | | - with those degrees will be included in the space. (A degree of a |
126 | | - permutation stands for that number of transformations (single switches |
127 | | - between items) that are needed to create that permutation. ) |
128 | | - |
129 | | - A permutation space can be sliced by using regular Python slice notation. |
130 | | - |
131 | 106 | Note: Some of the options are not allowed to be used with each other. |
132 | 107 | |
133 | | - Some clarification on terminology <blocktododoc> rapplied, dapplied "just" etc. |
| 108 | + For each of these variations, there's a function to make a perm space have |
| 109 | + that variation and get rid of it. For example, if you want to make a normal |
| 110 | + perm space be degreed, call `.get_degreed()` on it with the desired |
| 111 | + degrees. If you want to make a degreed perm space non-degreed, access its |
| 112 | + `.undegreed` property. The same is true for all other variations. |
| 113 | + |
| 114 | + A perm space that has none of these variations is called pure. |
134 | 115 | ''' |
135 | 116 |
|
136 | 117 | @classmethod |
|
0 commit comments