File indexing completed on 2026-11-07 10:15:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef FQ_NMOD_H
0016 #define FQ_NMOD_H
0017
0018 #ifdef FQ_NMOD_INLINES_C
0019 #define FQ_NMOD_INLINE
0020 #define FQ_TEMPLATES_INLINE
0021 #else
0022 #define FQ_NMOD_INLINE static inline
0023 #define FQ_TEMPLATES_INLINE static inline
0024 #endif
0025
0026 #include "fq_nmod_types.h"
0027
0028 #ifdef __cplusplus
0029 extern "C" {
0030 #endif
0031
0032
0033
0034 void fq_nmod_ctx_init_ui(fq_nmod_ctx_t ctx, ulong prime, slong deg, const char * var);
0035 int _fq_nmod_ctx_init_conway_ui(fq_nmod_ctx_t ctx, ulong prime, slong deg, const char * var);
0036 void fq_nmod_ctx_init_conway_ui(fq_nmod_ctx_t ctx, ulong prime, slong deg, const char * var);
0037 void fq_nmod_ctx_init_minimal_weight_ui(fq_nmod_ctx_t ctx, ulong prime, slong deg, const char * var);
0038 void fq_nmod_ctx_init_modulus(fq_nmod_ctx_t ctx, const nmod_poly_t modulus, const char * var);
0039
0040 void fq_nmod_ctx_init_randtest(fq_nmod_ctx_t ctx, flint_rand_t state, int type);
0041 void fq_nmod_ctx_init_randtest_reducible(fq_nmod_ctx_t ctx, flint_rand_t state, int type);
0042
0043 void fq_nmod_ctx_clear(fq_nmod_ctx_t ctx);
0044
0045 FQ_NMOD_INLINE
0046 const nmod_poly_struct * fq_nmod_ctx_modulus(const fq_nmod_ctx_t ctx)
0047 {
0048 return ctx->modulus;
0049 }
0050
0051 FQ_NMOD_INLINE
0052 slong fq_nmod_ctx_degree(const fq_nmod_ctx_t ctx)
0053 {
0054 return ctx->modulus->length - 1;
0055 }
0056
0057 FQ_NMOD_INLINE
0058 ulong fq_nmod_ctx_prime(const fq_nmod_ctx_t ctx)
0059 {
0060 return ctx->mod.n;
0061 }
0062
0063 void fq_nmod_ctx_order(fmpz_t f, const fq_nmod_ctx_t ctx);
0064
0065 #ifdef FLINT_HAVE_FILE
0066 int fq_nmod_ctx_fprint(FILE * file, const fq_nmod_ctx_t ctx);
0067 #endif
0068
0069 void fq_nmod_ctx_print(const fq_nmod_ctx_t ctx);
0070
0071
0072
0073 void fq_nmod_init(fq_nmod_t rop, const fq_nmod_ctx_t ctx);
0074 void fq_nmod_init2(fq_nmod_t rop, const fq_nmod_ctx_t ctx);
0075
0076 void fq_nmod_clear(fq_nmod_t rop, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0077
0078 void _fq_nmod_sparse_reduce(ulong *R, slong lenR, const fq_nmod_ctx_t ctx);
0079 void _fq_nmod_dense_reduce(ulong* R, slong lenR, const fq_nmod_ctx_t ctx);
0080 void _fq_nmod_reduce(ulong* R, slong lenR, const fq_nmod_ctx_t ctx);
0081 void fq_nmod_reduce(fq_nmod_t rop, const fq_nmod_ctx_t ctx);
0082
0083
0084
0085 void fq_nmod_add(fq_nmod_t rop, const fq_nmod_t op1,
0086 const fq_nmod_t op2, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0087
0088 void fq_nmod_sub(fq_nmod_t rop, const fq_nmod_t op1,
0089 const fq_nmod_t op2, const fq_nmod_ctx_t ctx);
0090
0091 void fq_nmod_sub_one(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t ctx);
0092
0093 void fq_nmod_neg(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0094
0095 void fq_nmod_mul(fq_nmod_t rop,
0096 const fq_nmod_t op1, const fq_nmod_t op2, const fq_nmod_ctx_t ctx);
0097
0098 void fq_nmod_mul_fmpz(fq_nmod_t rop,
0099 const fq_nmod_t op, const fmpz_t x, const fq_nmod_ctx_t ctx);
0100
0101 void fq_nmod_mul_si(fq_nmod_t rop,
0102 const fq_nmod_t op, slong x, const fq_nmod_ctx_t ctx);
0103
0104 void fq_nmod_mul_ui(fq_nmod_t rop,
0105 const fq_nmod_t op, ulong x, const fq_nmod_ctx_t ctx);
0106
0107 void fq_nmod_sqr(fq_nmod_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0108
0109 void fq_nmod_inv(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t ctx);
0110
0111 void _fq_nmod_pow(ulong *rop, const ulong *op,
0112 slong len, const fmpz_t e, const fq_nmod_ctx_t ctx);
0113
0114 void fq_nmod_pow(fq_nmod_t rop, const fq_nmod_t op1,
0115 const fmpz_t e, const fq_nmod_ctx_t ctx);
0116
0117 void fq_nmod_pow_ui(fq_nmod_t rop,
0118 const fq_nmod_t op1, const ulong e, const fq_nmod_ctx_t ctx);
0119
0120
0121
0122 int fq_nmod_sqrt(fq_nmod_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0123
0124 void fq_nmod_pth_root(fq_nmod_t rop, const fq_nmod_t op1, const fq_nmod_ctx_t ctx);
0125
0126 int fq_nmod_is_square(const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0127
0128
0129
0130 void fq_nmod_randtest(fq_nmod_t rop, flint_rand_t state, const fq_nmod_ctx_t ctx);
0131
0132 void fq_nmod_randtest_dense(fq_nmod_t rop, flint_rand_t state, const fq_nmod_ctx_t ctx);
0133
0134 void fq_nmod_randtest_not_zero(fq_nmod_t rop, flint_rand_t state, const fq_nmod_ctx_t ctx);
0135
0136 void fq_nmod_rand(fq_nmod_t rop, flint_rand_t state, const fq_nmod_ctx_t ctx);
0137
0138 void fq_nmod_rand_not_zero(fq_nmod_t rop, flint_rand_t state, const fq_nmod_ctx_t ctx);
0139
0140
0141
0142
0143 int fq_nmod_equal(const fq_nmod_t op1, const fq_nmod_t op2, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0144 int fq_nmod_is_zero(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0145 int fq_nmod_is_one(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0146 int fq_nmod_cmp(const fq_nmod_t a, const fq_nmod_t b, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0147
0148
0149
0150 void fq_nmod_set(fq_nmod_t rop, const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0151 void fq_nmod_set_si(fq_nmod_t rop, const slong x, const fq_nmod_ctx_t ctx);
0152 void fq_nmod_set_ui(fq_nmod_t rop, const ulong x, const fq_nmod_ctx_t ctx);
0153 void fq_nmod_set_fmpz(fq_nmod_t rop, const fmpz_t x, const fq_nmod_ctx_t ctx);
0154 void fq_nmod_set_nmod_poly(fq_nmod_t a, const nmod_poly_t b, const fq_nmod_ctx_t ctx);
0155
0156 int fq_nmod_get_fmpz(fmpz_t a, const fq_nmod_t b, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0157 void fq_nmod_get_nmod_poly(nmod_poly_t a, const fq_nmod_t b, const fq_nmod_ctx_t ctx);
0158
0159 void fq_nmod_swap(fq_nmod_t op1, fq_nmod_t op2, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0160
0161 void fq_nmod_zero(fq_nmod_t rop, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0162 void fq_nmod_one(fq_nmod_t rop, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0163
0164 void fq_nmod_gen(fq_nmod_t rop, const fq_nmod_ctx_t ctx);
0165
0166
0167
0168 #ifdef FLINT_HAVE_FILE
0169 int fq_nmod_fprint(FILE * file, const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0170 int fq_nmod_fprint_pretty(FILE * file, const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0171 #endif
0172
0173 void fq_nmod_print(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0174 void fq_nmod_print_pretty(const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0175
0176 char * fq_nmod_get_str(const fq_nmod_t op, const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0177 char * fq_nmod_get_str_pretty(const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0178
0179
0180
0181 void _fq_nmod_trace(fmpz_t rop, const ulong *op, slong len,
0182 const fq_nmod_ctx_t ctx);
0183
0184 void fq_nmod_trace(fmpz_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0185
0186 void _fq_nmod_frobenius(ulong *rop, const ulong *op, slong len, slong e,
0187 const fq_nmod_ctx_t ctx);
0188
0189 void fq_nmod_frobenius(fq_nmod_t rop, const fq_nmod_t op, slong e, const fq_nmod_ctx_t ctx);
0190
0191 void _fq_nmod_norm(fmpz_t rop, const ulong *op, slong len,
0192 const fq_nmod_ctx_t ctx);
0193
0194 void fq_nmod_norm(fmpz_t rop, const fq_nmod_t op, const fq_nmod_ctx_t ctx);
0195
0196
0197
0198 void fq_nmod_bit_pack(fmpz_t f, const fq_nmod_t op, flint_bitcnt_t bit_size,
0199 const fq_nmod_ctx_t FLINT_UNUSED(ctx));
0200
0201 void fq_nmod_bit_unpack(fq_nmod_t rop, const fmpz_t f, flint_bitcnt_t bit_size,
0202 const fq_nmod_ctx_t ctx);
0203
0204
0205
0206 void fq_nmod_ctx_init(fq_nmod_ctx_t ctx, fmpz_t p, slong d, const char * var);
0207 int _fq_nmod_ctx_init_conway(fq_nmod_ctx_t ctx, fmpz_t p, slong d, const char * var);
0208 void fq_nmod_ctx_init_conway(fq_nmod_ctx_t ctx, fmpz_t p, slong d, const char * var);
0209
0210 #ifdef T
0211 #undef T
0212 #endif
0213
0214 #define T fq_nmod
0215 #define CAP_T FQ_NMOD
0216 #define B nmod
0217 #include "fq_templates.h"
0218 #undef B
0219 #undef CAP_T
0220 #undef T
0221
0222 #ifdef __cplusplus
0223 }
0224 #endif
0225
0226 #endif