source: git/factory/facFqBivar.h @ a723558

fieker-DuValspielwiese
Last change on this file since a723558 was 03c742, checked in by Hans Schoenemann <hannes@…>, 4 years ago
factory: BuildIrred, FLINT/NTL seperation
  • Property mode set to 100644
File size: 27.0 KB
Line 
1/*****************************************************************************\
2 * Computer Algebra System SINGULAR
3\*****************************************************************************/
4/** @file facFqBivar.h
5 *
6 * This file provides functions for factorizing a bivariate polynomial over
7 * \f$ F_{p} \f$ , \f$ F_{p}(\alpha ) \f$ or GF.
8 *
9 * @author Martin Lee
10 *
11 **/
12/*****************************************************************************/
13
14#ifndef FAC_FQ_BIVAR_H
15#define FAC_FQ_BIVAR_H
16
17// #include "config.h"
18
19#include "timing.h"
20#include "cf_assert.h"
21
22#include "facFqBivarUtil.h"
23#include "DegreePattern.h"
24#include "ExtensionInfo.h"
25#include "cf_util.h"
26#include "facFqSquarefree.h"
27#include "cf_map.h"
28#include "cfNewtonPolygon.h"
29#include "fac_util.h"
30#include "cf_algorithm.h"
31
32TIMING_DEFINE_PRINT(fac_fq_bi_sqrf)
33TIMING_DEFINE_PRINT(fac_fq_bi_factor_sqrf)
34
35static const double log2exp= 1.442695041;
36
37#if defined(HAVE_NTL) || defined(HAVE_FLINT)
38/// Factorization of a squarefree bivariate polynomials over an arbitrary finite
39/// field, information on the current field we work over is in @a info. @a info
40/// may also contain information about the initial field if initial and current
41/// field do not coincide. In this case the current field is an extension of the
42/// initial field and the factors returned are factors of F over the initial
43/// field.
44///
45/// @return @a biFactorize returns a list of factors of F. If F is not monic
46///         its leading coefficient is not outputted.
47/// @sa extBifactorize()
48CFList
49biFactorize (const CanonicalForm& F,       ///< [in] a sqrfree bivariate poly
50             const ExtensionInfo& info     ///< [in] information about extension
51            );
52
53inline CFList
54biSqrfFactorizeHelper (const CanonicalForm& G, const ExtensionInfo& info)
55{
56  CFMap N;
57  CanonicalForm F= compress (G, N);
58  CanonicalForm contentX= content (F, 1);
59  CanonicalForm contentY= content (F, 2);
60  F /= (contentX*contentY);
61  CFFList contentXFactors, contentYFactors;
62  if (info.getAlpha().level() != 1)
63  {
64    contentXFactors= factorize (contentX, info.getAlpha());
65    contentYFactors= factorize (contentY, info.getAlpha());
66  }
67  else if (info.getAlpha().level() == 1 && info.getGFDegree() == 1)
68  {
69    contentXFactors= factorize (contentX);
70    contentYFactors= factorize (contentY);
71  }
72  else if (info.getAlpha().level() == 1 && info.getGFDegree() != 1)
73  {
74    CFList bufContentX, bufContentY;
75    bufContentX= biFactorize (contentX, info);
76    bufContentY= biFactorize (contentY, info);
77    for (CFListIterator iter= bufContentX; iter.hasItem(); iter++)
78      contentXFactors.append (CFFactor (iter.getItem(), 1));
79    for (CFListIterator iter= bufContentY; iter.hasItem(); iter++)
80      contentYFactors.append (CFFactor (iter.getItem(), 1));
81  }
82
83  if (contentXFactors.getFirst().factor().inCoeffDomain())
84    contentXFactors.removeFirst();
85  if (contentYFactors.getFirst().factor().inCoeffDomain())
86    contentYFactors.removeFirst();
87  if (F.inCoeffDomain())
88  {
89    CFList result;
90    for (CFFListIterator i= contentXFactors; i.hasItem(); i++)
91      result.append (N (i.getItem().factor()));
92    for (CFFListIterator i= contentYFactors; i.hasItem(); i++)
93      result.append (N (i.getItem().factor()));
94    normalize (result);
95    result.insert (Lc (G));
96    return result;
97  }
98  mpz_t * M=new mpz_t [4];
99  mpz_init (M[0]);
100  mpz_init (M[1]);
101  mpz_init (M[2]);
102  mpz_init (M[3]);
103
104  mpz_t * S=new mpz_t [2];
105  mpz_init (S[0]);
106  mpz_init (S[1]);
107
108  F= compress (F, M, S);
109  CFList result= biFactorize (F, info);
110  for (CFListIterator i= result; i.hasItem(); i++)
111    i.getItem()= N (decompress (i.getItem(), M, S));
112  for (CFFListIterator i= contentXFactors; i.hasItem(); i++)
113    result.append (N(i.getItem().factor()));
114  for (CFFListIterator i= contentYFactors; i.hasItem(); i++)
115    result.append (N (i.getItem().factor()));
116  normalize (result);
117  result.insert (Lc(G));
118
119  mpz_clear (M[0]);
120  mpz_clear (M[1]);
121  mpz_clear (M[2]);
122  mpz_clear (M[3]);
123  delete [] M;
124
125  mpz_clear (S[0]);
126  mpz_clear (S[1]);
127  delete [] S;
128
129  return result;
130}
131
132/// factorize a squarefree bivariate polynomial over \f$ F_{p} \f$.
133///
134/// @return @a FpBiSqrfFactorize returns a list of monic factors, the first
135///         element is the leading coefficient.
136/// @sa FqBiSqrfFactorize(), GFBiSqrfFactorize()
137inline
138CFList FpBiSqrfFactorize (const CanonicalForm & G ///< [in] a bivariate poly
139                         )
140{
141  ExtensionInfo info= ExtensionInfo (false);
142  return biSqrfFactorizeHelper (G, info);
143}
144
145/// factorize a squarefree bivariate polynomial over \f$ F_{p}(\alpha ) \f$.
146///
147/// @return @a FqBiSqrfFactorize returns a list of monic factors, the first
148///         element is the leading coefficient.
149/// @sa FpBiSqrfFactorize(), GFBiSqrfFactorize()
150inline
151CFList FqBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
152                          const Variable& alpha    ///< [in] algebraic variable
153                         )
154{
155  ExtensionInfo info= ExtensionInfo (alpha, false);
156  return biSqrfFactorizeHelper (G, info);
157}
158
159/// factorize a squarefree bivariate polynomial over GF
160///
161/// @return @a GFBiSqrfFactorize returns a list of monic factors, the first
162///         element is the leading coefficient.
163/// @sa FpBiSqrfFactorize(), FqBiSqrfFactorize()
164inline
165CFList GFBiSqrfFactorize (const CanonicalForm & G ///< [in] a bivariate poly
166                         )
167{
168  ASSERT (CFFactory::gettype() == GaloisFieldDomain,
169          "GF as base field expected");
170  ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false);
171  return biSqrfFactorizeHelper (G, info);
172}
173
174/// factorize a bivariate polynomial over \f$ F_{p} \f$
175///
176/// @return @a FpBiFactorize returns a list of monic factors with
177///         multiplicity, the first element is the leading coefficient.
178/// @sa FqBiFactorize(), GFBiFactorize()
179inline
180CFFList
181FpBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
182               bool substCheck= true    ///< [in] enables substitute check
183              )
184{
185  ExtensionInfo info= ExtensionInfo (false);
186  CFMap N;
187  CanonicalForm F= compress (G, N);
188
189  if (substCheck)
190  {
191    bool foundOne= false;
192    int * substDegree= NEW_ARRAY(int,F.level());
193    for (int i= 1; i <= F.level(); i++)
194    {
195      substDegree[i-1]= substituteCheck (F, Variable (i));
196      if (substDegree [i-1] > 1)
197      {
198        foundOne= true;
199        subst (F, F, substDegree[i-1], Variable (i));
200      }
201    }
202    if (foundOne)
203    {
204      CFFList result= FpBiFactorize (F, false);
205      CFFList newResult, tmp;
206      CanonicalForm tmp2;
207      newResult.insert (result.getFirst());
208      result.removeFirst();
209      for (CFFListIterator i= result; i.hasItem(); i++)
210      {
211        tmp2= i.getItem().factor();
212        for (int j= 1; j <= F.level(); j++)
213        {
214          if (substDegree[j-1] > 1)
215            tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j));
216        }
217        tmp= FpBiFactorize (tmp2, false);
218        tmp.removeFirst();
219        for (CFFListIterator j= tmp; j.hasItem(); j++)
220          newResult.append (CFFactor (j.getItem().factor(),
221                                      j.getItem().exp()*i.getItem().exp()));
222      }
223      decompress (newResult, N);
224      DELETE_ARRAY(substDegree);
225      return newResult;
226    }
227    DELETE_ARRAY(substDegree);
228  }
229
230  CanonicalForm LcF= Lc (F);
231  CanonicalForm contentX= content (F, 1);
232  CanonicalForm contentY= content (F, 2);
233  F /= (contentX*contentY);
234  CFFList contentXFactors, contentYFactors;
235  contentXFactors= factorize (contentX);
236  contentYFactors= factorize (contentY);
237  if (contentXFactors.getFirst().factor().inCoeffDomain())
238    contentXFactors.removeFirst();
239  if (contentYFactors.getFirst().factor().inCoeffDomain())
240    contentYFactors.removeFirst();
241  decompress (contentXFactors, N);
242  decompress (contentYFactors, N);
243  CFFList result;
244  if (F.inCoeffDomain())
245  {
246    result= Union (contentXFactors, contentYFactors);
247    normalize (result);
248    result.insert (CFFactor (LcF, 1));
249    return result;
250  }
251  mpz_t * M=new mpz_t [4];
252  mpz_init (M[0]);
253  mpz_init (M[1]);
254  mpz_init (M[2]);
255  mpz_init (M[3]);
256
257  mpz_t * S=new mpz_t [2];
258  mpz_init (S[0]);
259  mpz_init (S[1]);
260
261  F= compress (F, M, S);
262
263  TIMING_START (fac_fq_bi_sqrf);
264  CFFList sqrf= FpSqrf (F, false);
265  TIMING_END_AND_PRINT (fac_fq_bi_sqrf,
266                       "time for bivariate sqrf factors over Fp: ");
267  CFList bufResult;
268  sqrf.removeFirst();
269  CFListIterator i;
270  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
271  {
272    TIMING_START (fac_fq_bi_factor_sqrf);
273    bufResult= biFactorize (iter.getItem().factor(), info);
274    TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf,
275                          "time to factor bivariate sqrf factors over Fp: ");
276    for (i= bufResult; i.hasItem(); i++)
277      result.append (CFFactor (N (decompress (i.getItem(), M, S)),
278                               iter.getItem().exp()));
279  }
280
281  result= Union (result, contentXFactors);
282  result= Union (result, contentYFactors);
283  normalize (result);
284  result.insert (CFFactor (LcF, 1));
285
286  mpz_clear (M[0]);
287  mpz_clear (M[1]);
288  mpz_clear (M[2]);
289  mpz_clear (M[3]);
290  delete [] M;
291
292  mpz_clear (S[0]);
293  mpz_clear (S[1]);
294  delete [] S;
295
296  return result;
297}
298
299/// factorize a bivariate polynomial over \f$ F_{p}(\alpha ) \f$
300///
301/// @return @a FqBiFactorize returns a list of monic factors with
302///         multiplicity, the first element is the leading coefficient.
303/// @sa FpBiFactorize(), FqBiFactorize()
304inline
305CFFList
306FqBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
307               const Variable & alpha,  ///< [in] algebraic variable
308               bool substCheck= true    ///< [in] enables substitute check
309              )
310{
311  ExtensionInfo info= ExtensionInfo (alpha, false);
312  CFMap N;
313  CanonicalForm F= compress (G, N);
314
315  if (substCheck)
316  {
317    bool foundOne= false;
318    int * substDegree= NEW_ARRAY(int,F.level());
319    for (int i= 1; i <= F.level(); i++)
320    {
321      substDegree[i-1]= substituteCheck (F, Variable (i));
322      if (substDegree [i-1] > 1)
323      {
324        foundOne= true;
325        subst (F, F, substDegree[i-1], Variable (i));
326      }
327    }
328    if (foundOne)
329    {
330      CFFList result= FqBiFactorize (F, alpha, false);
331      CFFList newResult, tmp;
332      CanonicalForm tmp2;
333      newResult.insert (result.getFirst());
334      result.removeFirst();
335      for (CFFListIterator i= result; i.hasItem(); i++)
336      {
337        tmp2= i.getItem().factor();
338        for (int j= 1; j <= F.level(); j++)
339        {
340          if (substDegree[j-1] > 1)
341            tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j));
342        }
343        tmp= FqBiFactorize (tmp2, alpha, false);
344        tmp.removeFirst();
345        for (CFFListIterator j= tmp; j.hasItem(); j++)
346          newResult.append (CFFactor (j.getItem().factor(),
347                                      j.getItem().exp()*i.getItem().exp()));
348      }
349      decompress (newResult, N);
350      DELETE_ARRAY(substDegree);
351      return newResult;
352    }
353    DELETE_ARRAY(substDegree);
354  }
355
356  CanonicalForm LcF= Lc (F);
357  CanonicalForm contentX= content (F, 1);
358  CanonicalForm contentY= content (F, 2);
359  F /= (contentX*contentY);
360  CFFList contentXFactors, contentYFactors;
361  contentXFactors= factorize (contentX, alpha);
362  contentYFactors= factorize (contentY, alpha);
363  if (contentXFactors.getFirst().factor().inCoeffDomain())
364    contentXFactors.removeFirst();
365  if (contentYFactors.getFirst().factor().inCoeffDomain())
366    contentYFactors.removeFirst();
367  decompress (contentXFactors, N);
368  decompress (contentYFactors, N);
369  CFFList result;
370  if (F.inCoeffDomain())
371  {
372    result= Union (contentXFactors, contentYFactors);
373    normalize (result);
374    result.insert (CFFactor (LcF, 1));
375    return result;
376  }
377
378  mpz_t * M=new mpz_t [4];
379  mpz_init (M[0]);
380  mpz_init (M[1]);
381  mpz_init (M[2]);
382  mpz_init (M[3]);
383
384  mpz_t * S=new mpz_t [2];
385  mpz_init (S[0]);
386  mpz_init (S[1]);
387
388  F= compress (F, M, S);
389
390  TIMING_START (fac_fq_bi_sqrf);
391  CFFList sqrf= FqSqrf (F, alpha, false);
392  TIMING_END_AND_PRINT (fac_fq_bi_sqrf,
393                       "time for bivariate sqrf factors over Fq: ");
394  CFList bufResult;
395  sqrf.removeFirst();
396  CFListIterator i;
397  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
398  {
399    TIMING_START (fac_fq_bi_factor_sqrf);
400    bufResult= biFactorize (iter.getItem().factor(), info);
401    TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf,
402                          "time to factor bivariate sqrf factors over Fq: ");
403    for (i= bufResult; i.hasItem(); i++)
404      result.append (CFFactor (N (decompress (i.getItem(), M, S)),
405                               iter.getItem().exp()));
406  }
407
408  result= Union (result, contentXFactors);
409  result= Union (result, contentYFactors);
410  normalize (result);
411  result.insert (CFFactor (LcF, 1));
412
413  mpz_clear (M[0]);
414  mpz_clear (M[1]);
415  mpz_clear (M[2]);
416  mpz_clear (M[3]);
417  delete [] M;
418
419  mpz_clear (S[0]);
420  mpz_clear (S[1]);
421  delete [] S;
422
423  return result;
424}
425
426/// factorize a bivariate polynomial over GF
427///
428/// @return @a GFBiFactorize returns a list of monic factors with
429///         multiplicity, the first element is the leading coefficient.
430/// @sa FpBiFactorize(), FqBiFactorize()
431inline
432CFFList
433GFBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
434               bool substCheck= true    ///< [in] enables substitute check
435              )
436{
437  ASSERT (CFFactory::gettype() == GaloisFieldDomain,
438          "GF as base field expected");
439  ExtensionInfo info= ExtensionInfo (getGFDegree(), gf_name, false);
440  CFMap N;
441  CanonicalForm F= compress (G, N);
442
443  if (substCheck)
444  {
445    bool foundOne= false;
446    int * substDegree=NEW_ARRAY(int,F.level());
447    for (int i= 1; i <= F.level(); i++)
448    {
449      substDegree[i-1]= substituteCheck (F, Variable (i));
450      if (substDegree [i-1] > 1)
451      {
452        foundOne= true;
453        subst (F, F, substDegree[i-1], Variable (i));
454      }
455    }
456    if (foundOne)
457    {
458      CFFList result= GFBiFactorize (F, false);
459      CFFList newResult, tmp;
460      CanonicalForm tmp2;
461      newResult.insert (result.getFirst());
462      result.removeFirst();
463      for (CFFListIterator i= result; i.hasItem(); i++)
464      {
465        tmp2= i.getItem().factor();
466        for (int j= 1; j <= F.level(); j++)
467        {
468          if (substDegree[j-1] > 1)
469            tmp2= reverseSubst (tmp2, substDegree[j-1], Variable (j));
470        }
471        tmp= GFBiFactorize (tmp2, false);
472        tmp.removeFirst();
473        for (CFFListIterator j= tmp; j.hasItem(); j++)
474          newResult.append (CFFactor (j.getItem().factor(),
475                                      j.getItem().exp()*i.getItem().exp()));
476      }
477      decompress (newResult, N);
478      DELETE_ARRAY(substDegree);
479      return newResult;
480    }
481    DELETE_ARRAY(substDegree);
482  }
483
484  CanonicalForm LcF= Lc (F);
485  CanonicalForm contentX= content (F, 1);
486  CanonicalForm contentY= content (F, 2);
487  F /= (contentX*contentY);
488  CFFList contentXFactors, contentYFactors;
489  contentXFactors= factorize (contentX);
490  contentYFactors= factorize (contentY);
491  if (contentXFactors.getFirst().factor().inCoeffDomain())
492    contentXFactors.removeFirst();
493  if (contentYFactors.getFirst().factor().inCoeffDomain())
494    contentYFactors.removeFirst();
495  decompress (contentXFactors, N);
496  decompress (contentYFactors, N);
497  CFFList result;
498  if (F.inCoeffDomain())
499  {
500    result= Union (contentXFactors, contentYFactors);
501    normalize (result);
502    result.insert (CFFactor (LcF, 1));
503    return result;
504  }
505
506  mpz_t * M=new mpz_t [4];
507  mpz_init (M[0]);
508  mpz_init (M[1]);
509  mpz_init (M[2]);
510  mpz_init (M[3]);
511
512  mpz_t * S=new mpz_t [2];
513  mpz_init (S[0]);
514  mpz_init (S[1]);
515
516  F= compress (F, M, S);
517
518  TIMING_START (fac_fq_bi_sqrf);
519  CFFList sqrf= GFSqrf (F, false);
520  TIMING_END_AND_PRINT (fac_fq_bi_sqrf,
521                       "time for bivariate sqrf factors over GF: ");
522  CFList bufResult;
523  sqrf.removeFirst();
524  CFListIterator i;
525  for (CFFListIterator iter= sqrf; iter.hasItem(); iter++)
526  {
527    TIMING_START (fac_fq_bi_factor_sqrf);
528    bufResult= biFactorize (iter.getItem().factor(), info);
529    TIMING_END_AND_PRINT (fac_fq_bi_factor_sqrf,
530                          "time to factor bivariate sqrf factors over GF: ");
531    for (i= bufResult; i.hasItem(); i++)
532      result.append (CFFactor (N (decompress (i.getItem(), M, S)),
533                               iter.getItem().exp()));
534  }
535
536  result= Union (result, contentXFactors);
537  result= Union (result, contentYFactors);
538  normalize (result);
539  result.insert (CFFactor (LcF, 1));
540
541  mpz_clear (M[0]);
542  mpz_clear (M[1]);
543  mpz_clear (M[2]);
544  mpz_clear (M[3]);
545  delete [] M;
546
547  mpz_clear (S[0]);
548  mpz_clear (S[1]);
549  delete [] S;
550
551  return result;
552}
553
554/// \f$ \prod_{f\in L} {f (0, x)} \ mod\ M \f$ via divide-and-conquer
555///
556/// @return @a prodMod0 computes the above defined product
557/// @sa prodMod()
558CanonicalForm prodMod0 (const CFList& L,       ///< [in] a list of compressed,
559                                               ///< bivariate polynomials
560                        const CanonicalForm& M,///< [in] a power of Variable (2)
561                        const modpk& b= modpk()///< [in] coeff bound
562                       );
563
564/// find an evaluation point p, s.t. F(p,y) is squarefree and
565/// \f$ deg_{y} (F(p,y))= deg_{y} (F(x,y)) \f$.
566///
567/// @return @a evalPoint returns an evaluation point, which is valid if and only
568///         if fail == false.
569CanonicalForm
570evalPoint (const CanonicalForm& F, ///< [in] compressed, bivariate poly
571           CanonicalForm & eval,   ///< [in,out] F (p, y)
572           const Variable& alpha,  ///< [in] algebraic variable
573           CFList& list,           ///< [in] list of points already considered
574           const bool& GF,         ///< [in] GaloisFieldDomain?
575           bool& fail              ///< [in,out] equals true, if there is no
576                                   ///< valid evaluation point
577          );
578
579/// Univariate factorization of squarefree monic polys over finite fields via
580/// NTL. If the characteristic is even special GF2 routines of NTL are used.
581///
582/// @return @a uniFactorizer returns a list of monic factors
583CFList
584uniFactorizer (const CanonicalForm& A, ///< [in] squarefree univariate poly
585               const Variable& alpha,  ///< [in] algebraic variable
586               const bool& GF          ///< [in] GaloisFieldDomain?
587              );
588
589/// naive factor recombination over an extension of the initial field.
590/// Uses precomputed data to exclude combinations that are not possible.
591///
592/// @return @a extFactorRecombination returns a list of factors over the initial
593///         field, whose shift to zero is reversed.
594/// @sa factorRecombination(), extEarlyFactorDetection()
595CFList
596extFactorRecombination (
597         CFList& factors,          ///< [in,out] list of lifted factors that are
598                                   ///< monic wrt Variable (1),
599                                   ///< original factors-factors found
600         CanonicalForm& F,         ///< [in,out] poly to be factored,
601                                   ///< F/factors found
602         const CanonicalForm& M,   ///< [in] Variable (2)^liftBound
603         const ExtensionInfo& info,///< [in] contains information about
604                                   ///< extension
605         DegreePattern& degs,
606         const CanonicalForm& eval,///< [in] evaluation point
607         int s,                    ///< [in] algorithm starts checking subsets
608                                   ///< of size s
609         int thres                 ///< [in] threshold for the size of subsets
610                                   ///< which are checked, for a full factor
611                                   ///< recombination choose
612                                   ///< thres= factors.length()/2
613                       );
614
615/// naive factor recombination.
616/// Uses precomputed data to exclude combinations that are not possible.
617///
618/// @return @a factorRecombination returns a list of factors of F.
619/// @sa extFactorRecombination(), earlyFactorDetectection()
620CFList
621factorRecombination (
622            CFList& factors,            ///< [in,out] list of lifted factors
623                                        ///< that are monic wrt Variable (1)
624            CanonicalForm& F,           ///< [in,out] poly to be factored
625            const CanonicalForm& M,     ///< [in] Variable (2)^liftBound
626            DegreePattern& degs,        ///< [in] degree pattern
627            const CanonicalForm& eval,  ///< [in] evaluation point
628            int s,                      ///< [in] algorithm starts checking
629                                        ///< subsets of size s
630            int thres,                  ///< [in] threshold for the size of
631                                        ///< subsets which are checked, for a
632                                        ///< full factor recombination choose
633                                        ///< thres= factors.length()/2
634            const modpk& b=modpk(),     ///< [in] coeff bound
635            const CanonicalForm& den= 1 ///< [in] bound on the den if over Q (a)
636                    );
637
638/// chooses a field extension.
639///
640/// @return @a chooseExtension returns an extension specified by @a beta of
641///         appropiate size
642Variable chooseExtension (
643                      const Variable & alpha, ///< [in] some algebraic variable
644                      const Variable & beta,  ///< [in] some algebraic variable
645                      int k                   ///< [in] some int
646                         );
647
648/// compute lifting precisions from the shape of the Newton polygon of F
649///
650/// @return @a getLiftPrecisions returns lifting precisions computed from the
651/// shape of the Newton polygon of F
652int *
653getLiftPrecisions (const CanonicalForm& F, ///< [in] a bivariate poly
654                   int& sizeOfOutput,      ///< [in,out] size of the output
655                   int degreeLC            ///< [in] degree of the leading coeff
656                                           ///< [in] of F wrt. Variable (1)
657                  );
658
659
660/// detects factors of @a F at stage @a deg of Hensel lifting.
661/// No combinations of more than one factor are tested. Lift bound and possible
662/// degree pattern are updated.
663///
664/// @sa factorRecombination(), extEarlyFactorDetection()
665void
666earlyFactorDetection (
667           CFList& reconstructedFactors, ///< [in,out] list of reconstructed
668                                         ///< factors
669           CanonicalForm& F,       ///< [in,out] poly to be factored, returns
670                                   ///< poly divided by detected factors in case
671                                   ///< of success
672           CFList& factors,        ///< [in,out] list of factors lifted up to
673                                   ///< @a deg, returns a list of factors
674                                   ///< without detected factors
675           int& adaptedLiftBound,  ///< [in,out] adapted lift bound
676           int*& factorsFoundIndex,///< [in,out] factors already considered
677           DegreePattern& degs,    ///< [in,out] degree pattern, is updated
678                                   ///< whenever we find a factor
679           bool& success,          ///< [in,out] indicating success
680           int deg,                ///< [in] stage of Hensel lifting
681           const CanonicalForm& eval, ///<[in] evaluation point
682           const modpk& b= modpk()///< [in] coeff bound
683                     );
684
685/// detects factors of @a F at stage @a deg of Hensel lifting.
686/// No combinations of more than one factor are tested. Lift bound and possible
687/// degree pattern are updated.
688///
689/// @sa factorRecombination(), earlyFactorDetection()
690void
691extEarlyFactorDetection (
692        CFList& reconstructedFactors, ///< [in,out] list of reconstructed
693                                      ///< factors
694        CanonicalForm& F,          ///< [in,out] poly to be factored, returns
695                                   ///< poly divided by detected factors in case
696                                   ///< of success
697        CFList& factors,           ///< [in,out] list of factors lifted up to
698                                   ///< @a deg, returns a list of factors
699                                   ///< without detected factors
700        int& adaptedLiftBound,     ///< [in,out] adapted lift bound
701        int*& factorsFoundIndex,   ///< [in,out] factors already considered
702        DegreePattern& degs,       ///< [in,out] degree pattern, is updated
703                                   ///< whenever we find a factor
704        bool& success,             ///< [in,out] indicating success
705        const ExtensionInfo& info,  ///< [in] information about extension
706        const CanonicalForm& eval, ///< [in] evaluation point
707        int deg                    ///< [in] stage of Hensel lifting
708                      );
709
710/// hensel Lifting and early factor detection
711///
712/// @return @a henselLiftAndEarly returns monic (wrt Variable (1)) lifted
713///         factors without factors which have been detected at an early stage
714///         of Hensel lifting
715/// @sa earlyFactorDetection(), extEarlyFactorDetection()
716
717CFList
718henselLiftAndEarly (
719        CanonicalForm& A,          ///< [in,out] poly to be factored,
720                                   ///< returns poly divided by detected factors
721                                   ///< in case of success
722        bool& earlySuccess,        ///< [in,out] indicating success
723        CFList& earlyFactors,      ///< [in,out] list of factors detected
724                                   ///< at early stage of Hensel lifting
725        DegreePattern& degs,       ///< [in,out] degree pattern
726        int& liftBound,            ///< [in,out] (adapted) lift bound
727        const CFList& uniFactors,  ///< [in] univariate factors
728        const ExtensionInfo& info, ///< [in] information about extension
729        const CanonicalForm& eval, ///< [in] evaluation point
730        modpk& b,                  ///< [in] coeff bound
731        CanonicalForm& den         ///< [in] bound on the den if over Q(a)
732                  );
733
734/// hensel Lifting and early factor detection
735///
736/// @return @a henselLiftAndEarly returns monic (wrt Variable (1)) lifted
737///         factors without factors which have been detected at an early stage
738///         of Hensel lifting
739/// @sa earlyFactorDetection(), extEarlyFactorDetection()
740
741CFList
742henselLiftAndEarly (
743        CanonicalForm& A,          ///< [in,out] poly to be factored,
744                                   ///< returns poly divided by detected factors
745                                   ///< in case of success
746        bool& earlySuccess,        ///< [in,out] indicating success
747        CFList& earlyFactors,      ///< [in,out] list of factors detected
748                                   ///< at early stage of Hensel lifting
749        DegreePattern& degs,       ///< [in,out] degree pattern
750        int& liftBound,            ///< [in,out] (adapted) lift bound
751        const CFList& uniFactors,  ///< [in] univariate factors
752        const ExtensionInfo& info, ///< [in] information about extension
753        const CanonicalForm& eval  ///< [in] evaluation point
754                  );
755
756/// Factorization over an extension of initial field
757///
758/// @return @a extBiFactorize returns factorization of F over initial field
759/// @sa biFactorize()
760CFList
761extBiFactorize (const CanonicalForm& F,    ///< [in] poly to be factored
762                const ExtensionInfo& info  ///< [in] info about extension
763               );
764
765#endif
766#endif
767/* FAC_FQ_BIVAR_H */
768
Note: See TracBrowser for help on using the repository browser.