Changeset be66125 in git


Ignore:
Timestamp:
Sep 22, 2017, 5:10:17 PM (7 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
ea18a95964ffad2d2586d104f8f35140f7cff2e6
Parents:
5359196937f2937c7fab45eb6a94928bf6396e28
Message:
Prepare for release, add doc and make procs static
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    r535919 rbe66125  
    11361136// -----------------main procedures----------------------
    11371137
    1138 proc lpUfGkDim(ideal G)
     1138static proc lpUfGkDim(ideal G)
    11391139{
    11401140  G = lead(G);
     
    11951195}
    11961196
    1197 proc UfGraphURTNZDGrowth(intmat UG) {
     1197static proc UfGraphURTNZDGrowth(intmat UG) {
    11981198  // URTNZD = upper right triangle non zero diagonal
    11991199  for (int i = 1; i <= ncols(UG); i++) {
     
    12091209}
    12101210
    1211 proc imIsZero(intmat M) {
     1211static proc imIsZero(intmat M) {
    12121212  intmat Zero[nrows(M)][ncols(M)];
    12131213  return (M == Zero);
    12141214}
    12151215
    1216 proc imIsUpRightTriangle(intmat M) {
     1216static proc imIsUpRightTriangle(intmat M) {
    12171217  for (int i = 1; i <= nrows(M); i++) {
    12181218    for (int j = 1; j < i; j++) {
     
    12231223}
    12241224
    1225 proc eliminateZerosUpTriangle(intmat G) {
     1225static proc eliminateZerosUpTriangle(intmat G) {
    12261226  // G is expected to be an upper triangle matrix
    12271227  for (int i = 1; i <= ncols(G); i++) {
     
    12421242}
    12431243
    1244 proc imDelRowCol(intmat M, int row, int col) {
     1244static proc imDelRowCol(intmat M, int row, int col) {
    12451245  // row and col are expected to be > 0
    12461246  int nr = nrows(M);
     
    12611261}
    12621262
    1263 proc topologicalSort(intmat G) {
     1263static proc topologicalSort(intmat G) {
    12641264  // NOTE: ignores loops
    12651265  // NOTE: this takes O(|V^3|), can be optimized
     
    12951295}
    12961296
    1297 proc imPermcol (intmat A, int c1, int c2)
     1297static proc imPermcol (intmat A, int c1, int c2)
    12981298{
    12991299   intmat B = A;
     
    13041304}
    13051305
    1306 proc imPermrow (intmat A, int r1, int r2)
     1306static proc imPermrow (intmat A, int r1, int r2)
    13071307{
    13081308   intmat B = A;
     
    13131313}
    13141314
    1315 proc UfGraphGrowth(intmat UG)
     1315static proc UfGraphGrowth(intmat UG)
    13161316{
    13171317  int n = ncols(UG); // number of vertices
     
    13371337}
    13381338
    1339 proc countCycles(intmat G, int v, intvec visited, intvec cyclic, intvec path)
     1339static proc countCycles(intmat G, int v, intvec visited, intvec cyclic, intvec path)
    13401340"USAGE: countCycles(G, v, visited, cyclic, path); G a Graph, v the vertex to
    13411341start. visited, cyclic and path should be 0.
     
    14181418}
    14191419
    1420 proc lpUfGraph(ideal G)
     1420static proc lpUfGraph(ideal G)
    14211421"USAGE: lpUfGraph(G); G a set of monomials in a letterplace ring
    14221422RETURN: intmat
     
    14601460}
    14611461
    1462 proc ivStandardWords(list G, int length) {
     1462static proc ivStandardWords(list G, int length) {
    14631463  if (length == 0) {
    14641464    return (0); // iv = 0 means monom = 1
     
    14921492}
    14931493
    1494 proc lpGraphOfNormalWords(ideal G)
     1494static proc lpGraphOfNormalWords(ideal G)
    14951495"USAGE: lpGraphOfNormalWords(G); G a set of monomials in a letterplace ring
    14961496RETURN: intmat
     
    15621562}
    15631563
    1564 proc lpNorGkDim(ideal G)
     1564static proc lpNorGkDim(ideal G)
    15651565"USAGE: lpNorGkDim(G); G an ideal in a letterplace ring
    15661566RETURN: int
     
    28282828/*}*/
    28292829
    2830 proc lpSubstitute(poly f, list s1, list s2, ideal G) {
     2830proc lpSubstitute(poly f, list s1, list s2, list #) {
     2831"USAGE: lpSubstitute(f,s1,s2[,G]); f letterplace polynomial, s1 list of variables
     2832@*      to replace, s2 list of polynomials to replace with, G optional ideal to
     2833@*      reduce with.
     2834RETURN: poly, the substituted polynomial
     2835ASSUME: - basering is a Letterplace ring
     2836@*      - G is a groebner basis,
     2837@*      - the current ring has a sufficient degbound (can be calculated with
     2838@*        calcSubstDegBound())
     2839EXAMPLE: example lpSubstitute; shows examples
     2840"
     2841  ideal G;
     2842  if (size(#) > 0) {
     2843    if (typeof(#[1])=="ideal") {
     2844      G = #[1];
     2845    }
     2846  }
     2847
    28312848  poly fs;
    28322849  for (int i = 1; i <= size(f); i++) {
     
    28552872  setring R;
    28562873
    2857   ideal G = x(1)*y(2); // optional, can be 0
     2874  ideal G = x(1)*y(2); // optional
    28582875
    28592876  poly f = 3*x(1)*x(2)+y(1)*x(2);
     
    28612878  list s2 = y(1)*z(2)*z(3), x(1);
    28622879
     2880  // the substitution probably needs a higher degbound
    28632881  int minDegBound = calcSubstDegBounds(f,s1,s2);
    28642882  setring r;
     
    28662884  setring R1;
    28672885
     2886  // the last parameter is optional
    28682887  lpSubstitute(imap(R,f), imap(R,s1), imap(R,s2), imap(R,G));
    28692888}
     
    28902909  list s2 = imap(R,s2);
    28912910  for (int i = 1; i <= size(L); i++) {
    2892     lpSubstitute(L[i], s1, s2, 0);
    2893   }
    2894 }
    2895 
    2896 proc indexof(list L, int varindex) {
     2911    lpSubstitute(L[i], s1, s2);
     2912  }
     2913}
     2914
     2915static proc indexof(list L, int varindex) {
    28972916  for (int i = 1; i <= size(L); i++) {
    28982917    if (lp2iv(L[i])[1] == varindex) {
     
    29042923
    29052924proc calcSubstDegBound(poly f, list s1, list s2) {
     2925"USAGE: calcSubstDegBound(f,s1,s2); f letterplace polynomial, s1 list of variables
     2926@*      to replace, s2 list of polynomials to replace with
     2927RETURN: int, the min degbound required to perform the substitution
     2928ASSUME: - basering is a Letterplace ring
     2929EXAMPLE: example lpSubstitute; shows examples
     2930"
    29062931  int maxDegBound = 0;
    29072932  for (int i = 1; i <= size(f); i++) {
     
    29212946    }
    29222947  }
     2948
     2949  // increase degbound by 50% when ideal is provided
     2950  // needed for lpNF
     2951  maxDegBound = maxDegBound + maxDegBound/2;
     2952
    29232953  return (maxDegBound);
    29242954}
     
    29262956// convenience method
    29272957proc calcSubstDegBounds(list L, list s1, list s2) {
     2958"USAGE: calcSubstDegBounds(L,s1,s2); L list of letterplace polynomials, s1 list
     2959@*      of variables to replace, s2 list of polynomials to replace with
     2960RETURN: int, the min degbound required to perform all of the substitutions
     2961ASSUME: - basering is a Letterplace ring
     2962EXAMPLE: example lpSubstitute; shows examples
     2963"
    29282964  int maxDegBound = 0;
    29292965  for (int i = 1; i <= size(L); i++) {
    2930     int tmpDegBound = calcSubstDegBound(L[i], s1, s2);
     2966    int tmpDegBound = calcSubstDegBound(L[i], s1, s2, #);
    29312967    if (tmpDegBound > maxDegBound) {
    29322968      maxDegBound = tmpDegBound;
Note: See TracChangeset for help on using the changeset viewer.