1 /*
2     Copyright (C) 2014 Abhinav Baid
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 <https://www.gnu.org/licenses/>.
10 */
11 
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <gmp.h>
15 #include "flint.h"
16 #include "fmpz_mat.h"
17 #include "fmpq.h"
18 #include "fmpq_mat.h"
19 #include "fmpq_vec.h"
20 
21 int
main(void)22 main(void)
23 {
24     int i;
25     FLINT_TEST_INIT(state);
26 
27 
28     flint_printf("lll_original....");
29     fflush(stdout);
30 
31     /* check output basis is LLL reduced (randajtai used) */
32     for (i = 0; i < 100 * flint_test_multiplier(); i++)
33     {
34         int result;
35         fmpz_mat_t A;
36         fmpq_t delta, eta;
37 
38         slong m;
39 
40         m = n_randint(state, 10);
41 
42         fmpz_mat_init(A, m, m);
43         fmpq_init(delta);
44         fmpq_init(eta);
45 
46         fmpq_set_si(delta, 3, 4);
47         fmpq_set_si(eta, 1, 2);
48 
49         fmpz_mat_randajtai(A, state, 0.5);
50 
51         fmpz_mat_lll_original(A, delta, eta);
52 
53         result = fmpz_mat_is_reduced(A, 0.75, 0.5);
54 
55         if (!result)
56         {
57             flint_printf("FAIL:\n");
58             flint_printf("A:\n");
59             fmpz_mat_print_pretty(A);
60             abort();
61         }
62 
63         fmpz_mat_clear(A);
64         fmpq_clear(delta);
65         fmpq_clear(eta);
66     }
67 
68     FLINT_TEST_CLEANUP(state);
69 
70     flint_printf("PASS\n");
71     return EXIT_SUCCESS;
72 }
73