1 /*
2 Copyright (C) 2013 Mike Hansen
3
4 This file is part of FLINT.
5
6 FLINT is free software: you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License (LGPL) as published
8 by the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version. See <http://www.gnu.org/licenses/>.
10 */
11
12 #ifdef T
13
14 #include "flint.h"
15 #include "templates.h"
16
17 #include "profiler.h"
18
19 #define nalgs 1
20 #define ncases 1
21 #define cpumin 2
22
23 int
main(int argc,char ** argv)24 main(int argc, char** argv)
25 {
26 int len, ext;
27 fmpz_t p, temp;
28 TEMPLATE(T, poly_t) f;
29 TEMPLATE(T, ctx_t) ctx;
30 TEMPLATE(T, poly_factor_t) res;
31 timeit_t t;
32
33 FLINT_TEST_INIT(state);
34
35 fmpz_init(p);
36 fmpz_set_str(p, argv[1], 10);
37
38 fmpz_init(temp);
39
40 fmpz_set_str(temp, argv[2], 10);
41 ext = fmpz_get_si(temp);
42
43 fmpz_set_str(temp, argv[3], 10);
44 len = fmpz_get_si(temp);
45
46 TEMPLATE(T, ctx_init)(ctx, p, ext, "a");
47
48 TEMPLATE(T, poly_init)(f, ctx);
49 fmpz_one(temp);
50 TEMPLATE(T, poly_set_coeff_fmpz)(f, len + 1, temp, ctx);
51 TEMPLATE(T, poly_set_coeff_fmpz)(f, 1, temp, ctx);
52 TEMPLATE(T, poly_set_coeff_fmpz)(f, 0, temp, ctx);
53
54 TEMPLATE(T, poly_factor_init)(res, ctx);
55 timeit_start(t);
56 TEMPLATE(T, poly_factor_kaltofen_shoup)(res, f, ctx);
57 timeit_stop(t);
58 TEMPLATE(T, poly_factor_clear)(res, ctx);
59
60 flint_printf("%wd\n", t->cpu);
61
62 TEMPLATE(T, poly_clear)(f, ctx);
63 TEMPLATE(T, ctx_clear)(ctx);
64
65 fmpz_clear(p);
66 fmpz_clear(temp);
67
68 FLINT_TEST_CLEANUP(state);
69
70 return 0;
71 }
72
73 #endif
74