1 /* 2 Copyright (C) 2010 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 <stdlib.h> 13 #include "flint.h" 14 #include "fmpz.h" 15 #include "fmpz_poly.h" 16 #include "fmpz_poly_mat.h" 17 18 19 slong fmpz_poly_mat_rank(const fmpz_poly_mat_t A)20fmpz_poly_mat_rank(const fmpz_poly_mat_t A) 21 { 22 fmpz_poly_mat_t tmp; 23 fmpz_poly_t den; 24 slong rank; 25 26 if (fmpz_poly_mat_is_empty(A)) 27 return 0; 28 29 fmpz_poly_mat_init_set(tmp, A); 30 fmpz_poly_init(den); 31 rank = fmpz_poly_mat_fflu(tmp, den, NULL, tmp, 0); 32 fmpz_poly_mat_clear(tmp); 33 fmpz_poly_clear(den); 34 return rank; 35 } 36