1 /*
2     Copyright (C) 2011 Fredrik Johansson
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 #include <stdio.h>
13 #include <stdlib.h>
14 #include "flint.h"
15 #include "fmpz.h"
16 #include "fmpz_mat.h"
17 #include "fmpz_poly.h"
18 #include "fmpz_poly_mat.h"
19 
20 int
main(void)21 main(void)
22 {
23     int iter;
24 
25     FLINT_TEST_INIT(state);
26 
27     flint_printf("zero/is_zero....");
28     fflush(stdout);
29 
30     for (iter = 0; iter < 100 * flint_test_multiplier(); iter++)
31     {
32         fmpz_poly_mat_t A;
33         slong m, n;
34 
35         m = n_randint(state, 10);
36         n = n_randint(state, 10);
37 
38         fmpz_poly_mat_init(A, m, n);
39         fmpz_poly_mat_randtest(A, state, n_randint(state, 5),
40             n_randint(state, 100));
41         fmpz_poly_mat_zero(A);
42 
43         if (!fmpz_poly_mat_is_zero(A))
44         {
45             flint_printf("FAIL: expected matrix to be zero\n");
46             abort();
47         }
48 
49         if (m > 0 && n > 0)
50         {
51             m = n_randint(state, m);
52             n = n_randint(state, n);
53             fmpz_poly_randtest_not_zero(fmpz_poly_mat_entry(A, m, n),
54                 state, 5, 5);
55 
56             if (fmpz_poly_mat_is_zero(A))
57             {
58                 flint_printf("FAIL: expected matrix not to be zero\n");
59                 abort();
60             }
61         }
62 
63         fmpz_poly_mat_clear(A);
64     }
65 
66     FLINT_TEST_CLEANUP(state);
67 
68     flint_printf("PASS\n");
69     return 0;
70 }
71