source: git/factory/facFqBivar.h @ e65b1a4

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