The [power set] (or powerset) of a set S is the set of all subsets of S, \ including the empty set and S itself. Example: If S is the set {x, y, z}, then all the subsets of S are \ {} \ {x} \ {y} \ {z} \ {x, y} \ {x, z} \ {y, z} \ {x, y, z} \ and hence the power set of S is {{}, {x}, {y}, {z}, {x, y}, {x, z}, {y, z}, {x, y, z}}. [power set]: https://en.wikipedia.org/wiki/Power_set
(slice: &[T])
| 101 | /// |
| 102 | /// [power set]: https://en.wikipedia.org/wiki/Power_set |
| 103 | pub fn powerset<T>(slice: &[T]) -> Result<Vec<Vec<&T>>> { |
| 104 | if slice.len() >= 64 { |
| 105 | return plan_err!("The size of the set must be less than 64"); |
| 106 | } |
| 107 | |
| 108 | Ok(powerset_indices(slice.len()) |
| 109 | .map(|indices| indices.iter().map(|&idx| &slice[idx]).collect()) |
| 110 | .collect()) |
| 111 | } |
| 112 | |
| 113 | /// check the number of expressions contained in the grouping_set |
| 114 | fn check_grouping_set_size_limit(size: usize) -> Result<()> { |
no test coverage detected
searching dependent graphs…