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 "flint.h" 13 #include "nmod_poly.h" 14 #include "nmod_poly_mat.h" 15 16 int nmod_poly_mat_is_one(const nmod_poly_mat_t A)17nmod_poly_mat_is_one(const nmod_poly_mat_t A) 18 { 19 slong i, j; 20 21 if (A->r == 0 || A->c == 0) 22 return 1; 23 24 for (i = 0; i < A->r; i++) 25 { 26 for (j = 0; j < A->c; j++) 27 { 28 if (i == j) 29 { 30 if (!nmod_poly_is_one(nmod_poly_mat_entry(A, i, j))) 31 return 0; 32 } 33 else 34 { 35 if (!nmod_poly_is_zero(nmod_poly_mat_entry(A, i, j))) 36 return 0; 37 } 38 } 39 } 40 41 return 1; 42 } 43