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 <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.h"
17 #include "fmpz_mat.h"
18 #include "ulong_extras.h"
19 
20 int
main(void)21 main(void)
22 {
23     slong m, n, i, j, rep;
24     FLINT_TEST_INIT(state);
25 
26     flint_printf("one....");
27     fflush(stdout);
28 
29 
30 
31     for (rep = 0; rep < 100 * flint_test_multiplier(); rep++)
32     {
33         fmpz_mat_t A;
34 
35         m = n_randint(state, 20);
36         n = n_randint(state, 20);
37 
38         fmpz_mat_init(A, m, n);
39 
40         fmpz_mat_randtest(A, state, 100);
41         fmpz_mat_one(A);
42 
43         for (i = 0; i < m; i++)
44         {
45             for (j = 0; j < n; j++)
46             {
47                 if (fmpz_cmp_ui(fmpz_mat_entry(A,i,j), i == j) != 0)
48                 {
49                     flint_printf("FAIL: nonzero entry\n");
50                     abort();
51                 }
52             }
53         }
54 
55         fmpz_mat_clear(A);
56     }
57 
58     FLINT_TEST_CLEANUP(state);
59 
60     flint_printf("PASS\n");
61     return 0;
62 }
63