diff options
| author | J08nY | 2017-09-19 13:07:45 +0200 |
|---|---|---|
| committer | J08nY | 2017-09-19 13:07:45 +0200 |
| commit | 0d068cefe5f43d69fb7bae0c7882598c1213f60b (patch) | |
| tree | 29bf69e2bf51e33617b78e4439c8b0077e543b1d /src/math/subgroups.c | |
| parent | bfeeedd8b158288b1e66e241620966e933c9e3c7 (diff) | |
| parent | 8448edf40ea8d8b128ff83dc08335b3bf14718cb (diff) | |
| download | ecgen-0d068cefe5f43d69fb7bae0c7882598c1213f60b.tar.gz ecgen-0d068cefe5f43d69fb7bae0c7882598c1213f60b.tar.zst ecgen-0d068cefe5f43d69fb7bae0c7882598c1213f60b.zip | |
Diffstat (limited to 'src/math/subgroups.c')
| -rw-r--r-- | src/math/subgroups.c | 14 |
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); } /** |
