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 "fmpz_mat.h"
13 #include "perm.h"
14 
15 int
fmpz_mat_solve(fmpz_mat_t X,fmpz_t den,const fmpz_mat_t A,const fmpz_mat_t B)16 fmpz_mat_solve(fmpz_mat_t X, fmpz_t den,
17                     const fmpz_mat_t A, const fmpz_mat_t B)
18 {
19     if (fmpz_mat_nrows(A) <= 3)
20         return fmpz_mat_solve_cramer(X, den, A, B);
21     else if (fmpz_mat_nrows(A) <= 15)
22         return fmpz_mat_solve_fflu(X, den, A, B);
23     else if (fmpz_mat_ncols(B) == 1)
24         return fmpz_mat_solve_dixon_den(X, den, A, B);
25     else
26         return fmpz_mat_solve_multi_mod_den(X, den, A, B);
27 }
28