Changeset be66125 in git
- Timestamp:
- Sep 22, 2017, 5:10:17 PM (7 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- Children:
- ea18a95964ffad2d2586d104f8f35140f7cff2e6
- Parents:
- 5359196937f2937c7fab45eb6a94928bf6396e28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/fpadim.lib
r535919 rbe66125 1136 1136 // -----------------main procedures---------------------- 1137 1137 1138 proc lpUfGkDim(ideal G)1138 static proc lpUfGkDim(ideal G) 1139 1139 { 1140 1140 G = lead(G); … … 1195 1195 } 1196 1196 1197 proc UfGraphURTNZDGrowth(intmat UG) {1197 static proc UfGraphURTNZDGrowth(intmat UG) { 1198 1198 // URTNZD = upper right triangle non zero diagonal 1199 1199 for (int i = 1; i <= ncols(UG); i++) { … … 1209 1209 } 1210 1210 1211 proc imIsZero(intmat M) {1211 static proc imIsZero(intmat M) { 1212 1212 intmat Zero[nrows(M)][ncols(M)]; 1213 1213 return (M == Zero); 1214 1214 } 1215 1215 1216 proc imIsUpRightTriangle(intmat M) {1216 static proc imIsUpRightTriangle(intmat M) { 1217 1217 for (int i = 1; i <= nrows(M); i++) { 1218 1218 for (int j = 1; j < i; j++) { … … 1223 1223 } 1224 1224 1225 proc eliminateZerosUpTriangle(intmat G) {1225 static proc eliminateZerosUpTriangle(intmat G) { 1226 1226 // G is expected to be an upper triangle matrix 1227 1227 for (int i = 1; i <= ncols(G); i++) { … … 1242 1242 } 1243 1243 1244 proc imDelRowCol(intmat M, int row, int col) {1244 static proc imDelRowCol(intmat M, int row, int col) { 1245 1245 // row and col are expected to be > 0 1246 1246 int nr = nrows(M); … … 1261 1261 } 1262 1262 1263 proc topologicalSort(intmat G) {1263 static proc topologicalSort(intmat G) { 1264 1264 // NOTE: ignores loops 1265 1265 // NOTE: this takes O(|V^3|), can be optimized … … 1295 1295 } 1296 1296 1297 proc imPermcol (intmat A, int c1, int c2)1297 static proc imPermcol (intmat A, int c1, int c2) 1298 1298 { 1299 1299 intmat B = A; … … 1304 1304 } 1305 1305 1306 proc imPermrow (intmat A, int r1, int r2)1306 static proc imPermrow (intmat A, int r1, int r2) 1307 1307 { 1308 1308 intmat B = A; … … 1313 1313 } 1314 1314 1315 proc UfGraphGrowth(intmat UG)1315 static proc UfGraphGrowth(intmat UG) 1316 1316 { 1317 1317 int n = ncols(UG); // number of vertices … … 1337 1337 } 1338 1338 1339 proc countCycles(intmat G, int v, intvec visited, intvec cyclic, intvec path)1339 static proc countCycles(intmat G, int v, intvec visited, intvec cyclic, intvec path) 1340 1340 "USAGE: countCycles(G, v, visited, cyclic, path); G a Graph, v the vertex to 1341 1341 start. visited, cyclic and path should be 0. … … 1418 1418 } 1419 1419 1420 proc lpUfGraph(ideal G)1420 static proc lpUfGraph(ideal G) 1421 1421 "USAGE: lpUfGraph(G); G a set of monomials in a letterplace ring 1422 1422 RETURN: intmat … … 1460 1460 } 1461 1461 1462 proc ivStandardWords(list G, int length) {1462 static proc ivStandardWords(list G, int length) { 1463 1463 if (length == 0) { 1464 1464 return (0); // iv = 0 means monom = 1 … … 1492 1492 } 1493 1493 1494 proc lpGraphOfNormalWords(ideal G)1494 static proc lpGraphOfNormalWords(ideal G) 1495 1495 "USAGE: lpGraphOfNormalWords(G); G a set of monomials in a letterplace ring 1496 1496 RETURN: intmat … … 1562 1562 } 1563 1563 1564 proc lpNorGkDim(ideal G)1564 static proc lpNorGkDim(ideal G) 1565 1565 "USAGE: lpNorGkDim(G); G an ideal in a letterplace ring 1566 1566 RETURN: int … … 2828 2828 /*}*/ 2829 2829 2830 proc lpSubstitute(poly f, list s1, list s2, ideal G) { 2830 proc 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. 2834 RETURN: poly, the substituted polynomial 2835 ASSUME: - 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()) 2839 EXAMPLE: example lpSubstitute; shows examples 2840 " 2841 ideal G; 2842 if (size(#) > 0) { 2843 if (typeof(#[1])=="ideal") { 2844 G = #[1]; 2845 } 2846 } 2847 2831 2848 poly fs; 2832 2849 for (int i = 1; i <= size(f); i++) { … … 2855 2872 setring R; 2856 2873 2857 ideal G = x(1)*y(2); // optional , can be 02874 ideal G = x(1)*y(2); // optional 2858 2875 2859 2876 poly f = 3*x(1)*x(2)+y(1)*x(2); … … 2861 2878 list s2 = y(1)*z(2)*z(3), x(1); 2862 2879 2880 // the substitution probably needs a higher degbound 2863 2881 int minDegBound = calcSubstDegBounds(f,s1,s2); 2864 2882 setring r; … … 2866 2884 setring R1; 2867 2885 2886 // the last parameter is optional 2868 2887 lpSubstitute(imap(R,f), imap(R,s1), imap(R,s2), imap(R,G)); 2869 2888 } … … 2890 2909 list s2 = imap(R,s2); 2891 2910 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 2915 static proc indexof(list L, int varindex) { 2897 2916 for (int i = 1; i <= size(L); i++) { 2898 2917 if (lp2iv(L[i])[1] == varindex) { … … 2904 2923 2905 2924 proc 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 2927 RETURN: int, the min degbound required to perform the substitution 2928 ASSUME: - basering is a Letterplace ring 2929 EXAMPLE: example lpSubstitute; shows examples 2930 " 2906 2931 int maxDegBound = 0; 2907 2932 for (int i = 1; i <= size(f); i++) { … … 2921 2946 } 2922 2947 } 2948 2949 // increase degbound by 50% when ideal is provided 2950 // needed for lpNF 2951 maxDegBound = maxDegBound + maxDegBound/2; 2952 2923 2953 return (maxDegBound); 2924 2954 } … … 2926 2956 // convenience method 2927 2957 proc 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 2960 RETURN: int, the min degbound required to perform all of the substitutions 2961 ASSUME: - basering is a Letterplace ring 2962 EXAMPLE: example lpSubstitute; shows examples 2963 " 2928 2964 int maxDegBound = 0; 2929 2965 for (int i = 1; i <= size(L); i++) { 2930 int tmpDegBound = calcSubstDegBound(L[i], s1, s2 );2966 int tmpDegBound = calcSubstDegBound(L[i], s1, s2, #); 2931 2967 if (tmpDegBound > maxDegBound) { 2932 2968 maxDegBound = tmpDegBound;
Note: See TracChangeset
for help on using the changeset viewer.