diff options
| author | J08nY | 2017-04-10 23:47:46 +0200 |
|---|---|---|
| committer | J08nY | 2017-04-10 23:56:03 +0200 |
| commit | 2cf2eec873cb11f2f0767aac41da0f56dbd27cb9 (patch) | |
| tree | 9b9a52548ccc7c9e54c500e4b587560ce18a017c /src/math/point.c | |
| parent | c1de68ff1e47dfbb1b85671e4fadcce1c49c8967 (diff) | |
| download | ecgen-2cf2eec873cb11f2f0767aac41da0f56dbd27cb9.tar.gz ecgen-2cf2eec873cb11f2f0767aac41da0f56dbd27cb9.tar.zst ecgen-2cf2eec873cb11f2f0767aac41da0f56dbd27cb9.zip | |
Added unroll functions, to generalize going back in exhaustive generation
Diffstat (limited to 'src/math/point.c')
| -rw-r--r-- | src/math/point.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/math/point.c b/src/math/point.c index dc9cd4a..8b3dcef 100644 --- a/src/math/point.c +++ b/src/math/point.c @@ -3,7 +3,7 @@ * Copyright (C) 2017 J08nY */ #include "point.h" -#include "types.h" +#include "io/output.h" point_t *point_new(void) { point_t *point = pari_malloc(sizeof(point_t)); @@ -106,8 +106,6 @@ void points_free_deep(point_t ***points, size_t npoints) { } int point_random(curve_t *curve, const config_t *cfg, arg_t *args) { - points_free_deep(&curve->points, curve->npoints); - point_t *p = point_new(); p->point = genrand(curve->curve); p->order = ellorder(curve->curve, p->point, NULL); @@ -123,7 +121,6 @@ int points_random(curve_t *curve, const config_t *cfg, arg_t *args) { fprintf(stderr, "No args to an arged function. points_random"); return INT_MIN; } - points_free_deep(&curve->points, curve->npoints); size_t npoints = *(size_t *)args->args; @@ -160,7 +157,6 @@ int points_trial(curve_t *curve, const config_t *cfg, arg_t *args) { fprintf(stderr, "No args to an arged function. points_trial"); return INT_MIN; } - points_free_deep(&curve->points, curve->npoints); pari_ulong *primes = (pari_ulong *)args->args; size_t nprimes = args->nargs; @@ -195,7 +191,6 @@ int points_trial(curve_t *curve, const config_t *cfg, arg_t *args) { int points_prime(curve_t *curve, const config_t *cfg, arg_t *args) { // TODO stack code!!! - points_free_deep(&curve->points, curve->npoints); GEN factors = Z_factor(curve->order); GEN primes = gel(factors, 1); @@ -230,3 +225,11 @@ int points_prime(curve_t *curve, const config_t *cfg, arg_t *args) { return 1; } + +int points_unroll(curve_t *curve, const config_t *cfg, pari_sp from, + pari_sp to) { + if (curve->points) { + points_free_deep(&curve->points, curve->npoints); + } + return -1; +} |
