Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002     Copyright (C) 2023 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 NMOD_TYPES_H
0013 #define NMOD_TYPES_H
0014 
0015 #include "flint.h"
0016 
0017 #ifdef __cplusplus
0018 extern "C" {
0019 #endif
0020 
0021 typedef struct
0022 {
0023     ulong * entries;
0024     slong r;
0025     slong c;
0026     slong stride;
0027     nmod_t mod;
0028 }
0029 nmod_mat_struct;
0030 
0031 typedef nmod_mat_struct nmod_mat_t[1];
0032 
0033 typedef struct
0034 {
0035     nn_ptr coeffs;
0036     slong alloc;
0037     slong length;
0038     nmod_t mod;
0039 }
0040 nmod_poly_struct;
0041 
0042 typedef nmod_poly_struct nmod_poly_t[1];
0043 
0044 typedef struct
0045 {
0046     nmod_poly_struct * p;
0047     slong *exp;
0048     slong num;
0049     slong alloc;
0050 }
0051 nmod_poly_factor_struct;
0052 
0053 typedef nmod_poly_factor_struct nmod_poly_factor_t[1];
0054 
0055 typedef struct
0056 {
0057     nmod_poly_struct * entries;
0058     slong r;
0059     slong c;
0060     slong stride;
0061     ulong modulus;
0062 }
0063 nmod_poly_mat_struct;
0064 
0065 typedef nmod_poly_mat_struct nmod_poly_mat_t[1];
0066 
0067 typedef struct
0068 {
0069     ulong * coeffs;
0070     ulong * exps;
0071     slong length;
0072     flint_bitcnt_t bits;    /* number of bits per exponent */
0073     slong coeffs_alloc;     /* abs size in ulong units */
0074     slong exps_alloc;       /* abs size in ulong units */
0075 } nmod_mpoly_struct;
0076 
0077 typedef nmod_mpoly_struct nmod_mpoly_t[1];
0078 
0079 typedef struct
0080 {
0081     ulong constant;
0082     nmod_mpoly_struct * poly;
0083     fmpz * exp;
0084     slong num;
0085     slong alloc;
0086 }
0087 nmod_mpoly_factor_struct;
0088 
0089 typedef nmod_mpoly_factor_struct nmod_mpoly_factor_t[1];
0090 
0091 typedef enum
0092 {
0093     _DOT0 = 0,           /* len == 0 || mod.n == 1 */
0094     _DOT1 = 1,           /* 1 limb */
0095 #if (FLINT_BITS == 64)
0096     _DOT2_SPLIT = 2,     /* 2 limbs, modulus < ~2**30.5 (FLINT_BITS == 64 only) */
0097 #endif  // FLINT_BITS == 64
0098     _DOT2_HALF = 3,      /* 2 limbs, modulus < 2**(FLINT_BITS/2) */
0099     _DOT2 = 4,           /* 2 limbs */
0100     _DOT3_ACC = 5,       /* 3 limbs, modulus allowing some accumulation in 2 limbs */
0101     _DOT3 = 6,           /* 3 limbs */
0102     _DOT_POW2 = 7,       /* mod.n is a power of 2 */
0103 } dot_method_t;
0104 // if mod.n is a power of 2, we use _DOT_POW2 in all cases
0105 // otherwise, number of limbs of unreduced dot product can be deduced:
0106 // 1 limb  <=>  method <= _DOT1
0107 // 2 limbs <=>  _DOT1 < method <= _DOT2
0108 // 3 limbs <=>  _DOT2 < method
0109 
0110 typedef struct
0111 {
0112     dot_method_t method;
0113     ulong pow2_precomp;  /* for splitting: (1L << 56) % mod.n */
0114 } dot_params_t;
0115 
0116 #ifdef __cplusplus
0117 }
0118 #endif
0119 
0120 #endif /* NMOD_TYPES_H */