1 /*
2     Copyright (C) 2017 Luca De Feo
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 #ifndef FQ_ZECH_EMBED_H
13 #define FQ_ZECH_EMBED_H
14 
15 #ifdef FQ_ZECH_EMBED_INLINES_C
16 #define FQ_ZECH_EMBED_INLINE FLINT_DLL
17 #define FQ_EMBED_TEMPLATES_INLINE FLINT_DLL
18 #else
19 #define FQ_ZECH_EMBED_INLINE static __inline__
20 #define FQ_EMBED_TEMPLATES_INLINE static __inline__
21 #endif
22 
23 #include "fq_zech.h"
24 #include "fq_nmod_embed.h"
25 
26 #define T fq_zech
27 #define B nmod
28 #include "fq_embed_templates.h"
29 #undef B
30 #undef T
31 
fq_zech_modulus_derivative_inv(fq_zech_t m_prime,fq_zech_t m_prime_inv,const fq_zech_ctx_t ctx)32 FQ_ZECH_EMBED_INLINE void fq_zech_modulus_derivative_inv(fq_zech_t m_prime,
33                                                          fq_zech_t m_prime_inv,
34                                                          const fq_zech_ctx_t ctx)
35 {
36     fq_nmod_t m_nmod, m_inv_nmod;
37     fq_nmod_init(m_nmod, ctx->fq_nmod_ctx);
38     fq_nmod_init(m_inv_nmod, ctx->fq_nmod_ctx);
39 
40     fq_nmod_modulus_derivative_inv(m_nmod, m_inv_nmod, ctx->fq_nmod_ctx);
41 
42     fq_zech_set_fq_nmod(m_prime, m_nmod, ctx);
43     fq_zech_set_fq_nmod(m_prime_inv, m_inv_nmod, ctx);
44 
45     fq_nmod_clear(m_nmod, ctx->fq_nmod_ctx);
46     fq_nmod_clear(m_inv_nmod, ctx->fq_nmod_ctx);
47 }
48 
49 #endif
50