Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:29

0001 /*
0002     Copyright (C) 2023, 2024 Albin Ahlbäck
0003 
0004     This file is part of FLINT.
0005 
0006     FLINT is free software: you can redistribute it and/or modify it under
0007     the terms of the GNU Lesser General Public License (LGPL) as published
0008     by the Free Software Foundation; either version 3 of the License, or
0009     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0010 */
0011 
0012 #ifndef MPOLY_TYPES_H
0013 #define MPOLY_TYPES_H
0014 
0015 #include "fmpz_mod_types.h"
0016 #include "fq_nmod_types.h"
0017 #include "n_poly_types.h"
0018 
0019 #ifdef __cplusplus
0020 extern "C" {
0021 #endif
0022 
0023 #define MPOLY_MIN_BITS (UWORD(8))    /* minimum number of bits to pack into */
0024 
0025 typedef enum {
0026     ORD_LEX,
0027     ORD_DEGLEX,
0028     ORD_DEGREVLEX
0029 } ordering_t;
0030 
0031 #define MPOLY_NUM_ORDERINGS 3
0032 
0033 typedef struct
0034 {
0035     slong nvars;    /* number of variables */
0036     slong nfields;  /* number of fields in exponent vector */
0037     ordering_t ord; /* monomial ordering */
0038     int deg;        /* is ord a degree ordering? */
0039     int rev;        /* is ord a reversed ordering? */
0040     slong lut_words_per_exp[FLINT_BITS];
0041     unsigned char lut_fix_bits[FLINT_BITS]; /* FLINT_BITS < 256 */
0042 } mpoly_ctx_struct;
0043 
0044 typedef mpoly_ctx_struct mpoly_ctx_t[1];
0045 
0046 typedef struct
0047 {
0048     mpoly_ctx_t minfo;
0049     nmod_t mod;
0050 }
0051 nmod_mpoly_ctx_struct;
0052 
0053 typedef nmod_mpoly_ctx_struct nmod_mpoly_ctx_t[1];
0054 
0055 typedef struct
0056 {
0057     mpoly_ctx_t minfo;
0058 }
0059 fmpz_mpoly_ctx_struct;
0060 
0061 typedef fmpz_mpoly_ctx_struct fmpz_mpoly_ctx_t[1];
0062 
0063 typedef struct
0064 {
0065     fmpz_mpoly_ctx_t zctx;
0066 }
0067 fmpq_mpoly_ctx_struct;
0068 
0069 typedef fmpq_mpoly_ctx_struct fmpq_mpoly_ctx_t[1];
0070 
0071 typedef struct
0072 {
0073     mpoly_ctx_t minfo;
0074     fmpz_mod_ctx_t ffinfo;
0075 }
0076 fmpz_mod_mpoly_ctx_struct;
0077 
0078 typedef fmpz_mod_mpoly_ctx_struct fmpz_mod_mpoly_ctx_t[1];
0079 
0080 typedef struct
0081 {
0082     mpoly_ctx_t minfo;
0083     fq_nmod_ctx_t fqctx;
0084 } fq_nmod_mpoly_ctx_struct;
0085 
0086 typedef fq_nmod_mpoly_ctx_struct fq_nmod_mpoly_ctx_t[1];
0087 
0088 
0089 typedef struct {
0090     slong elem_size;
0091     const void * ctx;
0092     void (*init)(void *, const void *);
0093     void (*clear)(void *, const void *);
0094     int (*is_zero)(const void *, const void *);
0095     void (*zero)(void *, const void *);
0096     void (*one)(void *, const void *);
0097     void (*set_fmpz)(void *, const fmpz_t, const void *);
0098     void (*set)(void *, const void *, const void *);
0099     void (*swap)(void *, void *, const void *);
0100     void (*neg)(void *, const void *, const void *);
0101     void (*add)(void *, const void *, const void *, const void *);
0102     void (*sub)(void *, const void *, const void *, const void *);
0103     void (*mul_fmpz)(void *, const void *, const fmpz_t, const void *);
0104     void (*mul)(void *, const void *, const void *, const void *);
0105     void (*divexact)(void *, const void *, const void *, const void *);
0106     int (*divides)(void *, const void *, const void *, const void *);
0107     int (*pow_fmpz)(void *, const void *, const fmpz_t, const void *);
0108     slong (*length)(const void *, const void *);
0109 } mpoly_void_ring_t[1];
0110 
0111 typedef struct
0112 {
0113     ulong * Amax_exp;
0114     ulong * Amin_exp;
0115     ulong * Astride;
0116     slong * Adeflate_deg;
0117     slong * Alead_count;
0118     slong * Atail_count;
0119 
0120     ulong * Bmax_exp;
0121     ulong * Bmin_exp;
0122     ulong * Bstride;
0123     slong * Bdeflate_deg;
0124     slong * Blead_count;
0125     slong * Btail_count;
0126 
0127     ulong * Gmin_exp;
0128     ulong * Abarmin_exp;
0129     ulong * Bbarmin_exp;
0130     ulong * Gstride;
0131     slong * Gterm_count_est;
0132     slong * Gdeflate_deg_bound;
0133 
0134     flint_bitcnt_t Gbits, Abarbits, Bbarbits;
0135 
0136     slong mvars;
0137     slong Adeflate_tdeg;
0138     slong Bdeflate_tdeg;
0139 
0140     double Adensity;
0141     double Bdensity;
0142 
0143     double hensel_time, brown_time, zippel_time, zippel2_time;
0144     slong * hensel_perm, * brown_perm, * zippel_perm, * zippel2_perm;
0145     unsigned int can_use;
0146     int Gdeflate_deg_bounds_are_nice; /* all of Gdeflate_deg_bound came from real gcd computations */
0147 
0148     char * data;
0149 } mpoly_gcd_info_struct;
0150 
0151 typedef mpoly_gcd_info_struct mpoly_gcd_info_t[1];
0152 
0153 typedef struct {
0154     slong mvars;
0155     slong nvars;
0156     slong * exps;
0157     slong exps_alloc;
0158     slong * rest;
0159     slong rest_alloc;
0160     slong * umat;
0161     slong * deltas;
0162     slong * degs;
0163     int is_trivial;
0164     int is_perm;
0165     int is_irred;
0166 } mpoly_compression_struct;
0167 
0168 typedef mpoly_compression_struct mpoly_compression_t[1];
0169 
0170 /*
0171     nmod_mpolyn_t
0172     multivariates with n_poly_t coefficients
0173 */
0174 typedef struct
0175 {
0176    n_poly_struct * coeffs;
0177    ulong * exps;
0178    slong alloc;
0179    slong length;
0180    slong bits;
0181 } nmod_mpolyn_struct;
0182 typedef nmod_mpolyn_struct nmod_mpolyn_t[1];
0183 
0184 /*
0185     nmod_mpolyun_t
0186     sparse univariates with nmod_mpolyn_t coefficients
0187         with uniform bits and LEX ordering
0188 */
0189 typedef struct
0190 {
0191     nmod_mpolyn_struct * coeffs;
0192     ulong * exps;
0193     slong alloc;
0194     slong length;
0195     flint_bitcnt_t bits;   /* default bits to construct coeffs */
0196 } nmod_mpolyun_struct;
0197 typedef nmod_mpolyun_struct nmod_mpolyun_t[1];
0198 
0199 typedef enum {
0200     nmod_gcds_success,
0201     nmod_gcds_form_main_degree_too_high,
0202     nmod_gcds_form_wrong,
0203     nmod_gcds_no_solution,
0204     nmod_gcds_scales_not_found,
0205     nmod_gcds_eval_point_not_found,
0206     nmod_gcds_eval_gcd_deg_too_high
0207 } nmod_gcds_ret_t;
0208 
0209 #ifdef __cplusplus
0210 }
0211 #endif
0212 
0213 #endif /* MPOLY_TYPES_H */