summaryrefslogtreecommitdiff
path: root/src/math/subgroups.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/subgroups.c')
-rw-r--r--src/math/subgroups.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/math/subgroups.c b/src/math/subgroups.c
index 93526ae..45523ad 100644
--- a/src/math/subgroups.c
+++ b/src/math/subgroups.c
@@ -54,6 +54,7 @@ static GEN subgroups_divisors(GEN order) {
* @return a t_VEC of factors
*/
static GEN subgroups_2n_factors(GEN factors, size_t min_bits) {
+ pari_sp ltop = avma;
long nprimes = glength(factors);
if (nprimes == min_bits) return NULL;
GEN amount = int2n(nprimes);
@@ -77,17 +78,8 @@ static GEN subgroups_2n_factors(GEN factors, size_t min_bits) {
avma = btop;
}
}
- GEN sorted = sort(groups);
- size_t k = 1;
- for (size_t j = 1; j <= i; j++) {
- GEN k_value = gel(sorted, k);
- GEN j_value = gel(sorted, j);
- if (!gequal(k_value, j_value)) {
- gel(sorted, ++k) = j_value;
- }
- }
- sorted = vec_shorten(sorted, k);
- return sorted;
+ GEN ret = gtoset(groups);
+ return gerepilecopy(ltop, ret);
}
/**