aboutsummaryrefslogtreecommitdiffstats
path: root/moon-abe/pbc-0.5.14/gen/hilbertpoly.c
diff options
context:
space:
mode:
authorwukong <rebirthmonkey@gmail.com>2015-11-23 17:48:48 +0100
committerwukong <rebirthmonkey@gmail.com>2015-11-23 17:48:48 +0100
commitfca74d4bc3569506a6659880a89aa009dc11f552 (patch)
tree4cefd06af989608ea8ebd3bc6306889e2a1ad175 /moon-abe/pbc-0.5.14/gen/hilbertpoly.c
parent840ac3ebca7af381132bf7e93c1e4c0430d6b16a (diff)
moon-abe cleanup
Change-Id: Ie1259856db03f0b9e80de3e967ec6bd1f03191b3
Diffstat (limited to 'moon-abe/pbc-0.5.14/gen/hilbertpoly.c')
-rw-r--r--moon-abe/pbc-0.5.14/gen/hilbertpoly.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/moon-abe/pbc-0.5.14/gen/hilbertpoly.c b/moon-abe/pbc-0.5.14/gen/hilbertpoly.c
deleted file mode 100644
index 2e73af4e..00000000
--- a/moon-abe/pbc-0.5.14/gen/hilbertpoly.c
+++ /dev/null
@@ -1,57 +0,0 @@
-// Prints Hilbert polynomials H_D(X)
-//
-// Usage: hilbertpoly [LOWER [UPPER]]
-//
-// LOWER:
-// Lower limit of D. Defaults to 3.
-// UPPER:
-// Upper limit of D. Defaults to LOWER.
-//
-// e.g. $ hilbertpoly 3 1000000
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdint.h> // for intptr_t
-#include <stdlib.h> //for atoi, exit
-#include <gmp.h>
-#include "pbc_utils.h"
-#include "pbc_hilbert.h"
-
-static void xpow(int degree) {
- if (degree == 1) {
- printf("X");
- } else if (degree) {
- printf("X^%d", degree);
- }
-}
-
-int main(int argc, char **argv) {
- int D = argc > 1 ? atoi(argv[1]) : 3;
- if (D <= 0) pbc_die("D must be positive.");
-
- int Dlimit = argc > 2 ? atoi(argv[2]) : D;
-
- for(; D <= Dlimit; D++) {
- mpz_t *coefflist;
- int m = D % 4;
- if (m == 1 || m == 2) continue;
- printf("D = %d\n", D);
-
- int n = pbc_hilbert(&coefflist, D);
-
- printf(" ");
- xpow(n - 1);
- printf("\n");
- int i;
- for (i = n - 2; i >= 0; i--) {
- if (mpz_sgn(coefflist[i]) >= 0) {
- printf("+");
- }
- mpz_out_str(stdout, 0, coefflist[i]);
- xpow(i);
- printf("\n");
- }
- pbc_hilbert_free(coefflist, n);
- }
-
- return 0;
-}