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 "nmod_mat.h"
19 #include "ulong_extras.h"
20 #include "long_extras.h"
21 
22 int
main(void)23 main(void)
24 {
25     int i;
26     FLINT_TEST_INIT(state);
27 
28 
29     flint_printf("scalar_add/submul_ui....");
30     fflush(stdout);
31 
32     for (i = 0; i < 100 * flint_test_multiplier(); i++)
33     {
34         fmpz_mat_t A, B, C;
35         slong rows, cols;
36         ulong c;
37 
38         rows = n_randint(state, 10);
39         cols = n_randint(state, 10);
40 
41         fmpz_mat_init(A, rows, cols);
42         fmpz_mat_init(B, rows, cols);
43         fmpz_mat_init(C, rows, cols);
44 
45         c = n_randtest(state);
46 
47         fmpz_mat_randtest(A, state, 100);
48         fmpz_mat_randtest(B, state, 100);
49         fmpz_mat_set(C, B);
50 
51         fmpz_mat_scalar_addmul_ui(B, A, c);
52         fmpz_mat_scalar_submul_ui(B, A, c);
53 
54         if (!fmpz_mat_equal(B, C))
55         {
56             flint_printf("FAIL!\n");
57             abort();
58         }
59 
60         fmpz_mat_clear(A);
61         fmpz_mat_clear(B);
62         fmpz_mat_clear(C);
63     }
64 
65 
66 
67     FLINT_TEST_CLEANUP(state);
68     flint_printf("PASS\n");
69     return 0;
70 }
71