[ad3c3ff] | 1 | /*****************************************************************************\ |
---|
[806c18] | 2 | * Computer Algebra System SINGULAR |
---|
[ad3c3ff] | 3 | \*****************************************************************************/ |
---|
| 4 | /** @file facHensel.h |
---|
| 5 | * |
---|
[0e2e23] | 6 | * This file defines functions for Hensel lifting. |
---|
[806c18] | 7 | * |
---|
| 8 | * ABSTRACT: function are used for bi- and multivariate factorization over |
---|
[ad3c3ff] | 9 | * finite fields |
---|
| 10 | * |
---|
| 11 | * @author Martin Lee |
---|
| 12 | * |
---|
| 13 | * @internal @version \$Id$ |
---|
| 14 | * |
---|
| 15 | **/ |
---|
| 16 | /*****************************************************************************/ |
---|
| 17 | |
---|
| 18 | #ifndef FAC_HENSEL_H |
---|
| 19 | #define FAC_HENSEL_H |
---|
| 20 | |
---|
[e4fe2b] | 21 | // #include "config.h" |
---|
[650f2d8] | 22 | #include "cf_assert.h" |
---|
[ad3c3ff] | 23 | #include "debug.h" |
---|
| 24 | #include "timing.h" |
---|
| 25 | |
---|
| 26 | #include "canonicalform.h" |
---|
[d9357b] | 27 | #include "fac_util.h" |
---|
[ad3c3ff] | 28 | |
---|
[615ca8] | 29 | #ifdef HAVE_NTL |
---|
[ad3c3ff] | 30 | /// sort a list of polynomials by their degree in @a x. |
---|
| 31 | /// |
---|
[806c18] | 32 | void sortList (CFList& list, ///< [in, out] list of polys, sorted list |
---|
| 33 | const Variable& x ///< [in] some Variable |
---|
[ad3c3ff] | 34 | ); |
---|
| 35 | |
---|
| 36 | /// Hensel lift from univariate to bivariate. |
---|
[806c18] | 37 | /// |
---|
[ad3c3ff] | 38 | /// @sa henselLiftResume12(), henselLift23(), henselLiftResume(), henselLift() |
---|
[806c18] | 39 | void |
---|
[ad3c3ff] | 40 | henselLift12 (const CanonicalForm& F, ///< [in] compressed, bivariate poly |
---|
[806c18] | 41 | CFList& factors, ///< [in, out] monic univariate factors of |
---|
[ad3c3ff] | 42 | ///< F, including leading coefficient as |
---|
[806c18] | 43 | ///< first element. Returns monic lifted |
---|
| 44 | ///< factors without the leading |
---|
[ad3c3ff] | 45 | ///< coefficient |
---|
| 46 | int l, ///< [in] lifting precision |
---|
| 47 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
| 48 | CFList& diophant, ///< [in,out] result of diophantine() |
---|
[e368746] | 49 | CFMatrix& M, ///< [in,out] stores intermediate results |
---|
[d9357b] | 50 | bool sort= true, ///< [in] sort factors by degree in |
---|
[e368746] | 51 | ///< Variable(1) |
---|
[d9357b] | 52 | const modpk& b= modpk ()///< [in] coeff bound |
---|
[ad3c3ff] | 53 | ); |
---|
| 54 | |
---|
[806c18] | 55 | /// resume Hensel lift from univariate to bivariate. Assumes factors are lifted |
---|
[ad3c3ff] | 56 | /// to precision Variable (2)^start and lifts them to precision Variable (2)^end |
---|
[806c18] | 57 | /// |
---|
[ad3c3ff] | 58 | /// @sa henselLift12(), henselLift23(), henselLiftResume(), henselLift() |
---|
[806c18] | 59 | void |
---|
[ad3c3ff] | 60 | henselLiftResume12 (const CanonicalForm& F, ///< [in] compressed, bivariate poly |
---|
[806c18] | 61 | CFList& factors, ///< [in,out] monic factors of F, |
---|
| 62 | ///< lifted to precision start, |
---|
| 63 | ///< including leading coefficient |
---|
| 64 | ///< as first element. Returns monic |
---|
| 65 | ///< lifted factors without the |
---|
[ad3c3ff] | 66 | ///< leading coefficient |
---|
| 67 | int start, ///< [in] starting precision |
---|
| 68 | int end, ///< [in] end precision |
---|
| 69 | CFArray& Pi, ///< [in,out] stores intermediate |
---|
| 70 | ///< results |
---|
| 71 | const CFList& diophant, ///< [in] result of diophantine |
---|
[d9357b] | 72 | CFMatrix& M, ///< [in,out] stores intermediate |
---|
[ad3c3ff] | 73 | ///< results |
---|
[d9357b] | 74 | const modpk& b= modpk() ///< [in] coeff bound |
---|
[ad3c3ff] | 75 | ); |
---|
| 76 | |
---|
| 77 | /// Hensel lifting from bivariate to trivariate. |
---|
| 78 | /// |
---|
| 79 | /// @return @a henselLift23 returns a list of polynomials lifted to precision |
---|
| 80 | /// Variable (3)^l[1] |
---|
| 81 | /// @sa henselLift12(), henselLiftResume12(), henselLiftResume(), henselLift() |
---|
[806c18] | 82 | CFList |
---|
[ad3c3ff] | 83 | henselLift23 (const CFList& eval, ///< [in] contains compressed, bivariate |
---|
| 84 | ///< as first element and trivariate one as |
---|
[806c18] | 85 | ///< second element |
---|
| 86 | const CFList& factors, ///< [in] monic bivariate factors, |
---|
| 87 | ///< including leading coefficient |
---|
[ad3c3ff] | 88 | ///< as first element. |
---|
[81d96c] | 89 | int* l, ///< [in] l[0]: precision of bivariate |
---|
[ad3c3ff] | 90 | ///< lifting, l[1] as above |
---|
| 91 | CFList& diophant, ///< [in,out] returns the result of |
---|
| 92 | ///< biDiophantine() |
---|
| 93 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
| 94 | CFMatrix& M ///< [in,out] stores intermediate results |
---|
| 95 | ); |
---|
| 96 | |
---|
| 97 | /// resume Hensel lifting. |
---|
| 98 | /// |
---|
| 99 | /// @sa henselLift12(), henselLiftResume12(), henselLift23(), henselLift() |
---|
[806c18] | 100 | void |
---|
[ad3c3ff] | 101 | henselLiftResume ( |
---|
[806c18] | 102 | const CanonicalForm& F, ///< [in] compressed, multivariate poly |
---|
[ad3c3ff] | 103 | CFList& factors, ///< [in,out] monic multivariate factors |
---|
[806c18] | 104 | ///< lifted to precision F.mvar()^start, |
---|
| 105 | ///< including leading coefficient |
---|
[ad3c3ff] | 106 | ///< as first element. Returns factors |
---|
| 107 | ///< lifted to precision F.mvar()^end |
---|
[806c18] | 108 | int start, ///< [in] starting precision |
---|
[ad3c3ff] | 109 | int end, ///< [in] end precision |
---|
| 110 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
| 111 | const CFList& diophant, ///< [in] result of multiRecDiophantine() |
---|
| 112 | CFMatrix& M, ///< [in, out] stores intermediate results |
---|
| 113 | const CFList& MOD ///< [in] a list of powers of Variables |
---|
| 114 | ///< of level higher than 1 |
---|
| 115 | ); |
---|
| 116 | |
---|
| 117 | /// Hensel lifting |
---|
| 118 | /// |
---|
[806c18] | 119 | /// @return @a henselLift returns a list of polynomials lifted to |
---|
[ad3c3ff] | 120 | /// precision F.getLast().mvar()^l_new |
---|
| 121 | /// @sa henselLift12(), henselLiftResume12(), henselLift23(), henselLiftResume() |
---|
| 122 | CFList |
---|
| 123 | henselLift (const CFList& F, ///< [in] two compressed, multivariate |
---|
| 124 | ///< polys F and G |
---|
[806c18] | 125 | const CFList& factors, ///< [in] monic multivariate factors |
---|
| 126 | ///< including leading coefficient |
---|
| 127 | ///< as first element. |
---|
[ad3c3ff] | 128 | const CFList& MOD, ///< [in] a list of powers of Variables |
---|
| 129 | ///< of level higher than 1 |
---|
| 130 | CFList& diophant, ///< [in,out] result of multiRecDiophantine() |
---|
| 131 | CFArray& Pi, ///< [in,out] stores intermediate results |
---|
| 132 | CFMatrix& M, ///< [in,out] stores intermediate results |
---|
[81d96c] | 133 | int lOld, ///< [in] lifting precision of F.mvar() |
---|
| 134 | int lNew ///< [in] lifting precision of G.mvar() |
---|
[ad3c3ff] | 135 | ); |
---|
| 136 | |
---|
[806c18] | 137 | /// Hensel lifting from bivariate to multivariate |
---|
[ad3c3ff] | 138 | /// |
---|
[806c18] | 139 | /// @return @a henselLift returns a list of lifted factors |
---|
| 140 | /// @sa henselLift12(), henselLiftResume12(), henselLift23(), henselLiftResume() |
---|
[ad3c3ff] | 141 | CFList |
---|
[806c18] | 142 | henselLift (const CFList& eval, ///< [in] a list of polynomials the last |
---|
| 143 | ///< element is a compressed multivariate |
---|
| 144 | ///< poly, last but one element equals the |
---|
[ad3c3ff] | 145 | ///< last elements modulo its main variable |
---|
[806c18] | 146 | ///< and so on. The first element is a |
---|
[ad3c3ff] | 147 | ///< compressed bivariate poly. |
---|
[806c18] | 148 | const CFList& factors, ///< [in] bivariate factors, including |
---|
[ad3c3ff] | 149 | ///< leading coefficient |
---|
[81d96c] | 150 | int* l, ///< [in] lifting bounds |
---|
| 151 | int lLength, ///< [in] length of l |
---|
[e368746] | 152 | bool sort= true ///< [in] sort factors by degree in |
---|
| 153 | ///< Variable(1) |
---|
[ad3c3ff] | 154 | ); |
---|
| 155 | |
---|
[81d96c] | 156 | /// Hensel lifting from univariate to bivariate, factors need not to be monic |
---|
[08daea] | 157 | void |
---|
[81d96c] | 158 | nonMonicHenselLift12 (const CanonicalForm& F,///< [in] a bivariate poly |
---|
[08daea] | 159 | CFList& factors, ///< [in, out] a list of univariate polys |
---|
| 160 | ///< lifted factors |
---|
| 161 | int l, ///< [in] lift bound |
---|
| 162 | CFArray& Pi, ///< [in, out] stores intermediate results |
---|
| 163 | CFList& diophant, ///< [in, out] result of diophantine |
---|
| 164 | CFMatrix& M, ///< [in, out] stores intermediate results |
---|
| 165 | const CFArray& LCs, ///< [in] leading coefficients |
---|
| 166 | bool sort ///< [in] if true factors are sorted by |
---|
| 167 | ///< their degree |
---|
| 168 | ); |
---|
| 169 | |
---|
| 170 | /// two factor Hensel lifting from bivariate to multivariate, factors need not |
---|
| 171 | /// to be monic |
---|
| 172 | /// |
---|
| 173 | /// @return @a henselLift122 returns a list of lifted factors |
---|
| 174 | CFList |
---|
[81d96c] | 175 | nonMonicHenselLift2 (const CFList& eval,///< [in] a list of polynomials the last |
---|
[08daea] | 176 | ///< element is a compressed multivariate |
---|
| 177 | ///< poly, last but one element equals the |
---|
| 178 | ///< last elements modulo its main variable |
---|
| 179 | ///< and so on. The first element is a |
---|
| 180 | ///< compressed bivariate poly. |
---|
| 181 | const CFList& factors,///< [in] bivariate factors |
---|
| 182 | int* l, ///< [in] lift bounds |
---|
[81d96c] | 183 | int lLength, ///< [in] length of l |
---|
[08daea] | 184 | bool sort, ///< [in] if true factors are sorted by |
---|
| 185 | ///< their degree in Variable(1) |
---|
| 186 | const CFList& LCs1, ///< [in] a list of evaluated LC of first |
---|
| 187 | ///< factor |
---|
| 188 | const CFList& LCs2, ///< [in] a list of evaluated LC of second |
---|
| 189 | ///< factor |
---|
| 190 | const CFArray& Pi, ///< [in] intermediate result |
---|
[e368746] | 191 | const CFList& diophant,///< [in] result of diophantine |
---|
| 192 | bool& noOneToOne ///< [in,out] check for one to one |
---|
| 193 | ///< correspondence |
---|
[08daea] | 194 | ); |
---|
| 195 | |
---|
[c1b9927] | 196 | /// Hensel lifting of non monic factors, needs correct leading coefficients of |
---|
[e368746] | 197 | /// factors and a one to one corresponds between bivariate and multivariate |
---|
| 198 | /// factors to succeed |
---|
| 199 | /// |
---|
| 200 | /// @return @a nonMonicHenselLift returns a list of lifted factors |
---|
[c1b9927] | 201 | /// such that prod (factors) == eval.getLast() if there is a one to one |
---|
[e368746] | 202 | /// correspondence |
---|
| 203 | CFList |
---|
| 204 | nonMonicHenselLift (const CFList& eval, ///< [in] a list of polys the last |
---|
[c1b9927] | 205 | ///< element is a compressed |
---|
[e368746] | 206 | ///< multivariate poly, last but one |
---|
| 207 | ///< element equals the last elements |
---|
[c1b9927] | 208 | ///< modulo its main variable and so |
---|
| 209 | ///< on. The first element is a |
---|
[e368746] | 210 | ///< compressed poly in 3 variables |
---|
| 211 | const CFList& factors, ///< [in] a list of bivariate factors |
---|
| 212 | CFList* const& LCs, ///< [in] leading coefficients, |
---|
[c1b9927] | 213 | ///< evaluated in the same way as |
---|
[e368746] | 214 | ///< eval |
---|
| 215 | CFList& diophant, ///< [in, out] solution of univariate |
---|
[c1b9927] | 216 | ///< diophantine equation |
---|
[e368746] | 217 | CFArray& Pi, ///< [in, out] buffer intermediate |
---|
| 218 | ///< results |
---|
| 219 | int* liftBound, ///< [in] lifting bounds |
---|
| 220 | int length, ///< [in] length of lifting bounds |
---|
| 221 | bool& noOneToOne ///< [in, out] check for one to one |
---|
| 222 | ///< correspondence |
---|
| 223 | ); |
---|
[615ca8] | 224 | #endif /* HAVE_NTL */ |
---|
[ad3c3ff] | 225 | #endif |
---|
| 226 | /* FAC_HENSEL_H */ |
---|
| 227 | |
---|