1 /*
2     Copyright (C) 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 <http://www.gnu.org/licenses/>.
10 */
11 
12 #include "fmpz_mpoly.h"
13 
fmpz_mpoly_get_coeff_si_ui(const fmpz_mpoly_t A,const ulong * exp,const fmpz_mpoly_ctx_t ctx)14 slong fmpz_mpoly_get_coeff_si_ui(const fmpz_mpoly_t A,
15                                  const ulong * exp, const fmpz_mpoly_ctx_t ctx)
16 {
17     slong index;
18     index = mpoly_monomial_index_ui(A->exps, A->bits, A->length,
19                                                               exp, ctx->minfo);
20     if (index < 0)
21     {
22         return 0;
23     }
24     else
25     {
26         FLINT_ASSERT(index < A->length);
27         return fmpz_get_si(A->coeffs + index);
28     }
29 }
30