Changeset 82410d in git
 Timestamp:
 Nov 29, 2022, 2:46:42 PM (2 months ago)
 Branches:
 (u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
 Children:
 f4e6d43624519771601ddc522f21526d0bd1d7a5
 Parents:
 07fefd7e1818a24a256b720bb0c7021058b855b9
 gitauthor:
 Hans Schoenemann <hannes@mathematik.unikl.de>20221129 14:46:42+01:00
 gitcommitter:
 Hans Schoenemann <hannes@mathematik.unikl.de>20221129 14:48:29+01:00
 Location:
 Singular/dyn_modules/cohomo
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

Singular/dyn_modules/cohomo/cohomo.cc
r07fefd r82410d 47 47 /***************************print(only for debugging)***********************************************/ 48 48 //print vector of integers. 49 void listprint(std::vector<int> vec)49 static void listprint(std::vector<int> vec) 50 50 { 51 51 unsigned i; … … 63 63 64 64 //print vector of vectors of integers. 65 void listsprint(std::vector<std::vector<int> > posMat)65 static void listsprint(std::vector<std::vector<int> > posMat) 66 66 { 67 67 unsigned i; … … 82 82 83 83 //print ideal. 84 void id_print(ideal h)84 static void id_print(ideal h) 85 85 { 86 86 int i; … … 95 95 //only for T^2, 96 96 //print vector of polynomials. 97 void lpprint( std::vector<poly> pv)97 static void lpprint( std::vector<poly> pv) 98 98 { 99 99 for(unsigned i=0;i<pv.size();i++) … … 109 109 } 110 110 111 112 113 111 //print vector of vectors of polynomials. 114 void lpsprint(std::vector<std::vector<poly> > pvs)112 static void lpsprint(std::vector<std::vector<poly> > pvs) 115 113 { 116 114 for(unsigned i=0;i<pvs.size();i++) … … 128 126 } 129 127 130 131 132 133 134 135 136 137 138 139 128 /*************operations for vectors (regard vectors as sets)*********/ 140 129 141 130 //returns true if integer n is in vector vec, 142 131 //otherwise, returns false 143 bool IsinL(int a, std::vector<int> vec)132 static bool IsinL(int a, std::vector<int> vec) 144 133 { 145 134 unsigned i; … … 154 143 } 155 144 156 157 158 159 160 145 //returns intersection of vectors p and q, 161 146 //returns empty if they are disjoint 162 st d::vector<int> vecIntersection(std::vector<int> p, std::vector<int> q)147 static std::vector<int> vecIntersection(std::vector<int> p, std::vector<int> q) 163 148 { 164 149 unsigned i; … … 172 157 } 173 158 174 175 176 177 178 179 180 181 182 //returns true if vec1 is equal to vec2 (strictly equal, including the order)183 //is not used184 bool vEv(std::vector<int> vec1,std::vector<int> vec2)185 {186 unsigned j, lg1=vec1.size(),lg2=vec2.size();187 if(lg1!=lg2)188 {189 return false;190 }191 else192 {193 for(j=0;j<vec1.size();j++)194 {195 if(vec1[j]!=vec2[j])196 return false;197 }198 }199 return true;200 }201 202 203 204 205 159 //returns true if vec1 is contained in vec2 206 bool vsubset(std::vector<int> vec1, std::vector<int> vec2)160 static bool vsubset(std::vector<int> vec1, std::vector<int> vec2) 207 161 { 208 162 int i; … … 218 172 219 173 //not strictly equal(order doesn't matter) 220 bool vEvl(std::vector<int> vec1, std::vector<int> vec2)174 static bool vEvl(std::vector<int> vec1, std::vector<int> vec2) 221 175 { 222 176 if(vec1.size()==0 && vec2.size()==0) … … 227 181 } 228 182 229 230 183 //the length of vec must be same to it of the elements of vecs 231 184 //returns true if vec is as same as some element of vecs ((not strictly same)) 232 185 //returns false if vec is not in vecs 233 bool vInvsl(std::vector<int> vec, std::vector<std::vector<int> > vecs)186 static bool vInvsl(std::vector<int> vec, std::vector<std::vector<int> > vecs) 234 187 { 235 188 int i; … … 244 197 } 245 198 246 247 //the length of vec must be same to it of the elements of vecs (strictly same)248 //returns the position of vec in vecs,249 //returns 1 if vec is not in vecs250 //actrually is not used.251 int vInvs(std::vector<int> vec, std::vector<std::vector<int> > vecs)252 {253 int i;254 for(i=0;i<vecs.size();i++)255 {256 if(vEv(vec,vecs[i]))257 {258 return i+1;259 }260 }261 return 1;262 }263 264 199 //returns the union of two vectors(as the union of sets) 265 st d::vector<int> vecUnion(std::vector<int> vec1, std::vector<int> vec2)200 static std::vector<int> vecUnion(std::vector<int> vec1, std::vector<int> vec2) 266 201 { 267 202 std::vector<int> vec=vec1; … … 275 210 } 276 211 277 st d::vector<int> vecMinus(std::vector<int> vec1,std::vector<int> vec2)212 static std::vector<int> vecMinus(std::vector<int> vec1,std::vector<int> vec2) 278 213 { 279 214 std::vector<int> vec; … … 288 223 } 289 224 290 st d::vector<std::vector<int> > vsMinusv(std::vector<std::vector<int> > vecs, std::vector<int> vec)225 static std::vector<std::vector<int> > vsMinusv(std::vector<std::vector<int> > vecs, std::vector<int> vec) 291 226 { 292 227 int i; … … 302 237 } 303 238 304 305 std::vector<std::vector<int> > vsUnion(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2) 239 static std::vector<std::vector<int> > vsUnion(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2) 306 240 { 307 241 int i; … … 317 251 } 318 252 319 320 321 322 323 324 std::vector<std::vector<int> > vsIntersection(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2) 253 static std::vector<std::vector<int> > vsIntersection(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2) 325 254 { 326 255 int i; … … 336 265 } 337 266 338 339 340 341 342 267 /*************************************for transition between ideal and vectors******************************************/ 343 268 344 269 //P should be monomial, 345 270 // vector version of poly support(poly p) 346 st d::vector<int> support1(poly p)271 static std::vector<int> support1(poly p) 347 272 { 348 273 int j; … … 359 284 } 360 285 361 362 363 364 365 366 286 //simplicial complex(the faces set is ideal h) 367 st d::vector<std::vector<int> > supports(ideal h)287 static std::vector<std::vector<int> > supports(ideal h) 368 288 { 369 289 std::vector<std::vector<int> > vecs; … … 380 300 } 381 301 382 383 384 385 302 // only for eqsolve1 386 303 // p could be any polynomial 387 st d::vector<int> support2(poly p)304 static std::vector<int> support2(poly p) 388 305 { 389 306 int j; … … 406 323 } 407 324 408 409 410 325 //the supports of ideal 411 st d::vector<std::vector<int> > supports2(ideal h)326 static std::vector<std::vector<int> > supports2(ideal h) 412 327 { 413 328 std::vector<std::vector<int> > vecs; … … 423 338 return vecs; 424 339 } 340 425 341 //convert the vector(vbase[i] are the coefficients of x_{i+1}) to a polynomial w.r.t. current ring 426 342 //vector vbase has length of currRing>N. 427 poly pMake(std::vector<int> vbase)343 static poly pMake(std::vector<int> vbase) 428 344 { 429 345 int n=vbase.size(); poly p,q=0; … … 435 351 q = pAdd(q, p); 436 352 } 437 438 353 } 439 354 return q; 440 355 } 441 356 442 443 444 445 357 //convert the vectors to a ideal(for T^1) 446 ideal idMake(std::vector<std::vector<int> > vecs)358 static ideal idMake(std::vector<std::vector<int> > vecs) 447 359 { 448 360 int lv=vecs.size(), i; … … 458 370 } 459 371 460 461 462 372 /*****************************quotient ring of two ideals*********************/ 463 373 464 374 //the quotient ring of h1 respect to h2 465 ideal idmodulo(ideal h1,ideal h2)375 static ideal idmodulo(ideal h1,ideal h2) 466 376 { 467 377 ideal gb=kStd(h2,NULL,testHomog,NULL,NULL,0,0,NULL); … … 474 384 //returns the coeff of the monomial of polynomial p which involves the mth varialbe 475 385 //assume the polynomial p has form of y1+y2+... 476 int pcoef(poly p, int m)386 static int pcoef(poly p, int m) 477 387 { 478 388 int i,co; poly q=pCopy(p); … … 493 403 494 404 //returns true if p involves the mth variable of the current ring 495 bool vInp(int m,poly p)405 static bool vInp(int m,poly p) 496 406 { 497 407 poly q=pCopy(p); … … 507 417 } 508 418 509 510 511 419 //returns the vector w.r.t. polynomial p 512 st d::vector<int> vMake(poly p)420 static std::vector<int> vMake(poly p) 513 421 { 514 422 int i; … … 528 436 } 529 437 530 531 438 //returns the vectors w.r.t. ideal h 532 st d::vector<std::vector<int> > vsMake(ideal h)439 static std::vector<std::vector<int> > vsMake(ideal h) 533 440 { 534 441 std::vector<int> vec; … … 543 450 } 544 451 545 546 452 //the quotient ring of two ideals which are represented by vectors, 547 453 //the result is also represented by vector. 548 st d::vector<std::vector<int> > vecqring(std::vector<std::vector<int> > vec1, std::vector<std::vector<int> > vec2)454 static std::vector<std::vector<int> > vecqring(std::vector<std::vector<int> > vec1, std::vector<std::vector<int> > vec2) 549 455 { 550 456 ideal h1=idMake(vec1), h2=idMake(vec2); … … 554 460 } 555 461 556 557 558 462 /****************************************************************/ 559 463 //construct a monomial based on the support of it 560 464 //returns a squarefree monomial 561 poly pMaken(std::vector<int> vbase)465 static poly pMaken(std::vector<int> vbase) 562 466 { 563 467 int n=vbase.size(); … … 573 477 574 478 // returns a ideal according to a set of supports 575 ideal idMaken(std::vector<std::vector<int> > vecs)479 static ideal idMaken(std::vector<std::vector<int> > vecs) 576 480 { 577 481 ideal id_re=idInit(1,1); … … 588 492 } 589 493 590 591 592 494 /********************************new version for stanley reisner ideal ***********************************************/ 593 495 594 595 std::vector<std::vector<int> > b_subsets(std::vector<int> vec) 496 static std::vector<std::vector<int> > b_subsets(std::vector<int> vec) 596 497 { 597 498 int i,j; … … 618 519 } 619 520 620 621 521 //the number of the variables 622 int idvert(ideal h)522 static int idvert(ideal h) 623 523 { 624 524 int i, j, vert=0; … … 639 539 } 640 540 641 642 643 644 int pvert(poly p) 541 static int pvert(poly p) 645 542 { 646 543 int i, vert=0; … … 656 553 } 657 554 658 659 555 /* 660 556 //full complex 661 st d::vector<std::vector<int> > fullcomplex(ideal h)557 static std::vector<std::vector<int> > fullcomplex(ideal h) 662 558 { 663 559 int vert=vertnum(h), i, j; … … 671 567 fmons=b_subsets(pre); 672 568 return fmons; 673 674 569 }*/ 675 676 570 677 571 /* 678 572 //all the squarefree monomials whose degree is less or equal to n 679 st d::vector<std::vector<int> > sfrmons(ideal h, int n)573 static std::vector<std::vector<int> > sfrmons(ideal h, int n) 680 574 { 681 575 int vert=vertnum(h), i, j, time=0; … … 699 593 } 700 594 return fmons; 701 702 595 } 703 596 */ 704 597 705 598 /* 706 ideal id_complement(ideal h)599 static ideal id_complement(ideal h) 707 600 { 708 601 int i,j; … … 722 615 723 616 //h1 minus h2 724 ideal idMinus(ideal h1,ideal h2)617 static ideal idMinus(ideal h1,ideal h2) 725 618 { 726 619 ideal h=idInit(1,1); … … 746 639 } 747 640 748 749 750 641 //If poly P is squarefree, returns 1 751 642 //returns 0 otherwise, 752 bool p_Ifsfree(poly P)643 static bool p_Ifsfree(poly P) 753 644 { 754 645 int i,sf=1; … … 764 655 } 765 656 766 767 768 657 //returns the set of all squarefree monomials of degree deg in ideal h 769 ideal sfreemon(ideal h,int deg)658 static ideal sfreemon(ideal h,int deg) 770 659 { 771 660 int j; … … 786 675 } 787 676 788 789 790 791 792 793 794 677 //full simplex represented by ideal. 795 678 //(all the squarefree monomials over the polynomial ring) 796 ideal id_sfmon(ideal h)679 static ideal id_sfmon(ideal h) 797 680 { 798 681 ideal asfmons,sfmons,mons; … … 809 692 } 810 693 811 812 813 814 815 816 694 //if the input ideal is simplicial complex, returns the stanleyreisner ideal, 817 695 //if the input ideal is stanleyreisner ideal, returns the monomial ideal according to simplicial complex. 818 696 //(nonfaces and faces). 819 697 //returns the complement of the ideal h (consisting of only squarefree polynomials) 820 ideal id_complement(ideal h)698 static ideal id_complement(ideal h) 821 699 { 822 700 int j, vert=idvert(h); … … 837 715 } 838 716 839 840 841 842 717 //Returns true if p is one of the generators of ideal X 843 718 //returns false otherwise 844 bool IsInX(poly p,ideal X)719 static bool IsInX(poly p,ideal X) 845 720 { 846 721 int i; … … 857 732 } 858 733 859 860 861 862 863 864 734 //returns the monomials in the quotient ring R/(h1+h2) which have degree deg. 865 ideal qringadd(ideal h1, ideal h2, int deg)735 static ideal qringadd(ideal h1, ideal h2, int deg) 866 736 { 867 737 ideal h,qrh; … … 871 741 } 872 742 873 874 875 876 743 //returns the maximal degree of the monomials in ideal h 877 int id_maxdeg(ideal h)744 static int id_maxdeg(ideal h) 878 745 { 879 746 int i,max; … … 887 754 } 888 755 889 890 891 892 893 894 895 756 //input ideal h (a squarefree monomial ideal) is the ideal associated to simplicial complex, 896 757 //and returns the StanleyReisner ideal(minimal generators) 897 ideal idsrRing(ideal h)758 static ideal idsrRing(ideal h) 898 759 { 899 760 int i,n; … … 923 784 } 924 785 925 926 927 786 //returns the set of all the polynomials could divide p 928 ideal SimFacset(poly p)787 static ideal SimFacset(poly p) 929 788 { 930 789 int i,j,max=pTotaldegree(p); … … 942 801 } 943 802 } 944 945 803 } 946 804 idSkipZeroes(id_re); … … 948 806 } 949 807 950 951 952 ideal idadda(ideal h1, ideal h2) 808 static ideal idadda(ideal h1, ideal h2) 953 809 { 954 810 ideal h=idInit(1,1); … … 970 826 return h; 971 827 } 972 973 828 974 829 //complicated version 975 830 //(returns false if it is not a simplicial complex and print the simplex) 976 831 //input h is need to be at least part of faces 977 ideal IsSimplex(ideal h)832 static ideal IsSimplex(ideal h) 978 833 { 979 834 int i,max=id_maxdeg(h); … … 993 848 } 994 849 995 996 850 //input is the subset of the StainleyReisner ideal 997 851 //returns the faces 998 852 //is not used 999 ideal complementsimplex(ideal h)853 static ideal complementsimplex(ideal h) 1000 854 { 1001 855 int i,j;poly p,e=pOne(); … … 1020 874 } 1021 875 1022 1023 1024 int dim_sim(ideal h) 876 static int dim_sim(ideal h) 1025 877 { 1026 878 int dim=pTotaldegree(h>m[0]), i; … … 1035 887 } 1036 888 1037 1038 int num4dim(ideal h, int n) 889 static int num4dim(ideal h, int n) 1039 890 { 1040 891 int num=0; … … 1049 900 } 1050 901 1051 1052 1053 902 /********************Procedures for T1(M method and N method) ***********/ 1054 1055 1056 1057 1058 903 1059 904 //h is ideal( monomial ideal) associated to simplicial complex … … 1061 906 //at least one monomial in StanleyReisner ring) 1062 907 //not so efficient 1063 ideal findb(ideal h)908 static ideal findb(ideal h) 1064 909 { 1065 910 ideal ib=id_sfmon(h), nonf=id_complement(h), bset=idInit(1,1); … … 1081 926 return bset; 1082 927 } 1083 1084 1085 1086 928 1087 929 //h is ideal(monomial ideal associated to simplicial complex … … 1090 932 //3.x^a and x^a have disjoint supports 1091 933 //returns all the possible x^a according conditions 1. 2. 3. 1092 ideal finda(ideal h,poly S,int ddeg)934 static ideal finda(ideal h,poly S,int ddeg) 1093 935 { 1094 936 poly e=pOne(); … … 1116 958 } 1117 959 1118 1119 1120 1121 1122 1123 1124 1125 960 //returns true if support(p) union support(a) minus support(b) is face, 1126 961 //otherwise returns false 1127 962 //(the vector version of mabcondition) 1128 bool mabconditionv(std::vector<std::vector<int> > hvs,std::vector<int> pv,std::vector<int> av,std::vector<int> bv)963 static bool mabconditionv(std::vector<std::vector<int> > hvs,std::vector<int> pv,std::vector<int> av,std::vector<int> bv) 1129 964 { 1130 965 std::vector<int> uv=vecUnion(pv,av); … … 1137 972 } 1138 973 1139 1140 974 // returns the set of nonfaces p where mabconditionv(h, p, a, b) is true 1141 st d::vector<std::vector<int> > Mabv(ideal h,poly a,poly b)975 static std::vector<std::vector<int> > Mabv(ideal h,poly a,poly b) 1142 976 { 1143 977 std::vector<int> av=support1(a), bv=support1(b), pv, vec; … … 1160 994 1161 995 //subroutine for soleli1 1162 st d::vector<int> eli1(std::vector<int> eq1,std::vector<int> eq2)996 static std::vector<int> eli1(std::vector<int> eq1,std::vector<int> eq2) 1163 997 { 1164 998 int i,j; … … 1179 1013 /* 1180 1014 //get triangular form(eqs.size()>0) 1181 st d::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs)1015 static std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs) 1182 1016 { 1183 1017 int i,j; … … 1203 1037 }*/ 1204 1038 //make sure the first element is smaller that the second one 1205 st d::vector<int> keeporder( std::vector<int> vec)1039 static std::vector<int> keeporder( std::vector<int> vec) 1206 1040 { 1207 1041 std::vector<int> yaya; … … 1216 1050 } 1217 1051 1218 1219 std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs) 1052 static std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs) 1220 1053 { 1221 1054 int i; … … 1247 1080 } 1248 1081 1249 1250 1251 1082 // input is a set of equations who is of triangular form(every equations has a form of x_ix_j) 1252 1083 // n is the number of variables 1253 1084 //get the free variables and the dimension 1254 st d::vector<int> freevars(int n, std::vector<int> bset, std::vector<std::vector<int> > gset)1085 static std::vector<int> freevars(int n, std::vector<int> bset, std::vector<std::vector<int> > gset) 1255 1086 { 1256 1087 int ql=gset.size(), bl=bset.size(), i; … … 1271 1102 } 1272 1103 } 1273 return fvar; 1274 } 1275 1104 return fvar; 1105 } 1276 1106 1277 1107 //return the set of free variables except the vnum one 1278 st d::vector<int> fvarsvalue(int vnum, std::vector<int> fvars)1108 static std::vector<int> fvarsvalue(int vnum, std::vector<int> fvars) 1279 1109 { 1280 1110 int i; … … 1291 1121 } 1292 1122 1293 1294 1295 1296 1123 //returns the simplified bset and gset 1297 1124 //enlarge bset, simplify gset 1298 st d::vector<std::vector<int> > vAbsorb( std::vector<int> bset,std::vector<std::vector<int> > gset)1125 static std::vector<std::vector<int> > vAbsorb( std::vector<int> bset,std::vector<std::vector<int> > gset) 1299 1126 { 1300 1127 std::vector<int> badset=bset; … … 1338 1165 } 1339 1166 1340 1341 1342 1343 1344 1345 1167 //the labels of new variables are started with 1 1346 1168 //returns a vector of solution space according to index 1347 st d::vector<int> vecbase1(int num, std::vector<int> oset)1169 static std::vector<int> vecbase1(int num, std::vector<int> oset) 1348 1170 { 1349 1171 int i; … … 1359 1181 } 1360 1182 1361 1362 1363 1183 //returns a vector which has length of n, 1364 1184 //and all the entries are 0. 1365 st d::vector<int> make0(int n)1185 static std::vector<int> make0(int n) 1366 1186 { 1367 1187 int i; … … 1374 1194 } 1375 1195 1376 1377 1196 //returns a vector which has length of n, 1378 1197 //and all the entries are 1. 1379 st d::vector<int> make1(int n)1198 static std::vector<int> make1(int n) 1380 1199 { 1381 1200 int i; … … 1388 1207 } 1389 1208 1390 1391 1392 1393 1209 //input gset must be the triangular form after zero absorbing according to the badset, 1394 1210 //bset must be the zero set after absorbing. 1395 st d::vector<int> ofindbases1(int num, int vnum, std::vector<int> bset,std::vector<std::vector<int> > gset)1211 static std::vector<int> ofindbases1(int num, int vnum, std::vector<int> bset,std::vector<std::vector<int> > gset) 1396 1212 { 1397 1213 std::vector<std::vector<int> > goodset; … … 1407 1223 } 1408 1224 1409 1410 1411 1412 1413 1414 1415 1416 1225 //input gset must be the triangular form after zero absorbing according to the badset 1417 1226 //bset must be the zero set after absorbing 1418 st d::vector<std::vector<int> > ofindbases(int num, std::vector<int> bset,std::vector<std::vector<int> > gset)1227 static std::vector<std::vector<int> > ofindbases(int num, std::vector<int> bset,std::vector<std::vector<int> > gset) 1419 1228 { 1420 1229 int i,m; … … 1440 1249 } 1441 1250 1442 1443 1444 1445 1446 1447 1448 1449 1251 //gset is a set of equations which have forms of x_ix_j 1450 1252 //num is the number of varialbes also the length of the set which we need to consider 1451 1253 //output is trigular form of gset and badset where x_i=0 1452 st d::vector<std::vector<int> > eli2(int num, std::vector<int> bset,std::vector<std::vector<int> > gset)1254 static std::vector<std::vector<int> > eli2(int num, std::vector<int> bset,std::vector<std::vector<int> > gset) 1453 1255 { 1454 1256 std::vector<int> badset; … … 1485 1287 } 1486 1288 1487 1488 1289 /********************************************************************/ 1489 1490 1491 1492 1493 1494 1495 1496 1290 /************************links***********************************/ 1497 1291 1498 1499 1292 //returns the links of face a in simplicial complex X 1500 st d::vector<std::vector<int> > links(poly a, ideal h)1293 static std::vector<std::vector<int> > links(poly a, ideal h) 1501 1294 { 1502 1295 int i; … … 1520 1313 } 1521 1314 1522 1523 1524 int redefinedeg(poly p, int num) 1315 static int redefinedeg(poly p, int num) 1525 1316 { 1526 1317 int deg=0, deg0; … … 1541 1332 } 1542 1333 1543 1544 1334 // the degree of variables should be same 1545 ideal p_a(ideal h)1335 static ideal p_a(ideal h) 1546 1336 { 1547 1337 poly p; … … 1577 1367 } 1578 1368 1579 1580 1369 /*only for the exampels whose variables has degree more than 1*/ 1581 1370 /*ideal p_a(ideal h) … … 1613 1402 }*/ 1614 1403 1615 1616 1617 1618 std::vector<std::vector<int> > id_subsets(std::vector<std::vector<int> > vecs) 1619 { 1620 int i,j; 1621 std::vector<std::vector<int> > vvs, res; 1622 for(i=0;i<vecs.size();i++) 1623 { 1624 vvs=b_subsets(vecs[i]); 1625 //listsprint(vvs); 1626 for(j=0;j<vvs.size();j++) 1627 { 1628 if(!vInvsl(vvs[j],res)) 1629 res.push_back(vvs[j]); 1630 } 1631 } 1632 //listsprint(res); 1633 return (res); 1634 } 1635 1636 1637 1638 1639 std::vector<int> vertset(std::vector<std::vector<int> > vecs) 1404 static std::vector<int> vertset(std::vector<std::vector<int> > vecs) 1640 1405 { 1641 1406 int i,j; … … 1660 1425 1661 1426 //smarter way 1662 ideal p_b(ideal h, poly a)1427 static ideal p_b(ideal h, poly a) 1663 1428 { 1664 1429 std::vector<std::vector<int> > pbv,lk=links(a,h), res; … … 1685 1450 /*//dump way to get pb 1686 1451 // the degree of variables should be same 1687 ideal p_b(ideal h, poly a)1452 static ideal p_b(ideal h, poly a) 1688 1453 { 1689 1454 std::vector<std::vector<int> > pbv,lk=links(a,h),res; … … 1733 1498 } 1734 1499 1735 ideal p_b(ideal h, poly a)1500 static ideal p_b(ideal h, poly a) 1736 1501 { 1737 1502 std::vector<std::vector<int> > pbv,lk=links(a,h),res; … … 1770 1535 }*/ 1771 1536 1772 1773 1774 1775 1537 //input is a squarefree monomial p 1776 1538 //output is all the squarefree monomials which could divid p(including p itself?) 1777 ideal psubset(poly p)1539 static ideal psubset(poly p) 1778 1540 { 1779 1541 int i,j,max=pTotaldegree(p); … … 1795 1557 } 1796 1558 1797 1798 1799 1559 //inserts a new vector which has two elements a and b into vector gset (which is a vector of vectors) 1800 1560 //(especially for gradedpiece1 and gradedpiece1n) 1801 st d::vector<std::vector<int> > listsinsertlist(std::vector<std::vector<int> > gset, int a, int b)1561 static std::vector<std::vector<int> > listsinsertlist(std::vector<std::vector<int> > gset, int a, int b) 1802 1562 { 1803 1563 std::vector<int> eq; … … 1808 1568 } 1809 1569 1810 1811 1812 1813 1814 std::vector<int> makeequation(int i,int j, int t) 1570 static std::vector<int> makeequation(int i,int j, int t) 1815 1571 { 1816 1572 std::vector<int> equation; … … 1822 1578 } 1823 1579 1824 1825 1826 1827 1828 1580 /****************************************************************/ 1829 1581 //only for solving the equations obtained from T^2 1830 1582 //input should be a vector which has only 3 entries 1831 poly pMake3(std::vector<int> vbase)1583 static poly pMake3(std::vector<int> vbase) 1832 1584 { 1833 1585 int co=1; … … 1847 1599 } 1848 1600 1849 1850 ideal idMake3(std::vector<std::vector<int> > vecs) 1601 static ideal idMake3(std::vector<std::vector<int> > vecs) 1851 1602 { 1852 1603 ideal id_re=idInit(1,1); … … 1865 1616 1866 1617 //change the current ring to a new ring which is in num new variables 1867 void equmab(int num)1618 static void equmab(int num) 1868 1619 { 1869 1620 int i; … … 1885 1636 } 1886 1637 1887 1888 1638 //returns the trivial case of T^1 1889 1639 //b must only contain one variable 1890 st d::vector<int> subspace1(std::vector<std::vector<int> > mv, std::vector<int> bv)1640 static std::vector<int> subspace1(std::vector<std::vector<int> > mv, std::vector<int> bv) 1891 1641 { 1892 1642 int i, num=mv.size(); … … 1902 1652 } 1903 1653 1904 1905 1906 1907 1908 1909 1910 1911 1912 1654 /***************************only for T^2*************************************/ 1913 1655 //vbase only has two elements which records the position of the monomials in mv 1914 1656 1915 1916 std::vector<poly> pMakei(std::vector<std::vector<int> > mv,std::vector<int> vbase) 1657 static std::vector<poly> pMakei(std::vector<std::vector<int> > mv,std::vector<int> vbase) 1917 1658 { 1918 1659 poly p; … … 1927 1668 } 1928 1669 1929 1930 1931 1670 // returns a ideal according to a set of supports 1932 std::vector<std::vector<poly> > idMakei(std::vector<std::vector<int> > mv,std::vector<std::vector<int> > vecs)1671 static std::vector<std::vector<poly> > idMakei(std::vector<std::vector<int> > mv,std::vector<std::vector<int> > vecs) 1933 1672 { 1934 1673 int i,lv=vecs.size(); … … 1948 1687 /****************************************************************/ 1949 1688 1950 1951 1952 1953 1954 1955 1956 1957 1689 //return the graded pieces of cohomology T^1 according to a,b 1958 1690 //original method (only for debugging) 1959 void gradedpiece1(ideal h,poly a,poly b)1691 static void gradedpiece1(ideal h,poly a,poly b) 1960 1692 { 1961 1693 int i,j,m; … … 2016 1748 } 2017 1749 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 1750 //Returns true if b can divide p*q 2035 bool condition1for2(std::vector<int > pv,std::vector<int > qv,std::vector<int > bv)1751 static bool condition1for2(std::vector<int > pv,std::vector<int > qv,std::vector<int > bv) 2036 1752 { 2037 1753 std::vector<int > vec=vecUnion(pv,qv); … … 2045 1761 } 2046 1762 2047 2048 2049 1763 //Returns true if support(p) union support(q) union support(s) union support(a) minus support(b) is face 2050 bool condition2for2(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv, std::vector<int> sv, std::vector<int> av, std::vector<int> bv)1764 static bool condition2for2(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv, std::vector<int> sv, std::vector<int> av, std::vector<int> bv) 2051 1765 { 2052 1766 std::vector<int> vec=vecUnion(pv,qv); … … 2061 1775 } 2062 1776 2063 2064 2065 2066 2067 2068 bool condition3for2(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv, std::vector<int> av, std::vector<int> bv) 1777 static bool condition3for2(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv, std::vector<int> av, std::vector<int> bv) 2069 1778 { 2070 1779 std::vector<int> v1,v2,v3; … … 2083 1792 } 2084 1793 2085 2086 2087 2088 2089 2090 2091 2092 2093 1794 /****************solve the equations got from T^2*********************/ 2094 1795 2095 ideal getpresolve(ideal h)1796 static ideal getpresolve(ideal h) 2096 1797 { 2097 1798 //ring r=currRing; … … 2121 1822 } 2122 1823 2123 2124 2125 std::vector<int> numfree(ideal h) 1824 static std::vector<int> numfree(ideal h) 2126 1825 { 2127 1826 int i,j; … … 2142 1841 } 2143 1842 2144 2145 2146 2147 2148 std::vector<std::vector<int> > canonicalbase(int n) 1843 static std::vector<std::vector<int> > canonicalbase(int n) 2149 1844 { 2150 1845 std::vector<std::vector<int> > vecs; … … 2166 1861 } 2167 1862 2168 2169 2170 2171 2172 std::vector<std::vector<int> > getvector(ideal h,int n) 1863 static std::vector<std::vector<int> > getvector(ideal h,int n) 2173 1864 { 2174 1865 std::vector<int> vec; … … 2234 1925 2235 1926 //subspace of T2(find all the possible values of alpha) 2236 st d::vector<int> findalpha(std::vector<std::vector<int> > mv, std::vector<int> bv)1927 static std::vector<int> findalpha(std::vector<std::vector<int> > mv, std::vector<int> bv) 2237 1928 { 2238 1929 std::vector<int> alset; … … 2249 1940 } 2250 1941 2251 st d::vector<int> subspacet1(int num, std::vector<std::vector<int> > ntvs)1942 static std::vector<int> subspacet1(int num, std::vector<std::vector<int> > ntvs) 2252 1943 { 2253 1944 int i, j, t, n=ntvs.size(); … … 2275 1966 } 2276 1967 2277 2278 2279 2280 1968 //subspace for T^2(mab method) 2281 st d::vector<std::vector<int> > subspacet(std::vector<std::vector<int> > mv, std::vector<int> bv,std::vector<std::vector<int> > ntvs)1969 static std::vector<std::vector<int> > subspacet(std::vector<std::vector<int> > mv, std::vector<int> bv,std::vector<std::vector<int> > ntvs) 2282 1970 { 2283 1971 std::vector<int> alset=findalpha(mv,bv), subase; … … 2293 1981 } 2294 1982 2295 2296 2297 2298 2299 std::vector<std::vector<int> > mabtv(std::vector<std::vector<int> > hvs, std::vector<std::vector<int> > Mv, std::vector<int> av, std::vector<int> bv) 1983 static std::vector<std::vector<int> > mabtv(std::vector<std::vector<int> > hvs, std::vector<std::vector<int> > Mv, std::vector<int> av, std::vector<int> bv) 2300 1984 { 2301 1985 std::vector<int> v1,var; … … 2318 2002 } 2319 2003 2320 2321 2322 2323 2004 //fix the problem of the number of the new variables 2324 2005 //original method for T^2(only for debugging) 2325 void gradedpiece2(ideal h,poly a,poly b)2006 static void gradedpiece2(ideal h,poly a,poly b) 2326 2007 { 2327 2008 int t0,t1,t2,i,j,t,m; … … 2405 2086 } 2406 2087 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2088 /**********************************************************************/ 2433 2089 //For the method of N_{ab} 2434 2090 2435 2436 2437 2438 2091 //returns true if pv(support of monomial) satisfies pv union av minus bv is in hvs 2439 bool nabconditionv(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> av, std::vector<int> bv)2092 static bool nabconditionv(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> av, std::vector<int> bv) 2440 2093 { 2441 2094 std::vector<int> vec1=vecIntersection(pv,bv), vec2=vecUnion(pv,bv); … … 2450 2103 } 2451 2104 2452 2453 2454 2455 2456 2457 2105 //returns N_{ab} 2458 st d::vector<std::vector<int> > Nabv(std::vector<std::vector<int> > hvs, std::vector<int> av, std::vector<int> bv)2106 static std::vector<std::vector<int> > Nabv(std::vector<std::vector<int> > hvs, std::vector<int> av, std::vector<int> bv) 2459 2107 { 2460 2108 std::vector<std::vector<int> > vecs; … … 2471 2119 } 2472 2120 2473 2474 2475 2476 2477 2478 2121 //returns true if pv union qv union av minus bv is in hvs 2479 2122 //hvs is simplicial complex … … 2489 2132 } 2490 2133 2491 2492 2134 //returns N_{ab}^(2) 2493 st d::vector<std::vector<int> > nabtv(std::vector<std::vector<int> > hvs, std::vector<std::vector<int> > Nv, std::vector<int> av, std::vector<int> bv)2135 static std::vector<std::vector<int> > nabtv(std::vector<std::vector<int> > hvs, std::vector<std::vector<int> > Nv, std::vector<int> av, std::vector<int> bv) 2494 2136 { 2495 2137 std::vector<int> v1,var; … … 2511 2153 } 2512 2154 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2155 //p must be the monomial which is a face 2523 2156 // ideal sub=psubset(b); bvs=supports(sub); 2524 bool tNab(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<std::vector<int> > bvs)2157 static bool tNab(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<std::vector<int> > bvs) 2525 2158 { 2526 2159 std::vector<int> sv; … … 2537 2170 } 2538 2171 2539 st d::vector<int> tnab(std::vector<std::vector<int> > hvs,std::vector<std::vector<int> > nvs,std::vector<std::vector<int> > bvs)2172 static std::vector<int> tnab(std::vector<std::vector<int> > hvs,std::vector<std::vector<int> > nvs,std::vector<std::vector<int> > bvs) 2540 2173 { 2541 2174 std::vector<int> pv, vec; … … 2551 2184 } 2552 2185 2553 2554 2555 2556 2557 2558 2559 2560 2186 //the image phi(pv)=pv union av minus bv 2561 st d::vector<int> phimage(std::vector<int> pv, std::vector<int> av, std::vector<int> bv)2187 static std::vector<int> phimage(std::vector<int> pv, std::vector<int> av, std::vector<int> bv) 2562 2188 { 2563 2189 std::vector<int> qv=vecUnion(pv,av); … … 2566 2192 } 2567 2193 2568 2569 2570 2194 //mvs and nvs are the supports of ideal Mab and Nab 2571 2195 //vecs is the solution of nab 2572 st d::vector<std::vector<int> > value1(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > nvs, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv)2196 static std::vector<std::vector<int> > value1(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > nvs, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv) 2573 2197 { 2574 2198 int j; … … 2601 2225 2602 2226 } 2603 2604 2227 bases.push_back(base); 2605 2228 base.clear(); … … 2608 2231 } 2609 2232 2610 2611 2612 2613 2614 2615 2616 2617 2618 intvec *Tmat(std::vector<std::vector<int> > vecs) 2233 static intvec *Tmat(std::vector<std::vector<int> > vecs) 2619 2234 { 2620 2235 //std::vector<std::vector<int> > solve=gradedpiece1n(h,a,b); … … 2639 2254 } 2640 2255 } 2641 return (m); 2642 } 2643 2644 2645 2646 2647 2648 2649 2650 2256 return (m); 2257 } 2651 2258 2652 2259 //returns the set of position number of minimal gens in M 2653 st d::vector<int> gensindex(ideal M, ideal ids)2260 static std::vector<int> gensindex(ideal M, ideal ids) 2654 2261 { 2655 2262 int i; … … 2668 2275 } 2669 2276 2670 2671 2672 ideal mingens(ideal h, poly a, poly b) 2277 static ideal mingens(ideal h, poly a, poly b) 2673 2278 { 2674 2279 int i; … … 2684 2289 } 2685 2290 2686 2687 2688 std::vector<std::vector<int> > minisolve(std::vector<std::vector<int> > solve, std::vector<int> index) 2291 static std::vector<std::vector<int> > minisolve(std::vector<std::vector<int> > solve, std::vector<int> index) 2689 2292 { 2690 2293 int i,j; … … 2705 2308 } 2706 2309 2707 2708 2310 //T_1 graded piece(N method) 2709 2311 //frame of the most efficient version 2710 2312 //regardless of links 2711 2712 intvec * gradedpiece1n(ideal h,poly a,poly b) 2313 static intvec * gradedpiece1n(ideal h,poly a,poly b) 2713 2314 { 2714 2315 int i,j,co,n; … … 2776 2377 } 2777 2378 2778 2779 2780 2781 2782 2783 2379 //for debugging 2784 void T1(ideal h)2380 static void T1(ideal h) 2785 2381 { 2786 2382 ideal bi=findb(h),ai; … … 2797 2393 if(!idIs0(ai)) 2798 2394 { 2799 id_print(ai); 2800 for(int j=0;j<IDELEMS(ai);j++) 2801 { 2802 //PrintS("This is a:"); 2803 a=pCopy(ai>m[j]); 2804 //pWrite(a); 2805 intvec * solve=gradedpiece1n(h, a, b); 2806 if (IMATELEM(*solve,1,1)!=10) 2807 mm++; 2808 } 2809 } 2810 2811 } 2812 Print("Finished %d!\n",mm); 2813 2814 } 2815 2816 2817 2818 2819 2820 2821 bool condition2for2nv(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv, std::vector<int> fv) 2395 id_print(ai); 2396 for(int j=0;j<IDELEMS(ai);j++) 2397 { 2398 //PrintS("This is a:"); 2399 a=pCopy(ai>m[j]); 2400 //pWrite(a); 2401 intvec * solve=gradedpiece1n(h, a, b); 2402 if (IMATELEM(*solve,1,1)!=10) 2403 mm++; 2404 } 2405 } 2406 } 2407 Print("Finished %d!\n",mm); 2408 } 2409 2410 static bool condition2for2nv(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv, std::vector<int> fv) 2822 2411 { 2823 2412 std::vector<int> vec=vecUnion(pv,qv); … … 2832 2421 } 2833 2422 2834 2835 2836 2837 2838 2423 //for subspace of T2(find all the possible values of alpha) 2839 st d::vector<int> findalphan(std::vector<std::vector<int> > N, std::vector<int> tN)2424 static std::vector<int> findalphan(std::vector<std::vector<int> > N, std::vector<int> tN) 2840 2425 { 2841 2426 int i;std::vector<int> alset,vec; … … 2849 2434 } 2850 2435 //listprint(alset); 2851 return alset; 2852 } 2853 2854 2855 2436 return alset; 2437 } 2856 2438 2857 2439 //subspace of T^2 (nab method) 2858 st d::vector<std::vector<int> > subspacetn(std::vector<std::vector<int> > N, std::vector<int> tN, std::vector<std::vector<int> > ntvs)2440 static std::vector<std::vector<int> > subspacetn(std::vector<std::vector<int> > N, std::vector<int> tN, std::vector<std::vector<int> > ntvs) 2859 2441 { 2860 2442 int i; … … 2871 2453 } 2872 2454 2873 2874 2875 2455 //mts Mabt 2876 2456 //nts Nabt 2877 2457 //mvs Mab 2878 2458 //nvs Nab 2879 st d::vector<std::vector<int> > value2(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > nvs, std::vector<std::vector<int> > mts, std::vector<std::vector<int> > nts, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv)2459 static std::vector<std::vector<int> > value2(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > nvs, std::vector<std::vector<int> > mts, std::vector<std::vector<int> > nts, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv) 2880 2460 { 2881 2461 int row,col,j; … … 2929 2509 } 2930 2510 2931 2932 2933 2934 ideal genst(ideal h, poly a, poly b) 2511 static ideal genst(ideal h, poly a, poly b) 2935 2512 { 2936 2513 std::vector<std::vector<int> > hvs=supports(h),mv,mts; … … 2949 2526 } 2950 2527 2951 2952 2953 2954 2955 2956 2957 2958 intvec * gradedpiece2n(ideal h,poly a,poly b) 2528 static intvec * gradedpiece2n(ideal h,poly a,poly b) 2959 2529 { 2960 2530 int i,j,t,n; … … 3034 2604 } 3035 2605 3036 3037 3038 3039 3040 3041 2606 //for debugging 3042 void T2(ideal h)2607 static void T2(ideal h) 3043 2608 { 3044 2609 ideal bi=findb(h),ai; … … 3046 2611 poly a,b; 3047 2612 int mm=0,gp=0; 3048 std::vector<int> bv,av;2613 std::vector<int> bv,av; 3049 2614 std::vector<std::vector<int> > solve; 3050 2615 for(int i=0;i<IDELEMS(bi);i++) … … 3080 2645 } 3081 2646 3082 3083 3084 3085 3086 2647 /*****************************for links*******************************************/ 3087 2648 //the image phi(pv)=pv minus av minus bv 3088 st d::vector<int> phimagel(std::vector<int> fv, std::vector<int> av, std::vector<int> bv)2649 static std::vector<int> phimagel(std::vector<int> fv, std::vector<int> av, std::vector<int> bv) 3089 2650 { 3090 2651 std::vector<int> nv; … … 3094 2655 } 3095 2656 3096 3097 3098 2657 //mvs and nvs are the supports of ideal Mab and Nab 3099 2658 //vecs is the solution of nab 3100 st d::vector<std::vector<int> > value1l(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > lks, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv)2659 static std::vector<std::vector<int> > value1l(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > lks, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv) 3101 2660 { 3102 2661 int j; … … 3123 2682 usleep(1000000); 3124 2683 assert(false); 3125 3126 } 3127 2684 } 3128 2685 bases.push_back(base); 3129 2686 base.clear(); … … 3135 2692 VAR clock_t t_begin, t_mark, t_start, t_construct=0, t_solve=0, t_value=0, t_total=0; 3136 2693 /**************************************************/ 3137 3138 2694 3139 2695 static void TimeShow(clock_t t_construct, clock_t t_solve, clock_t t_value ,clock_t t_total) … … 3146 2702 } 3147 2703 3148 3149 3150 std::vector<std::vector<int> > gpl(ideal h,poly a,poly b) 2704 static std::vector<std::vector<int> > gpl(ideal h,poly a,poly b) 3151 2705 { 3152 2706 int i,j,co; … … 3210 2764 } 3211 2765 3212 3213 2766 //T^1 3214 2767 //only need to consider the links of a, and reduce a to empty set 3215 intvec * gradedpiece1nl(ideal h,poly a,poly b, int set)2768 static intvec * gradedpiece1nl(ideal h,poly a,poly b, int set) 3216 2769 { 3217 2770 t_start=clock(); … … 3236 2789 } 3237 2790 3238 3239 3240 3241 2791 //for finding values of T^2 3242 st d::vector<std::vector<int> > value2l(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > lks, std::vector<std::vector<int> > mts, std::vector<std::vector<int> > lkts, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv)2792 static std::vector<std::vector<int> > value2l(std::vector<std::vector<int> > mvs, std::vector<std::vector<int> > lks, std::vector<std::vector<int> > mts, std::vector<std::vector<int> > lkts, std::vector<std::vector<int> > vecs,std::vector<int> av, std::vector<int> bv) 3243 2793 { 3244 2794 std::vector<int> pv,qv,base; … … 3293 2843 } 3294 2844 3295 3296 std::vector<std::vector<int> > gpl2(ideal h,poly a,poly b) 2845 static std::vector<std::vector<int> > gpl2(ideal h,poly a,poly b) 3297 2846 { 3298 2847 int i,j,t,n; … … 3362 2911 } 3363 2912 3364 3365 3366 3367 3368 3369 intvec * gradedpiece2nl(ideal h,poly a,poly b) 2913 static intvec * gradedpiece2nl(ideal h,poly a,poly b) 3370 2914 { 3371 2915 poly e=pOne(); … … 3390 2934 return sl; 3391 2935 } 3392 3393 3394 2936 3395 2937 //for debugging … … 3422 2964 */ 3423 2965 3424 3425 3426 2966 /******************************for triangulation***********************************/ 3427 2967 3428 3429 3430 2968 //returns all the faces which are triangles 3431 ideal trisets(ideal h)2969 static ideal trisets(ideal h) 3432 2970 { 3433 2971 int i; … … 3444 2982 } 3445 2983 3446 3447 3448 3449 2984 // case 1 new faces 3450 st d::vector<std::vector<int> > triface(poly p, int vert)2985 static std::vector<std::vector<int> > triface(poly p, int vert) 3451 2986 { 3452 2987 std::vector<int> vec, fv=support1(p); … … 3467 3002 // the size of p's support must be 3 3468 3003 //returns the new complex which is a triangulation based on the face p 3469 ideal triangulations1(ideal h, poly p, int vert)3004 static ideal triangulations1(ideal h, poly p, int vert) 3470 3005 { 3471 3006 std::vector<int> vec, pv=support1(p); … … 3477 3012 //PrintS("is:\n"); 3478 3013 //listsprint(vecs); 3479 3480 3014 ideal re=idMaken(vecs); 3481 3482 3015 return re; 3483 3016 } 3484 3017 3485 3486 3487 3488 3018 /* 3489 ideal triangulations1(ideal h)3019 static ideal triangulations1(ideal h) 3490 3020 { 3491 3021 int i,vert=currRing>N+1; … … 3510 3040 }*/ 3511 3041 3512 3513 std::vector<int> commonedge(poly p, poly q) 3042 static std::vector<int> commonedge(poly p, poly q) 3514 3043 { 3515 3044 std::vector<int> ev, fv1= support1(p), fv2= support2(q); … … 3522 3051 } 3523 3052 3524 3525 intvec *edgemat(poly p, poly q) 3053 static intvec *edgemat(poly p, poly q) 3526 3054 { 3527 3055 intvec *m; … … 3542 3070 3543 3071 // case 2 the new face 3544 st d::vector<std::vector<int> > tetraface(poly p, poly q, int vert)3072 static std::vector<std::vector<int> > tetraface(poly p, poly q, int vert) 3545 3073 { 3546 3074 std::vector<int> ev=commonedge(p, q), vec, fv1=support1(p), fv2=support1(q); … … 3563 3091 } 3564 3092 3565 3566 3093 //if p and q have a common edge 3567 ideal triangulations2(ideal h, poly p, poly q, int vert)3094 static ideal triangulations2(ideal h, poly p, poly q, int vert) 3568 3095 { 3569 3096 std::vector<int> ev, fv1=support1(p), fv2=support1(q); … … 3579 3106 } 3580 3107 3581 3582 3583 3584 3108 // case 2 the new face 3585 st d::vector<std::vector<int> > penface(poly p, poly q, poly g, int vert)3109 static std::vector<std::vector<int> > penface(poly p, poly q, poly g, int vert) 3586 3110 { 3587 3111 int en=0; … … 3627 3151 } 3628 3152 3629 3630 3631 ideal triangulations3(ideal h, poly p, poly q, poly g, int vert) 3153 static ideal triangulations3(ideal h, poly p, poly q, poly g, int vert) 3632 3154 { 3633 3155 std::vector<int> ev1=commonedge(p, q), ev2=commonedge(p, g), ev3=commonedge(q, g), fv1=support1(p), fv2=support1(q), fv3=support1(g); … … 3652 3174 } 3653 3175 3654 3655 3176 //returns p's valency in h 3656 3177 //p must be a vertex 3657 int valency(ideal h, poly p)3178 static int valency(ideal h, poly p) 3658 3179 { 3659 3180 int val=0; … … 3702 3223 }*/ 3703 3224 3704 3705 3706 3225 /*********************************For computation of X_n***********************************/ 3707 st d::vector<std::vector<int> > vsMinusvs(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)3226 static std::vector<std::vector<int> > vsMinusvs(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2) 3708 3227 { 3709 3228 std::vector<std::vector<int> > vs=vs1; … … 3715 3234 } 3716 3235 3717 3718 std::vector<std::vector<int> > vs_subsets(std::vector<std::vector<int> > vs) 3236 static std::vector<std::vector<int> > vs_subsets(std::vector<std::vector<int> > vs) 3719 3237 { 3720 3238 std::vector<std::vector<int> > sset, bv; … … 3727 3245 } 3728 3246 3729 3730 3731 std::vector<std::vector<int> > p_constant(ideal Xo, ideal Sigma) 3247 static std::vector<std::vector<int> > p_constant(ideal Xo, ideal Sigma) 3732 3248 { 3733 3249 std::vector<std::vector<int> > xs=supports(idCopy(Xo)), ss=supports(idCopy(Sigma)), fvs1; … … 3737 3253 } 3738 3254 3739 3740 std::vector<std::vector<int> > p_change(ideal Sigma) 3255 static std::vector<std::vector<int> > p_change(ideal Sigma) 3741 3256 { 3742 3257 std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs; … … 3745 3260 } 3746 3261 3747 3748 3749 std::vector<std::vector<int> > p_new(ideal Xo, ideal Sigma) 3262 static std::vector<std::vector<int> > p_new(ideal Xo, ideal Sigma) 3750 3263 { 3751 3264 int vert=0; … … 3778 3291 } 3779 3292 3780 3781 3782 3783 ideal c_New(ideal Io, ideal sig) 3293 static ideal c_New(ideal Io, ideal sig) 3784 3294 { 3785 3295 std::vector<std::vector<int> > vs1=p_constant(Io, sig), vs2=p_change(sig), vs3=p_new(Io, sig), vsig=supports(sig), vs; … … 3816 3326 } 3817 3327 3818 3819 3820 3821 std::vector<std::vector<int> > phi1(poly a, ideal Sigma) 3328 static std::vector<std::vector<int> > phi1(poly a, ideal Sigma) 3822 3329 { 3823 3330 std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs; … … 3835 3342 } 3836 3343 3837 3838 3839 3344 static std::vector<std::vector<int> > phi2(poly a, ideal Xo, ideal Sigma) 3840 3345 { … … 3854 3359 } 3855 3360 3856 3857 std::vector<std::vector<int> > links_new(poly a, ideal Xo, ideal Sigma, int vert, int ord) 3361 static std::vector<std::vector<int> > links_new(poly a, ideal Xo, ideal Sigma, int vert, int ord) 3858 3362 { 3859 3363 std::vector<int> av=support1(a); … … 3879 3383 } 3880 3384 3881 3882 3883 3884 3385 //returns 1 if there is a real divisor of b not in Xs 3885 int existIn(poly b, ideal Xs)3386 static int existIn(poly b, ideal Xs) 3886 3387 { 3887 3388 std::vector<int> bv=support1(pCopy(b)); … … 3898 3399 } 3899 3400 3900 3901 int isoNum(poly p, ideal I, poly a, poly b) 3401 static int isoNum(poly p, ideal I, poly a, poly b) 3902 3402 { 3903 3403 int i; … … 3916 3416 } 3917 3417 3918 3919 3920 3921 int ifIso(poly p, poly q, poly f, poly g, poly a, poly b) 3418 static int ifIso(poly p, poly q, poly f, poly g, poly a, poly b) 3922 3419 { 3923 3420 std::vector<int> va=support1(a), vb=support1(b), vp=support1(p), vq=support1(q), vf=support1(f), vg=support1(g); … … 3930 3427 } 3931 3428 3932 3933 3934 3935 ideal idMinusp(ideal I, poly p) 3429 static ideal idMinusp(ideal I, poly p) 3936 3430 { 3937 3431 ideal h=idInit(1,1); … … 3948 3442 } 3949 3443 3950 3951 3444 /****************************for the interface of .lib*********************************/ 3952 3445 3953 ideal makemab(ideal h, poly a, poly b) 3954 { 3955 std::vector<std::vector<int> > mv=Mabv(h,a,b); 3956 ideal M=idMaken(mv); 3957 return M; 3958 } 3959 3960 3961 std::vector<int> v_minus(std::vector<int> v1, std::vector<int> v2) 3446 static std::vector<int> v_minus(std::vector<int> v1, std::vector<int> v2) 3962 3447 { 3963 3448 std::vector<int> vec; … … 3969 3454 } 3970 3455 3971 3972 std::vector<int> gdegree(poly a, poly b) 3456 static std::vector<int> gdegree(poly a, poly b) 3973 3457 { 3974 3458 int i; … … 3985 3469 } 3986 3470 3987 3988 3989 3990 3991 3992 3471 /********************************for stellar subdivision******************************/ 3993 3472 3994 3995 std::vector<std::vector<int> > star(poly a, ideal h) 3473 static std::vector<std::vector<int> > star(poly a, ideal h) 3996 3474 { 3997 3475 int i; … … 4009 3487 } 4010 3488 4011 4012 std::vector<std::vector<int> > boundary(poly a) 3489 static std::vector<std::vector<int> > boundary(poly a) 4013 3490 { 4014 3491 std::vector<int> av=support1(a), vec; … … 4020 3497 } 4021 3498 4022 4023 4024 4025 4026 4027 std::vector<std::vector<int> > stellarsub(poly a, ideal h) 3499 static std::vector<std::vector<int> > stellarsub(poly a, ideal h) 4028 3500 { 4029 3501 std::vector<std::vector<int> > vecs_minus, vecs_plus, lk=links(a,h), hvs=supports(h), sub, bys=boundary(a); … … 4058 3530 } 4059 3531 4060 4061 std::vector<std::vector<int> > bsubsets_1(poly b) 3532 static std::vector<std::vector<int> > bsubsets_1(poly b) 4062 3533 { 4063 3534 std::vector<int> bvs=support1(b), vs; … … 4075 3546 } 4076 3547 4077 4078 4079 3548 /***************************for time testing******************************/ 4080 ideal T_1h(ideal h)3549 static ideal T_1h(ideal h) 4081 3550 { 4082 3551 int i, j; … … 4100 3569 TimeShow(t_construct, t_solve, t_value, t_total); 4101 3570 return h; 4102 4103 } 3571 } 3572 4104 3573 /**************************************interface T1****************************************/ 4105 3574 /* 4106 BOOLEAN makeqring(leftv res, leftv args)3575 static BOOLEAN makeqring(leftv res, leftv args) 4107 3576 { 4108 3577 leftv h=args; … … 4129 3598 }*/ 4130 3599 4131 4132 4133 4134 4135 BOOLEAN SRideal(leftv res, leftv args) 3600 static BOOLEAN SRideal(leftv res, leftv args) 4136 3601 { 4137 3602 leftv h=args; … … 4145 3610 } 4146 3611 4147 4148 4149 4150 4151 4152 BOOLEAN idcomplement(leftv res, leftv args) 3612 static BOOLEAN idcomplement(leftv res, leftv args) 4153 3613 { 4154 3614 leftv h=args; … … 4163 3623 } 4164 3624 4165 4166 4167 4168 4169 BOOLEAN t1h(leftv res, leftv args) 3625 static BOOLEAN t1h(leftv res, leftv args) 4170 3626 { 4171 3627 leftv h=args; … … 4179 3635 } 4180 3636 4181 4182 BOOLEAN idsr(leftv res, leftv args) 3637 static BOOLEAN idsr(leftv res, leftv args) 4183 3638 { 4184 3639 leftv h=args; … … 4202 3657 } 4203 3658 4204 intvec *dmat(poly a, poly b)3659 static intvec *dmat(poly a, poly b) 4205 3660 { 4206 3661 intvec *m; … … 4220 3675 } 4221 3676 4222 4223 4224 BOOLEAN gd(leftv res, leftv args) 3677 static BOOLEAN gd(leftv res, leftv args) 4225 3678 { 4226 3679 leftv h=args; … … 4239 3692 } 4240 3693 4241 4242 4243 BOOLEAN comedg(leftv res, leftv args) 3694 static BOOLEAN comedg(leftv res, leftv args) 4244 3695 { 4245 3696 leftv h=args; … … 4258 3709 } 4259 3710 4260 4261 4262 4263 BOOLEAN fb(leftv res, leftv args) 3711 static BOOLEAN fb(leftv res, leftv args) 4264 3712 { 4265 3713 leftv h=args; … … 4273 3721 } 4274 3722 4275 4276 BOOLEAN pa(leftv res, leftv args) 3723 static BOOLEAN pa(leftv res, leftv args) 4277 3724 { 4278 3725 leftv h=args; … … 4286 3733 } 4287 3734 4288 4289 4290 BOOLEAN makeSimplex(leftv res, leftv args) 3735 static BOOLEAN makeSimplex(leftv res, leftv args) 4291 3736 { 4292 3737 leftv h=args; … … 4300 3745 } 4301 3746 4302 4303 BOOLEAN pb(leftv res, leftv args) 3747 static BOOLEAN pb(leftv res, leftv args) 4304 3748 { 4305 3749 leftv h=args; … … 4318 3762 } 4319 3763 4320 4321 4322 BOOLEAN fa(leftv res, leftv args) 3764 static BOOLEAN fa(leftv res, leftv args) 4323 3765 { 4324 3766 leftv h=args; … … 4342 3784 } 4343 3785 4344 4345 BOOLEAN fgp(leftv res, leftv args) 3786 static BOOLEAN fgp(leftv res, leftv args) 4346 3787 { 4347 3788 leftv h=args; … … 4365 3806 } 4366 3807 4367 4368 BOOLEAN fgpl(leftv res, leftv args) 3808 static BOOLEAN fgpl(leftv res, leftv args) 4369 3809 { 4370 3810 leftv h=args; … … 4393 3833 } 4394 3834 4395 4396 4397 BOOLEAN genstt(leftv res, leftv args) 3835 static BOOLEAN genstt(leftv res, leftv args) 4398 3836 { 4399 3837 leftv h=args; … … 4417 3855 } 4418 3856 4419 4420 BOOLEAN sgp(leftv res, leftv args) 3857 static BOOLEAN sgp(leftv res, leftv args) 4421 3858 { 4422 3859 leftv h=args; … … 4440 3877 } 4441 3878 4442 4443 BOOLEAN sgpl(leftv res, leftv args) 3879 static BOOLEAN sgpl(leftv res, leftv args) 4444 3880 { 4445 3881 leftv h=args; … … 4463 3899 } 4464 3900 4465 4466 BOOLEAN Links(leftv res, leftv args) 3901 static BOOLEAN Links(leftv res, leftv args) 4467 3902 { 4468 3903 leftv h=args; … … 4482 3917 } 4483 3918 4484 BOOLEAN isSim(leftv res, leftv args)3919 static BOOLEAN isSim(leftv res, leftv args) 4485 3920 { 4486 3921 leftv h=args; … … 4493 3928 return false; 4494 3929 } 4495 4496 3930 4497 3931 BOOLEAN nfaces1(leftv res, leftv args) … … 4517 3951 } 4518 3952 4519 4520 BOOLEAN nfaces2(leftv res, leftv args) 3953 static BOOLEAN nfaces2(leftv res, leftv args) 4521 3954 { 4522 3955 leftv h=args; … … 4545 3978 } 4546 3979 4547 4548 BOOLEAN nfaces3(leftv res, leftv args) 3980 static BOOLEAN nfaces3(leftv res, leftv args) 4549 3981 { 4550 3982 leftv h=args; … … 4578 4010 } 4579 4011 4580 4581 4582 4583 4584 BOOLEAN eqsolve1(leftv res, leftv args) 4012 static BOOLEAN eqsolve1(leftv res, leftv args) 4585 4013 { 4586 4014 leftv h=args;int i; … … 4623 4051 } 4624 4052 4625 4626 BOOLEAN tsets(leftv res, leftv args) 4053 static BOOLEAN tsets(leftv res, leftv args) 4627 4054 { 4628 4055 leftv h=args; … … 4636 4063 } 4637 4064 4638 4639 4640 4641 4642 BOOLEAN Valency(leftv res, leftv args) 4065 static BOOLEAN Valency(leftv res, leftv args) 4643 4066 { 4644 4067 leftv h=args; … … 4657 4080 } 4658 4081 4659 4660 4661 4662 BOOLEAN nabvl(leftv res, leftv args) 4082 static BOOLEAN nabvl(leftv res, leftv args) 4663 4083 { 4664 4084 leftv h=args; … … 4684 4104 } 4685 4105 4686 4687 4688 BOOLEAN tnabvl(leftv res, leftv args) 4106 static BOOLEAN tnabvl(leftv res, leftv args) 4689 4107 { 4690 4108 leftv h=args; … … 4718 4136 } 4719 4137 4720 4721 BOOLEAN vsIntersec(leftv res, leftv args) 4138 static BOOLEAN vsIntersec(leftv res, leftv args) 4722 4139 { 4723 4140 leftv h=args; … … 4737 4154 } 4738 4155 4739 4740 BOOLEAN mabvl(leftv res, leftv args) 4156 static BOOLEAN mabvl(leftv res, leftv args) 4741 4157 { 4742 4158 leftv h=args; … … 4760 4176 } 4761 4177 4762 4763 4764 BOOLEAN nabtvl(leftv res, leftv args) 4178 static BOOLEAN nabtvl(leftv res, leftv args) 4765 4179 { 4766 4180 leftv h=args; … … 4796 4210 } 4797 4211 4798 4799 BOOLEAN linkn(leftv res, leftv args) 4212 static BOOLEAN linkn(leftv res, leftv args) 4800 4213 { 4801 4214 leftv h=args; … … 4829 4242 } 4830 4243 4831 4832 4833 BOOLEAN existsub(leftv res, leftv args) 4244 static BOOLEAN existsub(leftv res, leftv args) 4834 4245 { 4835 4246 leftv h=args; … … 4848 4259 } 4849 4260 4850 4851 BOOLEAN pConstant(leftv res, leftv args) 4261 static BOOLEAN pConstant(leftv res, leftv args) 4852 4262 { 4853 4263 leftv h=args; … … 4866 4276 } 4867 4277 4868 BOOLEAN pChange(leftv res, leftv args)4278 static BOOLEAN pChange(leftv res, leftv args) 4869 4279 { 4870 4280 leftv h=args; … … 4878 4288 } 4879 4289 4880 4881 4882 BOOLEAN p_New(leftv res, leftv args) 4290 static BOOLEAN p_New(leftv res, leftv args) 4883 4291 { 4884 4292 leftv h=args; … … 4897 4305 } 4898 4306 4899 4900 4901 4902 BOOLEAN support(leftv res, leftv args) 4307 static BOOLEAN support(leftv res, leftv args) 4903 4308 { 4904 4309 leftv h=args; … … 4912 4317 } 4913 4318 4914 4915 4916 4917 4918 4919 BOOLEAN bprime(leftv res, leftv args) 4319 static BOOLEAN bprime(leftv res, leftv args) 4920 4320 { 4921 4321 leftv h=args; … … 4929 4329 } 4930 4330 4931 4932 4933 BOOLEAN psMinusp(leftv res, leftv args) 4331 static BOOLEAN psMinusp(leftv res, leftv args) 4934 4332 { 4935 4333 leftv h=args; … … 4948 4346 } 4949 4347 4950 4951 4952 BOOLEAN stellarremain(leftv res, leftv args) 4348 static BOOLEAN stellarremain(leftv res, leftv args) 4953 4349 { 4954 4350 leftv h=args; … … 4970 4366 } 4971 4367 4972 4973 BOOLEAN cNew(leftv res, leftv args) 4368 static BOOLEAN cNew(leftv res, leftv args) 4974 4369 { 4975 4370 leftv h=args; … … 4988 4383 } 4989 4384 4990 4991 4992 4993 BOOLEAN stars(leftv res, leftv args) 4385 static BOOLEAN stars(leftv res, leftv args) 4994 4386 { 4995 4387 leftv h=args; … … 5008 4400 } 5009 4401 5010 5011 5012 5013 BOOLEAN stellarsubdivision(leftv res, leftv args) 4402 static BOOLEAN stellarsubdivision(leftv res, leftv args) 5014 4403 { 5015 4404 leftv h=args; … … 5028 4417 } 5029 4418 5030 5031 5032 BOOLEAN idModulo(leftv res, leftv args) 4419 static BOOLEAN idModulo(leftv res, leftv args) 5033 4420 { 5034 4421 leftv h=args; … … 5047 4434 } 5048 4435 5049 5050 BOOLEAN idminus(leftv res, leftv args) 4436 static BOOLEAN idminus(leftv res, leftv args) 5051 4437 { 5052 4438 leftv h=args; … … 5065 4451 } 5066 4452 5067 5068 5069 BOOLEAN isoNumber(leftv res, leftv args) 4453 static BOOLEAN isoNumber(leftv res, leftv args) 5070 4454 { 5071 4455 leftv h=args; … … 5094 4478 } 5095 4479 5096 5097 5098 BOOLEAN ifIsomorphism(leftv res, leftv args) 4480 static BOOLEAN ifIsomorphism(leftv res, leftv args) 5099 4481 { 5100 4482 leftv h=args; … … 5133 4515 } 5134 4516 5135 5136 BOOLEAN newDegree(leftv res, leftv args) 4517 static BOOLEAN newDegree(leftv res, leftv args) 5137 4518 { 5138 4519 leftv h=args; … … 5151 4532 } 5152 4533 5153 5154 5155 BOOLEAN nonf2f(leftv res, leftv args) 4534 static BOOLEAN nonf2f(leftv res, leftv args) 5156 4535 { 5157 4536 leftv h=args; … … 5165 4544 } 5166 4545 5167 5168 5169 BOOLEAN dimsim(leftv res, leftv args) 4546 static BOOLEAN dimsim(leftv res, leftv args) 5170 4547 { 5171 4548 leftv h=args; … … 5179 4556 } 5180 4557 5181 5182 5183 BOOLEAN numdim(leftv res, leftv args) 4558 static BOOLEAN numdim(leftv res, leftv args) 5184 4559 { 5185 4560 leftv h=args; … … 5200 4575 /**************************************interface T2****************************************/ 5201 4576 5202 5203 5204 void firstorderdef_setup(SModulFunctions* p) 4577 static void firstorderdef_setup(SModulFunctions* p) 5205 4578 { 5206 4579 p>iiAddCproc("","mg",FALSE,idsr); … … 5253 4626 p>iiAddCproc("","idminus",FALSE,idminus); 5254 4627 p>iiAddCproc("","time1",FALSE,t1h); 5255 5256 } 5257 5258 4628 } 5259 4629 5260 4630 extern "C" int SI_MOD_INIT(cohomo)(SModulFunctions* p) … … 5265 4635 #endif 5266 4636 #endif 5267 5268 
Singular/dyn_modules/cohomo/cohomo.h
r07fefd r82410d 11 11 #include "libpolys/misc/intvec.h" 12 12 13 14 void gradedpiece1(ideal h,poly a,poly b);15 void gradedpiece2(ideal h,poly a,poly b);16 intvec *gradedpiece1n(ideal h,poly a,poly b);17 //void gradedpiece2n(ideal h,poly a,poly b);18 void Tlink(ideal h,poly a,poly b,int n);19 void T1(ideal h);20 void T2(ideal h);21 //void Gpt2(ideal h,poly a,poly b);22 //intvec *T1mat(int a,int b);23 ideal idsrRing(ideal h);24 BOOLEAN idsr(leftv res, leftv args);25 BOOLEAN gd(leftv res, leftv args);26 27 //void firstorderdef_setup(SModulFunctions* p);28 13 #endif
Note: See TracChangeset
for help on using the changeset viewer.