1 /*
2     Copyright (C) 2017, 2018 Daniel Schultz
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 "nmod_mpoly.h"
13 
nmod_mpoly_make_monic(nmod_mpoly_t A,const nmod_mpoly_t B,const nmod_mpoly_ctx_t ctx)14 void nmod_mpoly_make_monic(nmod_mpoly_t A, const nmod_mpoly_t B,
15                                                     const nmod_mpoly_ctx_t ctx)
16 {
17     if (B->length == 0)
18     {
19         flint_throw(FLINT_ERROR, "nmod_mpoly_make_monic: polynomial is zero.");
20     }
21 
22     nmod_mpoly_scalar_mul_nmod_invertible(A, B,
23                                         nmod_inv(B->coeffs[0], ctx->mod), ctx);
24 }
25