My Project
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 4271 of file cohomo.cc.

4272 {
4273  leftv h=args;
4274  if((h != NULL)&&(h->Typ() == POLY_CMD))
4275  {
4276  poly p= (poly)h->Data();
4277  h = h->next;
4278  if((h != NULL)&&(h->Typ() == POLY_CMD))
4279  {
4280  poly q= (poly)h->Data();
4281  res->rtyp =INTVEC_CMD;
4282  res->data =dmat(p,q);
4283  }
4284  }
4285  return false;
4286 }
int p
Definition: cfModGcd.cc:4078
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
intvec * dmat(poly a, poly b)
Definition: cohomo.cc:4251
CanonicalForm res
Definition: facAbsFact.cc:60
@ POLY_CMD
Definition: grammar.cc:289
STATIC_VAR Poly * h
Definition: janet.cc:971
#define NULL
Definition: omList.c:12
@ INTVEC_CMD
Definition: tok.h:101

◆ gradedpiece1()

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

Definition at line 1983 of file cohomo.cc.

1984 {
1985  int i,j,m;
1986  ideal sub=psubset(b);
1987  std::vector<int> av=support1(a), bv=support1(b), bad, vv;
1988  std::vector<std::vector<int> > hvs=supports(h), sbv=supports(sub), mv=Mabv(h,a,b),good;
1989  m=mv.size();
1990  ring r=currRing;
1991  if( m > 0 )
1992  {
1993  for(i=0;i<m;i++)
1994  {
1995  if(!vsubset(bv,mv[i]))
1996  {
1997  bad.push_back(i+1);
1998  }
1999  }
2000  for(i=0;i<m;i++)
2001  {
2002  for(j=i+1;j<m;j++)
2003  {
2004  vv=vecUnion(mv[i],mv[j]);
2005  if(mabconditionv(hvs,vv,av,bv))
2006  {
2007  good=listsinsertlist(good,i+1,j+1);
2008  }
2009  else
2010  {
2011  //PrintS("They are not in Mabt!\n");
2012  ;
2013  }
2014  }
2015  }
2016  std::vector<std::vector<int> > solve=eli2(m,bad,good);
2017  if(bv.size()!=1)
2018  {
2019  //PrintS("This is the solution of coefficients:\n");
2020  listsprint(solve);
2021  }
2022  else
2023  {
2024  std::vector<int> su=subspace1(mv,bv);
2025  //PrintS("This is the solution of subspace:\n");
2026  //listprint(su);
2027  std::vector<std::vector<int> > suu;
2028  suu.push_back(su);
2029  equmab(solve[0].size());
2030  std::vector<std::vector<int> > solves=vecqring(solve,suu);
2031  //PrintS("This is the solution of coefficients:\n");
2032  listsprint(solves);
2033  rChangeCurrRing(r);
2034  }
2035  }
2036  else
2037  {
2038  PrintS("No element considered!\n");
2039  }
2040 }
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
CanonicalForm b
Definition: cfModGcd.cc:4103
bool solve(int **extmat, int nrows, int ncols)
Definition: cf_linsys.cc:504
std::vector< std::vector< int > > eli2(int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1476
std::vector< std::vector< int > > Mabv(ideal h, poly a, poly b)
Definition: cohomo.cc:1153
std::vector< std::vector< int > > vecqring(std::vector< std::vector< int > > vec1, std::vector< std::vector< int > > vec2)
Definition: cohomo.cc:559
std::vector< std::vector< int > > listsinsertlist(std::vector< std::vector< int > > gset, int a, int b)
Definition: cohomo.cc:1825
bool mabconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:1140
std::vector< int > support1(poly p)
Definition: cohomo.cc:355
void equmab(int num)
Definition: cohomo.cc:1891
ideal psubset(poly p)
Definition: cohomo.cc:1801
std::vector< int > vecUnion(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:267
std::vector< std::vector< int > > supports(ideal h)
Definition: cohomo.cc:376
bool vsubset(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:206
std::vector< int > subspace1(std::vector< std::vector< int > > mv, std::vector< int > bv)
Definition: cohomo.cc:1914
void listsprint(std::vector< std::vector< int > > posMat)
Definition: cohomo.cc:65
bool bad
Definition: facFactorize.cc:64
int j
Definition: facHensel.cc:110
void rChangeCurrRing(ring r)
Definition: polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void PrintS(const char *s)
Definition: reporter.cc:284

◆ gradedpiece1n()

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

Definition at line 2759 of file cohomo.cc.

2760 {
2761  int i,j,co,n;
2762  std::vector<std::vector<int> > hvs=supports(h),mv=Mabv(h,a,b),sbv,nv,good,solve;
2763  std::vector<int> av=support1(a), bv=support1(b), bad, tnv, index;
2764  ideal sub=psubset(b),M;
2765  sbv=supports(sub);
2766  nv=Nabv(hvs,av,bv);
2767  M=idMaken(mv);
2768  index = gensindex(M, idsrRing(h));
2769  n=nv.size();
2770  ring r=currRing;
2771  if(n > 0)
2772  {
2773  tnv=tnab(hvs,nv,sbv);
2774  for(i=0;i<tnv.size();i++)
2775  {
2776  co=tnv[i];
2777  bad.push_back(co+1);
2778  }
2779  for(i=0;i<n;i++)
2780  {
2781  for(j=i+1;j<n;j++)
2782  {
2783  if(nabtconditionv(hvs,nv[i],nv[j]))
2784  {
2785  good=listsinsertlist(good,i+1,j+1);
2786  }
2787  else
2788  {
2789  ;
2790  }
2791  }
2792  }
2793  solve=eli2(n,bad,good);
2794  if(bv.size()!=1)
2795  {;
2796  //PrintS("This is the solution of coefficients:\n");
2797  //listsprint(solve);
2798  }
2799  else
2800  {
2801  std::vector<int> su=make1(n);
2802  std::vector<std::vector<int> > suu;
2803  suu.push_back(su);
2804  equmab(n);
2805  solve=vecqring(solve,suu);
2806  //PrintS("This is the solution of coefficients:\n");
2807  //listsprint(solve);
2808  rChangeCurrRing(r);
2809  }
2810  solve=value1(mv,nv,solve,av,bv);
2811  }
2812  else
2813  {
2814  //PrintS("No element considered here!\n");
2815  solve.clear();
2816  }
2817  //PrintS("This is the solution of final coefficients:\n");
2818  //listsprint(solve);
2820  intvec *sl=Tmat(solve);
2821  //sl->show(0,0);
2822  return sl;
2823 }
Definition: intvec.h:23
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:2619
std::vector< std::vector< int > > Nabv(std::vector< std::vector< int > > hvs, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:2499
static bool nabtconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv)
Definition: cohomo.cc:2521
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:2586
intvec * Tmat(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:2665
std::vector< std::vector< int > > minisolve(std::vector< std::vector< int > > solve, std::vector< int > index)
Definition: cohomo.cc:2735
ideal idMaken(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:587
ideal idsrRing(ideal h)
Definition: cohomo.cc:909
std::vector< int > gensindex(ideal M, ideal ids)
Definition: cohomo.cc:2700
std::vector< int > make1(int n)
Definition: cohomo.cc:1403
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define M
Definition: sirandom.c:25

◆ gradedpiece2()

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

Definition at line 2366 of file cohomo.cc.

2367 {
2368  int t0,t1,t2,i,j,t,m;
2369  ideal sub=psubset(b);
2370  ring r=rCopy(currRing);
2371  std::vector<std::vector<int> > hvs=supports(h), mv=Mabv(h,a,b), mts, vecs,vars;
2372  std::vector<int> av=support1(a), bv=support1(b), vec,var;
2373  mts=mabtv(hvs,mv,av,bv);
2374  PrintS("The homomorphism should map onto:\n");
2375  lpsprint(idMakei(mv,mts));
2376  m=mv.size();
2377  if(m > 0)
2378  {
2379  vars=mabtv(hvs,mv,av,bv);
2380  int vn=vars.size();
2381  for(t0=0;t0<vars.size();t0++)
2382  {
2383  i=vars[t0][0];
2384  j=vars[t0][1];
2385  if(!condition1for2(mv[i],mv[j],bv))//condition 1
2386  {
2387  //PrintS("And they satisfy the condition 1.\n");
2388  vec=makeequation(t0+1,0,0);
2389  //PrintS("So the equation:\n");
2390  //pWrite(p);
2391  //PrintS("holds.\n");
2392  vecs.push_back(vec);
2393  vec.clear();
2394  }
2395  if(condition3for2(hvs,mv[i],mv[j],av,bv))//condition 3
2396  {
2397  //PrintS("And they satisfy the condition 3.\n");
2398  vec=makeequation(t0+1,0,0);
2399  //PrintS("So the equation: \n");
2400  //pWrite(p);
2401  //PrintS("holds.\n");
2402  vecs.push_back(vec);
2403  vec.clear();
2404  }
2405  for(t1=t0+1;t1<vars.size();t1++)
2406  {
2407  for(t2=t1+1;t2<vars.size();t2++)
2408  {
2409  if(vars[t0][0]==vars[t1][0]&&vars[t1][1]==vars[t2][1]&&vars[t0][1]==vars[t2][0])
2410  {
2411  i=vars[t0][0];
2412  j=vars[t0][1];
2413  t=vars[t1][1];
2414  if(condition2for2(hvs,mv[i],mv[j],mv[t],av,bv))//condition 2
2415  {
2416  vec=makeequation(t0+1,t1+1,t2+1);
2417  vecs.push_back(vec);
2418  vec.clear();
2419  }
2420  }
2421  }
2422  }
2423  }
2424  //PrintS("this is EQUATIONS:\n");
2425  //listsprint(vecs);
2426  equmab(vn);
2427  ideal id_re=idMake3(vecs);
2428  //id_print(id_re);
2429  std::vector<std::vector<int> > re=getvector(id_re,vn);
2430  PrintS("this is the solution for ideal :\n");
2431  listsprint(re);
2432  rChangeCurrRing(r);
2433  std::vector<std::vector<int> > sub=subspacet(mv, bv,vars);
2434  PrintS("this is the solution for subspace:\n");
2435  listsprint(sub);
2436  equmab(vn);
2437  std::vector<std::vector<int> > solve=vecqring(re, sub);
2438  PrintS("This is the solution of coefficients:\n");
2439  listsprint(solve);
2440  rChangeCurrRing(r);
2441  }
2442  else
2443  {
2444  PrintS("No element considered!");
2445  }
2446 }
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:2092
bool condition1for2(std::vector< int > pv, std::vector< int > qv, std::vector< int > bv)
Definition: cohomo.cc:2059
ideal idMake3(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1874
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:2074
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:2340
void lpsprint(std::vector< std::vector< poly > > pvs)
Definition: cohomo.cc:114
std::vector< std::vector< poly > > idMakei(std::vector< std::vector< int > > mv, std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1956
std::vector< int > makeequation(int i, int j, int t)
Definition: cohomo.cc:1838
std::vector< std::vector< int > > getvector(ideal h, int n)
Definition: cohomo.cc:2196
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:2322
fq_nmod_poly_t * vec
Definition: facHensel.cc:108
ring rCopy(ring r)
Definition: ring.cc:1731

◆ idsr()

BOOLEAN idsr ( leftv  res,
leftv  args 
)

Definition at line 4229 of file cohomo.cc.

4230 {
4231  leftv h=args;
4232  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4233  {
4234  ideal h1= (ideal)h->Data();
4235  h = h->next;
4236  if((h != NULL)&&(h->Typ() == POLY_CMD))
4237  {
4238  poly p= (poly)h->Data();
4239  h = h->next;
4240  if((h != NULL)&&(h->Typ() == POLY_CMD))
4241  {
4242  poly q= (poly)h->Data();
4243  res->rtyp =IDEAL_CMD;
4244  res->data =mingens(h1,p,q);
4245  }
4246  }
4247  }
4248  return false;
4249 }
ideal mingens(ideal h, poly a, poly b)
Definition: cohomo.cc:2719
@ IDEAL_CMD
Definition: grammar.cc:284

◆ idsrRing()

ideal idsrRing ( ideal  h)

Definition at line 909 of file cohomo.cc.

910 {
911  int i,n;
912  ideal pp,qq,rsr,ppp,hc=idCopy(h);
913  for(i=1;i<=rVar(currRing);i++)
914  {
915  pp=sfreemon(hc,i);
916  pp=scKBase(i,pp);//quotient ring (R/I_i)_i
917  if(!idIs0(pp))
918  {
919  pp=sfreemon(pp,i);
920  rsr=pp;
921  //Print("This is the first quotient generators %d:\n",i);
922  //id_print(rsr);
923  break;
924  }
925  }
926  for(n=i+1;n<=rVar(currRing);n++)
927  {
928  qq=sfreemon(hc,n);
929  pp=qringadd(qq,rsr,n);
930  ppp=sfreemon(pp,n);
931  rsr=idAdd(rsr,ppp);
932  }
933  idSkipZeroes(rsr);
934  return rsr;
935 }
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
ideal qringadd(ideal h1, ideal h2, int deg)
Definition: cohomo.cc:877
ideal sfreemon(ideal h, int deg)
Definition: cohomo.cc:781
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1449
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:68
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:593
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ T1()

void T1 ( ideal  h)

Definition at line 2831 of file cohomo.cc.

2832 {
2833  ideal bi=findb(h),ai;
2834  int mm=0;
2835  id_print(bi);
2836  poly a,b;
2837  std::vector<std::vector<int> > solve;
2838  for(int i=0;i<IDELEMS(bi);i++)
2839  {
2840  //PrintS("This is aset according to:");
2841  b=pCopy(bi->m[i]);
2842  pWrite(b);
2843  ai=finda(h,b,0);
2844  if(!idIs0(ai))
2845  {
2846  id_print(ai);
2847  for(int j=0;j<IDELEMS(ai);j++)
2848  {
2849  //PrintS("This is a:");
2850  a=pCopy(ai->m[j]);
2851  //pWrite(a);
2852  intvec * solve=gradedpiece1n(h, a, b);
2853  if (IMATELEM(*solve,1,1)!=10)
2854  mm++;
2855  }
2856  }
2857 
2858  }
2859  Print("Finished %d!\n",mm);
2860 
2861 }
ideal finda(ideal h, poly S, int ddeg)
Definition: cohomo.cc:1104
ideal findb(ideal h)
Definition: cohomo.cc:1075
intvec * gradedpiece1n(ideal h, poly a, poly b)
Definition: cohomo.cc:2759
void id_print(ideal h)
Definition: cohomo.cc:84
#define Print
Definition: emacs.cc:80
#define IMATELEM(M, I, J)
Definition: intvec.h:85
void pWrite(poly p)
Definition: polys.h:308
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
#define IDELEMS(i)
Definition: simpleideals.h:23

◆ T2()

void T2 ( ideal  h)

Definition at line 3089 of file cohomo.cc.

3090 {
3091  ideal bi=findb(h),ai;
3092  id_print(bi);
3093  poly a,b;
3094  int mm=0,gp=0;
3095 std::vector<int> bv,av;
3096  std::vector<std::vector<int> > solve;
3097  for(int i=0;i<IDELEMS(bi);i++)
3098  {
3099  b=pCopy(bi->m[i]);
3100  //bv=support1(b);
3101  //PrintS("This is aset according to:");
3102  pWrite(b);
3103 //if(bv.size()==2)
3104  //{
3105  ai=finda(h,b,0);
3106  if(!idIs0(ai))
3107  {
3108  PrintS("This is a set according to current b:\n");
3109  id_print(ai);
3110  for(int j=0;j<IDELEMS(ai);j++)
3111  {
3112  PrintS("This is a:");
3113  a=pCopy(ai->m[j]);
3114  pWrite(a);
3115  PrintS("This is b:");
3116  pWrite(b);
3117  intvec *solve=gradedpiece2n(h, a, b);
3118  delete solve;
3119  gp++;
3120  }
3121  }
3122  mm=mm+1;
3123  }
3124  if(mm==IDELEMS(bi))
3125  PrintS("Finished!\n");
3126  Print("There are %d graded pieces in total.\n",gp);
3127 }
CanonicalForm gp
Definition: cfModGcd.cc:4102
intvec * gradedpiece2n(ideal h, poly a, poly b)
Definition: cohomo.cc:3005

◆ Tlink()

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