Changeset 640e4c in git


Ignore:
Timestamp:
Apr 8, 2011, 5:40:29 PM (13 years ago)
Author:
Burcin Erocal <burcin@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
6dce0a2f79407a50343791008290059180184804
Parents:
0b301eb684d2361d4bbb42f05cd0cca8ee0ea520
Message:
Add new version of ncfactor.lib received from the authors on 29.03.2011.

git-svn-id: file:///usr/local/Singular/svn/trunk@14123 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
9 added
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/ncfactor.lib

    r0b301e r640e4c  
    2020
    2121PROCEDURES:
    22   facFirstWeyl(h);    factorization in the first Weyl algebra
    23   testNCfac(l[,h]);   tests factorizations from a given list for correctness
    24   facSubWeyl(h,X,D);  factorization in the first Weyl algebra as a subalgebra
    25   facFirstShift(h);   factorization in the first shift algebra
     22  facFirstWeyl(h);           factorization in the first Weyl algebra
     23  testNCfac(l[,h[,1]]);      tests factorizations from a given list for correctness
     24  facSubWeyl(h,X,D);         factorization in the first Weyl algebra as a subalgebra
     25  facFirstShift(h);          factorization in the first shift algebra
     26  homogfacFirstQWeyl(h);     [-1,1]-homogeneous factorization in the first Q-Weyl algebra
     27  homogfacFirstQWeyl_all(h); [-1,1] homogeneous factorization(complete) in the first Q-Weyl algebra
    2628";
    2729
     
    3032LIB "involut.lib";
    3133LIB "freegb.lib"; // for isVar
     34
     35proc tst_ncfactor()
     36{
     37  example facFirstWeyl;
     38  example facFirstShift;
     39  example facSubWeyl;
     40  example testNCfac;
     41  example homogfacFirstQWeyl;
     42  example homogfacFirstQWeyl_all;
     43}
    3244
    3345/////////////////////////////////////////////////////
     
    945957PURPOSE: compute all factorizations of a polynomial in the first Weyl algebra
    946958THEORY: Implements the new algorithm by A. Heinle and V. Levandovskyy, see the thesis of A. Heinle
    947 ASSUME: basering in the first Weyl algebra
     959ASSUME: basering is the first Weyl algebra
    948960NOTE: Every entry of the output list is a list with factors for one possible factorization.
    949961The first factor is always a constant (1, if no nontrivial constant could be excluded).
     
    10591071  if(homogwithorder(h,ivm11))
    10601072  {
    1061     dbprint(p,"==> Given polynomial is -1,1 homogeneous. Starting homog. fac. and ret. its result");
     1073    dbprint(p,"==> Given polynomial is -1,1 homogeneous. Start homog. fac. and ret. its result");
    10621074    return(homogfacFirstWeyl_all(h));
    10631075  }
     
    10971109    {//We have one factorization
    10981110      result = result + list(M[i]);
     1111      dbprint(p,"Result list updated:");
     1112      dbprint(p,result);
    10991113      M = delete(M,i);
    11001114      continue;
     
    12091223      {
    12101224        result = result + list(M[i]);
     1225  dbprint(p,"Result list updated:");
     1226        dbprint(p,result);
    12111227        M = delete(M,i);
    12121228        continue;
     
    15911607PURPOSE: compute all factorizations of a polynomial in the first shift algebra
    15921608THEORY: Implements the new algorithm by A. Heinle and V. Levandovskyy, see the thesis of A. Heinle
    1593 ASSUME: basering in the first shift algebra
     1609ASSUME: basering is the first shift algebra
    15941610NOTE: Every entry of the output list is a list with factors for one possible factorization.
    15951611EXAMPLE: example facFirstShift; shows examples
     
    17511767    {//We have one factorization
    17521768      result = result + list(M[i]);
     1769      dbprint(p,"Result list updated:");
     1770      dbprint(p,result);
    17531771      M = delete(M,i);
    17541772      continue;
     
    18701888      {
    18711889        result = result + list(M[i]);
     1890        dbprint(p,"Result list updated:");
     1891        dbprint(p,result);
    18721892        M = delete(M,i);
    18731893        continue;
     
    18901910    result = list(list(1,h));
    18911911  }//only the trivial factorization could be found
     1912  dbprint(p,"==> done");
    18921913  return(result);
    18931914}//proc facshift
     
    19721993//==================================================
    19731994//A function to get the i'th triangular number
    1974 proc triangNum(int n)
     1995static proc triangNum(int n)
    19751996{
    1976      if (n == 0)
    1977      {
    1978           return(0);
    1979      }
    1980      return (n*(n+1)/2);
     1997  if (n == 0)
     1998  {
     1999    return(0);
     2000  }
     2001  return (n*(n+1)/2);
    19812002}
    19822003
     
    19952016        variable. If k is positive, the last k entries will be x. The other
    19962017        entries will be irreducible polynomials of degree zero or 1 resp. -1.
    1997 SEE ALSO: homogfacFirstWeyl
     2018SEE ALSO: homogfacFirstWeyl, homogfacFirstQWeyl_all
    19982019"{//proc homogfacFirstQWeyl
    19992020  int p = printlevel-voice+2;//for dbprint
     
    20472068  dbprint(p,"==> Done");
    20482069  dbprint(p,"==> Mapping this monomials to K(q)[theta]");
    2049   def characteristic = ringlist(r)[1][1];
    2050   def qparameter      = ringlist(r)[1][2][1];
    2051   ring tempRing = (characteristic,q),(x,y,theta),dp; //TODO: How to map a parameter?
     2070  //Now, map to the commutative ring with theta:
     2071  list tempRingList = ringlist(r);
     2072  tempRingList[2] = insert(tempRingList[2],"theta",2); //New variable theta = x*d
     2073  tempRingList = delete(tempRingList,5);
     2074  tempRingList = delete(tempRingList,5); //The ring should now be commutative
     2075  def tempRing = ring(tempRingList);
    20522076  setring tempRing;
    2053   map thetamap = r,x,y;
     2077  map thetamap = r,var(1),var(2);
    20542078  list mons = thetamap(mons);
    20552079  poly entry;
     
    20572081  for (i = 1; i<=size(mons);i++)
    20582082  {//transforming the monomials as monomials in theta
    2059        entry = 1; //leadcoef(mons[i]) * q^(-triangNum(leadexp(mons[i])[2]-1));
     2083    entry = 1;//leadcoef(mons[i]) * q^(-triangNum(leadexp(mons[i])[2]-1));
    20602084    for (j = 0; j<leadexp(mons[i])[2];j++)
    20612085    {
    2062 //"j:";j;
    2063          tempSummand = (q^j-1)/(q-1);
    2064          entry = entry * theta-tempSummand*entry;
    2065     }
    2066 //~;
    2067  mons[i] = entry*leadcoef(mons[i]) * q^(-triangNum(leadexp(mons[i])[2]-1));
     2086      tempSummand = (par(1)^j-1)/(par(1)-1);
     2087      entry = entry * theta-tempSummand*entry;
     2088    }
     2089    //entry;
     2090    //leadcoef(mons[i]) * q^(-triangNum(leadexp(mons[i])[2]-1));
     2091    mons[i] = entry*leadcoef(mons[i]) * par(1)^(-triangNum(leadexp(mons[i])[2]-1));
    20682092  }//transforming the monomials as monomials in theta
    20692093  dbprint(p,"==> Done");
     
    21022126  //Correction of the result in the special q-Case:
    21032127  for (j = 2 ; j<= size(result);j++)
    2104   {//Divide the whole Term by the leading coefficient and multiply it to the first entry in result[i]
    2105        result[1] = result[1] * leadcoef(result[j]);
    2106        result[j] = 1/leadcoef(result[j]) * result[j];
    2107   }//Divide the whole Term by the leading coefficient and multiply it to the first entry in result[i]
     2128  {//Div the whole Term by the leading coefficient and multiply it to the first entry in result[i]
     2129    result[1] = result[1] * leadcoef(result[j]);
     2130    result[j] = 1/leadcoef(result[j]) * result[j];
     2131  }//Div the whole Term by the leading coefficient and multiply it to the first entry in result[i]
    21082132  return(result);
    21092133}//proc homogfacFirstQWeyl
     2134example
     2135{
     2136  "EXAMPLE:";echo=2;
     2137  ring R = (0,q),(x,d),dp;
     2138  def r = nc_algebra (q,1);
     2139  setring(r);
     2140  poly h = q^25*x^10*d^10+q^16*(q^4+q^3+q^2+q+1)^2*x^9*d^9+
     2141           q^9*(q^13+3*q^12+7*q^11+13*q^10+20*q^9+26*q^8+30*q^7+
     2142           31*q^6+26*q^5+20*q^4+13*q^3+7*q^2+3*q+1)*x^8*d^8+
     2143           q^4*(q^9+2*q^8+4*q^7+6*q^6+7*q^5+8*q^4+6*q^3+
     2144     4*q^2+2q+1)*(q^4+q^3+q^2+q+1)*(q^2+q+1)*x^7*d^7+
     2145           q*(q^2+q+1)*(q^5+2*q^4+2*q^3+3*q^2+2*q+1)*(q^4+q^3+q^2+q+1)*(q^2+1)*(q+1)*x^6*d^6+
     2146           (q^10+5*q^9+12*q^8+21*q^7+29*q^6+33*q^5+31*q^4+24*q^3+15*q^2+7*q+12)*x^5*d^5+
     2147           6*x^3*d^3+24;
     2148  homogfacFirstQWeyl(h);
     2149}
    21102150
    21112151
     
    21142154//Computes all possible homogeneous factorizations for an element in the first Q-Weyl Algebra
    21152155proc homogfacFirstQWeyl_all(poly h)
    2116 "USAGE: homogfacFirstWWeyl_all(h); h is a homogeneous polynomial in the first q-Weyl algebra
     2156"USAGE: homogfacFirstQWeyl_all(h); h is a homogeneous polynomial in the first q-Weyl algebra
    21172157        with respect to the weight vector [-1,1]
    21182158RETURN: list
     
    21252165        the first q-Weyl algebra, the permutations of this element with the other
    21262166        entries will also be computed.
    2127 SEE ALSO: homogfacFirstWeyl
     2167SEE ALSO: homogfacFirstQWeyl
    21282168"{//proc HomogfacFirstQWeylAll
    21292169  int p=printlevel-voice+2;//for dbprint
     
    21822222  {//list_not_azero is not empty
    21832223    list_not_azero =
    2184       one_hom_fac[(size(one_hom_fac)-absValue(deg(h,ivm11))+1)..size(one_hom_fac)];
     2224    one_hom_fac[(size(one_hom_fac)-absValue(deg(h,ivm11))+1)..size(one_hom_fac)];
    21852225    is_list_not_azero_empty = 0;
    21862226  }//list_not_azero is not empty
    21872227  //Map list_azero in K[theta]
    21882228  dbprint(p,"==> Map list_azero to K[theta]");
    2189   def characteristic = ringlist(r)[1][1];
    2190   def qparameter      = ringlist(r)[1][2][1];
    2191   ring tempRing = (characteristic,q),(x,y,theta),dp; //TODO: How to map a parameter?
     2229  //Now, map to the commutative ring with theta:
     2230  list tempRingList = ringlist(r);
     2231  tempRingList[2] = insert(tempRingList[2],"theta",2); //New variable theta = x*d
     2232  tempRingList = delete(tempRingList,5);
     2233  tempRingList = delete(tempRingList,5); //The ring should now be commutative
     2234  def tempRing = ring(tempRingList);
    21922235  setring(tempRing);
    21932236  poly entry;
    2194   map thetamap = r,x,y;
     2237  map thetamap = r,var(1),var(2);
    21952238  if(!is_list_not_azero_empty)
    21962239  {//Mapping in Singular is only possible, if the list before
     
    22172260    for (j = 1 ; j<=size(tempmons);j++)
    22182261    {
    2219          //entry = leadcoef(tempmons[j]);
    2220          entry = leadcoef(tempmons[j]) * q^(-triangNum(leadexp(tempmons[j])[2]-1));
     2262      //entry = leadcoef(tempmons[j]);
     2263      entry = leadcoef(tempmons[j]) * par(1)^(-triangNum(leadexp(tempmons[j])[2]-1));
    22212264      for (k = 0; k < leadexp(tempmons[j])[2];k++)
    22222265      {
    2223            entry = entry*(theta-(q^k-1)/(q-1));
     2266        entry = entry*(theta-(par(1)^k-1)/(par(1)-1));
    22242267      }
    22252268      tempmons[j] = entry;
     
    22572300        else
    22582301        {
    2259              if (shift < 0)
    2260              {//We have two distict formulas for x and y. In this case use formula for y
    2261                   if (shift == -1)
    2262                   {
    2263                        result[i][j] = subst(result[i][j],theta,1/q*(theta - 1));
    2264                   }
    2265                   else
    2266                   {
    2267                        result[i][j] = subst(result[i][j],theta,1/q*((theta - 1)/q^(absValue(shift)-1) - (q^(shift +2)-q)/(1-q)));
    2268                   }
    2269              }//We have two distict formulas for x and y. In this case use formula for y
    2270              if (shift > 0)
    2271              {//We have two distict formulas for x and y. In this case use formula for x
    2272                   if (shift == 1)
    2273                   {
    2274                        result[i][j] = subst(result[i][j],theta,q*theta + 1);
    2275                   }
    2276                   else
    2277                   {
    2278                        result[i][j] = subst(result[i][j],theta,q^shift*theta+(q^shift-1)/(q-1));
    2279                   }
    2280              }//We have two distict formulas for x and y. In this case use formula for x
     2302          if (shift < 0)
     2303          {//We have two distict formulas for x and y. In this case use formula for y
     2304            if (shift == -1)
     2305            {
     2306              result[i][j] = subst(result[i][j],theta,1/par(1)*(theta - 1));
     2307            }
     2308            else
     2309            {
     2310              result[i][j] =
     2311                subst(result[i][j],
     2312                  theta,
     2313                  1/par(1)*((theta - 1)/par(1)^(absValue(shift)-1)
     2314                    - (par(1)^(shift +2)-par(1))/(1-par(1))));
     2315            }
     2316          }//We have two distict formulas for x and y. In this case use formula for y
     2317          if (shift > 0)
     2318          {//We have two distict formulas for x and y. In this case use formula for x
     2319            if (shift == 1)
     2320            {
     2321              result[i][j] = subst(result[i][j],theta,par(1)*theta + 1);
     2322            }
     2323            else
     2324            {
     2325              result[i][j] =
     2326                subst(result[i][j],
     2327                theta,par(1)^shift*theta+(par(1)^shift-1)/(par(1)-1));
     2328            }
     2329          }//We have two distict formulas for x and y. In this case use formula for x
    22812330        }
    22822331      }
     
    23162365        break;
    23172366      }//the jth entry is theta and can be written as x*y
    2318       if(result[i][j] == q*theta +1)
     2367      if(result[i][j] == par(1)*theta +1)
    23192368      {
    23202369        thetapos = j;
     
    23592408        if (shift_sign<0)
    23602409        {
    2361              leftpart[j] = subst(leftpart[j-1],theta, 1/q*(theta +shift_sign));
     2410          leftpart[j] = subst(leftpart[j-1],theta, 1/par(1)*(theta +shift_sign));
    23622411        }
    23632412        if (shift_sign>0)
    23642413        {
    2365              leftpart[j] = subst(leftpart[j-1],theta, q*theta + shift_sign);
     2414          leftpart[j] = subst(leftpart[j-1],theta, par(1)*theta + shift_sign);
    23662415        }
    23672416        leftpart[j-1] = shiftvar;
     
    23922441        if (shift_sign<0)
    23932442        {
    2394              rightpart[j] = subst(rightpart[j+1], theta, q*theta - shift_sign);
     2443          rightpart[j] = subst(rightpart[j+1], theta, par(1)*theta - shift_sign);
    23952444        }
    23962445        if (shift_sign>0)
    23972446        {
    2398              rightpart[j] = subst(rightpart[j+1], theta, 1/q*(theta - shift_sign));
     2447          rightpart[j] = subst(rightpart[j+1], theta, 1/par(1)*(theta - shift_sign));
    23992448        }
    24002449        rightpart[j+1] = shiftvar;
     
    24312480  return(result);
    24322481}//proc HomogfacFirstQWeylAll
     2482example
     2483{
     2484  "EXAMPLE:";echo=2;
     2485  ring R = (0,q),(x,d),dp;
     2486  def r = nc_algebra (q,1);
     2487  setring(r);
     2488  poly h = q^25*x^10*d^10+q^16*(q^4+q^3+q^2+q+1)^2*x^9*d^9+
     2489           q^9*(q^13+3*q^12+7*q^11+13*q^10+20*q^9+26*q^8+30*q^7+
     2490           31*q^6+26*q^5+20*q^4+13*q^3+7*q^2+3*q+1)*x^8*d^8+
     2491           q^4*(q^9+2*q^8+4*q^7+6*q^6+7*q^5+8*q^4+6*q^3+
     2492           4*q^2+2q+1)*(q^4+q^3+q^2+q+1)*(q^2+q+1)*x^7*d^7+
     2493           q*(q^2+q+1)*(q^5+2*q^4+2*q^3+3*q^2+2*q+1)*(q^4+q^3+q^2+q+1)*(q^2+1)*(q+1)*x^6*d^6+
     2494           (q^10+5*q^9+12*q^8+21*q^7+29*q^6+33*q^5+31*q^4+24*q^3+15*q^2+7*q+12)*x^5*d^5+
     2495           6*x^3*d^3+24;
     2496  homogfacFirstQWeyl_all(h);
     2497}
    24332498
    24342499//TODO: FirstQWeyl check the parameters...
     
    24522517def l= facFirstWeyl (a); l;
    24532518kill l;
    2454 poly b = -5328z8x5-5328z7x6+720z9x2+720z8x3-16976z7x4-38880z6x5-5184z7x3-5184z6x4-3774z5x5+2080z8x+5760z7x2-6144z6x3-59616z5x4+3108z3x6-4098z6x2-25704z5x3-21186z4x4+8640z6x-17916z4x3+22680z2x5+2040z5x-4848z4x2-9792z3x3+3024z2x4-10704z3x2-3519z2x3+34776zx4+12096zx3+2898x4-5040z2x+8064x3+6048x2; //Abgebrochen nach 1.5 Stunden; seems to be very complicated
     2519poly b = -5328z8x5-5328z7x6+720z9x2+720z8x3-16976z7x4-38880z6x5
     2520-5184z7x3-5184z6x4-3774z5x5+2080z8x+5760z7x2-6144z6x3-59616z5x4
     2521+3108z3x6-4098z6x2-25704z5x3-21186z4x4+8640z6x-17916z4x3+22680z2x5
     2522+2040z5x-4848z4x2-9792z3x3+3024z2x4-10704z3x2-3519z2x3+34776zx4
     2523+12096zx3+2898x4-5040z2x+8064x3+6048x2; //Abgebrochen nach 1.5 Stunden;seems to be very complicated
    24552524def l= facFirstWeyl (b); l;
    24562525
  • Tst/Long/ok_l.lst

    r0b301e r640e4c  
    3939mre
    4040mre_nonhom
     41ncfactor_tsai_l
    4142paraplan
    4243pAdd0L_l
  • Tst/Short/ok_s.lst

    r0b301e r640e4c  
    171171; mpsr_s
    172172mres_s
     173ncfactor_example_all_procedures_s
     174ncfactor_inhomog_s
    173175normal
    174176paraplan_s
Note: See TracChangeset for help on using the changeset viewer.