Functions
facAlgFunc.h File Reference

Factorization over algebraic function fields. More...

#include "canonicalform.h"

Go to the source code of this file.

Functions

CanonicalForm alg_gcd (const CanonicalForm &, const CanonicalForm &, const CFList &)
 
CFFList facAlgFunc2 (const CanonicalForm &f, const CFList &as)
 factorize a polynomial f that is irreducible over the ground field modulo an extension given by an irreducible characteristic set as, f is assumed to be integral, i.e. $ f\in K[x_1,\ldots,x_n]/(as) $, and each element of as is assumed to be integral as well. $ K $ must be either $ F_p $ or $ Q $. More...
 
CFFList facAlgFunc (const CanonicalForm &f, const CFList &as)
 factorize a polynomial f modulo an extension given by an irreducible characteristic set as, f is assumed to be integral, i.e. $ f\in K[x_1,\ldots,x_n]/(as) $, and each element of as is assumed to be integral as well. $ K $ must be either $ F_p $ or $ Q $. More...
 

Detailed Description

Factorization over algebraic function fields.

Note
some of the code is code from libfac or derived from code from libfac. Libfac is written by M. Messollen. See also COPYING for license information and README for general information on characteristic sets.
Author
Martin Lee

Definition in file facAlgFunc.h.

Function Documentation

Definition at line 61 of file facAlgFunc.cc.

62 {
63  if (fff.inCoeffDomain() || ggg.inCoeffDomain())
64  return 1;
65  CanonicalForm f=fff;
66  CanonicalForm g=ggg;
67  f=Prem(f,as);
68  g=Prem(g,as);
69  if ( f.isZero() )
70  {
71  if ( g.lc().sign() < 0 ) return -g;
72  else return g;
73  }
74  else if ( g.isZero() )
75  {
76  if ( f.lc().sign() < 0 ) return -f;
77  else return f;
78  }
79 
80  int v= as.getLast().level();
81  if (f.level() <= v || g.level() <= v)
82  return 1;
83 
85 
86  // does as appear in f and g ?
87  bool has_alg_var=false;
88  for ( CFListIterator j=as;j.hasItem(); j++ )
89  {
90  Variable v=j.getItem().mvar();
91  if (hasVar (f, v))
92  has_alg_var=true;
93  if (hasVar (g, v))
94  has_alg_var=true;
95  }
96  if (!has_alg_var)
97  {
98  /*if ((hasAlgVar(f))
99  || (hasAlgVar(g)))
100  {
101  Varlist ord;
102  for ( CFListIterator j=as;j.hasItem(); j++ )
103  ord.append(j.getItem().mvar());
104  res=algcd(f,g,as,ord);
105  }
106  else*/
107  if (!hasAlgVar (f) && !hasAlgVar (g))
108  return res=gcd(f,g);
109  }
110 
111  int mvf=f.level();
112  int mvg=g.level();
113  if (mvg > mvf)
114  {
115  CanonicalForm tmp=f; f=g; g=tmp;
116  int tmp2=mvf; mvf=mvg; mvg=tmp2;
117  }
118  if (g.inBaseDomain() || f.inBaseDomain())
119  return CanonicalForm(1);
120 
121  CanonicalForm c_f= alg_content (f, as);
122 
123  if (mvf != mvg)
124  {
125  res= alg_gcd (g, c_f, as);
126  return res;
127  }
128  Variable x= f.mvar();
129 
130  // now: mvf==mvg, f.level()==g.level()
131  CanonicalForm c_g= alg_content (g, as);
132 
133  int delta= degree (f) - degree (g);
134 
135  f= divide (f, c_f, as);
136  g= divide (g, c_g, as);
137 
138  // gcd of contents
139  CanonicalForm c_gcd= alg_gcd (c_f, c_g, as);
140  CanonicalForm tmp;
141 
142  if (delta < 0)
143  {
144  tmp= f;
145  f= g;
146  g= tmp;
147  delta= -delta;
148  }
149 
150  CanonicalForm r= 1;
151 
152  while (degree (g, x) > 0)
153  {
154  r= Prem (f, g);
155  r= Prem (r, as);
156  if (!r.isZero())
157  {
158  r= divide (r, alg_content (r,as), as);
159  r /= vcontent (r,Variable (v+1));
160  }
161  f= g;
162  g= r;
163  }
164 
165  if (degree (g, x) == 0)
166  return c_gcd;
167 
168  c_f= alg_content (f, as);
169 
170  f= divide (f, c_f, as);
171 
172  f *= c_gcd;
173  f /= vcontent (f, Variable (v+1));
174 
175  return f;
176 }
int level() const
Definition: variable.h:49
Variable mvar() const
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
f
Definition: cfModGcd.cc:4022
factory's class for variables
Definition: variable.h:32
CanonicalForm vcontent(const CanonicalForm &f, const Variable &x)
CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x )
Definition: cf_gcd.cc:230
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
factory's main class
Definition: canonicalform.h:72
g
Definition: cfModGcd.cc:4031
CF_NO_INLINE bool isZero() const
Definition: cf_inline.cc:372
CanonicalForm lc() const
CanonicalForm CanonicalForm::lc (), Lc (), LC (), LC ( v ) const.
bool delta(X x, Y y, D d)
Definition: TestSuite.h:160
int level() const
level() returns the level of CO.
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
CanonicalForm alg_content(const CanonicalForm &f, const CFList &as)
Definition: facAlgFunc.cc:42
int j
Definition: myNF.cc:70
CFList tmp2
Definition: facFqBivar.cc:70
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
CanonicalForm alg_gcd(const CanonicalForm &fff, const CanonicalForm &ggg, const CFList &as)
Definition: facAlgFunc.cc:61
int gcd(int a, int b)
Definition: walkSupport.cc:839
Variable x
Definition: cfModGcd.cc:4023
CanonicalForm Prem(const CanonicalForm &F, const CanonicalForm &G)
pseudo remainder of F by G with certain factors of LC (g) cancelled
bool inBaseDomain() const
int degree(const CanonicalForm &f)
int hasAlgVar(const CanonicalForm &f, const Variable &v)
int hasVar(const CanonicalForm &f, const Variable &v)
int sign() const
int CanonicalForm::sign () const
CFFList facAlgFunc ( const CanonicalForm f,
const CFList as 
)

factorize a polynomial f modulo an extension given by an irreducible characteristic set as, f is assumed to be integral, i.e. $ f\in K[x_1,\ldots,x_n]/(as) $, and each element of as is assumed to be integral as well. $ K $ must be either $ F_p $ or $ Q $.

Returns
the returned factors are not necessarily monic but only primitive and the product of the factors equals f up to a unit.

factorize a polynomial f modulo an extension given by an irreducible characteristic set as, f is assumed to be integral, i.e. $ f\in K[x_1,\ldots,x_n]/(as) $, and each element of as is assumed to be integral as well. $ K $ must be either $ F_p $ or $ Q $.

Parameters
[in]funivariate poly
[in]asirreducible characteristic set

Definition at line 1040 of file facAlgFunc.cc.

1041 {
1042  bool isRat= isOn (SW_RATIONAL);
1043  if (!isRat && getCharacteristic() == 0)
1044  On (SW_RATIONAL);
1045  CFFList Output, output, Factors= factorize(f);
1046  if (Factors.getFirst().factor().inCoeffDomain())
1047  Factors.removeFirst();
1048 
1049  if (as.length() == 0)
1050  {
1051  if (!isRat && getCharacteristic() == 0)
1052  Off (SW_RATIONAL);
1053  return Factors;
1054  }
1055  if (f.level() <= as.getLast().level())
1056  {
1057  if (!isRat && getCharacteristic() == 0)
1058  Off (SW_RATIONAL);
1059  return Factors;
1060  }
1061 
1062  for (CFFListIterator i=Factors; i.hasItem(); i++)
1063  {
1064  if (i.getItem().factor().level() > as.getLast().level())
1065  {
1066  output= facAlgFunc2 (i.getItem().factor(), as);
1067  for (CFFListIterator j= output; j.hasItem(); j++)
1068  Output= append (Output, CFFactor (j.getItem().factor(),
1069  j.getItem().exp()*i.getItem().exp()));
1070  }
1071  }
1072 
1073  if (!isRat && getCharacteristic() == 0)
1074  Off (SW_RATIONAL);
1075  return Output;
1076 }
CFFList append(const CFFList &Inputlist, const CFFactor &TheFactor)
CFFList facAlgFunc2(const CanonicalForm &f, const CFList &as)
factorize a polynomial that is irreducible over the ground field modulo an extension given by an irre...
Definition: facAlgFunc.cc:902
void Off(int sw)
switches
int getCharacteristic()
Definition: cf_char.cc:51
void removeFirst()
Definition: ftmpl_list.cc:287
int level() const
level() returns the level of CO.
CFFList factorize(const CanonicalForm &f, bool issqrfree=false)
factorization over or
Definition: cf_factor.cc:390
int j
Definition: myNF.cc:70
static const int SW_RATIONAL
set to 1 for computations over Q
Definition: cf_defs.h:28
bool isOn(int sw)
switches
void On(int sw)
switches
T getFirst() const
Definition: ftmpl_list.cc:279
int length() const
Definition: ftmpl_list.cc:273
int i
Definition: cfEzgcd.cc:123
T getLast() const
Definition: ftmpl_list.cc:309
CFFList facAlgFunc2 ( const CanonicalForm f,
const CFList as 
)

factorize a polynomial f that is irreducible over the ground field modulo an extension given by an irreducible characteristic set as, f is assumed to be integral, i.e. $ f\in K[x_1,\ldots,x_n]/(as) $, and each element of as is assumed to be integral as well. $ K $ must be either $ F_p $ or $ Q $.

Returns
the returned factors are not necessarily monic but only primitive and the product of the factors equals f up to a unit.

factorize a polynomial f that is irreducible over the ground field modulo an extension given by an irreducible characteristic set as, f is assumed to be integral, i.e. $ f\in K[x_1,\ldots,x_n]/(as) $, and each element of as is assumed to be integral as well. $ K $ must be either $ F_p $ or $ Q $.

Parameters
[in]funivariate poly
[in]asirreducible characteristic set

Definition at line 902 of file facAlgFunc.cc.

903 {
904  bool isRat= isOn (SW_RATIONAL);
905  if (!isRat && getCharacteristic() == 0)
906  On (SW_RATIONAL);
907  Variable vf=f.mvar();
909  CFFListIterator jj;
910  CFList reduceresult;
911  CFFList result;
912 
913 // F1: [Test trivial cases]
914 // 1) first trivial cases:
915  if (vf.level() <= as.getLast().level())
916  {
917  if (!isRat && getCharacteristic() == 0)
918  Off (SW_RATIONAL);
919  return CFFList(CFFactor(f,1));
920  }
921 
922 // 2) Setup list of those polys in AS having degree > 1
923  CFList Astar;
924  Variable x;
925  CanonicalForm elem;
926  Varlist ord, uord;
927  for (int ii= 1; ii < level (vf); ii++)
928  uord.append (Variable (ii));
929 
930  for (i= as; i.hasItem(); i++)
931  {
932  elem= i.getItem();
933  x= elem.mvar();
934  if (degree (elem, x) > 1) // otherwise it's not an extension
935  {
936  Astar.append (elem);
937  ord.append (x);
938  }
939  }
940  uord= Difference (uord, ord);
941 
942 // 3) second trivial cases: we already proved irr. of f over no extensions
943  if (Astar.length() == 0)
944  {
945  if (!isRat && getCharacteristic() == 0)
946  Off (SW_RATIONAL);
947  return CFFList (CFFactor (f, 1));
948  }
949 
950 // 4) Look if elements in uord actually occur in any of the minimal
951 // polynomials. If no element of uord occures in any of the minimal
952 // polynomials the field is an alg. number field not an alg. function field
953  Varlist newuord= varsInAs (uord, Astar);
954 
955  CFFList Factorlist;
956  Varlist gcdord= Union (ord, newuord);
957  gcdord.append (f.mvar());
958  bool isFunctionField= (newuord.length() > 0);
959 
960  // TODO alg_sqrfree?
961  CanonicalForm Fgcd= 0;
962  if (isFunctionField)
963  Fgcd= alg_gcd (f, f.deriv(), Astar);
964 
965  bool derivZero= f.deriv().isZero();
966  if (isFunctionField && (degree (Fgcd, f.mvar()) > 0) && !derivZero)
967  {
968  CanonicalForm Ggcd= divide(f, Fgcd,Astar);
969  if (getCharacteristic() == 0)
970  {
971  CFFList result= facAlgFunc2 (Ggcd, as); //Ggcd is the squarefree part of f
972  multiplicity (result, f, Astar);
973  if (!isRat && getCharacteristic() == 0)
974  Off (SW_RATIONAL);
975  return result;
976  }
977 
978  Fgcd= pp (Fgcd);
979  Ggcd= pp (Ggcd);
980  if (!isRat && getCharacteristic() == 0)
981  Off (SW_RATIONAL);
982  return merge (facAlgFunc2 (Fgcd, as), facAlgFunc2 (Ggcd, as));
983  }
984 
985  if (getCharacteristic() > 0)
986  {
987  IntList degreelist;
988  Variable vminpoly;
989  for (i= Astar; i.hasItem(); i++)
990  degreelist.append (degree (i.getItem()));
991 
992  int extdeg= getDegOfExt (degreelist, degree (f));
993 
994  if (newuord.length() == 0) // no parameters
995  {
996  if (extdeg > 1)
997  {
998  CanonicalForm MIPO= generateMipo (extdeg);
999  vminpoly= rootOf(MIPO);
1000  }
1001  Factorlist= Trager(f, Astar, vminpoly, as, isFunctionField);
1002  if (extdeg > 1)
1003  prune (vminpoly);
1004  return Factorlist;
1005  }
1006  else if (isInseparable(Astar) || derivZero) // inseparable case
1007  {
1008  Factorlist= SteelTrager (f, Astar);
1009  return Factorlist;
1010  }
1011  else // separable case
1012  {
1013  if (extdeg > 1)
1014  {
1015  CanonicalForm MIPO=generateMipo (extdeg);
1016  vminpoly= rootOf (MIPO);
1017  }
1018  Factorlist= Trager (f, Astar, vminpoly, as, isFunctionField);
1019  if (extdeg > 1)
1020  prune (vminpoly);
1021  return Factorlist;
1022  }
1023  }
1024  else // char 0
1025  {
1026  Variable vminpoly;
1027  Factorlist= Trager (f, Astar, vminpoly, as, isFunctionField);
1028  if (!isRat && getCharacteristic() == 0)
1029  Off (SW_RATIONAL);
1030  return Factorlist;
1031  }
1032 
1033  return CFFList (CFFactor(f,1));
1034 }
int level() const
Definition: variable.h:49
Variable mvar() const
mvar() returns the main variable of CO or Variable() if CO is in a base domain.
int ** merge(int **points1, int sizePoints1, int **points2, int sizePoints2, int &sizeResult)
int level(const CanonicalForm &f)
CFFList facAlgFunc2(const CanonicalForm &f, const CFList &as)
factorize a polynomial that is irreducible over the ground field modulo an extension given by an irre...
Definition: facAlgFunc.cc:902
void Off(int sw)
switches
CanonicalForm generateMipo(int degOfExt)
factory's class for variables
Definition: variable.h:32
static CFFList Trager(const CanonicalForm &F, const CFList &Astar, const Variable &vminpoly, const CFList &as, bool isFunctionField)
Trager's algorithm, i.e. convert to one field extension and factorize over this field extension...
Definition: facAlgFunc.cc:427
int getDegOfExt(IntList &degreelist, int n)
static int * multiplicity
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
factory's main class
Definition: canonicalform.h:72
List< CFFactor > CFFList
CF_NO_INLINE bool isZero() const
Definition: cf_inline.cc:372
CanonicalForm deriv() const
deriv() - return the formal derivation of CO.
int getCharacteristic()
Definition: cf_char.cc:51
Varlist varsInAs(const Varlist &uord, const CFList &Astar)
poly pp
Definition: myNF.cc:296
int level() const
level() returns the level of CO.
template List< Variable > Union(const List< Variable > &, const List< Variable > &)
static const int SW_RATIONAL
set to 1 for computations over Q
Definition: cf_defs.h:28
bool isInseparable(const CFList &Astar)
bool isOn(int sw)
switches
void On(int sw)
switches
int length() const
Definition: ftmpl_list.cc:273
int i
Definition: cfEzgcd.cc:123
void prune(Variable &alpha)
Definition: variable.cc:261
CanonicalForm alg_gcd(const CanonicalForm &fff, const CanonicalForm &ggg, const CFList &as)
Definition: facAlgFunc.cc:61
T & getItem() const
Definition: ftmpl_list.cc:431
Factor< CanonicalForm > CFFactor
T getLast() const
Definition: ftmpl_list.cc:309
Variable x
Definition: cfModGcd.cc:4023
void append(const T &)
Definition: ftmpl_list.cc:256
int degree(const CanonicalForm &f)
template List< Variable > Difference(const List< Variable > &, const List< Variable > &)
return result
Definition: facAbsBiFact.cc:76
Variable rootOf(const CanonicalForm &mipo, char name)
returns a symbolic root of polynomial with name name Use it to define algebraic variables ...
Definition: variable.cc:162
CFFList SteelTrager(const CanonicalForm &f, const CFList &AS)
algorithm of A. Steel described in "Conquering Inseparability: Primary decomposition and multivariate...
Definition: facAlgFunc.cc:756