Changeset 82410d in git


Ignore:
Timestamp:
Nov 29, 2022, 2:46:42 PM (2 months ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
f4e6d43624519771601ddc522f21526d0bd1d7a5
Parents:
07fefd7e1818a24a256b720bb0c7021058b855b9
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2022-11-29 14:46:42+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2022-11-29 14:48:29+01:00
Message:
simplify: static for cohomo
Location:
Singular/dyn_modules/cohomo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/cohomo/cohomo.cc

    r07fefd r82410d  
    4747/***************************print(only for debugging)***********************************************/
    4848//print vector of integers.
    49 void listprint(std::vector<int> vec)
     49static void listprint(std::vector<int> vec)
    5050{
    5151  unsigned i;
     
    6363
    6464//print vector of vectors of integers.
    65 void listsprint(std::vector<std::vector<int> > posMat)
     65static void listsprint(std::vector<std::vector<int> > posMat)
    6666{
    6767  unsigned i;
     
    8282
    8383//print ideal.
    84 void id_print(ideal h)
     84static void id_print(ideal h)
    8585{
    8686  int i;
     
    9595//only for T^2,
    9696//print vector of polynomials.
    97 void lpprint( std::vector<poly> pv)
     97static void lpprint( std::vector<poly> pv)
    9898{
    9999  for(unsigned i=0;i<pv.size();i++)
     
    109109}
    110110
    111 
    112 
    113111//print vector of vectors of polynomials.
    114 void lpsprint(std::vector<std::vector<poly> > pvs)
     112static void lpsprint(std::vector<std::vector<poly> > pvs)
    115113{
    116114  for(unsigned i=0;i<pvs.size();i++)
     
    128126}
    129127
    130 
    131 
    132 
    133 
    134 
    135 
    136 
    137 
    138 
    139128/*************operations for vectors (regard vectors as sets)*********/
    140129
    141130//returns true if integer n is in vector vec,
    142131//otherwise, returns false
    143 bool IsinL(int a, std::vector<int> vec)
     132static bool IsinL(int a, std::vector<int> vec)
    144133{
    145134  unsigned i;
     
    154143}
    155144
    156 
    157 
    158 
    159 
    160145//returns intersection of vectors p and q,
    161146//returns empty if they are disjoint
    162 std::vector<int> vecIntersection(std::vector<int> p, std::vector<int> q)
     147static std::vector<int> vecIntersection(std::vector<int> p, std::vector<int> q)
    163148{
    164149  unsigned i;
     
    172157}
    173158
    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 used
    184 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   else
    192   {
    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 
    205159//returns true if vec1 is contained in vec2
    206 bool vsubset(std::vector<int> vec1, std::vector<int> vec2)
     160static bool vsubset(std::vector<int> vec1, std::vector<int> vec2)
    207161{
    208162  int i;
     
    218172
    219173//not strictly equal(order doesn't matter)
    220 bool vEvl(std::vector<int> vec1, std::vector<int> vec2)
     174static bool vEvl(std::vector<int> vec1, std::vector<int> vec2)
    221175{
    222176  if(vec1.size()==0 && vec2.size()==0)
     
    227181}
    228182
    229 
    230183//the length of vec must be same to it of the elements of vecs
    231184//returns true if vec is as same as some element of vecs ((not strictly same))
    232185//returns false if vec is not in vecs
    233 bool vInvsl(std::vector<int> vec, std::vector<std::vector<int> > vecs)
     186static bool vInvsl(std::vector<int> vec, std::vector<std::vector<int> > vecs)
    234187{
    235188  int i;
     
    244197}
    245198
    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 vecs
    250 //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 
    264199//returns the union of two vectors(as the union of sets)
    265 std::vector<int> vecUnion(std::vector<int> vec1, std::vector<int> vec2)
     200static std::vector<int> vecUnion(std::vector<int> vec1, std::vector<int> vec2)
    266201{
    267202  std::vector<int> vec=vec1;
     
    275210}
    276211
    277 std::vector<int> vecMinus(std::vector<int> vec1,std::vector<int> vec2)
     212static std::vector<int> vecMinus(std::vector<int> vec1,std::vector<int> vec2)
    278213{
    279214  std::vector<int> vec;
     
    288223}
    289224
    290 std::vector<std::vector<int> > vsMinusv(std::vector<std::vector<int> > vecs, std::vector<int> vec)
     225static std::vector<std::vector<int> > vsMinusv(std::vector<std::vector<int> > vecs, std::vector<int> vec)
    291226{
    292227  int i;
     
    302237}
    303238
    304 
    305 std::vector<std::vector<int> > vsUnion(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)
     239static std::vector<std::vector<int> > vsUnion(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)
    306240{
    307241  int i;
     
    317251}
    318252
    319 
    320 
    321 
    322 
    323 
    324 std::vector<std::vector<int> > vsIntersection(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)
     253static std::vector<std::vector<int> > vsIntersection(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)
    325254{
    326255  int i;
     
    336265}
    337266
    338 
    339 
    340 
    341 
    342267/*************************************for transition between ideal and vectors******************************************/
    343268
    344269//P should be monomial,
    345270// vector version of poly support(poly p)
    346 std::vector<int> support1(poly p)
     271static std::vector<int> support1(poly p)
    347272{
    348273  int j;
     
    359284}
    360285
    361 
    362 
    363 
    364 
    365 
    366286//simplicial complex(the faces set is ideal h)
    367 std::vector<std::vector<int> >  supports(ideal h)
     287static std::vector<std::vector<int> >  supports(ideal h)
    368288{
    369289  std::vector<std::vector<int> > vecs;
     
    380300}
    381301
    382 
    383 
    384 
    385302// only for eqsolve1
    386303// p could be any polynomial
    387 std::vector<int> support2(poly p)
     304static std::vector<int> support2(poly p)
    388305{
    389306  int j;
     
    406323}
    407324
    408 
    409 
    410325//the supports of ideal
    411 std::vector<std::vector<int> >  supports2(ideal h)
     326static std::vector<std::vector<int> >  supports2(ideal h)
    412327{
    413328  std::vector<std::vector<int> > vecs;
     
    423338  return vecs;
    424339}
     340
    425341//convert the vector(vbase[i] are the coefficients of x_{i+1}) to a polynomial w.r.t. current ring
    426342//vector vbase has length of currRing->N.
    427 poly pMake(std::vector<int> vbase)
     343static poly pMake(std::vector<int> vbase)
    428344{
    429345  int n=vbase.size(); poly p,q=0;
     
    435351      q = pAdd(q, p);
    436352    }
    437 
    438353  }
    439354  return q;
    440355}
    441356
    442 
    443 
    444 
    445357//convert the vectors to a ideal(for T^1)
    446 ideal idMake(std::vector<std::vector<int> > vecs)
     358static ideal idMake(std::vector<std::vector<int> > vecs)
    447359{
    448360  int lv=vecs.size(), i;
     
    458370}
    459371
    460 
    461 
    462372/*****************************quotient ring of two ideals*********************/
    463373
    464374//the quotient ring of h1 respect to h2
    465 ideal idmodulo(ideal h1,ideal h2)
     375static ideal idmodulo(ideal h1,ideal h2)
    466376{
    467377  ideal gb=kStd(h2,NULL,testHomog,NULL,NULL,0,0,NULL);
     
    474384//returns the coeff of the monomial of polynomial p which involves the mth varialbe
    475385//assume the polynomial p has form of y1+y2+...
    476 int pcoef(poly p, int m)
     386static int pcoef(poly p, int m)
    477387{
    478388  int i,co; poly q=pCopy(p);
     
    493403
    494404//returns true if p involves the mth variable of the current ring
    495 bool vInp(int m,poly p)
     405static bool vInp(int m,poly p)
    496406{
    497407  poly q=pCopy(p);
     
    507417}
    508418
    509 
    510 
    511419//returns the vector w.r.t. polynomial p
    512 std::vector<int> vMake(poly p)
     420static std::vector<int> vMake(poly p)
    513421{
    514422  int i;
     
    528436}
    529437
    530 
    531438//returns the vectors w.r.t. ideal h
    532 std::vector<std::vector<int> > vsMake(ideal h)
     439static std::vector<std::vector<int> > vsMake(ideal h)
    533440{
    534441  std::vector<int> vec;
     
    543450}
    544451
    545 
    546452//the quotient ring of two ideals which are represented by vectors,
    547453//the result is also represented by vector.
    548 std::vector<std::vector<int> > vecqring(std::vector<std::vector<int> > vec1, std::vector<std::vector<int> > vec2)
     454static std::vector<std::vector<int> > vecqring(std::vector<std::vector<int> > vec1, std::vector<std::vector<int> > vec2)
    549455{
    550456  ideal h1=idMake(vec1), h2=idMake(vec2);
     
    554460}
    555461
    556 
    557 
    558462/****************************************************************/
    559463//construct a monomial based on the support of it
    560464//returns a squarefree monomial
    561 poly pMaken(std::vector<int> vbase)
     465static poly pMaken(std::vector<int> vbase)
    562466{
    563467  int n=vbase.size();
     
    573477
    574478// returns a ideal according to a set of supports
    575 ideal idMaken(std::vector<std::vector<int> > vecs)
     479static ideal idMaken(std::vector<std::vector<int> > vecs)
    576480{
    577481  ideal id_re=idInit(1,1);
     
    588492}
    589493
    590 
    591 
    592494/********************************new version for stanley reisner ideal ***********************************************/
    593495
    594 
    595 std::vector<std::vector<int> > b_subsets(std::vector<int> vec)
     496static std::vector<std::vector<int> > b_subsets(std::vector<int> vec)
    596497{
    597498  int i,j;
     
    618519}
    619520
    620 
    621521//the number of the variables
    622 int idvert(ideal h)
     522static int idvert(ideal h)
    623523{
    624524  int i, j, vert=0;
     
    639539}
    640540
    641 
    642 
    643 
    644 int pvert(poly p)
     541static int pvert(poly p)
    645542{
    646543  int i, vert=0;
     
    656553}
    657554
    658 
    659555/*
    660556//full complex
    661 std::vector<std::vector<int> > fullcomplex(ideal h)
     557static std::vector<std::vector<int> > fullcomplex(ideal h)
    662558{
    663559  int vert=vertnum(h), i, j;
     
    671567  fmons=b_subsets(pre);
    672568  return fmons;
    673 
    674569}*/
    675 
    676570
    677571/*
    678572//all the squarefree monomials whose degree is less or equal to n
    679 std::vector<std::vector<int> > sfrmons(ideal h, int n)
     573static std::vector<std::vector<int> > sfrmons(ideal h, int n)
    680574{
    681575  int vert=vertnum(h), i, j, time=0;
     
    699593  }
    700594  return fmons;
    701 
    702595}
    703596*/
    704597
    705598/*
    706 ideal id_complement(ideal h)
     599static ideal id_complement(ideal h)
    707600{
    708601  int i,j;
     
    722615
    723616//h1 minus h2
    724 ideal idMinus(ideal h1,ideal h2)
     617static ideal idMinus(ideal h1,ideal h2)
    725618{
    726619  ideal h=idInit(1,1);
     
    746639}
    747640
    748 
    749 
    750641//If poly P is squarefree, returns 1
    751642//returns 0 otherwise,
    752 bool p_Ifsfree(poly P)
     643static bool p_Ifsfree(poly P)
    753644{
    754645  int i,sf=1;
     
    764655}
    765656
    766 
    767 
    768657//returns the set of all squarefree monomials of degree deg in ideal h
    769 ideal sfreemon(ideal h,int deg)
     658static ideal sfreemon(ideal h,int deg)
    770659{
    771660  int j;
     
    786675}
    787676
    788 
    789 
    790 
    791 
    792 
    793 
    794677//full simplex represented by ideal.
    795678//(all the squarefree monomials over the polynomial ring)
    796 ideal id_sfmon(ideal h)
     679static ideal id_sfmon(ideal h)
    797680{
    798681  ideal asfmons,sfmons,mons;
     
    809692}
    810693
    811 
    812 
    813 
    814 
    815 
    816694//if the input ideal is simplicial complex, returns the stanley-reisner ideal,
    817695//if the input ideal is stanley-reisner ideal, returns the monomial ideal according to simplicial complex.
    818696//(nonfaces and faces).
    819697//returns the complement of the ideal h (consisting of only squarefree polynomials)
    820 ideal id_complement(ideal h)
     698static ideal id_complement(ideal h)
    821699{
    822700  int j, vert=idvert(h);
     
    837715}
    838716
    839 
    840 
    841 
    842717//Returns true if p is one of the generators of ideal X
    843718//returns false otherwise
    844 bool IsInX(poly p,ideal X)
     719static bool IsInX(poly p,ideal X)
    845720{
    846721  int i;
     
    857732}
    858733
    859 
    860 
    861 
    862 
    863 
    864734//returns the monomials in the quotient ring R/(h1+h2) which have degree deg.
    865 ideal qringadd(ideal h1, ideal h2, int deg)
     735static ideal qringadd(ideal h1, ideal h2, int deg)
    866736{
    867737  ideal h,qrh;
     
    871741}
    872742
    873 
    874 
    875 
    876743//returns the maximal degree of the monomials in ideal h
    877 int id_maxdeg(ideal h)
     744static int id_maxdeg(ideal h)
    878745{
    879746  int i,max;
     
    887754}
    888755
    889 
    890 
    891 
    892 
    893 
    894 
    895756//input ideal h (a squarefree monomial ideal) is the ideal associated to simplicial complex,
    896757//and returns the Stanley-Reisner ideal(minimal generators)
    897 ideal idsrRing(ideal h)
     758static ideal idsrRing(ideal h)
    898759{
    899760  int i,n;
     
    923784}
    924785
    925 
    926 
    927786//returns the set of all the polynomials could divide p
    928 ideal SimFacset(poly p)
     787static ideal SimFacset(poly p)
    929788{
    930789  int i,j,max=pTotaldegree(p);
     
    942801      }
    943802    }
    944 
    945803  }
    946804  idSkipZeroes(id_re);
     
    948806}
    949807
    950 
    951 
    952 ideal idadda(ideal h1, ideal h2)
     808static ideal idadda(ideal h1, ideal h2)
    953809{
    954810  ideal h=idInit(1,1);
     
    970826  return h;
    971827}
    972 
    973828
    974829//complicated version
    975830//(returns false if it is not a simplicial complex and print the simplex)
    976831//input h is need to be at least part of faces
    977 ideal IsSimplex(ideal h)
     832static ideal IsSimplex(ideal h)
    978833{
    979834  int i,max=id_maxdeg(h);
     
    993848}
    994849
    995 
    996850//input is the subset of the Stainley-Reisner ideal
    997851//returns the faces
    998852//is not used
    999 ideal complementsimplex(ideal h)
     853static ideal complementsimplex(ideal h)
    1000854{
    1001855  int i,j;poly p,e=pOne();
     
    1020874}
    1021875
    1022 
    1023 
    1024 int dim_sim(ideal h)
     876static int dim_sim(ideal h)
    1025877{
    1026878  int dim=pTotaldegree(h->m[0]), i;
     
    1035887}
    1036888
    1037 
    1038 int num4dim(ideal h, int n)
     889static int num4dim(ideal h, int n)
    1039890{
    1040891  int num=0;
     
    1049900}
    1050901
    1051 
    1052 
    1053902/********************Procedures for T1(M method and N method) ***********/
    1054 
    1055 
    1056 
    1057 
    1058903
    1059904//h is ideal( monomial ideal) associated to simplicial complex
     
    1061906//at least one monomial in Stanley-Reisner ring)
    1062907//not so efficient
    1063 ideal findb(ideal h)
     908static ideal findb(ideal h)
    1064909{
    1065910  ideal ib=id_sfmon(h), nonf=id_complement(h), bset=idInit(1,1);
     
    1081926  return bset;
    1082927}
    1083 
    1084 
    1085 
    1086928
    1087929//h is ideal(monomial ideal associated to simplicial complex
     
    1090932//3.x^a and x^a have disjoint supports
    1091933//returns all the possible x^a according conditions 1. 2. 3.
    1092 ideal finda(ideal h,poly S,int ddeg)
     934static ideal finda(ideal h,poly S,int ddeg)
    1093935{
    1094936  poly e=pOne();
     
    1116958}
    1117959
    1118 
    1119 
    1120 
    1121 
    1122 
    1123 
    1124 
    1125960//returns true if support(p) union support(a) minus support(b) is face,
    1126961//otherwise returns false
    1127962//(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)
     963static bool mabconditionv(std::vector<std::vector<int> > hvs,std::vector<int> pv,std::vector<int> av,std::vector<int> bv)
    1129964{
    1130965  std::vector<int> uv=vecUnion(pv,av);
     
    1137972}
    1138973
    1139 
    1140974// returns the set of nonfaces p where mabconditionv(h, p, a, b) is true
    1141 std::vector<std::vector<int> > Mabv(ideal h,poly a,poly b)
     975static std::vector<std::vector<int> > Mabv(ideal h,poly a,poly b)
    1142976{
    1143977  std::vector<int> av=support1(a), bv=support1(b), pv, vec;
     
    1160994
    1161995//subroutine for soleli1
    1162 std::vector<int> eli1(std::vector<int> eq1,std::vector<int> eq2)
     996static std::vector<int> eli1(std::vector<int> eq1,std::vector<int> eq2)
    1163997{
    1164998  int i,j;
     
    11791013/*
    11801014//get triangular form(eqs.size()>0)
    1181 std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs)
     1015static std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs)
    11821016{
    11831017  int i,j;
     
    12031037}*/
    12041038//make sure the first element is smaller that the second one
    1205 std::vector<int> keeporder(  std::vector<int> vec)
     1039static std::vector<int> keeporder(  std::vector<int> vec)
    12061040{
    12071041  std::vector<int> yaya;
     
    12161050}
    12171051
    1218 
    1219 std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs)
     1052static std::vector<std::vector<int> > soleli1( std::vector<std::vector<int> > eqs)
    12201053{
    12211054  int i;
     
    12471080}
    12481081
    1249 
    1250 
    12511082// input is a set of equations who is of triangular form(every equations has a form of x_i-x_j)
    12521083// n is the number of variables
    12531084//get the free variables and the dimension
    1254 std::vector<int> freevars(int n,  std::vector<int> bset, std::vector<std::vector<int> > gset)
     1085static std::vector<int> freevars(int n,  std::vector<int> bset, std::vector<std::vector<int> > gset)
    12551086{
    12561087  int ql=gset.size(), bl=bset.size(), i;
     
    12711102    }
    12721103  }
    1273     return fvar;
    1274 }
    1275 
     1104  return fvar;
     1105}
    12761106
    12771107//return the set of free variables except the vnum one
    1278 std::vector<int> fvarsvalue(int vnum, std::vector<int> fvars)
     1108static std::vector<int> fvarsvalue(int vnum, std::vector<int> fvars)
    12791109{
    12801110  int i;
     
    12911121}
    12921122
    1293 
    1294 
    1295 
    12961123//returns the simplified bset and gset
    12971124//enlarge bset, simplify gset
    1298 std::vector<std::vector<int> > vAbsorb( std::vector<int> bset,std::vector<std::vector<int> > gset)
     1125static std::vector<std::vector<int> > vAbsorb( std::vector<int> bset,std::vector<std::vector<int> > gset)
    12991126{
    13001127  std::vector<int> badset=bset;
     
    13381165}
    13391166
    1340 
    1341 
    1342 
    1343 
    1344 
    13451167//the labels of new variables are started with 1
    13461168//returns a vector of solution space according to index
    1347 std::vector<int> vecbase1(int num, std::vector<int> oset)
     1169static std::vector<int> vecbase1(int num, std::vector<int> oset)
    13481170{
    13491171  int i;
     
    13591181}
    13601182
    1361 
    1362 
    13631183//returns a vector which has length of n,
    13641184//and all the entries are 0.
    1365 std::vector<int> make0(int n)
     1185static std::vector<int> make0(int n)
    13661186{
    13671187  int i;
     
    13741194}
    13751195
    1376 
    13771196//returns a vector which has length of n,
    13781197//and all the entries are 1.
    1379 std::vector<int> make1(int n)
     1198static std::vector<int> make1(int n)
    13801199{
    13811200  int i;
     
    13881207}
    13891208
    1390 
    1391 
    1392 
    13931209//input gset must be the triangular form after zero absorbing according to the badset,
    13941210//bset must be the zero set after absorbing.
    1395 std::vector<int> ofindbases1(int num, int vnum, std::vector<int> bset,std::vector<std::vector<int> > gset)
     1211static std::vector<int> ofindbases1(int num, int vnum, std::vector<int> bset,std::vector<std::vector<int> > gset)
    13961212{
    13971213  std::vector<std::vector<int> > goodset;
     
    14071223}
    14081224
    1409 
    1410 
    1411 
    1412 
    1413 
    1414 
    1415 
    14161225//input gset must be the triangular form after zero absorbing according to the badset
    14171226//bset must be the zero set after absorbing
    1418 std::vector<std::vector<int> > ofindbases(int num,  std::vector<int> bset,std::vector<std::vector<int> > gset)
     1227static std::vector<std::vector<int> > ofindbases(int num,  std::vector<int> bset,std::vector<std::vector<int> > gset)
    14191228{
    14201229  int i,m;
     
    14401249}
    14411250
    1442 
    1443 
    1444 
    1445 
    1446 
    1447 
    1448 
    14491251//gset is a set of equations which have forms of x_i-x_j
    14501252//num is the number of varialbes also the length of the set which we need to consider
    14511253//output is trigular form of gset and badset where x_i=0
    1452 std::vector<std::vector<int> > eli2(int num, std::vector<int> bset,std::vector<std::vector<int> > gset)
     1254static std::vector<std::vector<int> > eli2(int num, std::vector<int> bset,std::vector<std::vector<int> > gset)
    14531255{
    14541256  std::vector<int> badset;
     
    14851287}
    14861288
    1487 
    14881289/********************************************************************/
    1489 
    1490 
    1491 
    1492 
    1493 
    1494 
    1495 
    14961290/************************links***********************************/
    14971291
    1498 
    14991292//returns the links of face a in simplicial complex X
    1500 std::vector<std::vector<int> > links(poly a, ideal h)
     1293static std::vector<std::vector<int> > links(poly a, ideal h)
    15011294{
    15021295  int i;
     
    15201313}
    15211314
    1522 
    1523 
    1524 int redefinedeg(poly p, int  num)
     1315static int redefinedeg(poly p, int  num)
    15251316{
    15261317  int deg=0, deg0;
     
    15411332}
    15421333
    1543 
    15441334// the degree of variables should be same
    1545 ideal p_a(ideal h)
     1335static ideal p_a(ideal h)
    15461336{
    15471337  poly p;
     
    15771367}
    15781368
    1579 
    15801369/*only for the exampels whose variables has degree more than 1*/
    15811370/*ideal p_a(ideal h)
     
    16131402}*/
    16141403
    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)
     1404static std::vector<int> vertset(std::vector<std::vector<int> > vecs)
    16401405{
    16411406  int i,j;
     
    16601425
    16611426//smarter way
    1662 ideal p_b(ideal h, poly a)
     1427static ideal p_b(ideal h, poly a)
    16631428{
    16641429  std::vector<std::vector<int> > pbv,lk=links(a,h), res;
     
    16851450/*//dump way to get pb
    16861451// the degree of variables should be same
    1687 ideal p_b(ideal h, poly a)
     1452static ideal p_b(ideal h, poly a)
    16881453{
    16891454  std::vector<std::vector<int> > pbv,lk=links(a,h),res;
     
    17331498}
    17341499
    1735 ideal p_b(ideal h, poly a)
     1500static ideal p_b(ideal h, poly a)
    17361501{
    17371502  std::vector<std::vector<int> > pbv,lk=links(a,h),res;
     
    17701535}*/
    17711536
    1772 
    1773 
    1774 
    17751537//input is a squarefree monomial p
    17761538//output is all the squarefree monomials which could divid p(including p itself?)
    1777 ideal psubset(poly p)
     1539static ideal psubset(poly p)
    17781540{
    17791541  int i,j,max=pTotaldegree(p);
     
    17951557}
    17961558
    1797 
    1798 
    17991559//inserts a new vector which has two elements a and b into vector gset (which is a vector of vectors)
    18001560//(especially for gradedpiece1 and gradedpiece1n)
    1801 std::vector<std::vector<int> > listsinsertlist(std::vector<std::vector<int> > gset, int a, int b)
     1561static std::vector<std::vector<int> > listsinsertlist(std::vector<std::vector<int> > gset, int a, int b)
    18021562{
    18031563  std::vector<int> eq;
     
    18081568}
    18091569
    1810 
    1811 
    1812 
    1813 
    1814 std::vector<int> makeequation(int i,int j, int t)
     1570static std::vector<int> makeequation(int i,int j, int t)
    18151571{
    18161572  std::vector<int> equation;
     
    18221578}
    18231579
    1824 
    1825 
    1826 
    1827 
    18281580/****************************************************************/
    18291581//only for solving the equations obtained from T^2
    18301582//input should be a vector which has only 3 entries
    1831 poly pMake3(std::vector<int> vbase)
     1583static poly pMake3(std::vector<int> vbase)
    18321584{
    18331585  int co=1;
     
    18471599}
    18481600
    1849 
    1850 ideal idMake3(std::vector<std::vector<int> > vecs)
     1601static ideal idMake3(std::vector<std::vector<int> > vecs)
    18511602{
    18521603  ideal id_re=idInit(1,1);
     
    18651616
    18661617//change the current ring to a new ring which is in num new variables
    1867 void equmab(int num)
     1618static void equmab(int num)
    18681619{
    18691620  int i;
     
    18851636}
    18861637
    1887 
    18881638//returns the trivial case of T^1
    18891639//b must only contain one variable
    1890 std::vector<int> subspace1(std::vector<std::vector<int> > mv, std::vector<int> bv)
     1640static std::vector<int> subspace1(std::vector<std::vector<int> > mv, std::vector<int> bv)
    18911641{
    18921642  int i, num=mv.size();
     
    19021652}
    19031653
    1904 
    1905 
    1906 
    1907 
    1908 
    1909 
    1910 
    1911 
    19121654/***************************only for T^2*************************************/
    19131655//vbase only has two elements which records the position of the monomials in mv
    19141656
    1915 
    1916 std::vector<poly> pMakei(std::vector<std::vector<int> > mv,std::vector<int> vbase)
     1657static std::vector<poly> pMakei(std::vector<std::vector<int> > mv,std::vector<int> vbase)
    19171658{
    19181659  poly p;
     
    19271668}
    19281669
    1929 
    1930 
    19311670// 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)
     1671static std::vector<std::vector<poly> > idMakei(std::vector<std::vector<int> > mv,std::vector<std::vector<int> > vecs)
    19331672{
    19341673  int i,lv=vecs.size();
     
    19481687/****************************************************************/
    19491688
    1950 
    1951 
    1952 
    1953 
    1954 
    1955 
    1956 
    19571689//return the graded pieces of cohomology T^1 according to a,b
    19581690//original method (only for debugging)
    1959 void gradedpiece1(ideal h,poly a,poly b)
     1691static void gradedpiece1(ideal h,poly a,poly b)
    19601692{
    19611693  int i,j,m;
     
    20161748}
    20171749
    2018 
    2019 
    2020 
    2021 
    2022 
    2023 
    2024 
    2025 
    2026 
    2027 
    2028 
    2029 
    2030 
    2031 
    2032 
    2033 
    20341750//Returns true if b can divide p*q
    2035 bool condition1for2(std::vector<int > pv,std::vector<int > qv,std::vector<int > bv)
     1751static bool condition1for2(std::vector<int > pv,std::vector<int > qv,std::vector<int > bv)
    20361752{
    20371753  std::vector<int > vec=vecUnion(pv,qv);
     
    20451761}
    20461762
    2047 
    2048 
    20491763//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)
     1764static 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)
    20511765{
    20521766  std::vector<int> vec=vecUnion(pv,qv);
     
    20611775}
    20621776
    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)
     1777static bool condition3for2(std::vector<std::vector<int> > hvs, std::vector<int> pv,  std::vector<int> qv,  std::vector<int> av,  std::vector<int> bv)
    20691778{
    20701779  std::vector<int> v1,v2,v3;
     
    20831792}
    20841793
    2085 
    2086 
    2087 
    2088 
    2089 
    2090 
    2091 
    2092 
    20931794/****************solve the equations got from T^2*********************/
    20941795
    2095 ideal getpresolve(ideal h)
     1796static ideal getpresolve(ideal h)
    20961797{
    20971798  //ring r=currRing;
     
    21211822}
    21221823
    2123 
    2124 
    2125 std::vector<int> numfree(ideal h)
     1824static std::vector<int> numfree(ideal h)
    21261825{
    21271826  int i,j;
     
    21421841}
    21431842
    2144 
    2145 
    2146 
    2147 
    2148 std::vector<std::vector<int> > canonicalbase(int n)
     1843static std::vector<std::vector<int> > canonicalbase(int n)
    21491844{
    21501845  std::vector<std::vector<int> > vecs;
     
    21661861}
    21671862
    2168 
    2169 
    2170 
    2171 
    2172 std::vector<std::vector<int> > getvector(ideal h,int n)
     1863static std::vector<std::vector<int> > getvector(ideal h,int n)
    21731864{
    21741865  std::vector<int> vec;
     
    22341925
    22351926//subspace of T2(find all the possible values of alpha)
    2236 std::vector<int> findalpha(std::vector<std::vector<int> > mv, std::vector<int> bv)
     1927static std::vector<int> findalpha(std::vector<std::vector<int> > mv, std::vector<int> bv)
    22371928{
    22381929  std::vector<int> alset;
     
    22491940}
    22501941
    2251 std::vector<int> subspacet1(int num, std::vector<std::vector<int> > ntvs)
     1942static std::vector<int> subspacet1(int num, std::vector<std::vector<int> > ntvs)
    22521943{
    22531944  int i, j, t, n=ntvs.size();
     
    22751966}
    22761967
    2277 
    2278 
    2279 
    22801968//subspace for T^2(mab method)
    2281 std::vector<std::vector<int> > subspacet(std::vector<std::vector<int> > mv, std::vector<int> bv,std::vector<std::vector<int> > ntvs)
     1969static std::vector<std::vector<int> > subspacet(std::vector<std::vector<int> > mv, std::vector<int> bv,std::vector<std::vector<int> > ntvs)
    22821970{
    22831971  std::vector<int> alset=findalpha(mv,bv), subase;
     
    22931981}
    22941982
    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)
     1983static 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)
    23001984{
    23011985  std::vector<int> v1,var;
     
    23182002}
    23192003
    2320 
    2321 
    2322 
    23232004//fix the problem of the number of the new variables
    23242005//original method for T^2(only for debugging)
    2325 void gradedpiece2(ideal h,poly a,poly b)
     2006static void gradedpiece2(ideal h,poly a,poly b)
    23262007{
    23272008  int t0,t1,t2,i,j,t,m;
     
    24052086}
    24062087
    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 
    24322088/**********************************************************************/
    24332089//For the method of N_{a-b}
    24342090
    2435 
    2436 
    2437 
    24382091//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)
     2092static bool nabconditionv(std::vector<std::vector<int> > hvs, std::vector<int> pv,  std::vector<int> av,  std::vector<int> bv)
    24402093{
    24412094  std::vector<int> vec1=vecIntersection(pv,bv), vec2=vecUnion(pv,bv);
     
    24502103}
    24512104
    2452 
    2453 
    2454 
    2455 
    2456 
    24572105//returns N_{a-b}
    2458 std::vector<std::vector<int> > Nabv(std::vector<std::vector<int> > hvs,  std::vector<int> av,  std::vector<int> bv)
     2106static std::vector<std::vector<int> > Nabv(std::vector<std::vector<int> > hvs,  std::vector<int> av,  std::vector<int> bv)
    24592107{
    24602108  std::vector<std::vector<int> > vecs;
     
    24712119}
    24722120
    2473 
    2474 
    2475 
    2476 
    2477 
    24782121//returns true if pv union qv union av minus bv is in hvs
    24792122//hvs is simplicial complex
     
    24892132}
    24902133
    2491 
    24922134//returns N_{a-b}^(2)
    2493 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)
     2135static 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)
    24942136{
    24952137  std::vector<int> v1,var;
     
    25112153}
    25122154
    2513 
    2514 
    2515 
    2516 
    2517 
    2518 
    2519 
    2520 
    2521 
    25222155//p must be the monomial which is a face
    25232156//  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)
     2157static bool tNab(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<std::vector<int> > bvs)
    25252158{
    25262159  std::vector<int> sv;
     
    25372170}
    25382171
    2539 std::vector<int>  tnab(std::vector<std::vector<int> > hvs,std::vector<std::vector<int> > nvs,std::vector<std::vector<int> > bvs)
     2172static std::vector<int>  tnab(std::vector<std::vector<int> > hvs,std::vector<std::vector<int> > nvs,std::vector<std::vector<int> > bvs)
    25402173{
    25412174  std::vector<int> pv, vec;
     
    25512184}
    25522185
    2553 
    2554 
    2555 
    2556 
    2557 
    2558 
    2559 
    25602186//the image phi(pv)=pv union av minus bv
    2561 std::vector<int> phimage(std::vector<int> pv,  std::vector<int> av, std::vector<int> bv)
     2187static std::vector<int> phimage(std::vector<int> pv,  std::vector<int> av, std::vector<int> bv)
    25622188{
    25632189  std::vector<int> qv=vecUnion(pv,av);
     
    25662192}
    25672193
    2568 
    2569 
    25702194//mvs and nvs are the supports of ideal Mab and Nab
    25712195//vecs is the solution of nab
    2572 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)
     2196static 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)
    25732197{
    25742198  int j;
     
    26012225
    26022226    }
    2603 
    26042227    bases.push_back(base);
    26052228    base.clear();
     
    26082231}
    26092232
    2610 
    2611 
    2612 
    2613 
    2614 
    2615 
    2616 
    2617 
    2618 intvec *Tmat(std::vector<std::vector<int> > vecs)
     2233static intvec *Tmat(std::vector<std::vector<int> > vecs)
    26192234{
    26202235    //std::vector<std::vector<int> > solve=gradedpiece1n(h,a,b);
     
    26392254    }
    26402255  }
    2641 return (m);
    2642 }
    2643 
    2644 
    2645 
    2646 
    2647 
    2648 
    2649 
    2650 
     2256  return (m);
     2257}
    26512258
    26522259//returns the set of position number of minimal gens in M
    2653 std::vector<int> gensindex(ideal M, ideal ids)
     2260static std::vector<int> gensindex(ideal M, ideal ids)
    26542261{
    26552262  int i;
     
    26682275}
    26692276
    2670 
    2671 
    2672 ideal mingens(ideal h, poly a, poly b)
     2277static ideal mingens(ideal h, poly a, poly b)
    26732278{
    26742279  int i;
     
    26842289}
    26852290
    2686 
    2687 
    2688 std::vector<std::vector<int> >  minisolve(std::vector<std::vector<int> > solve,  std::vector<int> index)
     2291static std::vector<std::vector<int> >  minisolve(std::vector<std::vector<int> > solve,  std::vector<int> index)
    26892292{
    26902293  int i,j;
     
    27052308}
    27062309
    2707 
    27082310//T_1 graded piece(N method)
    27092311//frame of the most efficient version
    27102312//regardless of links
    2711 
    2712 intvec * gradedpiece1n(ideal h,poly a,poly b)
     2313static intvec * gradedpiece1n(ideal h,poly a,poly b)
    27132314{
    27142315  int i,j,co,n;
     
    27762377}
    27772378
    2778 
    2779 
    2780 
    2781 
    2782 
    27832379//for debugging
    2784 void T1(ideal h)
     2380static void T1(ideal h)
    27852381{
    27862382  ideal bi=findb(h),ai;
     
    27972393    if(!idIs0(ai))
    27982394    {
    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
     2410static bool condition2for2nv(std::vector<std::vector<int> > hvs, std::vector<int> pv, std::vector<int> qv,  std::vector<int> fv)
    28222411{
    28232412  std::vector<int> vec=vecUnion(pv,qv);
     
    28322421}
    28332422
    2834 
    2835 
    2836 
    2837 
    28382423//for subspace of T2(find all the possible values of alpha)
    2839 std::vector<int> findalphan(std::vector<std::vector<int> >  N, std::vector<int>  tN)
     2424static std::vector<int> findalphan(std::vector<std::vector<int> >  N, std::vector<int>  tN)
    28402425{
    28412426  int i;std::vector<int> alset,vec;
     
    28492434  }
    28502435  //listprint(alset);
    2851     return alset;
    2852 }
    2853 
    2854 
    2855 
     2436  return alset;
     2437}
    28562438
    28572439//subspace of T^2 (nab method)
    2858 std::vector<std::vector<int> > subspacetn(std::vector<std::vector<int> >  N, std::vector<int>   tN, std::vector<std::vector<int> > ntvs)
     2440static std::vector<std::vector<int> > subspacetn(std::vector<std::vector<int> >  N, std::vector<int>   tN, std::vector<std::vector<int> > ntvs)
    28592441{
    28602442  int i;
     
    28712453}
    28722454
    2873 
    2874 
    28752455//mts  Mabt
    28762456//nts  Nabt
    28772457//mvs Mab
    28782458//nvs Nab
    2879 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)
     2459static 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)
    28802460{
    28812461  int row,col,j;
     
    29292509}
    29302510
    2931 
    2932 
    2933 
    2934 ideal genst(ideal h, poly a, poly b)
     2511static ideal genst(ideal h, poly a, poly b)
    29352512{
    29362513  std::vector<std::vector<int> > hvs=supports(h),mv,mts;
     
    29492526}
    29502527
    2951 
    2952 
    2953 
    2954 
    2955 
    2956 
    2957 
    2958 intvec * gradedpiece2n(ideal h,poly a,poly b)
     2528static intvec * gradedpiece2n(ideal h,poly a,poly b)
    29592529{
    29602530  int i,j,t,n;
     
    30342604}
    30352605
    3036 
    3037 
    3038 
    3039 
    3040 
    30412606//for debugging
    3042 void T2(ideal h)
     2607static void T2(ideal h)
    30432608{
    30442609  ideal bi=findb(h),ai;
     
    30462611  poly a,b;
    30472612  int mm=0,gp=0;
    3048 std::vector<int> bv,av;
     2613  std::vector<int> bv,av;
    30492614  std::vector<std::vector<int> > solve;
    30502615  for(int i=0;i<IDELEMS(bi);i++)
     
    30802645}
    30812646
    3082 
    3083 
    3084 
    3085 
    30862647/*****************************for links*******************************************/
    30872648//the image phi(pv)=pv minus av minus bv
    3088 std::vector<int> phimagel(std::vector<int> fv,  std::vector<int> av, std::vector<int> bv)
     2649static std::vector<int> phimagel(std::vector<int> fv,  std::vector<int> av, std::vector<int> bv)
    30892650{
    30902651  std::vector<int> nv;
     
    30942655}
    30952656
    3096 
    3097 
    30982657//mvs and nvs are the supports of ideal Mab and Nab
    30992658//vecs is the solution of nab
    3100 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)
     2659static 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)
    31012660{
    31022661  int j;
     
    31232682      usleep(1000000);
    31242683      assert(false);
    3125 
    3126     }
    3127 
     2684    }
    31282685    bases.push_back(base);
    31292686    base.clear();
     
    31352692VAR clock_t t_begin, t_mark, t_start, t_construct=0, t_solve=0, t_value=0, t_total=0;
    31362693/**************************************************/
    3137 
    31382694
    31392695static void TimeShow(clock_t t_construct, clock_t t_solve, clock_t t_value ,clock_t t_total)
     
    31462702}
    31472703
    3148 
    3149 
    3150 std::vector<std::vector<int> > gpl(ideal h,poly a,poly b)
     2704static std::vector<std::vector<int> > gpl(ideal h,poly a,poly b)
    31512705{
    31522706  int i,j,co;
     
    32102764}
    32112765
    3212 
    32132766//T^1
    32142767//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)
     2768static intvec * gradedpiece1nl(ideal h,poly a,poly b, int set)
    32162769{
    32172770  t_start=clock();
     
    32362789}
    32372790
    3238 
    3239 
    3240 
    32412791//for finding values of T^2
    3242 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)
     2792static 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)
    32432793{
    32442794  std::vector<int> pv,qv,base;
     
    32932843}
    32942844
    3295 
    3296 std::vector<std::vector<int> > gpl2(ideal h,poly a,poly b)
     2845static std::vector<std::vector<int> > gpl2(ideal h,poly a,poly b)
    32972846{
    32982847  int i,j,t,n;
     
    33622911}
    33632912
    3364 
    3365 
    3366 
    3367 
    3368 
    3369 intvec * gradedpiece2nl(ideal h,poly a,poly b)
     2913static intvec * gradedpiece2nl(ideal h,poly a,poly b)
    33702914{
    33712915  poly e=pOne();
     
    33902934  return sl;
    33912935}
    3392 
    3393 
    33942936
    33952937//for debugging
     
    34222964*/
    34232965
    3424 
    3425 
    34262966/******************************for triangulation***********************************/
    34272967
    3428 
    3429 
    34302968//returns all the faces which are triangles
    3431 ideal trisets(ideal h)
     2969static ideal trisets(ideal h)
    34322970{
    34332971  int i;
     
    34442982}
    34452983
    3446 
    3447 
    3448 
    34492984// case 1 new faces
    3450 std::vector<std::vector<int> > triface(poly p, int vert)
     2985static std::vector<std::vector<int> > triface(poly p, int vert)
    34512986{
    34522987  std::vector<int> vec, fv=support1(p);
     
    34673002// the size of p's support must be 3
    34683003//returns the new complex which is a triangulation based on the face p
    3469 ideal triangulations1(ideal h, poly p, int vert)
     3004static ideal triangulations1(ideal h, poly p, int vert)
    34703005{
    34713006  std::vector<int> vec, pv=support1(p);
     
    34773012  //PrintS("is:\n");
    34783013  //listsprint(vecs);
    3479 
    34803014  ideal re=idMaken(vecs);
    3481 
    34823015  return re;
    34833016}
    34843017
    3485 
    3486 
    3487 
    34883018/*
    3489 ideal triangulations1(ideal h)
     3019static ideal triangulations1(ideal h)
    34903020{
    34913021  int i,vert=currRing->N+1;
     
    35103040}*/
    35113041
    3512 
    3513 std::vector<int> commonedge(poly p, poly q)
     3042static std::vector<int> commonedge(poly p, poly q)
    35143043{
    35153044  std::vector<int> ev, fv1= support1(p), fv2= support2(q);
     
    35223051}
    35233052
    3524 
    3525 intvec *edgemat(poly p, poly q)
     3053static intvec *edgemat(poly p, poly q)
    35263054{
    35273055  intvec *m;
     
    35423070
    35433071// case 2 the new face
    3544 std::vector<std::vector<int> > tetraface(poly p, poly q, int vert)
     3072static std::vector<std::vector<int> > tetraface(poly p, poly q, int vert)
    35453073{
    35463074  std::vector<int> ev=commonedge(p, q), vec, fv1=support1(p), fv2=support1(q);
     
    35633091}
    35643092
    3565 
    35663093//if p and q have  a common edge
    3567 ideal triangulations2(ideal h, poly p, poly q, int vert)
     3094static ideal triangulations2(ideal h, poly p, poly q, int vert)
    35683095{
    35693096  std::vector<int> ev, fv1=support1(p), fv2=support1(q);
     
    35793106}
    35803107
    3581 
    3582 
    3583 
    35843108// case 2 the new face
    3585 std::vector<std::vector<int> > penface(poly p, poly q, poly g, int vert)
     3109static std::vector<std::vector<int> > penface(poly p, poly q, poly g, int vert)
    35863110{
    35873111  int en=0;
     
    36273151}
    36283152
    3629 
    3630 
    3631 ideal triangulations3(ideal h, poly p, poly q, poly g, int vert)
     3153static ideal triangulations3(ideal h, poly p, poly q, poly g, int vert)
    36323154{
    36333155  std::vector<int> ev1=commonedge(p, q), ev2=commonedge(p, g), ev3=commonedge(q, g), fv1=support1(p), fv2=support1(q), fv3=support1(g);
     
    36523174}
    36533175
    3654 
    36553176//returns p's valency in h
    36563177//p must be a vertex
    3657 int valency(ideal h, poly p)
     3178static int valency(ideal h, poly p)
    36583179{
    36593180  int val=0;
     
    37023223}*/
    37033224
    3704 
    3705 
    37063225/*********************************For computation of X_n***********************************/
    3707 std::vector<std::vector<int> > vsMinusvs(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)
     3226static std::vector<std::vector<int> > vsMinusvs(std::vector<std::vector<int> > vs1, std::vector<std::vector<int> > vs2)
    37083227{
    37093228  std::vector<std::vector<int> > vs=vs1;
     
    37153234}
    37163235
    3717 
    3718 std::vector<std::vector<int> > vs_subsets(std::vector<std::vector<int> > vs)
     3236static std::vector<std::vector<int> > vs_subsets(std::vector<std::vector<int> > vs)
    37193237{
    37203238  std::vector<std::vector<int> >  sset, bv;
     
    37273245}
    37283246
    3729 
    3730 
    3731 std::vector<std::vector<int> > p_constant(ideal Xo,  ideal Sigma)
     3247static std::vector<std::vector<int> > p_constant(ideal Xo,  ideal Sigma)
    37323248{
    37333249  std::vector<std::vector<int> > xs=supports(idCopy(Xo)), ss=supports(idCopy(Sigma)), fvs1;
     
    37373253}
    37383254
    3739 
    3740 std::vector<std::vector<int> > p_change(ideal Sigma)
     3255static std::vector<std::vector<int> > p_change(ideal Sigma)
    37413256{
    37423257  std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs;
     
    37453260}
    37463261
    3747 
    3748 
    3749 std::vector<std::vector<int> > p_new(ideal Xo, ideal Sigma)
     3262static std::vector<std::vector<int> > p_new(ideal Xo, ideal Sigma)
    37503263{
    37513264  int vert=0;
     
    37783291}
    37793292
    3780 
    3781 
    3782 
    3783 ideal c_New(ideal Io, ideal sig)
     3293static ideal c_New(ideal Io, ideal sig)
    37843294{
    37853295  std::vector<std::vector<int> > vs1=p_constant(Io, sig), vs2=p_change(sig), vs3=p_new(Io, sig), vsig=supports(sig), vs;
     
    38163326}
    38173327
    3818 
    3819 
    3820 
    3821 std::vector<std::vector<int> > phi1(poly a,  ideal Sigma)
     3328static std::vector<std::vector<int> > phi1(poly a,  ideal Sigma)
    38223329{
    38233330  std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs;
     
    38353342}
    38363343
    3837 
    3838 
    38393344static std::vector<std::vector<int> > phi2(poly a, ideal Xo, ideal Sigma)
    38403345{
     
    38543359}
    38553360
    3856 
    3857 std::vector<std::vector<int> > links_new(poly a, ideal Xo, ideal Sigma, int vert, int ord)
     3361static std::vector<std::vector<int> > links_new(poly a, ideal Xo, ideal Sigma, int vert, int ord)
    38583362{
    38593363  std::vector<int> av=support1(a);
     
    38793383}
    38803384
    3881 
    3882 
    3883 
    38843385//returns 1 if there is a real divisor of b not in Xs
    3885 int existIn(poly b, ideal Xs)
     3386static int existIn(poly b, ideal Xs)
    38863387{
    38873388  std::vector<int> bv=support1(pCopy(b));
     
    38983399}
    38993400
    3900 
    3901 int isoNum(poly p, ideal I, poly a, poly b)
     3401static int isoNum(poly p, ideal I, poly a, poly b)
    39023402{
    39033403  int i;
     
    39163416}
    39173417
    3918 
    3919 
    3920 
    3921 int ifIso(poly p, poly q, poly f, poly g, poly a, poly b)
     3418static int ifIso(poly p, poly q, poly f, poly g, poly a, poly b)
    39223419{
    39233420  std::vector<int> va=support1(a), vb=support1(b), vp=support1(p),  vq=support1(q), vf=support1(f), vg=support1(g);
     
    39303427}
    39313428
    3932 
    3933 
    3934 
    3935 ideal idMinusp(ideal I, poly p)
     3429static ideal idMinusp(ideal I, poly p)
    39363430{
    39373431  ideal h=idInit(1,1);
     
    39483442}
    39493443
    3950 
    39513444/****************************for the interface of .lib*********************************/
    39523445
    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)
     3446static std::vector<int> v_minus(std::vector<int> v1, std::vector<int> v2)
    39623447{
    39633448  std::vector<int> vec;
     
    39693454}
    39703455
    3971 
    3972 std::vector<int> gdegree(poly a, poly b)
     3456static std::vector<int> gdegree(poly a, poly b)
    39733457{
    39743458  int i;
     
    39853469}
    39863470
    3987 
    3988 
    3989 
    3990 
    3991 
    39923471/********************************for stellar subdivision******************************/
    39933472
    3994 
    3995 std::vector<std::vector<int> > star(poly a, ideal h)
     3473static std::vector<std::vector<int> > star(poly a, ideal h)
    39963474{
    39973475  int i;
     
    40093487}
    40103488
    4011 
    4012 std::vector<std::vector<int> > boundary(poly a)
     3489static std::vector<std::vector<int> > boundary(poly a)
    40133490{
    40143491  std::vector<int> av=support1(a), vec;
     
    40203497}
    40213498
    4022 
    4023 
    4024 
    4025 
    4026 
    4027 std::vector<std::vector<int> > stellarsub(poly a, ideal h)
     3499static std::vector<std::vector<int> > stellarsub(poly a, ideal h)
    40283500{
    40293501  std::vector<std::vector<int> > vecs_minus, vecs_plus, lk=links(a,h), hvs=supports(h), sub, bys=boundary(a);
     
    40583530}
    40593531
    4060 
    4061 std::vector<std::vector<int> > bsubsets_1(poly b)
     3532static std::vector<std::vector<int> > bsubsets_1(poly b)
    40623533{
    40633534  std::vector<int>  bvs=support1(b), vs;
     
    40753546}
    40763547
    4077 
    4078 
    40793548/***************************for time testing******************************/
    4080 ideal T_1h(ideal h)
     3549static ideal T_1h(ideal h)
    40813550{
    40823551  int i, j;
     
    41003569  TimeShow(t_construct, t_solve, t_value, t_total);
    41013570  return h;
    4102 
    4103 }
     3571}
     3572
    41043573/**************************************interface T1****************************************/
    41053574/*
    4106 BOOLEAN makeqring(leftv res, leftv args)
     3575static BOOLEAN makeqring(leftv res, leftv args)
    41073576{
    41083577  leftv h=args;
     
    41293598}*/
    41303599
    4131 
    4132 
    4133 
    4134 
    4135 BOOLEAN SRideal(leftv res, leftv args)
     3600static BOOLEAN SRideal(leftv res, leftv args)
    41363601{
    41373602  leftv h=args;
     
    41453610}
    41463611
    4147 
    4148 
    4149 
    4150 
    4151 
    4152 BOOLEAN idcomplement(leftv res, leftv args)
     3612static BOOLEAN idcomplement(leftv res, leftv args)
    41533613{
    41543614  leftv h=args;
     
    41633623}
    41643624
    4165 
    4166 
    4167 
    4168 
    4169 BOOLEAN t1h(leftv res, leftv args)
     3625static BOOLEAN t1h(leftv res, leftv args)
    41703626{
    41713627  leftv h=args;
     
    41793635}
    41803636
    4181 
    4182 BOOLEAN idsr(leftv res, leftv args)
     3637static BOOLEAN idsr(leftv res, leftv args)
    41833638{
    41843639  leftv h=args;
     
    42023657}
    42033658
    4204 intvec *dmat(poly a, poly b)
     3659static intvec *dmat(poly a, poly b)
    42053660{
    42063661  intvec *m;
     
    42203675}
    42213676
    4222 
    4223 
    4224 BOOLEAN gd(leftv res, leftv args)
     3677static BOOLEAN gd(leftv res, leftv args)
    42253678{
    42263679  leftv h=args;
     
    42393692}
    42403693
    4241 
    4242 
    4243 BOOLEAN comedg(leftv res, leftv args)
     3694static BOOLEAN comedg(leftv res, leftv args)
    42443695{
    42453696  leftv h=args;
     
    42583709}
    42593710
    4260 
    4261 
    4262 
    4263 BOOLEAN fb(leftv res, leftv args)
     3711static BOOLEAN fb(leftv res, leftv args)
    42643712{
    42653713  leftv h=args;
     
    42733721}
    42743722
    4275 
    4276 BOOLEAN pa(leftv res, leftv args)
     3723static BOOLEAN pa(leftv res, leftv args)
    42773724{
    42783725  leftv h=args;
     
    42863733}
    42873734
    4288 
    4289 
    4290 BOOLEAN makeSimplex(leftv res, leftv args)
     3735static BOOLEAN makeSimplex(leftv res, leftv args)
    42913736{
    42923737  leftv h=args;
     
    43003745}
    43013746
    4302 
    4303 BOOLEAN pb(leftv res, leftv args)
     3747static BOOLEAN pb(leftv res, leftv args)
    43043748{
    43053749  leftv h=args;
     
    43183762}
    43193763
    4320 
    4321 
    4322 BOOLEAN fa(leftv res, leftv args)
     3764static BOOLEAN fa(leftv res, leftv args)
    43233765{
    43243766  leftv h=args;
     
    43423784}
    43433785
    4344 
    4345 BOOLEAN fgp(leftv res, leftv args)
     3786static BOOLEAN fgp(leftv res, leftv args)
    43463787{
    43473788  leftv h=args;
     
    43653806}
    43663807
    4367 
    4368 BOOLEAN fgpl(leftv res, leftv args)
     3808static BOOLEAN fgpl(leftv res, leftv args)
    43693809{
    43703810  leftv h=args;
     
    43933833}
    43943834
    4395 
    4396 
    4397 BOOLEAN genstt(leftv res, leftv args)
     3835static BOOLEAN genstt(leftv res, leftv args)
    43983836{
    43993837  leftv h=args;
     
    44173855}
    44183856
    4419 
    4420 BOOLEAN sgp(leftv res, leftv args)
     3857static BOOLEAN sgp(leftv res, leftv args)
    44213858{
    44223859  leftv h=args;
     
    44403877}
    44413878
    4442 
    4443 BOOLEAN sgpl(leftv res, leftv args)
     3879static BOOLEAN sgpl(leftv res, leftv args)
    44443880{
    44453881  leftv h=args;
     
    44633899}
    44643900
    4465 
    4466 BOOLEAN Links(leftv res, leftv args)
     3901static BOOLEAN Links(leftv res, leftv args)
    44673902{
    44683903  leftv h=args;
     
    44823917}
    44833918
    4484 BOOLEAN isSim(leftv res, leftv args)
     3919static BOOLEAN isSim(leftv res, leftv args)
    44853920{
    44863921  leftv h=args;
     
    44933928  return false;
    44943929}
    4495 
    44963930
    44973931BOOLEAN nfaces1(leftv res, leftv args)
     
    45173951}
    45183952
    4519 
    4520 BOOLEAN nfaces2(leftv res, leftv args)
     3953static BOOLEAN nfaces2(leftv res, leftv args)
    45213954{
    45223955  leftv h=args;
     
    45453978}
    45463979
    4547 
    4548 BOOLEAN nfaces3(leftv res, leftv args)
     3980static BOOLEAN nfaces3(leftv res, leftv args)
    45493981{
    45503982  leftv h=args;
     
    45784010}
    45794011
    4580 
    4581 
    4582 
    4583 
    4584 BOOLEAN eqsolve1(leftv res, leftv args)
     4012static BOOLEAN eqsolve1(leftv res, leftv args)
    45854013{
    45864014  leftv h=args;int i;
     
    46234051}
    46244052
    4625 
    4626 BOOLEAN tsets(leftv res, leftv args)
     4053static BOOLEAN tsets(leftv res, leftv args)
    46274054{
    46284055  leftv h=args;
     
    46364063}
    46374064
    4638 
    4639 
    4640 
    4641 
    4642 BOOLEAN Valency(leftv res, leftv args)
     4065static BOOLEAN Valency(leftv res, leftv args)
    46434066{
    46444067  leftv h=args;
     
    46574080}
    46584081
    4659 
    4660 
    4661 
    4662 BOOLEAN nabvl(leftv res, leftv args)
     4082static BOOLEAN nabvl(leftv res, leftv args)
    46634083{
    46644084  leftv h=args;
     
    46844104}
    46854105
    4686 
    4687 
    4688 BOOLEAN tnabvl(leftv res, leftv args)
     4106static BOOLEAN tnabvl(leftv res, leftv args)
    46894107{
    46904108  leftv h=args;
     
    47184136}
    47194137
    4720 
    4721 BOOLEAN vsIntersec(leftv res, leftv args)
     4138static BOOLEAN vsIntersec(leftv res, leftv args)
    47224139{
    47234140  leftv h=args;
     
    47374154}
    47384155
    4739 
    4740 BOOLEAN mabvl(leftv res, leftv args)
     4156static BOOLEAN mabvl(leftv res, leftv args)
    47414157{
    47424158  leftv h=args;
     
    47604176}
    47614177
    4762 
    4763 
    4764 BOOLEAN nabtvl(leftv res, leftv args)
     4178static BOOLEAN nabtvl(leftv res, leftv args)
    47654179{
    47664180  leftv h=args;
     
    47964210}
    47974211
    4798 
    4799 BOOLEAN linkn(leftv res, leftv args)
     4212static BOOLEAN linkn(leftv res, leftv args)
    48004213{
    48014214  leftv h=args;
     
    48294242}
    48304243
    4831 
    4832 
    4833 BOOLEAN existsub(leftv res, leftv args)
     4244static BOOLEAN existsub(leftv res, leftv args)
    48344245{
    48354246  leftv h=args;
     
    48484259}
    48494260
    4850 
    4851 BOOLEAN pConstant(leftv res, leftv args)
     4261static BOOLEAN pConstant(leftv res, leftv args)
    48524262{
    48534263  leftv h=args;
     
    48664276}
    48674277
    4868 BOOLEAN pChange(leftv res, leftv args)
     4278static BOOLEAN pChange(leftv res, leftv args)
    48694279{
    48704280  leftv h=args;
     
    48784288}
    48794289
    4880 
    4881 
    4882 BOOLEAN p_New(leftv res, leftv args)
     4290static BOOLEAN p_New(leftv res, leftv args)
    48834291{
    48844292  leftv h=args;
     
    48974305}
    48984306
    4899 
    4900 
    4901 
    4902 BOOLEAN support(leftv res, leftv args)
     4307static BOOLEAN support(leftv res, leftv args)
    49034308{
    49044309  leftv h=args;
     
    49124317}
    49134318
    4914 
    4915 
    4916 
    4917 
    4918 
    4919 BOOLEAN bprime(leftv res, leftv args)
     4319static BOOLEAN bprime(leftv res, leftv args)
    49204320{
    49214321  leftv h=args;
     
    49294329}
    49304330
    4931 
    4932 
    4933 BOOLEAN psMinusp(leftv res, leftv args)
     4331static BOOLEAN psMinusp(leftv res, leftv args)
    49344332{
    49354333  leftv h=args;
     
    49484346}
    49494347
    4950 
    4951 
    4952 BOOLEAN stellarremain(leftv res, leftv args)
     4348static BOOLEAN stellarremain(leftv res, leftv args)
    49534349{
    49544350  leftv h=args;
     
    49704366}
    49714367
    4972 
    4973 BOOLEAN cNew(leftv res, leftv args)
     4368static BOOLEAN cNew(leftv res, leftv args)
    49744369{
    49754370  leftv h=args;
     
    49884383}
    49894384
    4990 
    4991 
    4992 
    4993 BOOLEAN stars(leftv res, leftv args)
     4385static BOOLEAN stars(leftv res, leftv args)
    49944386{
    49954387  leftv h=args;
     
    50084400}
    50094401
    5010 
    5011 
    5012 
    5013 BOOLEAN stellarsubdivision(leftv res, leftv args)
     4402static BOOLEAN stellarsubdivision(leftv res, leftv args)
    50144403{
    50154404  leftv h=args;
     
    50284417}
    50294418
    5030 
    5031 
    5032 BOOLEAN idModulo(leftv res, leftv args)
     4419static BOOLEAN idModulo(leftv res, leftv args)
    50334420{
    50344421  leftv h=args;
     
    50474434}
    50484435
    5049 
    5050 BOOLEAN idminus(leftv res, leftv args)
     4436static BOOLEAN idminus(leftv res, leftv args)
    50514437{
    50524438  leftv h=args;
     
    50654451}
    50664452
    5067 
    5068 
    5069 BOOLEAN isoNumber(leftv res, leftv args)
     4453static BOOLEAN isoNumber(leftv res, leftv args)
    50704454{
    50714455  leftv h=args;
     
    50944478}
    50954479
    5096 
    5097 
    5098 BOOLEAN ifIsomorphism(leftv res, leftv args)
     4480static BOOLEAN ifIsomorphism(leftv res, leftv args)
    50994481{
    51004482  leftv h=args;
     
    51334515}
    51344516
    5135 
    5136 BOOLEAN newDegree(leftv res, leftv args)
     4517static BOOLEAN newDegree(leftv res, leftv args)
    51374518{
    51384519  leftv h=args;
     
    51514532}
    51524533
    5153 
    5154 
    5155 BOOLEAN nonf2f(leftv res, leftv args)
     4534static BOOLEAN nonf2f(leftv res, leftv args)
    51564535{
    51574536  leftv h=args;
     
    51654544}
    51664545
    5167 
    5168 
    5169 BOOLEAN dimsim(leftv res, leftv args)
     4546static BOOLEAN dimsim(leftv res, leftv args)
    51704547{
    51714548  leftv h=args;
     
    51794556}
    51804557
    5181 
    5182 
    5183 BOOLEAN numdim(leftv res, leftv args)
     4558static BOOLEAN numdim(leftv res, leftv args)
    51844559{
    51854560  leftv h=args;
     
    52004575/**************************************interface T2****************************************/
    52014576
    5202 
    5203 
    5204 void firstorderdef_setup(SModulFunctions* p)
     4577static void firstorderdef_setup(SModulFunctions* p)
    52054578{
    52064579  p->iiAddCproc("","mg",FALSE,idsr);
     
    52534626  p->iiAddCproc("","idminus",FALSE,idminus);
    52544627  p->iiAddCproc("","time1",FALSE,t1h);
    5255 
    5256 }
    5257 
    5258 
     4628}
    52594629
    52604630extern "C" int SI_MOD_INIT(cohomo)(SModulFunctions* p)
     
    52654635#endif
    52664636#endif
    5267 
    5268 
  • Singular/dyn_modules/cohomo/cohomo.h

    r07fefd r82410d  
    1111#include "libpolys/misc/intvec.h"
    1212
    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);
    2813#endif
Note: See TracChangeset for help on using the changeset viewer.