Changeset 5a640f in git


Ignore:
Timestamp:
Aug 22, 2017, 2:45:37 PM (7 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a62db6acb39329a175a16c23ac737917e158e04d
Parents:
8c0eaaaf75a8408a9638e8ca5445961fe9974e7c
Message:
Optimized standardword computation performance
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    r8c0eaa r5a640f  
    14221422    }
    14231423  }
    1424   ideal V = lpStandardWords(G, l - 1); // vertices
    1425   int n = size(V);
     1424  list LG = lpId2ivLi(G);
     1425  list SW = ivStandardWords(LG, l - 1); // vertices
     1426  int n = size(SW);
    14261427  intmat UG[n][n]; // Ufnarovskij graph
    14271428  for (int i = 1; i <= n; i++) {
    14281429    for (int j = 1; j <= n; j++) {
    1429       // V[i] = v, V[j] = w [Studzinski page 76]
    1430       intvec v = lp2iv(V[i]);
    1431       intvec w = lp2iv(V[j]);
     1430      // [Studzinski page 76]
     1431      intvec v = SW[i];
     1432      intvec w = SW[j];
    14321433      intvec v_overlap;
    14331434      intvec w_overlap;
     
    14391440      intvec vw = v;
    14401441      vw[l] = w[l-1];
    1441       if (v_overlap == w_overlap && !divides(G, vw)) {
     1442      if (v_overlap == w_overlap && !ivdivides(LG, vw)) {
    14421443        UG[i,j] = 1;
    14431444      }
     
    14471448}
    14481449
    1449 proc lpStandardWords(ideal G, int length) {
     1450proc ivStandardWords(list G, int length) {
    14501451  if (length == 0) {
    1451     return (1);
     1452    return (0); // iv = 0 means monom = 1
    14521453  }
    14531454  int lV = attrib(basering, "lV"); // variable count
    1454   // recursion could cause problems
    1455   ideal prevWords = lpStandardWords(G, length - 1);
    1456   ideal words;
     1455  list prevWords = ivStandardWords(G, length - 1);
     1456  list words;
    14571457  for (int i = 1; i <= lV; i++) {
    14581458    for (int j = 1; j <= size(prevWords); j++) {
    1459       int placeShift = (length - 1) * lV; // letterplace
    1460       // multiply every previous word with every variable
    1461       poly word = prevWords[j] * var(i + placeShift);
     1459      intvec word = prevWords[j];
     1460      word[length] = i;
    14621461      // assumes that G is simplified!
    1463       if (!divides(G, lp2iv(word))) {
    1464         words = words, word;
    1465       }
    1466     }
    1467   }
    1468   words = simplify(words, 2); // remove zeroes
     1462      if (!ivdivides(G, word)) {
     1463        words = insert(words, word);
     1464      }
     1465    }
     1466  }
    14691467  return (words);
    14701468}
    14711469
    1472 proc divides(ideal G, intvec iv) {
     1470static proc ivdivides(list G, intvec iv) {
    14731471  for (int k = 1; k <= size(G); k++) {
    1474     if (isIF(lp2iv(G[k]), iv)) {
     1472    if (isIF(G[k], iv)) {
    14751473      return (1);
    14761474    } else {
Note: See TracChangeset for help on using the changeset viewer.