Changeset 868c93d in git


Ignore:
Timestamp:
Feb 13, 2019, 4:43:24 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '3720ae8bfcff4a4649ee98a15552089151d2d59b')
Children:
e26df3f314b9946ffef7f945cbe5c66517600b92
Parents:
4063070e6e1a1e17016b69b4af52ab449f9bde45d669f7b103e531e130535f2141dd1d77cfa31a81
Message:
Merge branch 'threadsupport' of https://github.com/rbehrends/Singular into t
Files:
5 added
3 deleted
50 edited
2 moved

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    rd669f7 r868c93d  
    1515
    1616KEYWORDS: finitely presented algebra; Letterplace Groebner basis; K-basis; K-dimension; Hilbert series
    17 
    18 PROCEDURES:
    19 lpKDimCheck(G);            checks whether the K-dimension of A/<G> is finite
    20 lpKDim(G[,d,n]);           computes the K-dimension of A/<G>
    21 lpMonomialBasis(d, donly, J); computes a list of monomials not contained in J
    22 lpHilbert(G[,d,n]);        computes the truncated Hilbert series of A/<G>
    23 lpSickleDim(G[,d,n]);      computes the mistletoes and the K-dimension of A/<G>
    2417
    2518NOTE:
     
    7366[Stu] G. Studzinski: Dimension computations in non-commutative,
    7467associative algebras, Diploma thesis, RWTH Aachen, 2010.
     68
     69PROCEDURES:
     70lpKDimCheck(G);            checks whether the K-dimension of A/<G> is finite
     71lpKDim(G[,d,n]);           computes the K-dimension of A/<G>
     72lpMonomialBasis(d, donly, J); computes a list of monomials not contained in J
     73lpHilbert(G[,d,n]);        computes the truncated Hilbert series of A/<G>
     74lpSickleDim(G[,d,n]);      computes the mistletoes and the K-dimension of A/<G>
    7575
    7676SEE ALSO: freegb_lib, fpaprops_lib, ncHilb_lib
  • Singular/LIB/fpalgebras.lib

    rd669f7 r868c93d  
    7878RETURN:  ideal
    7979ASSUME: basering has a letterplace ring structure and
    80 @*          A is a generalized Cartan matrix with integer entries
     80        A is a generalized Cartan matrix with integer entries
    8181PURPOSE: compute the ideal of Serre's relations associated to A
    8282EXAMPLE: example serreRelations; shows examples
     
    145145RETURN:  ring (and ideal)
    146146PURPOSE: compute the inhomogeneous Serre's relations associated to A in given
    147 @*       variable names
     147         variable names
    148148ASSUME: three ideals in the input are of the same sizes and contain merely
    149 @* variables which are interpreted as follows: N resp. P stand for negative
    150 @* resp. positive roots, C stand for Cartan elements. d is the degree bound for
    151 @* letterplace ring, which will be returned.
    152 @* The matrix A is a generalized Cartan matrix with integer entries
    153 @* The result is the ideal called 'fsRel' in the returned ring.
     149  variables which are interpreted as follows: N resp. P stand for negative
     150  resp. positive roots, C stand for Cartan elements. d is the degree bound for
     151  letterplace ring, which will be returned.
     152  The matrix A is a generalized Cartan matrix with integer entries
     153  The result is the ideal called 'fsRel' in the returned ring.
    154154EXAMPLE: example fullSerreRelations; shows examples
    155155"
     
    363363RETURN:  ring (and exports ideal)
    364364PURPOSE: compute the ideal of Adem relations for i<2j in characteristic 0
    365 @*  the ideal is exported under the name AdemRel in the output ring
     365    the ideal is exported under the name AdemRel in the output ring
    366366EXAMPLE: example ademRelations; shows examples
    367367"
  • Singular/LIB/fpaprops.lib

    rd669f7 r868c93d  
    5555"USAGE: lpNoetherian(G); G an ideal in a Letterplace ring
    5656RETURN: int
    57 @*      0 not Noetherian
    58 @*      1 left Noetherian
    59 @*      2 right Noetherian
    60 @*      3 Noetherian
    61 @*      4 weak Noetherian
     57      0 not Noetherian
     58      1 left Noetherian
     59      2 right Noetherian
     60      3 Noetherian
     61      4 weak Noetherian
    6262PURPOSE: Check whether the monomial algebra A/<LM(G)> is (left/right) noetherian
    6363ASSUME: - basering is a Letterplace ring
    64 @*      - G is a Groebner basis
     64      - G is a Groebner basis
    6565THEORY: lpNoetherian works with the monomial algebra A/<LM(G)>.
    6666If it gives an affirmative answer for one of the properties, then it
     
    644644start. The parameter visited, cyclic and path should be 0.
    645645RETURN: int
    646 @*:     Maximal number of distinct cycles
     646     Maximal number of distinct cycles
    647647PURPOSE: Calculate the maximal number of distinct cycles in a single path starting at v
    648648ASSUME: Basering is a Letterplace ring
     
    730730proc lpUfGraph(ideal G, list #)
    731731"USAGE: lpUfGraph(G); G a set of monomials in a letterplace ring.
    732 @*      lpUfGraph(G,1); G a set of monomials in a letterplace ring.
    733732RETURN: intmat or list
    734733NOTE: lpUfGraph(G); returns intmat. lpUfGraph(G,1); returns list L with L[1] an intmat and L[2] an ideal.
     
    882881RETURN: int
    883882PURPOSE: Determines the Gelfand Kirillov dimension of A/<G>
    884 @*       -1 means positive infinite
     883       -1 means positive infinite
    885884ASSUME: - basering is a Letterplace ring
    886 @*      - G is a Groebner basis
     885      - G is a Groebner basis
    887886"
    888887{
  • Singular/LIB/freegb.lib

    rd669f7 r868c93d  
    2323
    2424PROCEDURES:
    25 freeAlgebra(r, d);               creates a Letterplace ring out of given data
    2625isFreeAlgebra(r);                check whether r is a letterplace ring (free algebra)
    2726lpDegBound(R);                   returns the degree bound of a letterplace ring
    2827lpVarBlockSize(R);               returns the size of the letterplace blocks
    29 
    30 letplaceGBasis(I);               (deprecated, use twostd) two-sided Groebner basis of a letterplace ideal I
    31 
    3228lpDivision(f,I);                 two-sided division with remainder
    3329lpGBPres2Poly(L,I);              reconstructs a polynomial from the output of lpDivision
    34 
    35 lieBracket(a,b[, N]);            Lie bracket ab-ba of two letterplace polynomials
    3630isOrderingShiftInvariant(i);     tests shift-invariance of the monomial ordering
    37 isVar(p);                        check whether p is a power of a single variable
    38 
    39 lpLmDivides(ideal I, poly p);    tests whether there exists q in I, such that LM(q)|LM(p)
    40 lpVarAt(poly p, int pos);        returns the variable (as a poly) at position pos of the poly p
    41 
    4231makeLetterplaceRing(d);          (deprecated, use freeAlgebra) creates a Letterplace ring out of given data
     32letplaceGBasis(I);               (deprecated, use twostd) two-sided Groebner basis of a letterplace ideal I
     33lieBracket(a,b[, N]);            (deprecated, use bracket) Lie bracket ab-ba of two letterplace polynomials
    4334setLetterplaceAttributes(R,d,b); (for testing purposes) supplies ring R with the letterplace structure
    4435
     
    6253
    6354LIB "qhmoduli.lib"; // for Max
    64 LIB "bfun.lib"; // for inForm
    65 LIB "fpadim.lib"; // for intvec conversion
    6655LIB "fpalgebras.lib"; // for compatibility
    6756
     
    8271  example lieBracket;
    8372  example lpPrint;
    84   example isVar;
    85 
    86   example lpLmDivides;
    87   example lpVarAt;
    8873
    8974  example ivL2lpI;
     
    10085RETURN: ring with special attributes set
    10186PURPOSE: sets attributes for a letterplace ring:
    102 @*      'isLetterplaceRing' = true, 'uptodeg' = d, 'lV' = b, where
    103 @*      'uptodeg' stands for the degree bound,
    104 @*      'lV' for the number of variables in the block 0.
     87  'isLetterplaceRing' = true, 'uptodeg' = d, 'lV' = b, where
     88  'uptodeg' stands for the degree bound,
     89  'lV' for the number of variables in the block 0.
    10590NOTE: Activate the resulting ring by using @code{setring}
    10691"
     
    336321}
    337322
    338 proc isVar(poly p)
     323static proc isVar(poly p)
    339324"USAGE:  isVar(p);  poly p
    340325RETURN:  int
    341326PURPOSE: check, whether leading monomial of p is a power of a single variable
    342 @* from the basering. Returns the exponent or 0 if p is multivariate.
     327  from the basering. Returns the exponent or 0 if p is multivariate.
    343328EXAMPLE: example isVar; shows examples
    344329"
     
    380365}
    381366
    382 proc lpLmDivides(ideal I, poly p)
    383 "USAGE: lpLmDivides(I); I an ideal
    384 RETURN: boolean
    385 ASSUME: basering is a Letterplace ring
    386 PURPOSE: tests if there is a polynomial q in I with LM(q)|LM(p)
    387 EXAMPLE: example lpLmDivides; shows examples
    388 "
    389 {
    390   ERROR(" freegb.so not loaded");
    391 }
    392 example
    393 {
    394   "EXAMPLE:"; echo = 2;
    395   ring r = 0,(x,y),dp;
    396   def R = freeAlgebra(r, 5);
    397   setring R;
    398   poly p = x*y*y;
    399   lpLmDivides(y*y, p);
    400   lpLmDivides(y*x, p);
    401   lpLmDivides(ideal(y*y, y*x), p);
    402 }
    403 
    404 proc lpVarAt(poly p, int pos)
    405 "USAGE: lpVarAt(p, pos); p a poly, pos an int
    406 RETURN: poly
    407 ASSUME: basering is a Letterplace ring
    408 PURPOSE: returns the variable (as a poly) at position pos of the poly p
    409 EXAMPLE: example lpVarAt; shows examples
    410 "
    411 {
    412   ERROR(" freegb.so not loaded");
    413 }
    414 example
    415 {
    416   "EXAMPLE:"; echo = 2;
    417   ring r = 0,(x,y),dp;
    418   def R = freeAlgebra(r, 5);
    419   setring R;
    420   poly p = y*y*x;
    421   lpVarAt(p, 3);
    422 }
    423 
    424367proc letplaceGBasis(def I)
    425368"USAGE: letplaceGBasis(I);  I an ideal/module
    426369RETURN: ideal/module
    427 ASSUME: basering is a Letterplace ring, input consists of Letterplace
    428 @*      polynomials
    429 PURPOSE: compute the two-sided Groebner basis of I via Letterplace
    430 @*       algorithm (legacy routine)
     370ASSUME: basering is a Letterplace ring, input consists of Letterplace polynomials
     371PURPOSE: compute the two-sided Groebner basis of I via Letterplace algorithm (legacy routine)
    431372NOTE: the degree bound for this computation is read off the letterplace
    432 @*    structure of basering
     373      structure of basering
    433374EXAMPLE: example letplaceGBasis; shows examples
    434375"
     
    469410PURPOSE:compute the Lie bracket [a,b] = ab - ba between letterplace polynomials
    470411NOTE: if N>1 is specified, then the left normed bracket [a,[...[a,b]]]] is
    471 @*    computed.
     412computed.
    472413EXAMPLE: example lieBracket; shows examples
    473414"
    474415{
    475   if (lpAssumeViolation())
    476   {
    477     //    ERROR("Either 'uptodeg' or 'lV' global variables are not set!");
    478     ERROR("Incomplete Letterplace structure on the basering!");
    479   }
    480   // alias ppLiebr;
    481   //if int N is given compute [a,[...[a,b]]]] left normed bracket
    482416  int N=1;
    483417  if (size(#)>0)
     
    488422    }
    489423  }
    490   if (N<=0) { return(q); }
    491   poly q = a*b - b*a;
    492   if (N >1)
    493   {
    494     for(int i=1; i<=N-1; i++)
    495     {
    496       q = lieBracket(a,q);
    497     }
    498   }
    499   return(q);
     424  return (bracket(a,b,N));
     425
     426  /* if (lpAssumeViolation()) */
     427  /* { */
     428  /*   //    ERROR("Either 'uptodeg' or 'lV' global variables are not set!"); */
     429  /*   ERROR("Incomplete Letterplace structure on the basering!"); */
     430  /* } */
     431  /* // alias ppLiebr; */
     432  /* //if int N is given compute [a,[...[a,b]]]] left normed bracket */
     433  /* int N=1; */
     434  /* if (size(#)>0) */
     435  /* { */
     436  /*   if (typeof(#[1])=="int") */
     437  /*   { */
     438  /*     N = int(#[1]); */
     439  /*   } */
     440  /* } */
     441  /* if (N<=0) { return(q); } */
     442  /* poly q = a*b - b*a; */
     443  /* if (N >1) */
     444  /* { */
     445  /*   for(int i=1; i<=N-1; i++) */
     446  /*   { */
     447  /*     q = lieBracket(a,q); */
     448  /*   } */
     449  /* } */
     450  /* return(q); */
    500451}
    501452example
     
    566517RETURN:  ring
    567518ASSUME: L has a special form. Namely, it is a list of modules, where
    568 
    569519 - each generator of every module stands for a monomial times coefficient in
    570 @* free algebra,
    571 
     520   free algebra,
    572521 - in such a vector generator, the 1st entry is a nonzero coefficient from the
    573 @* ground field
    574 
     522   ground field
    575523 - and each next entry hosts a variable from the basering.
    576524PURPOSE: compute the two-sided Groebner basis of an ideal, encoded by L
    577 @* in the free associative algebra, up to degree d
     525  in the free associative algebra, up to degree d
    578526NOTE: Apply @code{lst2str} to the output in order to obtain a better readable
    579 @*    presentation
     527   presentation
    580528EXAMPLE: example freeGBasis; shows examples
    581529"
     
    10541002  def R = freeAlgebra(r, 7);
    10551003  isFreeAlgebra(R);
    1056 }
    1057 
    1058 proc freeAlgebra(def r, int d)
    1059 "USAGE:  freeAlgebra(r, d); r a ring, d an integer
    1060 RETURN:  ring
    1061 PURPOSE: creates a letterplace ring with the ordering of r
    1062 EXAMPLE: example freeAlgebra; shows examples
    1063 "
    1064 {
    1065   ERROR(" freegb.so not loaded");
    1066 }
    1067 example
    1068 {
    1069   "EXAMPLE:"; echo = 2;
    1070   ring r = 0,(x,y,z),dp;
    1071   def R = freeAlgebra(r, 7);
    1072   R;
    1073   ring r2 = 0,(x,y,z),lp;
    1074   def R2 = freeAlgebra(r2, 7);
    1075   R2;
    10761004}
    10771005
     
    32313159RETURN: int
    32323160NOTE: Tests whether the ordering of the current ring is shift invariant, which is the case, when LM(p) > LM(p') for all p and p' where p' is p shifted by any number of places.
    3233 @*      If withHoles != 0 even Letterplace polynomials with holes (eg. x(1)*y(4)) are considered.
     3161
     3162If withHoles != 0 even Letterplace polynomials with holes (eg. x(1)*y(4)) are considered.
    32343163ASSUME: - basering is a Letterplace ring.
    32353164"
     
    38863815static proc mod_init()
    38873816{
    3888   LIB"freegb.so";
    3889 }
     3817  LIB"freealgebra.so";
     3818}
  • Singular/LIB/ncfactor.lib

    rd669f7 r868c93d  
    11///////////////////////////////////////////////////////////
    2 version="version ncfactor.lib 4.1.1.0 Jan_2018 "; // $Id$
     2version="version ncfactor.lib 4.0.0.0 _2017 "; //$Id$
    33category="Noncommutative";
    44info="
    55LIBRARY: ncfactor.lib  Tools for factorization in some noncommutative algebras
    6 AUTHORS: Albert Heinle,     aheinle@uwaterloo.ca
    7 @*       Viktor Levandovskyy,     levandov@math.rwth-aachen.de
    8 
    9 OVERVIEW: New methods for factorization on polynomials
    10   are implemented for three types of algebras, all generated by
    11    2*n, n in NN, generators (n'th Weyl, n'th shift and graded polynomials in n'th q-Weyl algebras)
    12    over a field K.
     6AUTHORS: Albert Heinle,     aheinle at uwaterloo.ca
     7@*       Viktor Levandovskyy,     levandov at math.rwth-aachen.de
     8
     9OVERVIEW: In this library, new methods for factorization on polynomials
     10@* are implemented for several types of algebras, namely
     11@* - finitely presented (and also free) associative algebras (Letterplace subsystem)
     12@* - G-algebras (Plural subsystem), including (q)-Weyl and (q)-shift algebras in 2n variables
     13@* The determination of the best algorithm available for users input is done
     14@* automatically in the procedure ncfactor().
     15
    1316@* More detailled description of the algorithms and related publications can be found at
    14    @url{https://cs.uwaterloo.ca/\~aheinle/}.
     17@url{https://cs.uwaterloo.ca/\~aheinle/}.
    1518
    1619PROCEDURES:
    17   ncfactor(h);               Factorization in any G-algebra.
     20  ncfactor(h);               Factorization in any finitely presented algebra (incl. G-algebra)
    1821  facWeyl(h);                Factorization in the n'th Weyl algebra
    1922  facFirstWeyl(h);           Factorization in the first Weyl algebra
     
    3740LIB "solve.lib"; //for solve
    3841LIB "poly.lib"; //for content
     42LIB "fpadim.lib"; //for letterplace
    3943
    4044proc tst_ncfactor()
     
    128132  }
    129133  print("Successful.");
    130   print("Testing Min");
    131   if (!test_Min())
    132   {
    133     ERROR("Min is not working properly.");
    134   }
    135   print("Successful.");
    136134  print("Testing isListEqual");
    137135  if (!test_isListEqual())
     
    410408  }
    411409  print("Successful.");
    412   print("Testing delete_duplicates_noteval_and_sort");
     410  print("Testing getMaxDegreeVecLetterPlace");
     411  if(!test_getMaxDegreeVecLetterPlace())
     412  {
     413    ERROR("getMaxDegreeVecLetterPlace is not working properly.");
     414  }
     415  print("Successful.");
     416  print("Testing wordsWithMaxAppearance");
     417  if(!test_wordsWithMaxAppearance())
     418  {
     419    ERROR("wordsWithMaxAppearance is not working properly.");
     420  }
     421  print("Successful.");
     422  print("Testing monsSmallerThanLetterPlace");
     423  if(!test_monsSmallerThanLetterPlace())
     424  {
     425    ERROR("monsSmallerThanLetterPlace is not working properly.");
     426  }
     427  print("Successful.");
     428  print("Testing ncfactor_letterplace_poly_s");
     429  if(!test_ncfactor_letterplace_poly_s())
     430  {
     431    ERROR("ncfactor_letterplace_poly_s is not working properly.");
     432  }
     433  print("Successful.");
     434  print("Testing ncfactor_without_opt_letterplace");
     435  if(!test_ncfactor_without_opt_letterplace())
     436  {
     437    ERROR("ncfactor_without_opt_letterplace is not working properly.");
     438  }
     439  print("Successful.");
    413440  print("All tests ran successfully.");
    414441}
     
    20412068  return(result);
    20422069}//testing increment_intvec
    2043 
    2044 
    2045 //I know that Singular has this function in the package
    2046 //qhmoduli.lib. But I don't see the reason why I should clutter my
    2047 //namespace with functions to study Moduli Spaces of
    2048 //Semi-Quasihomogeneous Singularities (in case somebody wonders)
    2049 static proc Min(def lst)
    2050 "USAGE: Min(lst); list is an iterable element (list/ideal/intvec)
    2051         containing ordered elements.
    2052 PURPOSE: returns the minimal element in lst
    2053 ASSUME: lst contains at least one element
    2054 "{//proc Min
    2055   def minElem = lst[1];
    2056   int i;
    2057   for (i = 2; i<=size(lst);i++)
    2058   {
    2059     if (lst[i]<minElem)
    2060     {
    2061       minElem = lst[i];
    2062     }
    2063   }
    2064   return (minElem);
    2065 }//proc Min
    2066 
    2067 
    2068 static proc test_Min()
    2069 {//Testing Min
    2070   int result = 1;
    2071   //Test 1: One element list
    2072   int expected= 1;
    2073   int obtained = Min(list(1));
    2074   if (expected!=obtained)
    2075   {
    2076     print("Test 1 for Min failed.");
    2077     print("Expected:\n");
    2078     print(expected);
    2079     print("obtained:\n");
    2080     print(obtained);
    2081     result = 0;
    2082   }
    2083   //Test 2: Two element list, first one is Min
    2084   expected = 5;
    2085   obtained = Min(list(5,8));
    2086   if (expected!=obtained)
    2087   {
    2088     print("Test 2 for Min failed.");
    2089     print("Expected:\n");
    2090     print(expected);
    2091     print("obtained:\n");
    2092     print(obtained);
    2093     result = 0;
    2094   }
    2095   //Test 3: Two element list, second one is Min
    2096   expected = 5;
    2097   obtained = Min(list(8,5));
    2098   if (expected!=obtained)
    2099   {
    2100     print("Test 3 for Min failed.");
    2101     print("Expected:\n");
    2102     print(expected);
    2103     print("obtained:\n");
    2104     print(obtained);
    2105     result = 0;
    2106   }
    2107   //Test 4: A lot of elements, Min randomly in between.
    2108   expected = -11;
    2109   obtained = Min(list(5,8,7,2,8,0,-11,0,25));
    2110   if (expected!=obtained)
    2111   {
    2112     print("Test 4 for Min failed.");
    2113     print("Expected:\n");
    2114     print(expected);
    2115     print("obtained:\n");
    2116     print(obtained);
    2117     result = 0;
    2118   }
    2119   return(result);
    2120 }//Testing Min
    2121 
    21222070
    21232071static proc isListEqual(list l1, list l2)
     
    33403288"
    33413289{//isInCommutativeSubRing
     3290  int i; int j; int k;
     3291  intvec tempIntVec;
     3292  int previouslyEncounteredVar = -1;
     3293  if ( attrib(basering, "isLetterplaceRing") >= 1)
     3294  {//separate department: letterplace case
     3295    for (i = 1; i<=size(h); i++)
     3296    {//iterating over the monomials of h
     3297      tempIntVec = lp2iv(h[i]);
     3298      if (size(tempIntVec) > 1)
     3299      {//nontrivial monomial
     3300    j = tempIntVec[1];
     3301    if (previouslyEncounteredVar != -1 and j != previouslyEncounteredVar)
     3302    {//In this case, the previously encountered var is not equal to this one
     3303      return(0);
     3304    }//In this case, the previously encountered var is not equal to this one
     3305    previouslyEncounteredVar = j;
     3306    for (k = 2; k <= size(tempIntVec); k++)
     3307    {//checking if each entry in the intvec is the same
     3308      if (tempIntVec[k]!=j)
     3309      {//more than one variable in monomial
     3310        return(0);
     3311      }//more than one variable in monomial
     3312    }//checking if each entry in the intvec is the same
     3313      }//nontrivial monomial
     3314      else
     3315      {i++; continue;}
     3316    }//iterating over the monomials of h
     3317    return(1);
     3318  }//separate department: letterplace case
    33423319  list tempRingList = ringlist(basering);
    33433320  if (size(tempRingList)<=4)
     
    33463323  }//In this case, the given ring was commutative
    33473324  list appearing_variables;
    3348   int i; int j;
    33493325  intvec degreeIntVec;
    33503326  for (i = 1; i<=nvars(basering);i++)
     
    34263402  {
    34273403    print("Test 4 for isInCommutativeSubRing failed.");
     3404    print("Expected:\n");
     3405    print(expected);
     3406    print("obtained:\n");
     3407    print(obtained);
     3408    result = 0;
     3409  }
     3410  return(result);
     3411  //Test 5: Letterplace ring, negative example
     3412  ring r2 = 0,(x,y,z),dp;
     3413  int d =4; // degree bound
     3414  def R2 = makeLetterplaceRing(d);
     3415  setring R2;
     3416  expected = 0;
     3417  obtained = isInCommutativeSubRing(x + y);
     3418  if (expected !=obtained)
     3419  {
     3420    print("Test 5 for isInCommutativeSubRing failed.");
     3421    print("Expected:\n");
     3422    print(expected);
     3423    print("obtained:\n");
     3424    print(obtained);
     3425    result = 0;
     3426  }
     3427  //Test 6: Letterplace ring, positive example
     3428  expected = 1;
     3429  obtained = isInCommutativeSubRing(x + x*x);
     3430  if (expected !=obtained)
     3431  {
     3432    print("Test 6 for isInCommutativeSubRing failed.");
     3433    print("Expected:\n");
     3434    print(expected);
     3435    print("obtained:\n");
     3436    print(obtained);
     3437    result = 0;
     3438  }
     3439  //Test 7: Letterplace ring, previous bug
     3440  expected = 0;
     3441  obtained = isInCommutativeSubRing(x*x - y*y);
     3442  if (expected !=obtained)
     3443  {
     3444    print("Test 7 for isInCommutativeSubRing failed.");
    34283445    print("Expected:\n");
    34293446    print(expected);
     
    34573474  if (deg(h)<=0)
    34583475  {
    3459     dbprint(p,dbprintWhitespace + "h is a constant. Returning
    3460  immediately");
     3476    dbprint(p,dbprintWhitespace + "h is a constant. Returning immediately");
    34613477    return(list(list(h)));
    34623478  }
    34633479  def r = basering;
    34643480  list factorizeOutput;
    3465   if (size(ringlist(basering))<=4)
     3481  if (size(ringlist(basering))<=4 && (attrib(r, "isLetterplaceRing") == 0) )
    34663482  {//commutative ring case
    3467     dbprint(p,dbprintWhitespace + "We are in a commutative
    3468  ring. Factoring h using factorize.");
     3483    dbprint(p,dbprintWhitespace + "We are in a commutative ring. Factoring h using factorize.");
    34693484    factorizeOutput = factorize(h);
    34703485  }//commutative ring case
    34713486  else
    34723487  {//commutative subring case;
    3473     dbprint(p,dbprintWhitespace + "We are in a commutative
    3474  subring. Generating commutative ring..");
    3475     def rList = ringlist(basering);
    3476     rList = delete(rList,5);
    3477     rList = delete(rList,5);
    3478     def tempRing = ring(rList);
    3479     setring(tempRing);
    3480     poly h = imap(r,h);
    3481     dbprint(p, dbprintWhitespace+"Factoring h in commutative ring.");
    3482     list tempResult = factorize(h);
    3483     setring(r);
    3484     factorizeOutput = imap(tempRing,tempResult);
     3488    dbprint(p,dbprintWhitespace + "We are in a commutative subring. Generating commutative ring.");
     3489    if (attrib(r, "isLetterplaceRing") == 0)
     3490    {//G-algebra case
     3491      def rList = ringlist(basering);
     3492      rList = delete(rList,5);
     3493      rList = delete(rList,5);
     3494      def tempRing = ring(rList);
     3495      setring(tempRing);
     3496      poly h = imap(r,h);
     3497      dbprint(p, dbprintWhitespace+"Factoring h in commutative ring.");
     3498      list tempResult = factorize(h);
     3499      setring(r);
     3500      factorizeOutput = imap(tempRing,tempResult);
     3501    }//G-algebra case
     3502    else
     3503    {//Letterplace case
     3504      int theRightVar = lp2iv(h[1])[1];
     3505      list commFactInIv = list();
     3506      list tempMonomList = list();
     3507      def rList = ringlist(basering);
     3508      rList[2] = list("@x");
     3509      rList[3] = list(list("dp", intvec(1)),
     3510              list("C", 0));
     3511      def tempRing = ring(rList);
     3512      setring(tempRing);
     3513      ideal tempIdeal;
     3514      for (i=1; i<=nvars(r); i++)
     3515      {tempIdeal[i] = var(1);}
     3516      map fromR = r, tempIdeal;
     3517      poly h = fromR(h);
     3518      dbprint(p, dbprintWhitespace+"Factoring h in commutative ring.");
     3519      list tempResult = factorize(h);
     3520      dbprint(p, dbprintWhitespace+"Done. The result is:");
     3521      dbprint(p, tempResult);
     3522      dbprint(p, dbprintWhitespace+"Now translated into intvec representation:");
     3523      for (i = 1; i <= size(tempResult[1]); i++)
     3524      {//translate all factorizations into lists of intvecs and coeffs
     3525    commFactInIv[i] = list();
     3526    for (j = 1; j <= size(tempResult[1][i]); j++)
     3527    {//iterate over each monomial
     3528      commFactInIv[i][j] = list(leadcoef(tempResult[1][i][j]));
     3529      if (deg(tempResult[1][i][j]) != 0)
     3530      {//a power of @x
     3531        commFactInIv[i][j] = commFactInIv[i][j] + list(theRightVar:deg(tempResult[1][i][j]));
     3532      }//a power of @x
     3533    }//iterate over each monomial
     3534      }//translate all factorizations into lists of intvecs and coeffs
     3535      dbprint(p, commFactInIv);
     3536      setring(r);
     3537      factorizeOutput = imap(tempRing,tempResult);
     3538      list commFactInIv = imap(tempRing, commFactInIv);
     3539      poly tempEntry;
     3540      for (i = 1; i<=size(commFactInIv); i++)
     3541      {
     3542    tempEntry = 0;
     3543    for (j=1; j<=size(commFactInIv[i]); j++)
     3544    {
     3545      if (size(commFactInIv[i][j]) == 1)
     3546      {//simply a number
     3547        tempEntry = tempEntry + commFactInIv[i][j][1];
     3548      }//simply a number
     3549      else
     3550      {
     3551        tempEntry = tempEntry + commFactInIv[i][j][1]*iv2lp(commFactInIv[i][j][2]);
     3552      }
     3553    }
     3554    factorizeOutput[1][i] = tempEntry;
     3555      }
     3556    }//Letterplace case
    34853557  }//commutative subring case;
    3486   dbprint(p,dbprintWhitespace + "Done commutatively factorizing.
    3487  The result is:");
     3558  dbprint(p,dbprintWhitespace + "Done commutatively factorizing. The result isssssss:");
    34883559  dbprint(p,factorizeOutput);
    34893560  dbprint(p,dbprintWhitespace+"Computing all permutations of this factorization.");
     
    35263597  }
    35273598  kill R;
    3528   //Test 2: Non-commutative ring, constant
     3599  //Test 2: G-Algebra, constant
    35293600  ring R = 0,(x,d),dp;
    35303601  def r = nc_algebra(1,1);
     
    35423613  }
    35433614  kill r; kill R;
    3544   //Test 3: Non-commutative ring, definitely commutative subring, irreducible
     3615  //Test 3: G-Algebra, definitely commutative subring, irreducible
    35453616  ring R = 0,(x1,x2,d1,d2),dp;
    35463617  def r = Weyl();
     
    35583629  }
    35593630  kill r; kill R;
    3560   //Test 4: Non-commutative ring, definitely commutative subring,
     3631  //Test 4: G-Algebra, definitely commutative subring,
    35613632  //reducible
    35623633  ring R = 0,(x1,x2,d1,d2),dp;
     
    35793650  }
    35803651  kill r; kill R;
     3652  //Test 5: Letterplace ring, constant
     3653  ring r = 0,(x,y,z),dp;
     3654  int d =4; // degree bound
     3655  def R = makeLetterplaceRing(d);
     3656  setring R;
     3657  list expected = list(list(poly(3445)));
     3658  list obtained = factor_commutative(3445);
     3659  if (!isListEqual(expected,obtained))
     3660  {
     3661    print("Test 5 for factor_commutative failed.");
     3662    print("Expected:\n");
     3663    print(expected);
     3664    print("obtained:\n");
     3665    print(obtained);
     3666    result = 0;
     3667  }
     3668  //Test 6: Letterplace ring, definitely commutative subring, irreducible
     3669  expected = list(list(poly(1), x*x+ 2*x + 2));
     3670  obtained = factor_commutative(x*x+ 2*x + 2);
     3671  if (!isListEqual(expected,obtained))
     3672  {
     3673    print("Test 6 for factor_commutative failed.");
     3674    print("Expected:\n");
     3675    print(expected);
     3676    print("obtained:\n");
     3677    print(obtained);
     3678    result = 0;
     3679  }
     3680  //Test 7: Letterplace ring, definitely commutative subring,
     3681  //reducible
     3682  expected = list(list(poly(1), x*x+ 2*x + 2, x*x- 2*x - 2),
     3683            list(poly(1), x*x- 2*x - 2, x*x+ 2*x + 2));
     3684  obtained = factor_commutative((x*x+ 2*x + 2)*(x*x- 2*x - 2));
     3685  if (!isListEqual(expected,obtained))
     3686  {
     3687    print("Test 7 for factor_commutative failed.");
     3688    print("Expected:\n");
     3689    print(expected);
     3690    print("obtained:\n");
     3691    print(obtained);
     3692    result = 0;
     3693  }
     3694  //Test 8: Letterplace ring, using last variable
     3695  expected = list(list(poly(1), z*z+ 2*z + 2, z*z - 2*z - 2),
     3696            list(poly(1), z*z - 2*z - 2, z*z+ 2*z + 2));
     3697  obtained = factor_commutative((z*z+ 2*z + 2)*(z*z - 2*z - 2));
     3698  if (!isListEqual(expected,obtained))
     3699  {
     3700    print("Test 8 for factor_commutative failed.");
     3701    print("Expected:\n");
     3702    print(expected);
     3703    print("obtained:\n");
     3704    print(obtained);
     3705    result = 0;
     3706  }
    35813707  return(result);
    35823708}//testing factor_commutative
     
    67306856
    67316857  result = delete_duplicates_noteval_and_sort(result);
    6732   //print(M);
    67336858  if (size(result) == 0)
    67346859  {//no factorization found
     
    68947019  }
    68957020  hZeroinR = tempHList;
    6896   //hBetweenDegrees = reverse(hBetweenDegrees);
    68977021  dbprint(p,dbprintWhitespace+" Done!");
    68987022  dbprint(p,dbprintWhitespace+" Moving everything into the ring K[theta]");
     
    82448368  list tempList = list();
    82458369  //First, we are going to deal with our most hated guys: The Coefficients.
    8246   //
    82478370  dbprint(p,dbprintWhitespace + "We get all combinations for the coefficient of the
    82488371maximal homogeneous part");
     
    97469869  rlist[3][2][2]=intvec(0);
    97479870  rlist = insert(rlist,ideal(0),3);
    9748   //The following lines of code will become obsolete once bug #753 in
    9749   //Singular is fixed. Until then, this measure is unfortunately
    9750   //necessary.
    9751   //begin
    9752   intvec perms = 0:nvars(@r);
    9753   for (i =1; i<=nvars(@r);i++)
    9754   {//finding the right position of each input variable
    9755     for (j = 1; j<=size(inpList); j++)
    9756     {
    9757       if (var(i)==inpList[j])
    9758       {//found the correct spot
    9759     perms[i] = j;
    9760     break;
    9761       }//found the correct spot
    9762     }
    9763   }//finding the right position of each input variable
    97649871  def @r2 = ring(rlist);
    97659872  setring(@r2);
    97669873  def @r3 = Weyl();
    97679874  setring(@r3);
    9768   ideal mappingIdeal;
    9769   for (i = 1; i<=size(perms); i++)
    9770   {//generating the mapping ideal
    9771     if (perms[i]>0)
    9772     {//only variables that are in the input list are permitted
    9773       mappingIdeal[i] = var(perms[i]);
    9774     }//only variables that are in the input list are permitted
    9775   }//generating the mapping ideal
    9776   map toR3 = @r, mappingIdeal;
    9777   poly h = toR3(h);
     9875  poly h = imap(@r,h);
    97789876  list result = facWeyl(h);
    97799877  setring(@r);
    9780   ideal mappingIdeal;
    9781   for (i = 1; i<=size(perms);i++)
    9782   {//finding the correct permutation
    9783     for (j = 1; j<=size(perms); j++)
    9784     {//the spot needs to coincide
    9785       if (perms[j]==i)
    9786       {//found it
    9787     mappingIdeal[i] = var(j);
    9788     break;
    9789       }//found it
    9790     }//the spot needs to coincide
    9791   }//finding the correct permutation
    9792   map toR = @r3, mappingIdeal;
    9793   list result = toR(result);
    9794   //end
    9795   //once bug is fixed, please uncomment the following lines and
    9796   //discard the above
    9797   /* def @r2 = ring(rlist); */
    9798   /* setring(@r2); */
    9799   /* def @r3 = Weyl(); */
    9800   /* setring(@r3); */
    9801   /* poly h = imap(@r,h); */
    9802   /* list result = facWeyl(h); */
    9803   /* setring(@r); */
    9804   /* list result = imap(@r3,result); */
     9878  list result = imap(@r3,result);
    98059879  return(result);
    98069880}//proc facSubWeyl
     
    1047410548 - We have n parameters q_1,..., q_n given.
    1047510549
    10476 SEE ALSO: homogfacFirstQWeyl, homogfacFirstQWeyl_all
     10550SEE ALSO: homogfacNthWeyl, homogfacFirstQWeyl, homogfacFirstQWeyl_all
    1047710551"
    1047810552{//proc homogfacNthQWeyl_all
     
    1099211066- There exists at least one variable in the ring.
    1099311067NOTE:
     11068- works for both PLURAL and LETTERPLACE subsystems
    1099411069- Every entry of the output list is a list with factors for one possible factorization.
    1099511070  The first factor is always a constant (1, if no nontrivial constant
     
    1100211077  for (i = 1; i<=voice;i++)
    1100311078  {dbprintWhitespace = dbprintWhitespace + " ";}
    11004   dbprint(p,dbprintWhitespace + "Checking if the field fulfills
     11079  dbprint(p,dbprintWhitespace + "Checking if the field fulfills\
    1100511080 everything we assume.");
    1100611081  if (nvars(basering)<1)
     
    1101011085    if (minpoly !=0)
    1101111086    {
    11012       ERROR("factorize does not support fields of type (p^n,a)");
     11087      ERROR("factorize does not support fields of type (p^n,a) yet");
    1101311088      return list(list());
    1101411089    }
    1101511090  }
    11016   dbprint(p,dbprintWhitespace + "Everything seems to be alright with
     11091  dbprint(p,dbprintWhitespace + "Everything seems to be alright with\
    1101711092 the ground field.");
    1101811093  if (deg(h)<=0)
     
    1102411099  dbprint(p,dbprintWhitespace+"Checking if a more improved algorithm\
    1102511100 is available other than the naive ansatz-method.");
    11026   dbprint(p,dbprintWhitespace+"1. Checking if h in commutative
    11027  (sub)-ring");
     11101  dbprint(p,dbprintWhitespace+"1. Checking if h in commutative (sub)-ring");
    1102811102  if (isInCommutativeSubRing(h))
    1102911103  {//h is in a commutative subring
    1103011104    return(factor_commutative(h));
    1103111105  }//h is in a commutative subring
    11032   dbprint(p,dbprintWhitespace+"h was not in a commutative
     11106  dbprint(p,dbprintWhitespace+"h was not in a commutative\
    1103311107 (sub)-ring.");
    11034   dbprint(p,dbprintWhitespace+"2. Checking if h is in Weyl-Algebra
    11035  over QQ");
     11108  dbprint(p,dbprintWhitespace+"2. Checking if h was in a letterplace ring");
     11109  if ( attrib(basering, "isLetterplaceRing") >= 1 )
     11110  {
     11111    dbprint(p,dbprintWhitespace+
     11112            "We are indeed in a letterplace ring. Forwarding the computation " +
     11113            "to ncfactor-without-opt-letterplace");
     11114    return(ncfactor_without_opt_letterplace(h));
     11115  }
     11116  dbprint(p,dbprintWhitespace+"2. Checking if h is in Weyl-Algebra over QQ");
    1103611117  if (ncfactor_isWeyl()&&npars(basering)==0&&char(basering)==0)
    1103711118  {
    11038     dbprint(p,dbprintWhitespace + "We are indeed in a Weyl
    11039  algebra. Forwarding computation to facWeyl");
     11119    dbprint(p,dbprintWhitespace +
     11120            "We are indeed in a Weyl algebra. Forwarding computation to facWeyl");
    1104011121    return(facWeyl(h));
    1104111122  }
    1104211123  dbprint(p,dbprintWhitespace+"Our ring is not a Weyl algebra over QQ.");
    11043   dbprint(p,dbprintWhitespace+"3. Checking if we are in a q-Weyl
    11044  algebra over QQ.");
     11124  dbprint(p,dbprintWhitespace+"3. Checking if we are in a q-Weyl algebra over QQ.");
    1104511125  if (ncfactor_isQWeyl()&&char(basering)==0)
    1104611126  {
    11047     dbprint(p,dbprintWhitespace + "We are indeed in a q-Weyl
     11127    dbprint(p,dbprintWhitespace + "We are indeed in a q-Weyl\
    1104811128 algebra over QQ. Checking if homogeneous.");
    1104911129    if(homogwithorderNthWeyl(h))
    1105011130    {
    11051       dbprint(p,dbprintWhitespace+"h was homogeneous. Forwarding
     11131      dbprint(p,dbprintWhitespace+"h was homogeneous. Forwarding\
    1105211132 computation to homogfacqweyl.");
    1105311133      return(homogfacNthQWeyl_all(h));
     
    1105511135  }
    1105611136  dbprint(p,dbprintWhitespace+"Our ring is not a q-Weyl algebra.");
    11057   dbprint(p,dbprintWhitespace+"4. Checking if h is in a subalgebra
     11137  dbprint(p,dbprintWhitespace+"4. Checking if h is in a subalgebra\
    1105811138 that resembles the Weyl algebra");
    1105911139  if(isInWeylSubAlg(h)&&npars(basering)==0&&char(basering)==0)
    1106011140  {
    11061     dbprint(p,dbprintWhitespace+"We are indeed in a subalgebra that is
     11141    dbprint(p,dbprintWhitespace+"We are indeed in a subalgebra that is\
    1106211142 isomorphic to a Weyl algebra. Forwarding to facSubWeyl.");
    1106311143    return(facSubWeyl(h));
    1106411144  }
    11065   dbprint(p,dbprintWhitespace+"No optimized algorithm available. Going
     11145  dbprint(p,dbprintWhitespace+"No optimized algorithm available. Going \
    1106611146 for the ansatz method without optimization.");
    1106711147  return(ncfactor_without_opt(h));
     
    1107011150{
    1107111151  "EXAMPLE:";echo=2;
     11152  // first, an example with PLURAL
    1107211153  def R = makeUsl2();
    1107311154  setring(R);
    1107411155  poly p = e^3*f+e^2*f^2-e^3+e^2*f+2*e*f^2-3*e^2*h-2*e*f*h-8*e^2
    1107511156           +e*f+f^2-4*e*h-2*f*h-7*e+f-h;
     11157  ncfactor(p);
     11158  kill R;
     11159  // an example with LETTERPLACE
     11160  LIB "freegb.lib";
     11161  ring r = 0,(x,y),Dp;
     11162  def R = freeAlgebra(r,5); setring(R);
     11163  poly p = x*y*x - x;
    1107611164  ncfactor(p);
    1107711165}
     
    1128611374  {
    1128711375    print("Test 10 for ncfactor failed.");
     11376    print("Expected:\n");
     11377    print(expected);
     11378    print("obtained:\n");
     11379    print(obtained);
     11380    result = 0;
     11381  }
     11382  kill r;
     11383  //Test 11: Generic Letterplace example
     11384  ring r = 0,(x,y,z),dp;
     11385  int d =4; // degree bound
     11386  def R = makeLetterplaceRing(d);
     11387  setring R;
     11388  poly f1 = 6*x*y*x + 9*x;
     11389  list obtained = ncfactor(f1);
     11390  list expected = sortFactorizations(
     11391    list(
     11392      list(number(3), x, 2*y*x + 3),
     11393      list(number(3), 2*x*y + 3, x)
     11394      ));
     11395  if (!isListEqual(expected,obtained))
     11396  {
     11397    print("Test 11 for ncfactor failed.");
    1128811398    print("Expected:\n");
    1128911399    print(expected);
     
    1198412094}//testing factorize_nc_s
    1198512095
     12096
     12097static proc getMaxDegreeVecLetterPlace(poly h)
     12098"USAGE: getMaxDegreeVecLetterPlace(h); h is a polynomial in a
     12099        Letterplace ring.
     12100RETURN: intvec
     12101PURPOSE: Returns for each variable in the ring the maximal
     12102         degree in which it appears in h.
     12103ASSUMING: The basering is
     12104"
     12105{//proc getMaxDegreeVecLetterPlace
     12106  int lv = attrib(basering, "isLetterplaceRing"); // nvars of orig ring
     12107  if (h == 0) { return (0:lv); }
     12108  intvec tempIntVec1 = 0:lv;
     12109  intvec maxDegrees = 0:lv;
     12110  intvec tempIntVec2;
     12111  int i; int j;
     12112  for (i = 1; i<=size(h); i++)
     12113  {//going through each monomial in h and finding the degree in each var
     12114    tempIntVec2 = lp2iv(h[i]);
     12115    if (tempIntVec2 == 0)
     12116    {
     12117      i++; continue;
     12118    }
     12119    tempIntVec1 = 0:lv;
     12120    for (j=1; j<=size(tempIntVec2); j++)
     12121    {//filling in the number of occurrences
     12122      tempIntVec1[tempIntVec2[j]] = tempIntVec1[tempIntVec2[j]] + 1;
     12123    }//filling in the number of occurrences
     12124    for (j = 1; j<=lv; j++)
     12125    {//putting the max into maxDegrees
     12126      maxDegrees[j] = max(maxDegrees[j], tempIntVec1[j]);
     12127    }//putting the max into maxDegrees
     12128  }//going through each monomial in h and finding the degree in each var
     12129  return(maxDegrees);
     12130}//proc getMaxDegreeVecLetterPlace
     12131
     12132static proc test_getMaxDegreeVecLetterPlace()
     12133{//testing getMaxDegreeVecLetterPlace
     12134  int result = 1;
     12135  ring r = 0,(x,y,z),dp;
     12136  int d =4; // degree bound
     12137  def R = makeLetterplaceRing(d);
     12138  setring R;
     12139  //Test 1: 0
     12140  intvec expected = 0:3;
     12141  intvec obtained = getMaxDegreeVecLetterPlace(0);
     12142  if (expected!=obtained)
     12143  {
     12144    print("Test 1 for getMaxDegreeVecLetterPlace failed.");
     12145    print("Expected:\n");
     12146    print(expected);
     12147    print("obtained:\n");
     12148    print(obtained);
     12149    result = 0;
     12150  }
     12151  //Test 2: Constant neq 0
     12152  expected = 0:3;
     12153  obtained = getMaxDegreeVecLetterPlace(3);
     12154  if (expected!=obtained)
     12155  {
     12156    print("Test 2 for getMaxDegreeVecLetterPlace failed.");
     12157    print("Expected:\n");
     12158    print(expected);
     12159    print("obtained:\n");
     12160    print(obtained);
     12161    result = 0;
     12162  }
     12163  //Test 3: univariate, first variable
     12164  expected = 2, 0, 0;
     12165  obtained = getMaxDegreeVecLetterPlace(5*x*x + x + 1);
     12166  if (expected!=obtained)
     12167  {
     12168    print("Test 3 for getMaxDegreeVecLetterPlace failed.");
     12169    print("Expected:\n");
     12170    print(expected);
     12171    print("obtained:\n");
     12172    print(obtained);
     12173    result = 0;
     12174  }
     12175  //Test 4: univariate, another variable
     12176  expected = 0, 0, 3;
     12177  obtained = getMaxDegreeVecLetterPlace(5*z*z*z + z*z + 1);
     12178  if (expected!=obtained)
     12179  {
     12180    print("Test 4 for getMaxDegreeVecLetterPlace failed.");
     12181    print("Expected:\n");
     12182    print(expected);
     12183    print("obtained:\n");
     12184    print(obtained);
     12185    result = 0;
     12186  }
     12187  //Test 5: random polynomial
     12188  expected = 3, 1, 2;
     12189  obtained = getMaxDegreeVecLetterPlace(2*x*y*x*x + 4*y*z*z);
     12190  if (expected!=obtained)
     12191  {
     12192    print("Test 5 for getMaxDegreeVecLetterPlace failed.");
     12193    print("Expected:\n");
     12194    print(expected);
     12195    print("obtained:\n");
     12196    print(obtained);
     12197    result = 0;
     12198  }
     12199  return(result);
     12200}//testing getMaxDegreeVecLetterPlace
     12201
     12202static proc wordsWithMaxAppearance(intvec maxDegInCoordinates, int upToDeg)
     12203"USAGE: wordsWithMaxAppearance(maxDegInCoordinates);
     12204maxDegreeInCoordinates is an intvec.
     12205RETURN: list
     12206PURPOSE: maxDegInCoordinates is a vector representing
     12207the maximum times a variable is allowed to appear in a monomial in
     12208letterplace representation. This function computes all possible words
     12209given this restriction.
     12210ASSUME: maxDegInCoordinates only has non-negative entries
     12211"{//wordsWithMaxAppearance
     12212  int p=printlevel-voice+2;//for dbprint
     12213  int i; int j;
     12214  string dbprintWhitespace = "";
     12215  for (i = 1; i<=voice;i++)
     12216  {dbprintWhitespace = dbprintWhitespace + " ";}
     12217  list result;
     12218  intvec tempMaxDegs;
     12219  list recResult;
     12220  for (i = 1; i<=size(maxDegInCoordinates); i++)
     12221  {//For each coordinate not equal to zero, do a recursive call and concatenate
     12222    if (maxDegInCoordinates[i] <= 0)
     12223    {//Done with coordinate i
     12224      i++; continue;
     12225    }//Done with coordinate i
     12226    tempMaxDegs = maxDegInCoordinates;
     12227    tempMaxDegs[i] = tempMaxDegs[i] - 1;
     12228    recResult = wordsWithMaxAppearance(tempMaxDegs, upToDeg);
     12229    if (size(recResult) == 0 && upToDeg>=1)
     12230    {//Single entry just needs to be there
     12231      result = result + list(intvec(i));
     12232    }//Single entry just needs to be there
     12233    result = result + recResult;
     12234    for (j = 1; j<=size(recResult); j++)
     12235    {//concatenate i to all elements in recResult
     12236      if (size(recResult[j]) + 1 <= upToDeg)
     12237      {//only concatenate if uptodeg is not exceeded
     12238    recResult[j] = intvec(i, recResult[j]);
     12239      }//only concatenate if uptodeg is not exceeded
     12240    }//concatenate i to all elements in recResult
     12241    result = result + recResult;
     12242  }//For each coordinate not equal to zero, do a recursive call and concatenate
     12243  return(delete_duplicates_noteval_and_sort(result));
     12244}//wordsWithMaxAppearance
     12245
     12246static proc test_wordsWithMaxAppearance()
     12247{//test_wordsWithMaxAppearance
     12248  int result = 1;
     12249  //Test 1: 0 intvec
     12250  list expected = list();
     12251  list obtained = wordsWithMaxAppearance(intvec(0), 4);
     12252  if (!isListEqual(expected,obtained))
     12253  {
     12254    print("Test 1 for wordsWithMaxAppearance failed.");
     12255    print("Expected:\n");
     12256    print(expected);
     12257    print("obtained:\n");
     12258    print(obtained);
     12259    result = 0;
     12260  }
     12261  //Test 2: 0 multiple entries intvec
     12262  expected = list();
     12263  obtained = wordsWithMaxAppearance(0:10, 4);
     12264  if (!isListEqual(expected,obtained))
     12265  {
     12266    print("Test 2 for wordsWithMaxAppearance failed.");
     12267    print("Expected:\n");
     12268    print(expected);
     12269    print("obtained:\n");
     12270    print(obtained);
     12271    result = 0;
     12272  }
     12273  //Test 3: Single letter
     12274  expected = list(intvec(4));
     12275  obtained = wordsWithMaxAppearance(intvec(0, 0, 0, 1, 0, 0), 4);
     12276  if (!isListEqual(expected,obtained))
     12277  {
     12278    print("Test 3 for wordsWithMaxAppearance failed.");
     12279    print("Expected:\n");
     12280    print(expected);
     12281    print("obtained:\n");
     12282    print(obtained);
     12283    result = 0;
     12284  }
     12285  //Test 4: Two letters, one appearance
     12286  expected = list(intvec(3), intvec(3,4), intvec(4), intvec(4,3));
     12287  obtained = wordsWithMaxAppearance(intvec(0, 0, 1, 1, 0, 0), 4);
     12288  if (!isListEqual(expected,obtained))
     12289  {
     12290    print("Test 4 for wordsWithMaxAppearance failed.");
     12291    print("Expected:\n");
     12292    print(expected);
     12293    print("obtained:\n");
     12294    print(obtained);
     12295    result = 0;
     12296  }
     12297  //Test 5: One letter, degree 2
     12298  expected = list(intvec(4), intvec(4,4));
     12299  obtained = wordsWithMaxAppearance(intvec(0, 0, 0, 2, 0, 0), 4);
     12300  if (!isListEqual(expected,obtained))
     12301  {
     12302    print("Test 5 for wordsWithMaxAppearance failed.");
     12303    print("Expected:\n");
     12304    print(expected);
     12305    print("obtained:\n");
     12306    print(obtained);
     12307    result = 0;
     12308  }
     12309  //Test 6: random example
     12310  expected = list(intvec(1),
     12311          intvec(1,4),
     12312          intvec(1,4,4),
     12313          intvec(4),
     12314          intvec(4,1),
     12315          intvec(4,1,4),
     12316          intvec(4,4),
     12317          intvec(4,4,1));
     12318  obtained = wordsWithMaxAppearance(intvec(1, 0, 0, 2, 0, 0), 4);
     12319  if (!isListEqual(expected,obtained))
     12320  {
     12321    print("Test 6 for wordsWithMaxAppearance failed.");
     12322    print("Expected:\n");
     12323    print(expected);
     12324    print("obtained:\n");
     12325    print(obtained);
     12326    result = 0;
     12327  }
     12328  return(result);
     12329}//test_wordsWithMaxAppearance
     12330
     12331static proc monsSmallerThanLetterPlace(poly e, intvec maxDegInCoordinates, int upToDeg)
     12332"USAGE: monsSmallerThanLetterPlace(e, maxDegInCoordinates); e is a
     12333monomial.
     12334maxDegreeInCoordinates encodes the maximal degree we wish to encounter
     12335in each variable.
     12336RETURN: list
     12337PURPOSE: Computes all monomials in the basering which are degree-wise
     12338smaller than the leading monomial of e.
     12339"{//monsSmallerThanLetterPlace
     12340  int p=printlevel-voice+2;//for dbprint
     12341  int i;
     12342  string dbprintWhitespace = "";
     12343  for (i = 1; i<=voice;i++)
     12344  {dbprintWhitespace = dbprintWhitespace + " ";}
     12345  list result;
     12346  int maxLen = min(sum(maxDegInCoordinates), lpDegBound(basering));
     12347  dbprint(p,dbprintWhitespace + "maxLength: " + string(maxLen));
     12348  list allPossibilities = wordsWithMaxAppearance(maxDegInCoordinates, upToDeg);
     12349  dbprint(p,dbprintWhitespace + "words with max appearance: " + string(allPossibilities));
     12350  poly candidate;
     12351  intvec candidateMaxDeg;
     12352  for (i = 1; i<=size(allPossibilities); i++)
     12353  {//checking for monomials with smaller degree than e
     12354    candidate = iv2lp(allPossibilities[i]);
     12355    dbprint(p,dbprintWhitespace + "Checking candidate: " + string(candidate));
     12356    candidateMaxDeg = getMaxDegreeVecLetterPlace(candidate);
     12357    if (candidate < e && candidateMaxDeg <= maxDegInCoordinates)
     12358    {//successfully found a candidate
     12359      result = insert(result, candidate);
     12360    }//successfully found a candidate
     12361  }//checking for monomials with smaller degree than e
     12362  return(result);
     12363}//monsSmallerThanLetterPlace
     12364
     12365static proc test_monsSmallerThanLetterPlace()
     12366{//test_monsSmallerThanLetterPlace
     12367  int result = 1;
     12368  ring r = 0,(x,y,z,d,w),dp;
     12369  int upToDegBound = 10; // degree bound
     12370  def R = makeLetterplaceRing(upToDegBound);
     12371  setring R;
     12372  //Test 1: 0, 0
     12373  poly input1 = 0;
     12374  intvec input2 = intvec(0,0,0,0,0);
     12375  list expected = list();
     12376  list obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound);
     12377  if (!isListEqual(expected,obtained))
     12378  {
     12379    print("Test 1 for monsSmallerThanLetterPlace failed.");
     12380    print("Expected:\n");
     12381    print(expected);
     12382    print("obtained:\n");
     12383    print(obtained);
     12384    result = 0;
     12385  }
     12386  //Test 2: 0, nontrivial maxdegree
     12387  input1 = 0;
     12388  input2 = intvec(0,0,2,1,0);
     12389  expected = list();
     12390  obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound );
     12391  if (!isListEqual(expected,obtained))
     12392  {
     12393    print("Test 2 for monsSmallerThanLetterPlace failed.");
     12394    print("Expected:\n");
     12395    print(expected);
     12396    print("obtained:\n");
     12397    print(obtained);
     12398    result = 0;
     12399  }
     12400  //Test 3: constant, nontrivial maxdegree
     12401  input1 = 7;
     12402  input2 = intvec(0,0,2,1,0);
     12403  expected = list();
     12404  obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound);
     12405  if (!isListEqual(expected,obtained))
     12406  {
     12407    print("Test 3 for monsSmallerThanLetterPlace failed.");
     12408    print("Expected:\n");
     12409    print(expected);
     12410    print("obtained:\n");
     12411    print(obtained);
     12412    result = 0;
     12413  }
     12414  //Test 4: single variable smallest, nontrivial maxdegree
     12415  input1 = w;
     12416  input2 = intvec(0,0,2,1,0);
     12417  expected = list();
     12418  obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound );
     12419  if (!isListEqual(expected,obtained))
     12420  {
     12421    print("Test 4 for monsSmallerThanLetterPlace failed.");
     12422    print("Expected:\n");
     12423    print(expected);
     12424    print("obtained:\n");
     12425    print(obtained);
     12426    result = 0;
     12427  }
     12428  //Test 5: single variable highest, nontrivial maxdegree
     12429  input1 = x;
     12430  input2 = intvec(0,0,2,1,0);
     12431  expected = list(d, z);
     12432  obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound);
     12433  if (!isListEqual(expected,obtained))
     12434  {
     12435    print("Test 5 for monsSmallerThanLetterPlace failed.");
     12436    print("Expected:\n");
     12437    print(expected);
     12438    print("obtained:\n");
     12439    print(obtained);
     12440    result = 0;
     12441  }
     12442  //Test 6: single variable highest, nontrivial maxdegree
     12443  input1 = x;
     12444  input2 = intvec(0,0,2,1,0);
     12445  expected = list(d, z);
     12446  obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound );
     12447  if (!isListEqual(expected,obtained))
     12448  {
     12449    print("Test 6 for monsSmallerThanLetterPlace failed.");
     12450    print("Expected:\n");
     12451    print(expected);
     12452    print("obtained:\n");
     12453    print(obtained);
     12454    result = 0;
     12455  }
     12456  //Test 7: nontrivial monomial, nontrivial maxdegree
     12457  input1 = z*z*d*d;
     12458  input2 = intvec(0,0,2,1,0);
     12459  expected = list(d*z*z,
     12460          d*z,
     12461          d,
     12462          z*d*z,
     12463          z*d,
     12464          z*z*d,
     12465          z*z,
     12466          z);
     12467  obtained = monsSmallerThanLetterPlace(input1, input2, upToDegBound);
     12468  if (!isListEqual(expected,obtained))
     12469  {
     12470    print("Test 7 for monsSmallerThanLetterPlace failed.");
     12471    print("Expected:\n");
     12472    print(expected);
     12473    print("obtained:\n");
     12474    print(obtained);
     12475    result = 0;
     12476  }
     12477  return(result);
     12478}//test_monsSmallerThanLetterPlace
     12479
     12480static proc ncfactor_letterplace_poly_s(poly h)
     12481"USAGE: ncfactor_letterplace_poly_s(h); h is a polynomial in a
     12482        letterplace algebra
     12483RETURN: list(list)
     12484PURPOSE: Compute all factorizations of h
     12485THEORY: Implements an ansatz-driven factorization method as outlined
     12486by Bell, Heinle and Levandovskyy in \"On Noncommutative Finite
     12487Factorization Domains\".
     12488ASSUME:
     12489- basering is a Letterplace ring
     12490- basefield is such, that factorize() can factor any univariate and
     12491  multivariate commutative polynomial over it.
     12492- h is not a constant or 0.
     12493NOTE:
     12494- Every entry of the output list is a list with factors for one possible factorization.
     12495  The first factor is always a constant (1, if no nontrivial constant
     12496  could be excluded).
     12497SEE ALSO: ncfactor
     12498"{//proc ncfactor_letterplace_poly_s
     12499  int p=printlevel-voice+2;//for dbprint
     12500  int i; int j; int k; int l;
     12501  string dbprintWhitespace = "";
     12502  for (i = 1; i<=voice;i++)
     12503  {dbprintWhitespace = dbprintWhitespace + " ";}
     12504  list result;
     12505  // Producing the set M of the paper (permutation of the variables in
     12506  // the leading monomial)
     12507  dbprint(p,dbprintWhitespace + "Generating the set M.");
     12508  def r = basering;
     12509  intvec maxDegrees = getMaxDegreeVecLetterPlace(h);
     12510  dbprint(p,dbprintWhitespace + "The maximum degrees for each var are given by: "+
     12511      string(maxDegrees));
     12512  intvec expVec = lp2iv(leadmonom(h));
     12513  dbprint(p, dbprintWhitespace + "The leading monomial of h is: " + string(expVec));
     12514  list M;
     12515  for (i = 1; i<size(expVec); i++)
     12516  {//The set M consists of all posssible two-word-combinations of the leading monomial
     12517    M = M + list(list(intvec(expVec[1..i]), intvec(expVec[i+1..size(expVec)])));
     12518  }
     12519  dbprint(p,dbprintWhitespace+"The set M is:");
     12520  dbprint(p, M);
     12521  list list_UpToA;
     12522  list list_UpToB;
     12523  list tempSringlist = ringlist(r);
     12524  list clearSlateRingList = ringlist(r);
     12525  clearSlateRingList[2] = list();
     12526  clearSlateRingList[3] = list();
     12527  if (size(clearSlateRingList) == 6)
     12528  {//some non-commutative relations defined
     12529    clearSlateRingList = delete(clearSlateRingList, 6);
     12530    clearSlateRingList = delete(clearSlateRingList, 5);
     12531  }
     12532  else
     12533  {//It is still possible that we have a 5th entry
     12534    if (size(clearSlateRingList) == 5)
     12535    {
     12536      clearSlateRingList = delete(clearSlateRingList, 5);
     12537    }
     12538  }
     12539  intvec tempIntVec;
     12540  def S; def W; def W2;
     12541  list MEntry;
     12542  poly tempA;
     12543  poly tempB;
     12544  int filterFlag;
     12545  int jj = 1; int sizeOfSol = 1;
     12546  for (i = 1; i<=size(M); i++)
     12547  {//Iterating over all two-combinations in the set M
     12548    MEntry = M[i];
     12549    tempA = iv2lp(MEntry[1]);
     12550    tempB = iv2lp(MEntry[2]);
     12551    dbprint(p,dbprintWhitespace + "The potential leading combination of a is " + string(tempA));
     12552    dbprint(p,dbprintWhitespace + "The potential leading combination of b is " + string(tempB));
     12553    dbprint(p,dbprintWhitespace + "Calculating the monomials smaller than A");
     12554    list_UpToA = monsSmallerThanLetterPlace(leadmonom(tempA),
     12555                        maxDegrees - getMaxDegreeVecLetterPlace(tempB),
     12556                        lpDegBound(r));
     12557    dbprint(p,dbprintWhitespace + "Done, they are: " + string(list_UpToA));
     12558    dbprint(p,dbprintWhitespace + "Calculating the monomials smaller than B");
     12559    list_UpToB = monsSmallerThanLetterPlace(leadmonom(tempB),
     12560                        maxDegrees - getMaxDegreeVecLetterPlace(tempA),
     12561                        lpDegBound(r));
     12562    dbprint(p,dbprintWhitespace + "Done, they are: " + string(list_UpToB));
     12563    //we need to filter out lm(tempA) and lm(tempB);
     12564    for (k = size(list_UpToA); k>0; k--)
     12565    {//removing the leading monomial from list_UpToA and invalid parts
     12566      if (list_UpToA[k] == leadmonom(tempA))
     12567      {//found it
     12568    list_UpToA = delete(list_UpToA,k);
     12569    continue;
     12570      }//found it
     12571      if(sum(getMaxDegreeVecLetterPlace(h)) < sum(getMaxDegreeVecLetterPlace(list_UpToA[k])))
     12572      {//total degree exceeds
     12573    list_UpToA = delete(list_UpToA,k);
     12574    continue;
     12575      }//total degree exceeds
     12576    }//removing the leading monomial from list_UpToA and invalid parts
     12577    for (k = size(list_UpToB); k>0; k--)
     12578    {//removing the leading monomial from list_UpToA
     12579      if (list_UpToB[k] == leadmonom(tempB))
     12580      {//found it
     12581    list_UpToB = delete(list_UpToB,k);
     12582    continue;
     12583      }//found it
     12584      if(sum(getMaxDegreeVecLetterPlace(h)) < sum(getMaxDegreeVecLetterPlace(list_UpToB[k])))
     12585      {//total degree exceeds
     12586    list_UpToB = delete(list_UpToB,k);
     12587    continue;
     12588      }//total degree exceeds
     12589    }//removing the leading monomial from list_UpToA
     12590    if (typeof(tempSringlist[1]) == "int")
     12591    {//No extra parameters in the original ring
     12592      tempSringlist[1] = list(tempSringlist[1],list(), list(list()));
     12593    }//No extra parameters in the original ring
     12594    for (k = size(list_UpToB)+1; k>=0; k--)
     12595    {//fill in b-coefficients as variables
     12596      tempSringlist[1][2] = insert(tempSringlist[1][2],"@b("+string(k)+")");
     12597      clearSlateRingList[2] = insert(clearSlateRingList[2],"@b("+string(k)+")");
     12598    }//fill in b-coefficients as variables
     12599    for (k = size(list_UpToA); k>=0; k--)
     12600    {//fill in a-coefficients as variables
     12601      tempSringlist[1][2] = insert(tempSringlist[1][2],"@a("+string(k)+")");
     12602      clearSlateRingList[2] = insert(clearSlateRingList[2], "@a("+string(k)+")");
     12603    }//fill in a-coefficients as variables
     12604    tempIntVec = 0;
     12605    for(k=1; k<=size(list_UpToA) + size(list_UpToB)+3; k++)
     12606    {tempIntVec[k] = 1;}
     12607    clearSlateRingList[3] =
     12608      list(list("lp",tempIntVec),list("C",intvec(0)));
     12609    if (size(tempSringlist[1][3][1]) == 0)
     12610    {//No values in there before
     12611      tempSringlist[1][3][1] =
     12612    list("lp", tempIntVec);
     12613      tempSringlist[1][4] = ideal(0);
     12614    }//No values in there before
     12615    else
     12616    {//there were other parameters
     12617      tempSringlist[1][3][1][2] = tempSringlist[1][3][1][2], tempIntVec;
     12618    }//there were other parameters
     12619    attrib(tempSringlist, "isLetterplaceRing", attrib(r,"isLetterplaceRing"));
     12620    attrib(tempSringlist, "maxExp", 1);
     12621    if (defined(S)) {
     12622      kill S;
     12623    }
     12624    def S = ring(tempSringlist); setring S;
     12625    attrib(S, "uptodeg", lpDegBound(r));
     12626    attrib(S, "isLetterplaceRing", attrib(r,"isLetterplaceRing"));
     12627    dbprint(p,dbprintWhitespace+"Done generating ring S:");
     12628    dbprint(p,dbprintWhitespace+string(S));
     12629    dbprint(p,dbprintWhitespace+"Generate the ansatz.");
     12630    dbprint(p,dbprintWhitespace+"The new ring is: " + string(basering));
     12631    setring(S);
     12632    poly h = imap(r, h);
     12633    poly a = imap(r,tempA);
     12634    poly b = imap(r,tempB);
     12635    if (!defined(list_UpToA))
     12636    {list list_UpToA = imap(r,list_UpToA);}
     12637    if (!defined(list_UpToB))
     12638    {list list_UpToB = imap(r,list_UpToB);}
     12639    b = b*par(size(list_UpToA)+size(list_UpToB)+3);
     12640    for (k = size(list_UpToB); k>0; k--)
     12641    {b = b + par(size(list_UpToA)+2+k)*list_UpToB[k];}
     12642    b = b + par(size(list_UpToA) + 2);
     12643    dbprint(p,dbprintWhitespace + "The ansatz for b is " + string(b));
     12644    for (k = size(list_UpToA); k>0; k--)
     12645    {a = a + par(k+1)*list_UpToA[k];}
     12646    a = a + par(1);
     12647    dbprint(p,dbprintWhitespace + "The ansatz for a is " + string(a));
     12648    poly ansatzPoly = a*b - h;
     12649    dbprint(p,dbprintWhitespace + "The ansatzpoly is " + string(ansatzPoly));
     12650    ideal listOfRelations = coeffs(ansatzPoly, var(1));
     12651    for (k = 2;k<=nvars(r);k++)
     12652    {listOfRelations = coeffs(listOfRelations,var(k));}
     12653    setring(r);
     12654    W = ring(clearSlateRingList); // comm ring of coeffs of the ansatz
     12655    W2 = W+r; // first coeffs, then orig letterplace vars
     12656    setring(W);
     12657    ideal listOfRelations = imap(S, listOfRelations);
     12658    option(redSB);
     12659    option(redTail);
     12660    dbprint(p,dbprintWhitespace + "Calculating the solutions of:");
     12661    dbprint(p,listOfRelations);
     12662    if (!defined(sol))
     12663    {
     12664      def sol = facstd(listOfRelations);
     12665    }
     12666    else
     12667    {
     12668      sol = facstd(listOfRelations);
     12669    }
     12670    dbprint(p,dbprintWhitespace + "Filtering the solutions that are " +
     12671      "not in the base-field.");
     12672    for(k = 1; k <=size(sol);k++)
     12673    {//filtering what is not in the ground-field
     12674      filterFlag = 0;
     12675      for (l=1; l<=size(sol[k]); l++)
     12676      {
     12677        if ((deg(sol[k][l])>1) or ((sol[k][l]/leadcoef(sol[k][l])==1)))
     12678        {//Not in the ground field
     12679          filterFlag = 1;
     12680          break;
     12681        }//Not in the ground field
     12682      }
     12683      if (filterFlag or (vdim(std(sol[k]))<0))
     12684      {//In this case, we can delete that whole entry and move on
     12685        sol= delete(sol,k);
     12686        continue;
     12687      }//In this case, we can delete that whole entry and move on
     12688    }//filtering what is not in the ground-field
     12689    dbprint(p,dbprintWhitespace + "Solutions for the coefficients are:");
     12690    dbprint(p,sol);
     12691    setring S;
     12692    ideal a_coef; jj=1;
     12693    while (a[jj]!=0)
     12694    {
     12695      a_coef[jj]=leadcoef(a[jj]);
     12696      jj++;
     12697    }
     12698    ideal b_coef;
     12699    jj=1;
     12700    while (b[jj]!=0)
     12701    {
     12702      b_coef[jj]=leadcoef(b[jj]);
     12703      jj++;
     12704    }
     12705    setring W; //W = ring of coeffs_variables
     12706    ideal a_coef = imap(S, a_coef);
     12707    ideal b_coef = imap(S, b_coef);
     12708    sizeOfSol = size(sol);
     12709    if (!defined(tempResultCoeffs)) {
     12710      list tempResultCoeffs;
     12711    }
     12712    tempResultCoeffs = list();
     12713    for (k=1; k<=sizeOfSol; k++)
     12714    {
     12715      sol[k] = std(sol[k]);
     12716      tempResultCoeffs = insert(tempResultCoeffs, list(
     12717      NF(a_coef, sol[k]), // element-wise
     12718      NF(b_coef, sol[k]))); // element-wise
     12719    }
     12720    setring S;
     12721    if(!defined(tempResultCoeffs)) {
     12722      list tempResultCoeffs = imap(W, tempResultCoeffs);
     12723    }
     12724    if (!(defined(tempResult)))
     12725    {list tempResult;}
     12726    poly ared;
     12727    poly bred;
     12728    for (k = 1; k <= size(tempResultCoeffs); k++)
     12729    {//Creating the resulting polynomials with the respective coeffs.
     12730      jj=1;
     12731      ared=0;
     12732      bred=0;
     12733      while (a[jj]!=0)
     12734      {//Going through all monomials of a
     12735        ared= ared+leadcoef(tempResultCoeffs[k][1][jj])*leadmonom(a[jj]);
     12736        jj++;
     12737      }//Going through all monomials of a
     12738      jj=1;
     12739      while (b[jj]!=0)
     12740      {//Going through all monomials of b
     12741        bred= bred+leadcoef(tempResultCoeffs[k][2][jj])*leadmonom(b[jj]);
     12742        jj++;
     12743      }//Going through all monomials of b
     12744      tempResult = insert(tempResult,list(ared,bred));
     12745    }//Creating the resulting polynomials with the respective coeffs.
     12746    setring(r);
     12747    if (!defined(tempResult))
     12748    {def tempResult = imap(S,tempResult);}
     12749    for (k=1; k<= size(tempResult);k++)
     12750    {
     12751      result = insert(result,tempResult[k]);
     12752    }
     12753    kill tempResult;
     12754    clearSlateRingList[2] = list();
     12755    clearSlateRingList[3] = list();
     12756    tempSringlist = ringlist(r);
     12757  }//Iterating over all two-combinations in the set M
     12758  if(size(result)==0)
     12759  {
     12760    return (list(list(h)));
     12761  }
     12762  return(delete_duplicates_noteval_and_sort(result));
     12763}//proc ncfactor_letterplace_poly_s
     12764
     12765
     12766static proc test_ncfactor_letterplace_poly_s()
     12767"Tests the basic functionality."
     12768{//proc test_ncfactor_letterplace_poly_s()
     12769  int result = 1;
     12770  ring r = 0,(x,y,z),dp;
     12771  int d =4; // degree bound
     12772  def R = makeLetterplaceRing(d);
     12773  setring R;
     12774  //TEST 1: power of 2
     12775  poly f1 = (x + y)*(x + y);
     12776  list obtained = ncfactor_letterplace_poly_s(f1);
     12777  list expected = sortFactorizations(
     12778    list(
     12779      list(x + y, x + y)
     12780      ));
     12781  if (!isListEqual(expected,obtained))
     12782  {
     12783    print("Test 1 for ncfactor_letterplace_poly_s failed.");
     12784    print("Expected:\n");
     12785    print(expected);
     12786    print("obtained:\n");
     12787    print(obtained);
     12788    result = 0;
     12789  }
     12790  //TEST 2: Monomial
     12791  f1 = x*z;
     12792  obtained = ncfactor_letterplace_poly_s(f1);
     12793  expected = sortFactorizations(
     12794    list(
     12795      list(x, z)
     12796      ));
     12797  if (!isListEqual(expected,obtained))
     12798  {
     12799    print("Test 2 for ncfactor_letterplace_poly_s failed.");
     12800    print("Expected:\n");
     12801    print(expected);
     12802    print("obtained:\n");
     12803    print(obtained);
     12804    result = 0;
     12805  }
     12806  //TEST 3: Generic product with all variables
     12807  f1 = (x*y + z*x)*(x+ z+ y);
     12808  obtained = ncfactor_letterplace_poly_s(f1);
     12809  expected = sortFactorizations(
     12810    list(
     12811      list(
     12812      x*y + z*x,
     12813      x+ z+ y))
     12814      );
     12815  if (!isListEqual(expected,obtained))
     12816  {
     12817    print("Test 3 for ncfactor_letterplace_poly_s failed.");
     12818    print("Expected:\n");
     12819    print(expected);
     12820    print("obtained:\n");
     12821    print(obtained);
     12822    result = 0;
     12823  }
     12824  //TEST 4: More than one factorization
     12825  f1 = x*y*x + x;
     12826  obtained = ncfactor_letterplace_poly_s(f1);
     12827  expected = sortFactorizations(
     12828    list(
     12829      list(x, y*x + 1),
     12830      list(x*y + 1, x))
     12831      );
     12832  if (!isListEqual(expected,obtained))
     12833  {
     12834    print("Test 4 for ncfactor_letterplace_poly_s failed.");
     12835    print("Expected:\n");
     12836    print(expected);
     12837    print("obtained:\n");
     12838    print(obtained);
     12839    result = 0;
     12840  }
     12841  return (result);
     12842}//proc test_ncfactor_letterplace_poly_s()
     12843
     12844static proc ncfactor_without_opt_letterplace(poly h)
     12845"USAGE: ncfactor_without_opt_letterplace(h); h is a polynomial in a
     12846        letterplace ring over a field k.
     12847RETURN: list(list)
     12848PURPOSE: Compute all factorizations of h, without making any
     12849         sanity-checks
     12850THEORY: Implements an ansatz-driven factorization method as outlined
     12851by Bell, Heinle and Levandovskyy in \"On Noncommutative Finite
     12852Factorization Domains\".
     12853ASSUME:
     12854- the basering is a Letterplace ring.
     12855- k is a ring, such that factorize can factor any univariate and
     12856  multivariate commutative polynomial over k.
     12857- There exists at least one variable in the ring.
     12858- h is not a constant or 0.
     12859NOTE:
     12860- Every entry of the output list is a list with factors for one possible factorization.
     12861  The first factor is always a constant (1, if no nontrivial constant
     12862  could be excluded).
     12863SEE ALSO: facWeyl, facSubWeyl, testNCfac, ncfactor
     12864"{//ncfactor_without_opt_letterplace
     12865  int p = printlevel-voice+2;
     12866  int i; int j; int k; int l;
     12867  string dbprintWhitespace = "";
     12868  for (i = 1; i<=voice;i++)
     12869  {dbprintWhitespace = dbprintWhitespace + " ";}
     12870  number commonCoefficient = content(h);
     12871  poly hath = h/commonCoefficient;
     12872  dbprint(p,dbprintWhitespace + "Calculating all possibilities of h as
     12873 a combination of two factors.");
     12874  list result = ncfactor_letterplace_poly_s(hath);
     12875  result = delete_duplicates_noteval_and_sort(result);
     12876  dbprint(p,dbprintWhitespace + "Done. The result is:");
     12877  dbprint(p,result);
     12878  dbprint(p,dbprintWhitespace+"Recursively check factors for
     12879 irreducibility");
     12880  list recursivetemp;
     12881  int changedSomething;
     12882  for(i = 1; i<=size(result);i++)
     12883  {//recursively factorize factors
     12884    if(size(result[i])>1)
     12885    {//Nontrivial factorization
     12886      for (j=1;j<=size(result[i]);j++)
     12887      {//Factorize every factor
     12888        recursivetemp = ncfactor_letterplace_poly_s(result[i][j]);
     12889        recursivetemp = delete_duplicates_noteval(recursivetemp);
     12890        changedSomething = 0;
     12891        for(k=1; k<=size(recursivetemp);k++)
     12892        {//insert factorized factors
     12893          if(size(recursivetemp[k])>1)
     12894          {//nontrivial
     12895            changedSomething = 1;
     12896            result = insert(result,result[i],i);
     12897            for(l = size(recursivetemp[k]);l>=1;l--)
     12898            {
     12899              result[i+1] = insert(result[i+1],recursivetemp[k][l],j);
     12900            }
     12901            result[i+1] = delete(result[i+1],j);
     12902          }//nontrivial
     12903        }//insert factorized factors
     12904        if (changedSomething)
     12905        {break;}
     12906      }//Factorize every factor
     12907      if(changedSomething)
     12908      {
     12909        result = delete(result,i);
     12910        continue;
     12911      }
     12912    }//Nontrivial factorization
     12913  }//recursively factorize factors
     12914  dbprint(p,dbprintWhitespace +" Done");
     12915  dbprint(p,dbprintWhitespace + "Removing duplicates from the list");
     12916  result = delete_duplicates_noteval_and_sort(result);
     12917  for (i = 1; i<=size(result);i++)
     12918  {//Putting the content everywhere
     12919    result[i] = insert(result[i],commonCoefficient);
     12920  }//Putting the content everywhere
     12921  result = normalizeFactors(result);
     12922  result = delete_duplicates_noteval_and_sort(result);
     12923  dbprint(p,dbprintWhitespace +" Done");
     12924  return(result);
     12925}//ncfactor_without_opt_letterplace
     12926
     12927static proc test_ncfactor_without_opt_letterplace()
     12928"Tests the basic functionality."
     12929{//test_ncfactor_without_opt_letterplace
     12930  int result = 1;
     12931  ring r = 0,(x,y,z),dp;
     12932  int d =4; // degree bound
     12933  def R = makeLetterplaceRing(d);
     12934  setring R;
     12935  //TEST 1: power of 2
     12936  poly f1 = 4*(x + y)*(x + y);
     12937  list obtained = ncfactor_without_opt_letterplace(f1);
     12938  list expected = sortFactorizations(
     12939    list(
     12940      list(number(4), x + y, x + y)
     12941      ));
     12942  if (!isListEqual(expected,obtained))
     12943  {
     12944    print("Test 1 for ncfactor_without_opt_letterplace failed.");
     12945    print("Expected:\n");
     12946    print(expected);
     12947    print("obtained:\n");
     12948    print(obtained);
     12949    result = 0;
     12950  }
     12951  //TEST 2: Monomial
     12952  f1 = 11*x*z;
     12953  obtained = ncfactor_without_opt_letterplace(f1);
     12954  expected = sortFactorizations(
     12955    list(
     12956      list(number(11), x, z)
     12957      ));
     12958  if (!isListEqual(expected,obtained))
     12959  {
     12960    print("Test 2 for ncfactor_without_opt_letterplace failed.");
     12961    print("Expected:\n");
     12962    print(expected);
     12963    print("obtained:\n");
     12964    print(obtained);
     12965    result = 0;
     12966  }
     12967  //TEST 3: Generic product with all variables
     12968  f1 = (2*x*y + 4*z*x)*(x+z+y);
     12969  obtained = ncfactor_without_opt_letterplace(f1);
     12970  expected = sortFactorizations(
     12971    list(
     12972      list(number(2), x*y + 2*z*x, x+z+y)
     12973      ));
     12974  if (!isListEqual(expected,obtained))
     12975  {
     12976    print("Test 3 for ncfactor_without_opt_letterplace failed.");
     12977    print("Expected:\n");
     12978    print(expected);
     12979    print("obtained:\n");
     12980    print(obtained);
     12981    result = 0;
     12982  }
     12983  //TEST 4: More than one factorization
     12984  f1 = 6*x*y*x + 9*x;
     12985  obtained = ncfactor_without_opt_letterplace(f1);
     12986  expected = sortFactorizations(
     12987    list(
     12988      list(number(3), x, 2*y*x + 3),
     12989      list(number(3), 2*x*y + 3, x)
     12990      ));
     12991  if (!isListEqual(expected,obtained))
     12992  {
     12993    print("Test 4 for ncfactor_without_opt_letterplace failed.");
     12994    print("Expected:\n");
     12995    print(expected);
     12996    print("obtained:\n");
     12997    print(obtained);
     12998    result = 0;
     12999  }
     13000  //Test 5: At least one recursive call
     13001  f1 = f1*(x + y);
     13002  obtained = ncfactor_without_opt_letterplace(f1);
     13003  expected = sortFactorizations(
     13004    list(
     13005      list(number(3), x, 2*y*x + 3, x + y),
     13006      list(number(3), 2*x*y + 3, x, x + y)
     13007      ));
     13008  if (!isListEqual(expected,obtained))
     13009  {
     13010    print("Test 5 for ncfactor_without_opt_letterplace failed.");
     13011    print("Expected:\n");
     13012    print(expected);
     13013    print("obtained:\n");
     13014    print(obtained);
     13015    result = 0;
     13016  }
     13017  return (result);
     13018}//test_ncfactor_without_opt_letterplace
     13019
     13020
    1198613021//==================================================
    1198713022// EASY EXAMPLES FOR WEYL ALGEBRA
     
    1221713252
    1221813253 /* recent bufgixes (2) Jan 2018; exs from Viktor and Johannes Hoffmann
    12219  // Original bug: found only (x+d)^2*x as faktorization
     13254 // Original bug: found only (x+d)^2*x as factorization
    1222013255LIB "nctools.lib";
    1222113256ring r = 0,(x,d),dp;
     
    1222513260
    1222613261//======================================================================
    12227 // Hard examples not yet calculatable in feasible amount of time
     13262// Hard examples not yet computable in feasible amount of time
    1222813263//======================================================================
    1222913264
  • Singular/LIB/nctools.lib

    rd669f7 r868c93d  
    13961396
    13971397///////////////////////////////////////////////////////////////////////////////
    1398 proc rightStd(def I)
     1398proc rightStd(def I)// just an alias for compatibility
    13991399"USAGE:  rightStd(I); I an ideal/ module
    14001400PURPOSE: compute a right Groebner basis of I
     
    14031403"
    14041404{
    1405   def A = basering;
    1406   def Aopp = opposite(A);
    1407   setring Aopp;
    1408   def Iopp = oppose(A,I);
    1409   def Jopp = groebner(Iopp);
    1410   setring A;
    1411   def J = oppose(Aopp,Jopp);
    1412   return(J);
     1405  return(rightstd(I));
    14131406}
    14141407example
     
    17711764RETURN:  ring
    17721765PURPOSE: create a copy of a given ring equipped with the
    1773 @* elimination ordering for module components @code{(c,<)}
     1766  elimination ordering for module components @code{(c,<)}
    17741767NOTE: usually the list argument contains a ring to work with
    17751768EXAMPLE: example makeModElimRing; shows an example
  • Singular/checklibs.c

    rd669f7 r868c93d  
    77#define LINE_LEN 200
    88#define RECOMMENDED_LEN 100
    9 VAR FILE *f;
    10 VAR int trailing_spaces=0;
    11 VAR int tabs=0;
    12 VAR int verylong_lines=0;
    13 VAR int lines=0;
    14 VAR unsigned char buf[LINE_LEN];
    15 VAR int proc_cnt=0;
    16 VAR unsigned char *proc[NUM_PROC];
    17 VAR unsigned char have_doc[NUM_PROC];
    18 VAR unsigned char have_example[NUM_PROC];
    19 VAR unsigned char proc_found[NUM_PROC];
    20 VAR int non_ascii=0;
    21 VAR int non_ascii_line=0;
    22 VAR int star_nl=0;
    23 VAR int footer=0;
    24 VAR int header=0;
    25 VAR int crlf=0;
    26 VAR int proc_help_lines=0;
    27 VAR int proc_help_texinfo=0;
     9FILE *f;
     10int trailing_spaces=0;
     11int tabs=0;
     12int verylong_lines=0;
     13int lines=0;
     14unsigned char buf[LINE_LEN];
     15int proc_cnt=0;
     16unsigned char *proc[NUM_PROC];
     17unsigned char have_doc[NUM_PROC];
     18unsigned char have_example[NUM_PROC];
     19unsigned char proc_found[NUM_PROC];
     20int non_ascii=0;
     21int non_ascii_line=0;
     22int star_nl=0;
     23int footer=0;
     24int header=0;
     25int crlf=0;
     26int proc_help_lines=0;
     27int proc_help_texinfo=0;
    2828
    2929void get_next()
  • Singular/dyn_modules/Makefile.am

    rd669f7 r868c93d  
    11ACLOCAL_AMFLAGS = -I ../m4
    22
    3 SUBDIRS=staticdemo bigintm subsets syzextra pyobject customstd gfanlib python gitfan polymake singmathic Order interval cohomo freegb
     3SUBDIRS=staticdemo bigintm subsets syzextra pyobject customstd gfanlib python gitfan polymake singmathic Order interval cohomo freealgebra
  • Singular/dyn_modules/Order/singular.cc

    rd669f7 r868c93d  
    510510     (currPack->libname? currPack->libname: "NFOrder"),// the library name,
    511511    "nforder: orders in number fields"); // the help string for the module
    512   VAR return MAX_TOK;
     512  return MAX_TOK;
    513513}
    514514#endif
  • Singular/dyn_modules/cohomo/cohomo.cc

    rd669f7 r868c93d  
    53315331{
    53325332  firstorderdef_setup(p);
    5333   VAR return MAX_TOK;
     5333  return MAX_TOK;
    53345334}
    53355335
  • Singular/dyn_modules/freealgebra/Makefile.am

    rd669f7 r868c93d  
    11ACLOCAL_AMFLAGS = -I ../../m4
    22
    3 if SI_BUILTIN_FREEGB
    4   noinst_LTLIBRARIES=freegb.la
     3if SI_BUILTIN_FREEALGEBRA
     4  noinst_LTLIBRARIES=freealgebra.la
    55  P_PROCS_MODULE_LDFLAGS = -module
    66  P_PROCS_CPPFLAGS_COMMON = -DSTATIC_VERSION
    77else
    8   module_LTLIBRARIES=freegb.la
     8  module_LTLIBRARIES=freealgebra.la
    99  moduledir = $(libexecdir)/singular/MOD
    1010  P_PROCS_CPPFLAGS_COMMON = -DDYNAMIC_VERSION
     
    1818
    1919
    20 freegb_la_CPPFLAGS  = ${MYINCLUDES} ${P_PROCS_CPPFLAGS_COMMON}
    21 freegb_la_LDFLAGS   = ${AM_LDFLAGS} ${P_PROCS_MODULE_LDFLAGS} $(SINGULAR_LDFLAGS)
    22 SOURCES = freegb.cc
    23 freegb_la_SOURCES   = $(SOURCES)
     20freealgebra_la_CPPFLAGS  = ${MYINCLUDES} ${P_PROCS_CPPFLAGS_COMMON}
     21freealgebra_la_LDFLAGS   = ${AM_LDFLAGS} ${P_PROCS_MODULE_LDFLAGS} $(SINGULAR_LDFLAGS)
     22SOURCES = freealgebra.cc
     23freealgebra_la_SOURCES   = $(SOURCES)
    2424
  • Singular/dyn_modules/freealgebra/freealgebra.cc

    rd669f7 r868c93d  
    22
    33#ifdef HAVE_SHIFTBBA
    4 static BOOLEAN freegb(leftv res, leftv args)
     4static BOOLEAN freeAlgebra(leftv res, leftv args)
    55{
    66  const short t1[]={2,RING_CMD,INT_CMD};
     
    8080}
    8181
    82 /*==================== divide-test for freeGB  =================*/
    8382static BOOLEAN lpLmDivides(leftv res, leftv h)
    8483{
     
    112111}
    113112
    114 /*==================== get var for freeGB  ====================*/
    115113static BOOLEAN lpVarAt(leftv res, leftv h)
    116114{
     
    130128//------------------------------------------------------------------------
    131129// initialisation of the module
    132 extern "C" int SI_MOD_INIT(freegb)(SModulFunctions* p)
     130extern "C" int SI_MOD_INIT(freealgebra)(SModulFunctions* p)
    133131{
    134132#ifdef HAVE_SHIFTBBA
    135   p->iiAddCproc("freegb.so","freeAlgebra",FALSE,freegb);
    136   p->iiAddCproc("freegb.so","lpLmDivides",FALSE,lpLmDivides);
    137   p->iiAddCproc("freegb.so","lpVarAt",FALSE,lpVarAt);
    138   p->iiAddCproc("freegb.so","stest",TRUE,stest);
    139   p->iiAddCproc("freegb.so","btest",TRUE,btest);
     133  p->iiAddCproc("freealgebra.so","freeAlgebra",FALSE,freeAlgebra);
     134  p->iiAddCproc("freealgebra.so","lpLmDivides",FALSE,lpLmDivides);
     135  p->iiAddCproc("freealgebra.so","lpVarAt",FALSE,lpVarAt);
     136  p->iiAddCproc("freealgebra.so","stest",TRUE,stest);
     137  p->iiAddCproc("freealgebra.so","btest",TRUE,btest);
    140138#endif
    141139  return (MAX_TOK);
  • Singular/dyn_modules/interval/interval.cc

    rd669f7 r868c93d  
    12531253    evalPolyAtBox);
    12541254
    1255   VAR return MAX_TOK;
     1255  return MAX_TOK;
    12561256}
    12571257// vim: spell spelllang=en
  • Singular/dyn_modules/python/python_module.cc

    rd669f7 r868c93d  
    8080
    8181  psModulFunctions->iiAddCproc(currPack->libname,"python",FALSE, mod_python);
    82   VAR return MAX_TOK;
     82  return MAX_TOK;
    8383}
    8484#endif
  • Singular/dyn_modules/singmathic/singmathic.cc

    rd669f7 r868c93d  
    597597    prOrderX
    598598  );
    599   VAR return MAX_TOK;
     599  return MAX_TOK;
    600600}
    601601
  • Singular/iparith.cc

    rd669f7 r868c93d  
    28752875  res->data=NULL;
    28762876
    2877   if (rIsPluralRing(currRing))
     2877  if (rIsPluralRing(currRing) || rIsLPRing(currRing))
    28782878  {
    28792879    const poly q = (poly)b->Data();
     
    28832883      if( (poly)a->Data() != NULL )
    28842884      {
    2885         poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
    2886         res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
     2885        if (rIsPluralRing(currRing))
     2886        {
     2887          poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
     2888          res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
     2889        }
     2890        else if (rIsLPRing(currRing))
     2891        {
     2892          const poly p = (poly)a->Data();
     2893          res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
     2894        }
     2895      }
     2896    }
     2897  }
     2898  return FALSE;
     2899}
     2900static BOOLEAN jjBRACKET_REC(leftv res, leftv a, leftv b, leftv c)
     2901{
     2902  res->data=NULL;
     2903
     2904  if (rIsLPRing(currRing) || rIsPluralRing(currRing))
     2905  {
     2906    const poly q = (poly)b->Data();
     2907    if(q != NULL)
     2908    {
     2909      if((poly)a->Data() != NULL)
     2910      {
     2911        const poly p = (poly)a->Data();
     2912        int k=(int)(long)c->Data();
     2913        if (k > 0)
     2914        {
     2915          poly qq = pCopy(q);
     2916          for (int i = 0; i < k; i++)
     2917          {
     2918            poly qq_ref = qq;
     2919            if (rIsLPRing(currRing))
     2920            {
     2921              qq = pAdd(ppMult_qq(p,qq), pNeg(ppMult_qq(qq,p)));
     2922            }
     2923            else if (rIsPluralRing(currRing))
     2924            {
     2925              qq = nc_p_Bracket_qq(pCopy(p), qq, currRing);
     2926            }
     2927            pDelete(&qq_ref);
     2928            if (qq == NULL) break;
     2929          }
     2930          res->data = qq;
     2931        }
     2932        else
     2933        {
     2934          Werror("invalid number of iterations");
     2935        }
    28872936      }
    28882937    }
     
    51165165}
    51175166#endif
    5118 
     5167#ifdef HAVE_SHIFTBBA // do not place above jjSTD in this file because we need to reference it
     5168static BOOLEAN jjRIGHTSTD(leftv res, leftv v)
     5169{
     5170  if (rIsLPRing(currRing))
     5171  {
     5172    if (rField_is_numeric(currRing))
     5173      WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
     5174    ideal result;
     5175    ideal v_id=(ideal)v->Data();
     5176    /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
     5177    /* tHomog hom=testHomog; */
     5178    /* if (w!=NULL) */
     5179    /* { */
     5180    /*   if (!idTestHomModule(v_id,currRing->qideal,w)) */
     5181    /*   { */
     5182    /*     WarnS("wrong weights"); */
     5183    /*     w=NULL; */
     5184    /*   } */
     5185    /*   else */
     5186    /*   { */
     5187    /*     hom=isHomog; */
     5188    /*     w=ivCopy(w); */
     5189    /*   } */
     5190    /* } */
     5191    /* result=kStd(v_id,currRing->qideal,hom,&w); */
     5192    result = rightgb(v_id, currRing->qideal);
     5193    idSkipZeroes(result);
     5194    res->data = (char *)result;
     5195    if(!TEST_OPT_DEGBOUND) setFlag(res,FLAG_STD);
     5196    /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
     5197    return FALSE;
     5198  }
     5199  else if (rIsPluralRing(currRing))
     5200  {
     5201    ideal I=(ideal)v->Data();
     5202
     5203    ring A = currRing;
     5204    ring Aopp = rOpposite(A);
     5205    currRing = Aopp;
     5206    ideal Iopp = idOppose(A, I, Aopp);
     5207    ideal Jopp = kStd(Iopp,currRing->qideal,testHomog,NULL);
     5208    currRing = A;
     5209    ideal J = idOppose(Aopp, Jopp, A);
     5210
     5211    id_Delete(&Iopp, Aopp);
     5212    id_Delete(&Jopp, Aopp);
     5213    rDelete(Aopp);
     5214
     5215    idSkipZeroes(J);
     5216    res->data = (char *)J;
     5217    if(!TEST_OPT_DEGBOUND) setFlag(res,FLAG_STD);
     5218    return FALSE;
     5219  }
     5220  else
     5221  {
     5222    return jjSTD(res, v);
     5223  }
     5224}
     5225#endif
    51195226static BOOLEAN jjTYPEOF(leftv res, leftv v)
    51205227{
     
    53315438BOOLEAN jjLOAD_TRY(const char *s)
    53325439{
    5333   void (*WerrorS_save)(const char *s) = WerrorS_callback;
    5334   WerrorS_callback=WerrorS_dummy;
    5335   WerrorS_dummy_cnt=0;
    5336   BOOLEAN bo=jjLOAD(s,TRUE);
    5337   if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
    5338     Print("loading of >%s< failed\n",s);
    5339   WerrorS_callback=WerrorS_save;
    5340   errorreported=0;
     5440  if (!iiGetLibStatus(s))
     5441  {
     5442    void (*WerrorS_save)(const char *s) = WerrorS_callback;
     5443    WerrorS_callback=WerrorS_dummy;
     5444    WerrorS_dummy_cnt=0;
     5445    BOOLEAN bo=jjLOAD(s,TRUE);
     5446    if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
     5447      Print("loading of >%s< failed\n",s);
     5448    WerrorS_callback=WerrorS_save;
     5449    errorreported=0;
     5450  }
    53415451  return FALSE;
    53425452}
  • Singular/iplib.cc

    rd669f7 r868c93d  
    7171* return TRUE if the libray libname is already loaded
    7272*/
    73 BOOLEAN iiGetLibStatus(char *lib)
     73BOOLEAN iiGetLibStatus(const char *lib)
    7474{
    7575  idhdl hl;
     
    8282    return FALSE;
    8383  }
    84   return (strcmp(lib,IDPACKAGE(hl)->libname)==0);
     84  if ((IDPACKAGE(hl)->language!=LANG_C)&&(IDPACKAGE(hl)->libname!=NULL))
     85    return (strcmp(lib,IDPACKAGE(hl)->libname)==0);
     86  return FALSE;
    8587}
    8688
  • Singular/ipshell.h

    rd669f7 r868c93d  
    9797poly    iiHighCorner(ideal i, int ak);
    9898char *  iiConvName(const char *libname);
     99BOOLEAN iiGetLibStatus(const char *lib);
    99100BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib,
    100101                         idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror);
  • Singular/links/asciiLink.cc

    rd669f7 r868c93d  
    2424static const char* GetIdString(idhdl h);
    2525static int DumpRhs(FILE *fd, idhdl h);
    26 static BOOLEAN DumpQring(FILE *fd, idhdl h, const char *type_str);
     26static BOOLEAN DumpQring(FILE *fd, idhdl h);
     27static BOOLEAN DumpNCring(FILE *fd, idhdl h);
    2728static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl);
    2829static BOOLEAN CollectLibs(char *name, char ***list_of_libs);
     
    294295    if (strcmp(IDID(h),"Top")==0) return FALSE; // do not dump "Top"
    295296    if (IDPACKAGE(h)->language==LANG_SINGULAR) return FALSE;
     297    if (IDPACKAGE(h)->language==LANG_MIX) return FALSE;
    296298  }
    297299  if (type_id == CRING_CMD)
     
    310312    return FALSE;
    311313
     314  // handle nc-rings separately
     315  if ((type_id == RING_CMD)&&(rIsNCRing(IDRING(h))))
     316    return DumpNCring(fd,h);
     317
    312318  // handle qrings separately
    313319  if ((type_id == RING_CMD)&&(IDRING(h)->qideal!=NULL))
    314     return DumpQring(fd, h, type_str);
     320    return DumpQring(fd, h);
    315321
    316322  // C-proc not to be dumped
     
    368374  {
    369375    case LIST_CMD:
    370     {
    371       lists l = IDLIST(h);
    372       int i, nl = l->nr + 1;
    373 
    374       for (i=0; i<nl; i++)
    375         if (GetIdString((idhdl) &(l->m[i])) == NULL) return NULL;
    376     }
     376    //{
     377    //
     378    //
     379    //  lists l = IDLIST(h);
     380    //  int i, nl = l->nr + 1;
     381//
     382    //  for (i=0; i<nl; i++)
     383    //    if (GetIdString((idhdl) &(l->m[i])) == NULL) return NULL;
     384    //  break;
     385    //}
    377386    case CRING_CMD:
    378387    #ifdef SINGULAR_4_2
     
    408417}
    409418
    410 static BOOLEAN DumpQring(FILE *fd, idhdl h, const char *type_str)
     419static BOOLEAN DumpNCring(FILE *fd, idhdl h)
    411420{
    412421  char *ring_str = h->String();
    413   if (fprintf(fd, "%s temp_ring = %s;\n", Tok2Cmdname(RING_CMD), ring_str)
    414               == EOF) return TRUE;
    415   if (fprintf(fd, "%s temp_ideal = %s;\n", Tok2Cmdname(IDEAL_CMD),
    416               iiStringMatrix((matrix) IDRING(h)->qideal, 1, currRing, n_GetChar(currRing->cf)))
     422  ring r=IDRING(h);
     423
     424  if (rIsPluralRing(r))
     425  {
     426    if (fprintf(fd, "ring temp_ring = %s;\n", ring_str)
     427      == EOF) return TRUE;
     428    if (fprintf(fd, "ideal temp_C = %s;\n",
     429              iiStringMatrix((matrix) r->GetNC()->C, 2, r, n_GetChar(r->cf)))
     430      == EOF) return TRUE;
     431    if (fprintf(fd, "ideal temp_D = %s;\n",
     432              iiStringMatrix((matrix) r->GetNC()->D, 2, r, n_GetChar(r->cf)))
     433      == EOF) return TRUE;
     434    if (fprintf(fd, "def %s = nc_algebra(temp_C,temp_D);\n",IDID(h)) == EOF)
     435      return TRUE;
     436    if (fputs("kill temp_ring;\n",fd) == EOF) return TRUE;
     437  }
     438  if (rIsLPRing(r))
     439  {
     440    //if (fprintf(fd, "ring %s = %s;\n", IDID(h), ring_str) == EOF) return TRUE;
     441    //if (fprintf(fd, "attrib(%s,\"isLetterplaceRing\",%d);\n",IDID(h),r->isLPring) ==EOF) return TRUE;
     442    Warn("cannot write LP ring %s",IDID(h));
     443    return TRUE;
     444  }
     445  omFree(ring_str);
     446  return FALSE;
     447}
     448
     449static BOOLEAN DumpQring(FILE *fd, idhdl h)
     450{
     451  char *ring_str = h->String();
     452  ring r=IDRING(h);
     453  if (fprintf(fd, "ring temp_ring = %s;\n", ring_str) == EOF) return TRUE;
     454  if (fprintf(fd, "ideal temp_ideal = %s;\n",
     455              iiStringMatrix((matrix) r->qideal, 1, currRing, n_GetChar(r->cf)))
    417456      == EOF) return TRUE;
    418457  if (fputs("attrib(temp_ideal, \"isSB\", 1);\n",fd) == EOF) return TRUE;
    419   if (fprintf(fd, "%s %s = temp_ideal;\n", type_str, IDID(h)) == EOF)
     458  if (fprintf(fd, "qring %s = temp_ideal;\n",IDID(h)) == EOF)
    420459    return TRUE;
    421460  if (fputs("kill temp_ring;\n",fd) == EOF) return TRUE;
  • Singular/links/ssiLink.cc

    rd669f7 r868c93d  
    4949#include <netinet/in.h> /* for htons etc.*/
    5050
    51 #define SSI_VERSION 12
     51#define SSI_VERSION 13
    5252// 5->6: changed newstruct representation
    5353// 6->7: attributes
     
    5757// 10->11: extended ring descr. for named coeffs (not in used until 4.1)
    5858// 11->12: add rank to ideal/module, add smatrix
     59// 12->13: NC rings
    5960
    6061VAR link_list ssiToBeClosed=NULL;
     
    233234  {
    234235    fputs("0 0 0 0 "/*,r->ch,r->N, blocks, q-ideal*/,d->f_write);
     236  }
     237  if (rIsLPRing(r)) // cannot be combined with 23 2
     238  {
     239    fprintf(d->f_write,"23 1 %d %d ",SI_LOG2(r->bitmask),r->isLPring);
     240  }
     241  else
     242  {
     243    unsigned long bm=0;
     244    int b=0;
     245    bm=rGetExpSize(bm,b,r->N);
     246    if (r->bitmask!=bm)
     247    {
     248      fprintf(d->f_write,"23 0 %d ",SI_LOG2(r->bitmask));
     249    }
     250    if (rIsPluralRing(r))
     251    {
     252      fputs("23 2 ",d->f_write);
     253      void ssiWriteIdeal(const ssiInfo *d, int typ,const ideal I);
     254      ssiWriteIdeal(d,MATRIX_CMD,(ideal)r->GetNC()->C);
     255      ssiWriteIdeal(d,MATRIX_CMD,(ideal)r->GetNC()->D);
     256    }
    235257  }
    236258}
     
    779801  }
    780802  res->flag=fl;
     803}
     804void ssiReadRingProperties(si_link l)
     805{
     806  ssiInfo *d=(ssiInfo*)l->data;
     807  int what=s_readint(d->f_read);
     808  switch(what)
     809  {
     810    case 0: // bitmask
     811    {
     812      int lb=s_readint(d->f_read);
     813      unsigned long bm=~0L;
     814      bm=bm<<lb;
     815      bm=~bm;
     816      rUnComplete(d->r);
     817      d->r->bitmask=bm;
     818      rComplete(d->r);
     819      break;
     820    }
     821    case 1: // LPRing
     822    {
     823      int lb=s_readint(d->f_read);
     824      int isLPring=s_readint(d->f_read);
     825      unsigned long bm=~0L;
     826      bm=bm<<lb;
     827      bm=~bm;
     828      rUnComplete(d->r);
     829      d->r->bitmask=bm;
     830      d->r->isLPring=isLPring;
     831      rComplete(d->r);
     832      break;
     833    }
     834    case 2: // Plural rings
     835    {
     836      matrix C=ssiReadMatrix(d);
     837      matrix D=ssiReadMatrix(d);
     838      nc_CallPlural(C,D,NULL,NULL,d->r,true,true,false,d->r,false);
     839      break;
     840    }
     841  }
    781842}
    782843//**************************************************************************/
     
    12871348             if (d->r==NULL) return NULL;
    12881349             res->data=(char*)d->r;
     1350             d->r->ref++;
    12891351             res->rtyp=RING_CMD;
    12901352             if (t==15) // setring
     
    13601422    case 21: ssiReadAttrib(res,l);
    13611423             break;
     1424    case 23: ssiReadRingProperties(l);
     1425             return ssiRead1(l);
     1426             break;
    13621427    // ------------
    13631428    case 98: // version
     
    14011466  && (res->RingDependend()))
    14021467  {
    1403     if(ssiSetCurrRing(d->r)) { d->r=currRing; d->r->ref++; }
     1468    if(ssiSetCurrRing(d->r)) { d->r=currRing; }
    14041469  }
    14051470  return res;
     
    15201585                        else if(tt==MATRIX_CMD) fputs("8 ",d->f_write);
    15211586                        else if(tt==SMATRIX_CMD) fputs("22 ",d->f_write);
    1522                         else
     1587                        else /* tt==MODUL_CMD*/
    15231588                        {
    15241589                          ideal M=(ideal)dd;
     
    21682233// 21 attrib <bit-attrib> <len> <a-name1> <val1>... <data>
    21692234// 22 smatrix
     2235// 23 0 <log(bitmask)> ring properties: max.exp.
     2236// 23 1 <log(bitmask)> <r->IsLPRing> ring properties:LPRing
     2237// 23 2 <matrix C> <matrix D> ring properties: PLuralRing
    21702238//
    21712239// 98: verify version: <ssi-version> <MAX_TOK> <OPT1> <OPT2>
  • Singular/misc_ip.cc

    rd669f7 r868c93d  
    10921092 * few lines of m2_end() should not matter.
    10931093 */
    1094 VAR volatile BOOLEAN m2_end_called = FALSE;
     1094volatile BOOLEAN m2_end_called = FALSE;
    10951095
    10961096void m2_end(int i)
  • Singular/table.h

    rd669f7 r868c93d  
    245245,{D(jjDUMMY),      RESOLUTION_CMD,  RESOLUTION_CMD, RESOLUTION_CMD, ALLOW_PLURAL |ALLOW_RING}
    246246,{D(jjRESTART),    RESTART_CMD,     NONE,           INT_CMD,        ALLOW_NC |ALLOW_RING}
     247#ifdef HAVE_SHIFTBBA
     248,{D(jjRIGHTSTD),   RIGHTSTD_CMD,    IDEAL_CMD,      IDEAL_CMD     , ALLOW_NC |NO_RING}
     249#endif
    247250,{D(jjRINGLIST),   RINGLIST_CMD,    LIST_CMD,       RING_CMD      , ALLOW_NC |ALLOW_RING}
    248251,{D(jjRINGLIST_C), RING_LIST_CMD,   LIST_CMD,       CRING_CMD     , ALLOW_NC |ALLOW_RING}
     
    590593,{D(jjBETTI2_ID), BETTI_CMD,      INTMAT_CMD,     IDEAL_CMD,  INT_CMD, ALLOW_PLURAL | ALLOW_RING}
    591594,{D(jjBETTI2_ID), BETTI_CMD,      INTMAT_CMD,     MODUL_CMD,  INT_CMD, ALLOW_PLURAL | ALLOW_RING}
    592 #ifdef HAVE_PLURAL
    593 ,{D(jjBRACKET),   BRACKET_CMD,    POLY_CMD,       POLY_CMD,   POLY_CMD, ALLOW_PLURAL | NO_RING}
     595#if defined(HAVE_PLURAL) || defined(HAVE_SHIFTBBA)
     596,{D(jjBRACKET),   BRACKET_CMD,    POLY_CMD,       POLY_CMD,   POLY_CMD, ALLOW_NC | NO_RING}
    594597#endif
    595598,{D(jjCHINREM_BI),CHINREM_CMD,    BIGINT_CMD,     INTVEC_CMD, INTVEC_CMD, ALLOW_PLURAL |ALLOW_RING}
     
    791794,{D(atATTRIB3),        ATTRIB_CMD, NONE,       IDHDL,      STRING_CMD, DEF_CMD, ALLOW_NC |ALLOW_RING}
    792795,{D(jjBAREISS3),       BAREISS_CMD,LIST_CMD,   MODUL_CMD,  INT_CMD,    INT_CMD, NO_NC |ALLOW_RING|NO_ZERODIVISOR}
     796#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)
     797,{D(jjBRACKET_REC),    BRACKET_CMD,POLY_CMD,   POLY_CMD,   POLY_CMD,   INT_CMD, ALLOW_NC | NO_RING}
     798#endif
    793799,{D(jjCOEFFS3_P),      COEFFS_CMD, MATRIX_CMD, POLY_CMD,   POLY_CMD,   MATRIX_CMD, ALLOW_PLURAL |ALLOW_RING}
    794800,{D(jjCOEFFS3_P),      COEFFS_CMD, MATRIX_CMD, VECTOR_CMD, POLY_CMD,   MATRIX_CMD, ALLOW_PLURAL |ALLOW_RING}
     
    983989  { "bigintmat",   0, BIGINTMAT_CMD ,     BIGINTMAT_CMD},
    984990  { "branchTo",    0, BRANCHTO_CMD ,      CMD_M},
    985   #ifdef HAVE_PLURAL
    986   { "bracket",     0, BRACKET_CMD ,       CMD_2},
     991  #if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)
     992  { "bracket",     0, BRACKET_CMD ,       CMD_23},
    987993  #endif
    988994  { "break",       0, BREAK_CMD ,         BREAK_CMD},
     
    11681174  { "return",      0, RETURN ,            RETURN},
    11691175  { "RETURN",      0, END_GRAMMAR ,       RETURN},
     1176#ifdef HAVE_SHIFTBBA
     1177  { "rightstd",    0, RIGHTSTD_CMD ,      CMD_1},
     1178#endif /* HAVE_PLURAL */
    11701179  { "ring",        0, RING_CMD ,          RING_CMD},
    11711180  { "ringlist",    0, RINGLIST_CMD ,      CMD_1},
  • Singular/tok.h

    rd669f7 r868c93d  
    169169  RESTART_CMD,
    170170  RESULTANT_CMD,
     171  RIGHTSTD_CMD,
    171172  RINGLIST_CMD,
    172173  RING_LIST_CMD,
  • Tst/Manual/m.lst

    rd669f7 r868c93d  
    10701070involution
    10711071isFsat
    1072 isVar
    10731072makeQsl2
    10741073makeUsp1
  • Tst/Old/m141si.res.gz.uu

    rd669f7 r868c93d  
    11begin 640 m141si.res.gz
    2 M'XL(".\Z4%<``VTQ-#%S:2YR97,`O==/2\,P%`#P^SY%*!XZD6W='P7+=AA>
    3 MAN)!O8]T>>T>3=HN>;/SVYMNZD`%:9%W*>'U_9K0I'W)\\O=ZE$($2W\!0L2
    4 M.)_$O>>/Z+B)JKVIPN"V%G"0IM(PH`,%_7/2I$G*46N!Y^"T"69`)_Q-#H?B
    5 M\E)84)!B@44FR-':D:2]6Z>H082.[&_QN0A,-(T<#@JH!\V=(.[_?)PCE6;:
    6 MB%"74H6!SRN4M&J@,0FN`K)O?A#_RK:H$R:VVY>$4-`#.N*TE;3C5VF?FC8?
    7 M;=X0I]LYC29K/RG=6&9+2`JP7,Z"8R#-*N,R4==/8-05=NZQ,QRSPPD[G+'#
    8 M*1OT516L@TW[%>`J7P4I96*<*F5E-6"VI?LEEU.2@-``E\N3C9:N]8]:@>XH
    9 M\Z2RX,MZZY%NMK#)Z[KU1*#*$^E:=W>:0%,6;:&1!PZ"[0?6@91J[5M_U=?/
    10 MG?OL>!*(>Y.OR'43<6^.P'B]]<::[X>!T5?VS4(\K)8B\'OW8P_Q>1,?1OWX
    11 +HO<.P/0W.7,,````
     2M'XL("`ID5%P"`VTQ-#%S:2YR97,`;8]!"X)`$(7O_HIAZ*`1FFD%+7J(+D)T
     3ML7L4;3:T*^*.9/\^MT)!NLSAF^_Q>/EQEQT`($R[0R4#)9%P\A]=6'IM=.7B
     4MY@FR/>M*29];1F^0(BL]2"F@`<86%I*_X5$R"&`ZA5I>Y8U**@M@PR?#9V[,
     5MZ49*@FNX_L<30!W&H2&_E$_??E!X?>?RLT$X44]6EIB78:E=-'><8:W',^:]
     6;O4YAGVT!NU9?T07%4.^&GI@X;^+`Y-0M`0``
    127`
    138end
  • Tst/Old/m141si.stat

    rd669f7 r868c93d  
    1 1 >> tst_memory_0 :: 1415105097:4011, 32 bit:4.0.1:i686-Linux:mamawutz:194256
    2 1 >> tst_memory_1 :: 1415105097:4011, 32 bit:4.0.1:i686-Linux:mamawutz:2271020
    3 1 >> tst_memory_2 :: 1415105097:4011, 32 bit:4.0.1:i686-Linux:mamawutz:2311992
    4 1 >> tst_timer_1 :: 1415105097:4011, 32 bit:4.0.1:i686-Linux:mamawutz:3
     11 >> tst_memory_0 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:79680
     21 >> tst_memory_1 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:2150160
     31 >> tst_memory_2 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:2191264
     41 >> tst_timer_1 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:2
  • Tst/Old/m24si.res.gz.uu

    rd669f7 r868c93d  
    11begin 640 m24si.res.gz
    2 M'XL("/^?*5@``VTR-'-I+G)E<P"]6$UOVS@0O>M7$,(>I$)P+#G.=F.X0#_V
    3 M$&S10]*]]!+0XMAA38DJ24=6?GV'E"6K3A9;N04-V*;(>3./,T\?H[O/'VX^
    4 M$4+2-_BC>+DA:CG+IM-9$NV3)GF*$U8M@KN#56:M!"^W1"S#ZYK`GA:5@(G9
    5 MFW!![.?B@IBF`L(U>:MSSA-22.8.Y2.H6G$#O;>9\[8(.LPU>7OW_N;&'CO0
    6 M-:GMN*2%'0]BV5E908FSI;0'"BAS!\8-&SOG8@WGNK"7-JPVU.QT)!(26O]A
    7 MW-(GW29<4&0]C#H<=\[F)\XLK1#_&]`'G^C,90R=62X-&,<=6##MO5Q9+YP!
    8 M%80O"[IWPRB+CYG_TUJX+1&,DR;A(DPR]QMVN##A=F(`>OTSY$I9]P2M09#V
    9 M^+].\+8JSS*UELH10^T$=0=-ISW?*!RJ!.F6AGQ=SBU11#-JJ(U,*PS-@!$C
    10 MR9J+7B1I*TPLX(]^!BP&7A28G<+4$JJ1MY4S[F819/CMLA0\94GSE#19LG]*
    11 M]DVRSW#M0"GHHSJAYT)JB,0/&QY&[;+F[%B/=;*&/>0[W+QC+N(3'YUD6XZM
    12 MSIP]0[Z95>^K5VC!8,U+9T"BCG_<QSG5\<CJIJ?2?;&ZO&R9VL5`]=BK7\B/
    13 MD[(MVJZHR"-5QTN#W6JEX)'+G78J(+DL#93FN@>_GB#8(J/3Z\]1]ZG3[98+
    14 M050_F3E%;L"TX)>TA)QPO>6U5K)HA?BL&$:;^S9M]XYC=*CBZ?P24YI=:CXI
    15 MH9[8A7`1/_?V%4MKY8?F\Y?6M6'KC2CPK)?V'$`_):.*301?X<ED5(/T?ROL
    16 M@8N5)]BWG30<R_N1:^,36U&5H?!N[=@?U&;()^Z;%KS8C"_*>;"-DK`J0?G"
    17 M*=`>(%9EOC#IN:?`]%S@V1'/!F;>@3/OP+EWX*4W(-ZJ0&G(QRM`5WB3-&M/
    18 M,)^HM5=8#7SS8/YYYPN'C]9@>`&^<-M5+J@>?:%F(,Y$;E?XR(FW]=%,\P?(
    19 MMW4]NA"<;5=4CP[7%K"0Y5@@]I,^('P\L3,@DMWCZ/_NK]TSOVL>/]Z\(^$&
    20 M.VY%A;,[]@19URA0(:*P4C(?M!'9K&\C#B;')==[M9U$^)_]CVLDL)_%IV.Y
    21 M,\'/MPE!^R(&EZ(O7R[<ZYBX?Q\3L2K"P_=QW].B7?O"X%EK&Q]Z6]=<!+(R
    22 M7):1!I/8"_DCY-%L-I]?SJ^F"7;LV?P*^]2@3>PP7UU>@]N_/_][^RD:I*CM
    23 J(1MMH,!B/*"I*DZ[LOXU1X9=HRL&IJ`MQ#$741HO_@B^`S\W3]^.$@``
     2M'XL("`ID5%P"`VTR-'-I+G)E<P"E55UOVC`4?<^OL*P].)5%B2&L(V)2U^T!
     3M:>I#V[WTI<J(Z=PZ<>082/CUN[:)26&3*A6)Q!_WX]QSCYW[A^_+6X10\A4>
     4M6E3/2"\F;#R>4-+2CNYC6M19='^P8M9*BNH5R06>[Q!O\[*6?&1:@S-D?Y>7
     5MR'0U1Z)!U\U*"(I*5;BIVG*]T\+P$&WBHF51[S-'U_<WRZ6=.Z<YVMEQE9=V
     6M/,AE5U7-*UBME)UHGA=N8MRPLVLNUW"M3SNU:1N3FTU#)$78QL>QAX_Z(EQ2
     7M0#W,.ASWP=*38!86AG?'FT-,".88@V`62\>-P\Z+:!RBS&P44?!<(K$H\]8-
     8M"8N/S'^V%JXD!'D2BC-,F7OBW@]381<&3E?O`5>I70!H#:(D^'\Y\;==.6-J
     9MK;0#!MJ)=KUK,@YX"1ZJ!.!6!KTL4@L4O(O<Y#9S7D/J@A?(*+06,H@D\<*$
     10M!KZ-,T`QB**YV6B@%N4-X+9RAFJRB,&_9RG:,]KM:<=HNZ=M1UL&>P=(4<CJ
     11MA+Z2JN%$OBEXF+5GS=D5P=?)FK=\M8'B'7(9G\3H)>LQ>ITY^P+P,JO>BPNP
     12M*/A:5,X`D1Y_'/),/];=)'U/=T7ED=K-2`??V0?X<5*V3=N4-=KF^G@UV%)K
     13MS;=";1JG`K12E>&5F0?GJQ$X6T]R>O\<=9\XW;X**9$.B\PI\ID;[_PO+0$F
     14MV/>XUEJ57HAGS3"->?*T/3F,Y-#%T_4%4,JFC1A5?#>R&SB+SZ.]0&NM_,`\
     15MS4)SF9/]S^4WA)_AKM"Y'$GQ&Q^K87V)N90$UUJM!@2P22#@8'+<<JKQ'.#_
     16M=LY1`">Q,87:F.C]!4;^$P);Y/'QTGU(XO`E(45-8'H3A],(=OZJ.SN4\>%4
     17M.EHB51NA*M)P0T&19LM79#))TVDZ&U.X:U@Z@Q,6265OB2%?%!O=66+N?CS\
     18MNKLE`XJ\^KO&\)+@Y@^8ZO)43^&"9J!WUPR@P#?BR`5)XNQ3]!>^)=_W2`<`
     19!````
    2420`
    2521end
  • Tst/Old/m24si.stat

    rd669f7 r868c93d  
    1 1 >> tst_memory_0 :: 1479122943:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:227904
    2 1 >> tst_memory_1 :: 1479122943:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2424832
    3 1 >> tst_memory_2 :: 1479122943:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:2441216
    4 1 >> tst_timer_1 :: 1479122943:4100, 64 bit:4.1.0:x86_64-Linux:nepomuck:3
     11 >> tst_memory_0 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:205384
     21 >> tst_memory_1 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:2278176
     31 >> tst_memory_2 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:2319280
     41 >> tst_timer_1 :: 1549034506:4114, 64 bit:4.1.1:x86_64-Linux:jim:4
  • Tst/Short/ncfactor_example_all_procedures_s.res.gz.uu

    rd669f7 r868c93d  
    11begin 640 ncfactor_example_all_procedures_s.res.gz
    2 M'XL("(^-:%H"`VYC9F%C=&]R7V5X86UP;&5?86QL7W!R;V-E9'5R97-?<RYR
    3 M97,`W5??3^,X$'[/7Q$A'H!*Y9H$5BH2I]V6ZB*QA:/5WD.U6SG)I+%P[&`[
    4 M_7%__8V3E`4V#@LKG73W$J>>;[Z,QS-?[=E\'$Y=UQU<NM?A)_=`*]UG-#JX
    5 M<&:-Q;MT<7)).=5'QQ>.&=W+2Y?'*8FUD$O8DKQ@L"2,+0LI8DA*"6JI^APV
    6 M?:6)?F3R&Z85%Q*.#D9?9FXX=@_#Y/``B4]/GUB'[A/K(T'0!+G_]HM(SVK^
    7 MO=5$.P>E*5^Y"3#0L$S*@M&8:(R/"PUKPOK.K(QC4"HM\?U5^)+P9*F$U*UN
    8 ML<@CRN$^I9REK8@"9%X4K2;T)'(W`R+CK!6P`OV1L3%=4PQ`3:3()[C.:ZK:
    9 M@]&2$KZ:EGFK-45WXSH7(==KB*V@VCP7UN_@GB=E#'^(7*P,:"+D;35E@0NE
    10 M:,1J_"V16H7\$^@-`&_%<]CJ68[%!?**:[E[*^E4\#N(2ZGH&EI]*8\EY,!-
    11 MB5LS\9FV1T>56?+50TE8>_3[+J'J+]B]BOG3"HHSB._#%#.+)335V4\#[904
    12 MDS02>5YBCV)R9F5TA]/MA5`'&']'=\#HWX!%TU'"(P%I.L?>`H7?C]J3(B1N
    13 M.E)-*D[5WJ;8"PFTV_*2:5JPG?''<&Y*79261L%Q.L+8VWD$5TW]S3/";<OZ
    14 M3+9C6$F`+Y8*HFK29`?S)WA#V0HU^@))R!58=.8%E[W\#-,S:'NN,M,VF("N
    15 MNGJ!,7)OJX'NVD1]J-HTY%D]:$#%0ZDB$654[[J"4,B^(=XO0A+4=IFC4-_A
    16 MQ$WZ732ZG%8DSPG&/L]`DRX@ZI7$E%>LP$&4:B_9[_.ZAE2_S_..KK).5^QG
    17 M;`H857];=7V@T&$I5V2=V6@:.8^:_)DJLR%O*W4VFTM!80JKN&;6SJW*8HRR
    18 M*FE4FJ!^8O770!+\.<=]O4D;_*U@.\O^FT9]%R[D:S#-:0]\0W4F9-(MTD9Z
    19 MC1$U]R.S2BY:K0S&G-%4O]:KM?P;@QNXJ9`_V)"),DCZSM6V@!B7-N3.8O!U
    20 MZ)A#X:GG++SZ_<@[>0B^G1^?;(-OP4F"CUX]==8+S!#TSLW@5P#?`/P&X-<6
    21 MKQHJLV?,7L\_V>*;U_-P#F=Z@]^<A=]\[<$0^0:)C][1<\<M\ON]VBEP1*0)
    22 M-K,U\#=0/7[^7UELM2MG_]-=602U3S)P%F?UZQ;C/F]F?6?QH9G]#^_@6Q:)
    23 MS]]_W&>J\*BCW8V0]\UA&H]M;->OX0S(^ND1T5QXAL.GEYS'R\]Y??DQ%ZY2
    24 7F:O/WO#AF6%P?.$>.O\`2J>J*_8-````
     2M'XL("%B;8EP"`VYC9F%C=&]R7V5X86UP;&5?86QL7W!R;V-E9'5R97-?<RYR
     3M97,`W5=;3^,X%'[/KX@0#T"ELDT"(Q6)U4Q+M9&8PM)J]J&:J9SDI+%P[&`[
     4MO>ROW^,D98")P\!(*^V^Q*[/=SX?GUOMV7P<3EW7'5RZU^$G]T`KW6<T.KAP
     5M9HW$NW1Q<4DYU4?'%XX9W<M+E\<IB;602]B2O&"P)(PM"REB2$H):JGZ'#9]
     6MI8E^9/(;IA47$HX.1E]F;CAV#\/D\`")3T^?2(?N$^DC0=`8N=_[A:5G-?]>
     7M:JR=@]*4K]P$&&A8)F7!:$PTVL>%AC5A?6=6QC$HE98X?Q6^)#Q9*B%UJUHL
     8M\HARN$\I9VDKH@"9%T6K"#6)W,V`R#AK!:Q`?V1L3-<4#5`3*?()GO.:JG9C
     9MM*2$KZ9EWBI-4=VHSD7(]1IB*Z@6SX5U'XQY4L;PA\C%RH`F0MY62Q:X4(I&
     10MK,;?$JE5R#^!W@#P5CR'K9[EF%P@K[B6N[>23@6_@[B4BJZA59?R6$(.W*2X
     11MU1-4F:-=/92$M5NYKP:J_H+=JY@_K:`X@_@^3-&#F"I3G?TTT$Y)T1DCD><E
     12MUB(Z859&=[C<'O#:P/@[N@-&_P9,CHY4'0E(TSG6$"C</VIWBI`87*2:5)RJ
     13MO1PQYQ-HE^4ET[1@.Z./YMR4NB@M!8'C=(2VM_,(KIH\FV>$VX[UF6S'L)(`
     14M7ZR9,FF\@_X3O*%LA9H^`DG(%5CZR0LN>_H9IF?0=E]EICS0`5UY]0)CVKHM
     15M![IS$_M`58XAS^I!`W8V;$DDHHSJ79<1"MDWQ/M%2((]7.;8D.]PX2;]WARZ
     16ME%8DSPG:/L]`DRX@]B6)+J]8@8,HU;XUOT_K&E+]/LT[NLHZ5;&>L2A@5/T]
     17MU?GQF7),Y8JLTQM-(>=1XS^393;D;=6%37`I*'1A9=?,6KE56HRQK4H:E<:H
     18MGSC]-9`$?\XQKC=I@[\5;&>)ORG4=^%"O@93G';#-U1G0B;=3=JT7B/$GON1
     19M65LN2JT,1IS15+]6JW7[-P(W<%,A?Y`A$V60])VK;0$Q'FW(G<7@Z]`QE[]3
     20MSUEX]?S(.WD(OIT?GVR#;\%)@I]>O736"\P0],[-X%<`WP#\!N#7$J\:*K%G
     21MQ%[//]GBS.MYN(8KO<%OSL)O=GLP1+Y!XJ=W]%QQB_Q^KU8*'!%I@L5L-?P-
     22M5(_;_RN'K:)R]C^-RB*H=9*!LSBKIUNT^[Q9]9W%AV;U/QS!MQP2O[__&&>J
     23M\*JCW8V0]\VE&:]M;->OX0S(^ND5T3QLAL.GCYG'1\YY_<@Q#ZM2F2?.7O#A
     241F6!P?.$>.O\`/4L7U-X-````
    2525`
    2626end
  • Tst/Short/ncfactor_example_all_procedures_s.stat

    rd669f7 r868c93d  
    1 1 >> tst_memory_0 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:3967424
    2 1 >> tst_memory_1 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:7045120
    3 1 >> tst_memory_2 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:17891328
    4 1 >> tst_timer :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:14634
    5 2 >> tst_memory_0 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:3968152
    6 2 >> tst_memory_1 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:7045120
    7 2 >> tst_memory_2 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:17891328
    8 2 >> tst_timer_1 :: 1516801423:4104, 64 bit:4.1.0:x86_64-Linux:nepomuck:14634
     11 >> tst_memory_0 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:4038920
     21 >> tst_memory_1 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:9031680
     31 >> tst_memory_2 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:17932288
     41 >> tst_timer :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:11234
     52 >> tst_memory_0 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:4039648
     62 >> tst_memory_1 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:9031680
     72 >> tst_memory_2 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:17932288
     82 >> tst_timer_1 :: 1549966168:4114, 64 bit:4.1.1:x86_64-Linux:nepomuck:11235
  • Tst/Short/ok_s.lst

    rd669f7 r868c93d  
    127127ncfactor_usl2_reducible_bug_s
    128128ncfactor_usl2_s
     129newstruct_ring
    129130nfmodsyz_s
    130131parallel_s
  • configure.ac

    rd669f7 r868c93d  
    249249AC_CONFIG_FILES([Singular/dyn_modules/staticdemo/Makefile])
    250250AC_CONFIG_FILES([Singular/dyn_modules/subsets/Makefile])
    251 AC_CONFIG_FILES([Singular/dyn_modules/freegb/Makefile])
     251AC_CONFIG_FILES([Singular/dyn_modules/freealgebra/Makefile])
    252252AC_CONFIG_FILES([Singular/dyn_modules/gitfan/Makefile])
    253253AC_CONFIG_FILES([Singular/dyn_modules/interval/Makefile])
  • doc/Makefile.bsp

    rd669f7 r868c93d  
    134134info: singular.hlp
    135135
    136 singular.hlp: ${MANUAL_FILES} singular.tex s-plural.tex s-plulibs.tex
     136singular.hlp: ${MANUAL_FILES} singular.tex s-plural.tex s-plulibs.tex s-letterplace.tex
    137137        - ${MAKEINFO} --no-split singular.tex
    138138
     
    140140dvi: manual.dvi usercard.dvi
    141141
    142 singular.dvi: ${MANUAL_FILES} singular.tex s-plural.tex s-plulibs.tex
     142singular.dvi: ${MANUAL_FILES} singular.tex s-plural.tex s-plulibs.tex s-letterplace.tex
    143143        tex singular.tex
    144144        texindex singular.cp
     
    147147        tex singular.tex
    148148
    149 singular.pdf: ${MANUAL_FILES} singular.tex s-plural.tex s-plulibs.tex
     149singular.pdf: ${MANUAL_FILES} singular.tex s-plural.tex s-plulibs.tex s-letterplace.tex
    150150        ${TEXI2PDF} singular.tex
    151151
    152 manual.dvi: ${MANUAL_FILES} manual.tex s-plural.tex s-plulibs.tex
     152manual.dvi: ${MANUAL_FILES} manual.tex s-plural.tex s-plulibs.tex  s-letterplace.tex
    153153        tex manual.tex
    154154        texindex manual.cp
     
    174174        sed -e "s/BR_PLURAL_BR/(plural)/g" <plulibs.tex >s-plulibs.tex
    175175
     176s-letterplace.tex: letterplace.tex
     177        sed -e "s/BR_LETTERPLACE_BR/(letterplace)/g" <letterplace.tex >s-letterplace.tex
     178       
    176179# postscript stuff
    177180ps: dvi manual.ps usercard.ps
     
    270273#
    271274html: ${TMP_DIR} ${HTML_SUBDIR}/${HTML_MANUAL_TOP} ${IMAGES_HTML} $(STANDALONE_TEXI_FILES)
    272 ${HTML_SUBDIR}/${HTML_MANUAL_TOP}: ${TEXI2HTML_INIT} ${TEXI2HTML} singular.tex s-plural.tex
     275${HTML_SUBDIR}/${HTML_MANUAL_TOP}: ${TEXI2HTML_INIT} ${TEXI2HTML} singular.tex s-plural.tex s-letterplace.tex
    273276        ${PERL} ${TEXI2HTML} ${TEXI2HTML_OPTS} -prefix ${HTML_MANUAL_PREFIX} \
    274277        -top_file ${HTML_MANUAL_TOP} singular.tex
     
    384387        /bin/rm -f *.fn *.fns *.ky *.kys *.log *.pg *.pgs *.toc *.tp
    385388        /bin/rm -f *.tps *.vr *.vrs *.dvi *.ps
    386         /bin/rm -f s-plural.tex
     389        /bin/rm -f s-plural.tex s-plulibs.tex s-letterplace.tex
    387390        /bin/rm -f singular.hlp manual.hlp  ${DOC2TEX_FILES} singular.idx
    388391        /bin/rm -f manual.hlp
  • factory/Makefile.am

    rd669f7 r868c93d  
    240240                bin/folding.el bin/fold-docu.el \
    241241                bin/makeheader bin/gen-readcf readcf.yy \
    242                 make_factory_dist
     242                make_factory_dist \
     243                threadsupport.cc
    243244
    244245##################################################
  • kernel/GBEngine/kstd1.cc

    rd669f7 r868c93d  
    20932093
    20942094#ifdef HAVE_SHIFTBBA
    2095   if(rIsLPRing(currRing)) return freegb(F);
     2095  if(rIsLPRing(currRing)) return freegb(F, Q);
    20962096#endif
    20972097
  • kernel/GBEngine/kstd1.h

    rd669f7 r868c93d  
    4141ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** mw, intvec *hilb=NULL,
    4242    int syzComp=0, int newIdeal=0, intvec *vw=NULL, BOOLEAN rightGB=FALSE);
     43
     44ideal freegb(ideal F, ideal Q);
     45ideal rightgb(ideal F, ideal Q);
    4346
    4447/* the following global data are defined in kutil.cc */
  • kernel/GBEngine/kstd2.cc

    rd669f7 r868c93d  
    44594459
    44604460
    4461 ideal freegb(ideal F)
     4461ideal freegb(ideal F, ideal Q)
    44624462{
    44634463  assume(rIsLPRing(currRing));
    44644464  assume(idIsInV(F));
    4465   ideal RS = kStdShift(F, NULL, testHomog, NULL);
     4465  ideal RS = kStdShift(F, Q, testHomog, NULL);
    44664466  idSkipZeroes(RS); // is this even necessary?
    44674467  assume(idIsInV(RS));
  • kernel/GBEngine/kutil.h

    rd669f7 r868c93d  
    861861int redFirstShift (LObject* h,kStrategy strat); // ok
    862862
    863 ideal freegb(ideal F);
    864 ideal rightgb(ideal F, ideal Q);
    865 
    866863ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat);
    867864// test syz strategy: // will be removed soon
  • kernel/ideals.h

    rd669f7 r868c93d  
    140140ideal   idLiftStd  (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL, GbVariant a=GbDefault);
    141141
    142 ideal   idLift (ideal mod, ideal sumod,ideal * rest=NULL,
     142ideal   idLift (ideal mod, ideal submod,ideal * rest=NULL,
    143143             BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE,BOOLEAN divide=FALSE,
    144144             matrix *unit=NULL, GbVariant a=GbDefault);
  • kernel/polys.cc

    rd669f7 r868c93d  
    77#include "kernel/ideals.h"
    88#include "polys/clapsing.h"
     9#include "polys/clapconv.h"
    910
    1011/// Widely used global variable which specifies the current polynomial ring for Singular interpreter and legacy implementatins.
     
    5051    if(p_GetComp(p,r)==0)
    5152    {
    52       if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
     53      if((rFieldType(r)==n_transExt)
     54      &&(convSingTrP(p,r))
     55      &&(convSingTrP(q,r)))
     56      {
     57        poly res=singclap_pdivide(p, q, r);
     58        p_Delete(&p,r);
     59        p_Delete(&q,r);
     60        return res;
     61      }
     62      else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
    5363      &&(!rField_is_Ring(r)))
    5464      {
     
    7181        SI_RESTORE_OPT1(save_opt);
    7282        if (r!=save_ring) rChangeCurrRing(save_ring);
    73         if (idIs0(R))
    74         {
    75           matrix T = id_Module2formatedMatrix(m,1,1,r);
    76           p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
    77           id_Delete((ideal *)&T,r);
    78         }
    79         else p=NULL;
     83        matrix T = id_Module2formatedMatrix(m,1,1,r);
     84        p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
     85        id_Delete((ideal *)&T,r);
    8086        id_Delete((ideal *)&U,r);
    8187        id_Delete(&R,r);
     
    109115        if (I->m[i]!=NULL)
    110116        {
    111           if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
     117          if((rFieldType(r)==n_transExt)
     118          &&(convSingTrP(I->m[i],r))
     119          &&(convSingTrP(q,r)))
     120          {
     121            h=singclap_pdivide(I->m[i],q,r);
     122          }
     123          else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
    112124          &&(!rField_is_Ring(r)))
    113125            h=singclap_pdivide(I->m[i],q,r);
     
    164176    return p_DivideM(p,q,r);
    165177  }
    166   return FALSE;
     178  return NULL;
     179}
     180
     181poly p_DivRem(poly p, poly q, poly &rest, const ring r)
     182{
     183  assume(q!=NULL);
     184  rest=NULL;
     185  if (q==NULL)
     186  {
     187    WerrorS("div. by 0");
     188    return NULL;
     189  }
     190  if (p==NULL)
     191  {
     192    p_Delete(&q,r);
     193    return NULL;
     194  }
     195  if (rIsLPRing(r))
     196  {
     197    WerrorS("not implemented for letterplace rings");
     198    return NULL;
     199  }
     200  if(p_GetComp(p,r)==0)
     201  {
     202    if((rFieldType(r)==n_transExt)
     203    &&(convSingTrP(p,r))
     204    &&(convSingTrP(q,r)))
     205    {
     206      poly res=singclap_pdivide(p, q, r);
     207      rest=singclap_pmod(p,q,r);
     208      p_Delete(&p,r);
     209      p_Delete(&q,r);
     210      return res;
     211    }
     212    else if ((r->cf->convSingNFactoryN!=ndConvSingNFactoryN)
     213    &&(!rField_is_Ring(r)))
     214    {
     215      poly res=singclap_pdivide(p, q, r);
     216      rest=singclap_pmod(p,q,r);
     217      p_Delete(&p,r);
     218      p_Delete(&q,r);
     219      return res;
     220    }
     221    else
     222    {
     223      ideal vi=idInit(1,1); vi->m[0]=q;
     224      ideal ui=idInit(1,1); ui->m[0]=p;
     225      ideal R; matrix U;
     226      ring save_ring=currRing;
     227      if (r!=currRing) rChangeCurrRing(r);
     228      int save_opt;
     229      SI_SAVE_OPT1(save_opt);
     230      si_opt_1 &= ~(Sy_bit(OPT_PROT));
     231      ideal m = idLift(vi,ui,&R, FALSE,TRUE,TRUE,&U);
     232      SI_RESTORE_OPT1(save_opt);
     233      if (r!=save_ring) rChangeCurrRing(save_ring);
     234      matrix T = id_Module2formatedMatrix(m,1,1,r);
     235      p=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
     236      id_Delete((ideal *)&T,r);
     237      T = id_Module2formatedMatrix(R,1,1,r);
     238      rest=MATELEM(T,1,1); MATELEM(T,1,1)=NULL;
     239      id_Delete((ideal *)&T,r);
     240      id_Delete((ideal *)&U,r);
     241      id_Delete(&R,r);
     242      //vi->m[0]=NULL; ui->m[0]=NULL;
     243      id_Delete(&vi,r);
     244      id_Delete(&ui,r);
     245      return p;
     246    }
     247  }
     248  return NULL;
    167249}
    168250
  • kernel/polys.h

    rd669f7 r868c93d  
    160160#endif
    161161
    162 /// polynomial division, ignoring the rest
     162/// polynomial division a/b, ignoring the rest
    163163/// via singclap_pdivide resp. idLift
    164164/// destroyes a,b
    165165poly p_Divide(poly a, poly b, const ring r);
     166poly p_DivRem(poly a, poly b, poly &rest, const ring r); /*julia*/
    166167
    167168/// polynomial gcd
  • libpolys/misc/options.h

    rd669f7 r868c93d  
    1313extern "C" VAR unsigned si_opt_1; //< NOTE: Original option variable name: test
    1414extern "C" VAR unsigned si_opt_2; //< NOTE: Original option variable name: verbose
    15 extern "C" BOOLEAN siCntrlc;
    1615#else
    1716EXTERN_VAR unsigned si_opt_1;
    1817EXTERN_VAR unsigned si_opt_2;
     18#endif
    1919EXTERN_VAR BOOLEAN siCntrlc;
    20 #endif
    2120#define SI_SAVE_OPT(A,B) { A=si_opt_1; B=si_opt_2; }
    2221#define SI_SAVE_OPT1(A) { A=si_opt_1; }
  • libpolys/polys/clapconv.cc

    rd669f7 r868c93d  
    290290  while ( p!=NULL )
    291291  {
    292     n_Normalize(p_GetCoeff(p, r), r->cf);
     292    //n_Normalize(p_GetCoeff(p, r), r->cf);
    293293
    294294    // test if denominator is constant
    295     if (!p_IsConstantPoly(DEN ((fraction)p_GetCoeff (p,r)),r->cf->extRing) && !errorreported)
     295    if (!errorreported && !p_IsConstantPoly(DEN ((fraction)p_GetCoeff (p,r)),r->cf->extRing))
    296296      WerrorS("conversion error: denominator!= 1");
    297297
     
    316316  }
    317317  return result;
     318}
     319
     320BOOLEAN convSingTrP(poly p, const ring r )
     321{
     322  while ( p!=NULL )
     323  {
     324    n_Normalize(p_GetCoeff(p, r), r->cf);
     325
     326    // test if denominator is constant
     327    if (!p_IsConstantPoly(DEN ((fraction)p_GetCoeff (p,r)),r->cf->extRing))
     328      return FALSE;
     329    pIter(p);
     330  }
     331  return TRUE;
    318332}
    319333
  • libpolys/polys/clapconv.h

    rd669f7 r868c93d  
    3030
    3131CanonicalForm convSingTrPFactoryP ( poly p, const ring r );
     32BOOLEAN convSingTrP(poly p, const ring r );
    3233poly convFactoryPSingTrP ( const CanonicalForm & f, const ring r );
    3334
  • libpolys/polys/clapsing.cc

    rd669f7 r868c93d  
    8484    else
    8585    {
     86      convSingTrP(f,r);
     87      convSingTrP(g,r);
    8688      CanonicalForm F( convSingTrPFactoryP( f,r ) ), G( convSingTrPFactoryP( g,r ) );
    8789      res= convFactoryPSingTrP( gcd( F, G ),r );
  • libpolys/polys/monomials/ring.cc

    rd669f7 r868c93d  
    16641664  if (r1->cf!=r2->cf) return FALSE;
    16651665  if (rVar(r1)!=rVar(r2)) return FALSE;
     1666  if (r1->bitmask!=r2->bitmask) return FALSE;
     1667  #ifdef HAVE_SHIFTBBA
     1668  if (r1->isLPring!=r2->isLPring) return FALSE;
     1669  #endif
    16661670
    16671671  if( !rSamePolyRep(r1, r2) )
     
    51265130  int lb = rBlocks(r) - 2;
    51275131  return (r->order[lb] == ringorder_c || r->order[lb] == ringorder_C);
    5128 }
    5129 
    5130 n_coeffType rFieldType(ring r)
    5131 {
    5132   return (r->cf->type);
    5133   if (rField_is_Zp(r))     return n_Zp;
    5134   if (rField_is_Q(r))      return n_Q;
    5135   if (rField_is_R(r))      return n_R;
    5136   if (rField_is_GF(r))     return n_GF;
    5137   if (rField_is_long_R(r)) return n_long_R;
    5138   if (rField_is_Zp_a(r))   return getCoeffType(r->cf);
    5139   if (rField_is_Q_a(r))    return getCoeffType(r->cf);
    5140   if (rField_is_long_C(r)) return n_long_C;
    5141   if (rField_is_Z(r))         return n_Z;
    5142   if (rField_is_Zn(r))        return n_Zn;
    5143   if (rField_is_Ring_PtoM(r)) return n_Znm;
    5144   if (rField_is_Ring_2toM(r)) return  n_Z2m;
    5145 
    5146   return n_unknown;
    51475132}
    51485133
  • libpolys/polys/monomials/ring.h

    rd669f7 r868c93d  
    548548{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_has_simple_Alloc(r->cf); }
    549549
    550 n_coeffType rFieldType(const ring r);
     550/// the type of the coefficient filed of r (n_Zp, n_Q, etc)
     551static inline n_coeffType rFieldType(const ring r) { return (r->cf->type); }
    551552
    552553/// this needs to be called whenever a new ring is created: new fields
  • m4/options.m4

    rd669f7 r868c93d  
    321321  bi_staticdemo=false
    322322  bi_subsets=false
    323   bi_freegb=false
     323  bi_freealgebra=false
    324324  bi_syzextra=false
    325325  bi_pyobject=false
     
    357357       staticdemo ) bi_staticdemo=true;;
    358358       subsets ) bi_subsets=true;;
    359        freegb ) bi_freegb=true;;
     359       freealgebra ) bi_freealgebra=true;;
    360360       syzextra ) bi_syzextra=true ;;
    361361       pyobject ) bi_pyobject=true ;;
     
    396396 AM_CONDITIONAL([SI_BUILTIN_STATICDEMO], [test x$bi_staticdemo = xtrue])
    397397 AM_CONDITIONAL([SI_BUILTIN_SUBSETS], [test x$bi_subsets = xtrue])
    398  AM_CONDITIONAL([SI_BUILTIN_FREEGB], [test x$bi_freegb = xtrue])
     398 AM_CONDITIONAL([SI_BUILTIN_FREEALGEBRA], [test x$bi_freealgebra = xtrue])
    399399 AM_CONDITIONAL([SI_BUILTIN_SYZEXTRA], [test x$bi_syzextra = xtrue])
    400400 AM_CONDITIONAL([SI_BUILTIN_PYOBJECT], [test x$bi_pyobject = xtrue])
Note: See TracChangeset for help on using the changeset viewer.