/factory/facHensel.h

https://github.com/YueRen/Sources · C Header · 243 lines · 108 code · 15 blank · 120 comment · 0 complexity · 02c5faec7c2958321862612a3c01cd58 MD5 · raw file

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