File: class_poly.c

package info (click to toggle)
flint 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 68,996 kB
  • sloc: ansic: 915,350; asm: 14,605; python: 5,340; sh: 4,512; lisp: 2,621; makefile: 787; cpp: 341
file content (57 lines) | stat: -rw-r--r-- 1,097 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* This file is public domain. Author: Fredrik Johansson. */

#include <string.h>
#include <stdlib.h>
#include <flint/arb.h>
#include <flint/acb_modular.h>
#include <flint/fmpz_poly.h>
#include <flint/profiler.h>

int main(int argc, char *argv[])
{
    fmpz_poly_t res;
    slong i, num_threads;
    slong D;

    if (argc < 2)
    {
        flint_printf("usage: build/examples/class_poly D [-threads n]\n");
        return 1;
    }

    D = atol(argv[1]);

    num_threads = 1;

    for (i = 2; i < argc; i++)
    {
        if (!strcmp(argv[i], "-threads"))
            num_threads = atol(argv[i+1]);
    }

    flint_set_num_threads(num_threads);

    fmpz_poly_init(res);

    TIMEIT_ONCE_START;
    acb_modular_hilbert_class_poly(res, D);
    TIMEIT_ONCE_STOP;

    print_memory_usage();

    if (FLINT_ABS(D) <= 100)
    {
        fmpz_poly_print(res);
        flint_printf("\n");
    }
    else
    {
        flint_printf("degree = %wd, bits = %wd\n",
            fmpz_poly_degree(res), fmpz_poly_max_bits(res));
    }

    fmpz_poly_clear(res);
    flint_cleanup_master();
    return 0;
}