My Project  UNKNOWN_GIT_VERSION
Functions
cohomo.h File Reference
#include "kernel/linear_algebra/linearAlgebra.h"
#include "libpolys/misc/intvec.h"

Go to the source code of this file.

Functions

void gradedpiece1 (ideal h, poly a, poly b)
 
void gradedpiece2 (ideal h, poly a, poly b)
 
intvecgradedpiece1n (ideal h, poly a, poly b)
 
void Tlink (ideal h, poly a, poly b, int n)
 
void T1 (ideal h)
 
void T2 (ideal h)
 
ideal idsrRing (ideal h)
 
BOOLEAN idsr (leftv res, leftv args)
 
BOOLEAN gd (leftv res, leftv args)
 

Function Documentation

◆ gd()

BOOLEAN gd ( leftv  res,
leftv  args 
)

Definition at line 2974 of file cohomo.cc.

2975 {
2976  leftv h=args;
2977  if((h != NULL)&&(h->Typ() == POLY_CMD))
2978  {
2979  poly p= (poly)h->Data();
2980  h = h->next;
2981  if((h != NULL)&&(h->Typ() == POLY_CMD))
2982  {
2983  poly q= (poly)h->Data();
2984  res->rtyp =INTVEC_CMD;
2985  res->data =dmat(p,q);
2986  }
2987  }
2988  return false;
2989 }

◆ gradedpiece1()

void gradedpiece1 ( ideal  h,
poly  a,
poly  b 
)

Definition at line 1523 of file cohomo.cc.

1524 {
1525  int i,j;
1526  std::vector<std::vector<int> > hvs=supports(h);
1527  std::vector<int> av=support1(a);
1528  std::vector<int> bv=support1(b);
1529  ideal sub=psubset(b);
1530  std::vector<std::vector<int> > sbv=supports(sub);
1531  //ideal M=Mab(h,a,b);
1532  std::vector<std::vector<int> > mv=Mabv(h,a,b);
1533  PrintS("The homophisim is map onto the set:\n");
1534  id_print(idMaken(mv));
1535  int m=mv.size();
1536  std::vector<std::vector<int> > good;
1537  std::vector<int> bad,vv;
1538  ring r=currRing;
1539  if( m > 0 )
1540  {
1541  for(i=0;i<m;i++)
1542  {
1543  if(!vsubset(bv,mv[i]))
1544  {
1545  bad.push_back(i+1);
1546  }
1547  }
1548  for(i=0;i<m;i++)
1549  {
1550  for(j=i+1;j<m;j++)
1551  {
1552  vv=vecUnion(mv[i],mv[j]);
1553  if(mabconditionv(hvs,vv,av,bv))
1554  {
1555  good=listsinsertlist(good,i+1,j+1);
1556  }
1557  else
1558  {
1559  //PrintS("They are not in Mabt!\n");
1560  ;
1561  }
1562  }
1563  }
1564  std::vector<std::vector<int> > solve=eli2(m,bad,good);
1565  if(bv.size()!=1)
1566  {
1567  PrintS("This is the solution of coefficients:\n");
1568  listsprint(solve);
1569  }
1570  else
1571  {
1572  std::vector<int> su=subspace1(mv,bv);
1573  //PrintS("This is the solution of subspace:\n");
1574  //listprint(su);
1575  std::vector<std::vector<int> > suu;
1576  suu.push_back(su);
1577  equmab(solve[0].size());
1578  std::vector<std::vector<int> > solves=vecqring(solve,suu);
1579  PrintS("This is the solution of coefficients:\n");
1580  listsprint(solves);
1581  rChangeCurrRing(r);
1582  }
1583  }
1584  else
1585  {
1586  PrintS("No element considered!\n");
1587  }
1588 }

◆ gradedpiece1n()

intvec* gradedpiece1n ( ideal  h,
poly  a,
poly  b 
)

Definition at line 2359 of file cohomo.cc.

2360 {
2361  int i,j,co;
2362  std::vector<std::vector<int> > hvs=supports(h);
2363  std::vector<int> av=support1(a);
2364  //listprint(av);
2365  std::vector<int> bv=support1(b);
2366  //listprint(bv);
2367  ideal sub=psubset(b);
2368 //id_print(sub);
2369  std::vector<std::vector<int> > sbv=supports(sub);
2370 //listsprint(sbv);
2371  std::vector<std::vector<int> > nv=Nabv(hvs,av,bv);
2372  //PrintS("The N set is:\n");
2373  //listsprint(nv);
2374  std::vector<std::vector<int> > mv=Mabv(h,a,b);
2375  //listsprint(mv);
2376  ideal M=idMaken(mv);
2377  std::vector<int> index = gensindex(M, idsrRing(h));
2378  //ideal gens=mingens(M,index);
2379  int n=nv.size();
2380  //PrintS("The homophisim is map onto the set:\n");
2381  //id_print(M);
2382  std::vector<std::vector<int> > good,solve;
2383  std::vector<int> bad;
2384  ring r=currRing;
2385  std::vector<int> tnv;
2386  if(n > 0)
2387  {
2388  tnv=tnab(hvs,nv,sbv);
2389  for(i=0;i<tnv.size();i++)
2390  {
2391  co=tnv[i];
2392  bad.push_back(co+1);
2393  }
2394  for(i=0;i<n;i++)
2395  {
2396  for(j=i+1;j<n;j++)
2397  {
2398  if(nabtconditionv(hvs,nv[i],nv[j],av,bv))
2399  {
2400  good=listsinsertlist(good,i+1,j+1);
2401  }
2402  else
2403  {
2404  ;
2405  }
2406  }
2407  }
2408  solve=eli2(n,bad,good);
2409  if(bv.size()!=1)
2410  {;
2411  //PrintS("This is the solution of coefficients:\n");
2412  //listsprint(solve);
2413  }
2414  else
2415  {
2416  std::vector<int> su=make1(n);
2417  std::vector<std::vector<int> > suu;
2418  suu.push_back(su);
2419  equmab(n);
2420  solve=vecqring(solve,suu);
2421  //PrintS("This is the solution of coefficients:\n");
2422  //listsprint(solve);
2423  rChangeCurrRing(r);
2424  }
2425  solve=value1(mv,nv,solve,av,bv);
2426  }
2427  else
2428  {
2429  //PrintS("No element considered here!\n");
2430  solve.clear();
2431  }
2432  //PrintS("This is the solution of final coefficients:\n");
2433  //listsprint(solve);
2435  intvec *sl=Tmat(solve);
2436  //sl->show(0,0);
2437  return sl;
2438 }

◆ gradedpiece2()

void gradedpiece2 ( ideal  h,
poly  a,
poly  b 
)

Definition at line 1922 of file cohomo.cc.

1923 {
1924  int t0,t1,t2,i,j,t;
1925  ring r=rCopy(currRing);
1926  std::vector<std::vector<int> > hvs=supports(h);
1927  std::vector<int> av=support1(a);
1928  std::vector<int> bv=support1(b);
1929  ideal sub=psubset(b);
1930  std::vector<std::vector<int> > mv=Mabv(h,a,b);
1931  std::vector<std::vector<int> > mts=mabtv(hvs,mv,av,bv);
1932  PrintS("The homomorphism should map onto:\n");
1933  lpsprint(idMakei(mv,mts));
1934  int m=mv.size();
1935  //ideal M=Mab(h,a,b);
1936  std::vector<std::vector<int> > vecs,vars;
1937  std::vector<int> vec,var;
1938  if(m > 0)
1939  {
1940  vars=mabtv(hvs,mv,av,bv);
1941  int vn=vars.size();
1942  for(t0=0;t0<vars.size();t0++)
1943  {
1944  i=vars[t0][0];
1945  j=vars[t0][1];
1946  if(!condition1for2(mv[i],mv[j],bv))//condition 1
1947  {
1948  //PrintS("And they satisfy the condition 1.\n");
1949  vec=makeequation(t0+1,0,0);
1950  //PrintS("So the equation:\n");
1951  //pWrite(p);
1952  //PrintS("holds.\n");
1953  vecs.push_back(vec);
1954  vec.clear();
1955  }
1956  if(condition3for2(hvs,mv[i],mv[j],av,bv))//condition 3
1957  {
1958  //PrintS("And they satisfy the condition 3.\n");
1959  vec=makeequation(t0+1,0,0);
1960  //PrintS("So the equation: \n");
1961  //pWrite(p);
1962  //PrintS("holds.\n");
1963  vecs.push_back(vec);
1964  vec.clear();
1965  }
1966  for(t1=t0+1;t1<vars.size();t1++)
1967  {
1968  for(t2=t1+1;t2<vars.size();t2++)
1969  {
1970  if(vars[t0][0]==vars[t1][0]&&vars[t1][1]==vars[t2][1]&&vars[t0][1]==vars[t2][0])
1971  {
1972  i=vars[t0][0];
1973  j=vars[t0][1];
1974  t=vars[t1][1];
1975  if(condition2for2(hvs,mv[i],mv[j],mv[t],av,bv))//condition 2
1976  {
1977  vec=makeequation(t0+1,t1+1,t2+1);
1978  vecs.push_back(vec);
1979  vec.clear();
1980  }
1981  }
1982  }
1983  }
1984  }
1985  //PrintS("this is EQUATIONS:\n");
1986  //listsprint(vecs);
1987  equmab(vn);
1988  ideal id_re=idMake3(vecs);
1989  //id_print(id_re);
1990  std::vector<std::vector<int> > re=getvector(id_re,vn);
1991  PrintS("this is the solution for ideal :\n");
1992  listsprint(re);
1993  rChangeCurrRing(r);
1994  std::vector<std::vector<int> > sub=subspacet(mv, bv,vars);
1995  PrintS("this is the solution for subspace:\n");
1996  listsprint(sub);
1997  equmab(vn);
1998  std::vector<std::vector<int> > solve=vecqring(re, sub);
1999  PrintS("This is the solution of coefficients:\n");
2000  listsprint(solve);
2001  rChangeCurrRing(r);
2002  }
2003  else
2004  {
2005  PrintS("No element considered!");
2006  }
2007 }

◆ idsr()

BOOLEAN idsr ( leftv  res,
leftv  args 
)

Definition at line 2923 of file cohomo.cc.

2924 {
2925  leftv h=args;
2926  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
2927  {
2928  ideal h1= (ideal)h->Data();
2929 //T1(h1);
2930  h = h->next;
2931  if((h != NULL)&&(h->Typ() == POLY_CMD))
2932  {
2933  poly p= (poly)h->Data();
2934  h = h->next;
2935  if((h != NULL)&&(h->Typ() == POLY_CMD))
2936  {
2937  poly q= (poly)h->Data();
2938  res->rtyp =IDEAL_CMD;
2939  res->data =mingens(h1,p,q);
2940  }
2941  }
2942  }
2943  return false;
2944 }

◆ idsrRing()

ideal idsrRing ( ideal  h)

Definition at line 312 of file cohomo.cc.

313 {
314  int max,i,j,n;
315  ideal hc=idCopy(h);
316  //Print("This is the complement generators\n");
317  //id_print(hc);
318  ideal pp,qq,rsr,ppp;
319  for(i=1;i<=rVar(currRing);i++)
320  {
321  pp=sfreemon(hc,i);
322  pp=scKBase(i,pp);//quotient ring (R/I_i)_i
323  if(!idIs0(pp))
324  {
325  pp=sfreemon(pp,i);
326  rsr=pp;
327  //Print("This is the first quotient generators %d:\n",i);
328  //id_print(rsr);
329  break;
330  }
331  }
332  for(n=i+1;n<=rVar(currRing);n++)
333  {
334  qq=sfreemon(hc,n);
335  if(!idIs0(qq))
336  {
337  pp=qringadd(qq,rsr,n);
338  ppp=sfreemon(pp,n);
339  //Print("This is the quotient generators %d:\n",n);
340  //id_print(ppp);
341  rsr=idAdd(rsr,ppp);
342  //Print("This is the current minimal set\n");
343  //id_print(rsr);
344  }
345  }
346  idSkipZeroes(rsr);
347  //PrintS("This is the minimal generators:\n");
348  //id_print(rsr);
349  return rsr;
350 }

◆ T1()

void T1 ( ideal  h)

Definition at line 2473 of file cohomo.cc.

2474 {
2475  ideal bi=findb(h),ai;
2476  int mm=0,index=0;
2477  id_print(bi);
2478  poly a,b;
2479  std::vector<std::vector<int> > solve;
2480  for(int i=0;i<IDELEMS(bi);i++)
2481  {
2482  PrintS("This is aset according to:");
2483  b=pCopy(bi->m[i]);
2484  pWrite(b);
2485  ai=finda(h,b,0);
2486  if(!idIs0(ai))
2487  {
2488  id_print(ai);
2489  for(int j=0;j<IDELEMS(ai);j++)
2490  {
2491  //PrintS("This is a:");
2492  a=pCopy(ai->m[j]);
2493  //pWrite(a);
2494  intvec * solve=gradedpiece1n(h, a, b);
2495  if (IMATELEM(*solve,1,1)!=10)
2496  mm++;
2497  }
2498  }
2499 
2500  }
2501  Print("Finished %d!\n",mm);
2502 
2503 }

◆ T2()

void T2 ( ideal  h)

Definition at line 2754 of file cohomo.cc.

2755 {
2756  ideal bi=findb(h),ai;
2757  id_print(bi);
2758  poly a,b;
2759  int mm=0,gp=0;
2760 std::vector<int> bv,av;
2761  std::vector<std::vector<int> > solve;
2762  for(int i=0;i<IDELEMS(bi);i++)
2763  {
2764  b=pCopy(bi->m[i]);
2765  //bv=support1(b);
2766  //PrintS("This is aset according to:");
2767  pWrite(b);
2768 //if(bv.size()==2)
2769  //{
2770  ai=finda(h,b,0);
2771  if(!idIs0(ai))
2772  {
2773  PrintS("This is a set according to current b:\n");
2774  id_print(ai);
2775  for(int j=0;j<IDELEMS(ai);j++)
2776  {
2777  PrintS("This is a:");
2778  a=pCopy(ai->m[j]);
2779  pWrite(a);
2780  PrintS("This is b:");
2781  pWrite(b);
2782  intvec *solve=gradedpiece2n(h, a, b);
2783  gp++;
2784  }
2785  }
2786  mm=mm+1;
2787  }
2788  if(mm==IDELEMS(bi))
2789  PrintS("Finished!\n");
2790  Print("There are %d graded pieces in total.\n",gp);
2791 }

◆ Tlink()

void Tlink ( ideal  h,
poly  a,
poly  b,
int  n 
)

Definition at line 2798 of file cohomo.cc.

2799 {
2800  std::vector<std::vector<int> > hvs=supports(h);
2801  std::vector<int> av=support1(a);
2802  std::vector<int> bv=support1(b);
2803  std::vector<std::vector<int> > vec=links(a, h);
2804  PrintS("This is the links of a:\n");
2805  listsprint(vec);
2806  ideal li=idMaken(vec);
2807  PrintS("This is the links of a(ideal version):\n");
2808  id_print(li);
2809  poly p=pOne();
2810  PrintS("1************************************************\n");
2811  PrintS("This is T_1 (m):\n");
2812  gradedpiece1(li,p,b);
2813  PrintS("2************************************************\n");
2814  PrintS("This is T_2 (m):\n");
2815  gradedpiece2(li,p,b);
2816  PrintS("3************************************************\n");
2817  PrintS("This is T_1 (n):\n");
2818  gradedpiece1n(li,p,b);
2819  PrintS("4************************************************\n");
2820  PrintS("This is T_2 (n):\n");
2821  gradedpiece2n(li,p,b);
2822 }
idCopy
ideal idCopy(ideal A)
Definition: ideals.h:59
idsrRing
ideal idsrRing(ideal h)
Definition: cohomo.cc:312
gradedpiece2n
intvec * gradedpiece2n(ideal h, poly a, poly b)
Definition: cohomo.cc:2663
j
int j
Definition: facHensel.cc:105
equmab
void equmab(int num)
Definition: cohomo.cc:1386
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition: polys.cc:15
idAdd
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:67
Tmat
intvec * Tmat(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:2235
scKBase
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1353
findb
ideal findb(ideal h)
Definition: cohomo.cc:645
vecqring
std::vector< std::vector< int > > vecqring(std::vector< std::vector< int > > vec1, std::vector< std::vector< int > > vec2)
Definition: cohomo.cc:1197
gensindex
std::vector< int > gensindex(ideal M, ideal ids)
Definition: cohomo.cc:2292
eli2
std::vector< std::vector< int > > eli2(int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1034
lpsprint
void lpsprint(std::vector< std::vector< poly > > pvs)
Definition: cohomo.cc:134
bad
bool bad
Definition: facFactorize.cc:65
vecUnion
std::vector< int > vecUnion(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:567
makeequation
std::vector< int > makeequation(int i, int j, int t)
Definition: cohomo.cc:1321
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:767
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:81
b
CanonicalForm b
Definition: cfModGcd.cc:4044
dmat
intvec * dmat(poly a, poly b)
Definition: cohomo.cc:2946
condition3for2
bool condition3for2(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:1640
condition1for2
bool condition1for2(std::vector< int > pv, std::vector< int > qv, std::vector< int > bv)
Definition: cohomo.cc:1607
finda
ideal finda(ideal h, poly S, int ddeg)
Definition: cohomo.cc:676
idMakei
std::vector< std::vector< poly > > idMakei(std::vector< std::vector< int > > mv, std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1497
make1
std::vector< int > make1(int n)
Definition: cohomo.cc:951
links
std::vector< std::vector< int > > links(poly a, ideal h)
Definition: cohomo.cc:1215
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:581
i
int i
Definition: cfEzgcd.cc:125
res
CanonicalForm res
Definition: facAbsFact.cc:64
M
#define M
Definition: sirandom.c:24
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
Mabv
std::vector< std::vector< int > > Mabv(ideal h, poly a, poly b)
Definition: cohomo.cc:732
condition2for2
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)
Definition: cohomo.cc:1622
gradedpiece1
void gradedpiece1(ideal h, poly a, poly b)
Definition: cohomo.cc:1523
listsinsertlist
std::vector< std::vector< int > > listsinsertlist(std::vector< std::vector< int > > gset, int a, int b)
Definition: cohomo.cc:1308
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:171
sfreemon
ideal sfreemon(ideal h, int deg)
Definition: cohomo.cc:210
IDEAL_CMD
Definition: grammar.cc:284
h
static Poly * h
Definition: janet.cc:972
gp
CanonicalForm gp
Definition: cfModGcd.cc:4043
idMake3
ideal idMake3(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1362
max
static int max(int a, int b)
Definition: fast_mult.cc:264
size
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
pOne
#define pOne()
Definition: polys.h:297
intvec
Definition: intvec.h:16
id_print
void id_print(ideal h)
Definition: cohomo.cc:101
psubset
ideal psubset(poly p)
Definition: cohomo.cc:1282
subspace1
std::vector< int > subspace1(std::vector< std::vector< int > > mv, std::vector< int > bv)
Definition: cohomo.cc:1410
mabconditionv
bool mabconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:716
subspacet
std::vector< std::vector< int > > subspacet(std::vector< std::vector< int > > mv, std::vector< int > bv, std::vector< std::vector< int > > ntvs)
Definition: cohomo.cc:1877
pp
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
vsubset
bool vsubset(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:505
support1
std::vector< int > support1(poly p)
Definition: cohomo.cc:608
INTVEC_CMD
Definition: tok.h:100
IMATELEM
#define IMATELEM(M, I, J)
Definition: intvec.h:83
minisolve
std::vector< std::vector< int > > minisolve(std::vector< std::vector< int > > solve, std::vector< int > index)
Definition: cohomo.cc:2336
supports
std::vector< std::vector< int > > supports(ideal h)
Definition: cohomo.cc:623
mabtv
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)
Definition: cohomo.cc:1897
Print
#define Print
Definition: emacs.cc:79
listsprint
void listsprint(std::vector< std::vector< int > > posMat)
Definition: cohomo.cc:82
solve
bool solve(int **extmat, int nrows, int ncols)
Definition: cf_linsys.cc:504
nabtconditionv
bool nabtconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:2094
m
int m
Definition: cfEzgcd.cc:121
gradedpiece2
void gradedpiece2(ideal h, poly a, poly b)
Definition: cohomo.cc:1922
getvector
std::vector< std::vector< int > > getvector(ideal h, int n)
Definition: cohomo.cc:1745
NULL
#define NULL
Definition: omList.c:9
tnab
std::vector< int > tnab(std::vector< std::vector< int > > hvs, std::vector< std::vector< int > > nvs, std::vector< std::vector< int > > bvs)
Definition: cohomo.cc:2163
p
int p
Definition: cfModGcd.cc:4019
idMaken
ideal idMaken(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1452
qringadd
ideal qringadd(ideal h1, ideal h2, int deg)
Definition: cohomo.cc:285
POLY_CMD
Definition: grammar.cc:289
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:173
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:24
rCopy
ring rCopy(ring r)
Definition: ring.cc:1619
Nabv
std::vector< std::vector< int > > Nabv(std::vector< std::vector< int > > hvs, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:2075
index
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:585
mingens
ideal mingens(ideal h, poly a, poly b)
Definition: cohomo.cc:2311
gradedpiece1n
intvec * gradedpiece1n(ideal h, poly a, poly b)
Definition: cohomo.cc:2359
vec
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
value1
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)
Definition: cohomo.cc:2197
pWrite
void pWrite(poly p)
Definition: polys.h:290