diff options
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; +} |
