My Project  debian-1:4.1.2-p1+ds-2
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 4294 of file cohomo.cc.

4295 {
4296  leftv h=args;
4297  if((h != NULL)&&(h->Typ() == POLY_CMD))
4298  {
4299  poly p= (poly)h->Data();
4300  h = h->next;
4301  if((h != NULL)&&(h->Typ() == POLY_CMD))
4302  {
4303  poly q= (poly)h->Data();
4304  res->rtyp =INTVEC_CMD;
4305  res->data =dmat(p,q);
4306  }
4307  }
4308  return false;
4309 }

◆ gradedpiece1()

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

Definition at line 1988 of file cohomo.cc.

1989 {
1990  int i,j,m;
1991  ideal sub=psubset(b);
1992  std::vector<int> av=support1(a), bv=support1(b), bad, vv;
1993  std::vector<std::vector<int> > hvs=supports(h), sbv=supports(sub), mv=Mabv(h,a,b),good;
1994  m=mv.size();
1995  ring r=currRing;
1996  if( m > 0 )
1997  {
1998  for(i=0;i<m;i++)
1999  {
2000  if(!vsubset(bv,mv[i]))
2001  {
2002  bad.push_back(i+1);
2003  }
2004  }
2005  for(i=0;i<m;i++)
2006  {
2007  for(j=i+1;j<m;j++)
2008  {
2009  vv=vecUnion(mv[i],mv[j]);
2010  if(mabconditionv(hvs,vv,av,bv))
2011  {
2012  good=listsinsertlist(good,i+1,j+1);
2013  }
2014  else
2015  {
2016  //PrintS("They are not in Mabt!\n");
2017  ;
2018  }
2019  }
2020  }
2021  std::vector<std::vector<int> > solve=eli2(m,bad,good);
2022  if(bv.size()!=1)
2023  {
2024  //PrintS("This is the solution of coefficients:\n");
2025  listsprint(solve);
2026  }
2027  else
2028  {
2029  std::vector<int> su=subspace1(mv,bv);
2030  //PrintS("This is the solution of subspace:\n");
2031  //listprint(su);
2032  std::vector<std::vector<int> > suu;
2033  suu.push_back(su);
2034  equmab(solve[0].size());
2035  std::vector<std::vector<int> > solves=vecqring(solve,suu);
2036  //PrintS("This is the solution of coefficients:\n");
2037  listsprint(solves);
2038  rChangeCurrRing(r);
2039  }
2040  }
2041  else
2042  {
2043  PrintS("No element considered!\n");
2044  }
2045 }

◆ gradedpiece1n()

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

Definition at line 2766 of file cohomo.cc.

2767 {
2768  int i,j,co,n;
2769  std::vector<std::vector<int> > hvs=supports(h),mv=Mabv(h,a,b),sbv,nv,good,solve;
2770  std::vector<int> av=support1(a), bv=support1(b), bad, tnv, index;
2771  ideal sub=psubset(b),M;
2772  sbv=supports(sub);
2773  nv=Nabv(hvs,av,bv);
2774  M=idMaken(mv);
2775  index = gensindex(M, idsrRing(h));
2776  n=nv.size();
2777  ring r=currRing;
2778  if(n > 0)
2779  {
2780  tnv=tnab(hvs,nv,sbv);
2781  for(i=0;i<tnv.size();i++)
2782  {
2783  co=tnv[i];
2784  bad.push_back(co+1);
2785  }
2786  for(i=0;i<n;i++)
2787  {
2788  for(j=i+1;j<n;j++)
2789  {
2790  if(nabtconditionv(hvs,nv[i],nv[j],av,bv))
2791  {
2792  good=listsinsertlist(good,i+1,j+1);
2793  }
2794  else
2795  {
2796  ;
2797  }
2798  }
2799  }
2800  solve=eli2(n,bad,good);
2801  if(bv.size()!=1)
2802  {;
2803  //PrintS("This is the solution of coefficients:\n");
2804  //listsprint(solve);
2805  }
2806  else
2807  {
2808  std::vector<int> su=make1(n);
2809  std::vector<std::vector<int> > suu;
2810  suu.push_back(su);
2811  equmab(n);
2812  solve=vecqring(solve,suu);
2813  //PrintS("This is the solution of coefficients:\n");
2814  //listsprint(solve);
2815  rChangeCurrRing(r);
2816  }
2817  solve=value1(mv,nv,solve,av,bv);
2818  }
2819  else
2820  {
2821  //PrintS("No element considered here!\n");
2822  solve.clear();
2823  }
2824  //PrintS("This is the solution of final coefficients:\n");
2825  //listsprint(solve);
2827  intvec *sl=Tmat(solve);
2828  //sl->show(0,0);
2829  return sl;
2830 }

◆ gradedpiece2()

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

Definition at line 2373 of file cohomo.cc.

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

◆ idsr()

BOOLEAN idsr ( leftv  res,
leftv  args 
)

Definition at line 4252 of file cohomo.cc.

4253 {
4254  leftv h=args;
4255  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4256  {
4257  ideal h1= (ideal)h->Data();
4258  h = h->next;
4259  if((h != NULL)&&(h->Typ() == POLY_CMD))
4260  {
4261  poly p= (poly)h->Data();
4262  h = h->next;
4263  if((h != NULL)&&(h->Typ() == POLY_CMD))
4264  {
4265  poly q= (poly)h->Data();
4266  res->rtyp =IDEAL_CMD;
4267  res->data =mingens(h1,p,q);
4268  }
4269  }
4270  }
4271  return false;
4272 }

◆ idsrRing()

ideal idsrRing ( ideal  h)

Definition at line 913 of file cohomo.cc.

914 {
915  int max,i,j,n;
916  ideal pp,qq,rsr,ppp,hc=idCopy(h);
917  for(i=1;i<=rVar(currRing);i++)
918  {
919  pp=sfreemon(hc,i);
920  pp=scKBase(i,pp);//quotient ring (R/I_i)_i
921  if(!idIs0(pp))
922  {
923  pp=sfreemon(pp,i);
924  rsr=pp;
925  //Print("This is the first quotient generators %d:\n",i);
926  //id_print(rsr);
927  break;
928  }
929  }
930  for(n=i+1;n<=rVar(currRing);n++)
931  {
932  qq=sfreemon(hc,n);
933  pp=qringadd(qq,rsr,n);
934  ppp=sfreemon(pp,n);
935  rsr=idAdd(rsr,ppp);
936  }
937  idSkipZeroes(rsr);
938  return rsr;
939 }

◆ T1()

void T1 ( ideal  h)

Definition at line 2838 of file cohomo.cc.

2839 {
2840  ideal bi=findb(h),ai;
2841  int mm=0,index=0;
2842  id_print(bi);
2843  poly a,b;
2844  std::vector<std::vector<int> > solve;
2845  for(int i=0;i<IDELEMS(bi);i++)
2846  {
2847  //PrintS("This is aset according to:");
2848  b=pCopy(bi->m[i]);
2849  pWrite(b);
2850  ai=finda(h,b,0);
2851  if(!idIs0(ai))
2852  {
2853  id_print(ai);
2854  for(int j=0;j<IDELEMS(ai);j++)
2855  {
2856  //PrintS("This is a:");
2857  a=pCopy(ai->m[j]);
2858  //pWrite(a);
2859  intvec * solve=gradedpiece1n(h, a, b);
2860  if (IMATELEM(*solve,1,1)!=10)
2861  mm++;
2862  }
2863  }
2864 
2865  }
2866  Print("Finished %d!\n",mm);
2867 
2868 }

◆ T2()

void T2 ( ideal  h)

Definition at line 3097 of file cohomo.cc.

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

◆ Tlink()

void Tlink ( ideal  h,
poly  a,
poly  b,
int  n 
)
idCopy
ideal idCopy(ideal A)
Definition: ideals.h:59
idsrRing
ideal idsrRing(ideal h)
Definition: cohomo.cc:913
gradedpiece2n
intvec * gradedpiece2n(ideal h, poly a, poly b)
Definition: cohomo.cc:3013
j
int j
Definition: facHensel.cc:105
equmab
void equmab(int num)
Definition: cohomo.cc:1896
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition: polys.cc:15
idAdd
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:67
h
STATIC_VAR Poly * h
Definition: janet.cc:971
Tmat
intvec * Tmat(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:2672
scKBase
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1352
findb
ideal findb(ideal h)
Definition: cohomo.cc:1079
vecqring
std::vector< std::vector< int > > vecqring(std::vector< std::vector< int > > vec1, std::vector< std::vector< int > > vec2)
Definition: cohomo.cc:562
gensindex
std::vector< int > gensindex(ideal M, ideal ids)
Definition: cohomo.cc:2707
eli2
std::vector< std::vector< int > > eli2(int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1480
lpsprint
void lpsprint(std::vector< std::vector< poly > > pvs)
Definition: cohomo.cc:117
bad
bool bad
Definition: facFactorize.cc:65
vecUnion
std::vector< int > vecUnion(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:270
makeequation
std::vector< int > makeequation(int i, int j, int t)
Definition: cohomo.cc:1843
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:776
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:4274
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:2097
condition1for2
bool condition1for2(std::vector< int > pv, std::vector< int > qv, std::vector< int > bv)
Definition: cohomo.cc:2064
finda
ideal finda(ideal h, poly S, int ddeg)
Definition: cohomo.cc:1108
idMakei
std::vector< std::vector< poly > > idMakei(std::vector< std::vector< int > > mv, std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1961
make1
std::vector< int > make1(int n)
Definition: cohomo.cc:1406
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
i
int i
Definition: cfEzgcd.cc:125
res
CanonicalForm res
Definition: facAbsFact.cc:64
M
#define M
Definition: sirandom.c:25
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:1157
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:2079
listsinsertlist
std::vector< std::vector< int > > listsinsertlist(std::vector< std::vector< int > > gset, int a, int b)
Definition: cohomo.cc:1830
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:180
sfreemon
ideal sfreemon(ideal h, int deg)
Definition: cohomo.cc:784
IDEAL_CMD
Definition: grammar.cc:284
gp
CanonicalForm gp
Definition: cfModGcd.cc:4043
idMake3
ideal idMake3(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1879
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
intvec
Definition: intvec.h:18
id_print
void id_print(ideal h)
Definition: cohomo.cc:84
psubset
ideal psubset(poly p)
Definition: cohomo.cc:1806
subspace1
std::vector< int > subspace1(std::vector< std::vector< int > > mv, std::vector< int > bv)
Definition: cohomo.cc:1919
mabconditionv
bool mabconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:1144
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:2328
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:209
support1
std::vector< int > support1(poly p)
Definition: cohomo.cc:358
INTVEC_CMD
Definition: tok.h:100
IMATELEM
#define IMATELEM(M, I, J)
Definition: intvec.h:85
minisolve
std::vector< std::vector< int > > minisolve(std::vector< std::vector< int > > solve, std::vector< int > index)
Definition: cohomo.cc:2742
supports
std::vector< std::vector< int > > supports(ideal h)
Definition: cohomo.cc:379
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:2347
Print
#define Print
Definition: emacs.cc:79
listsprint
void listsprint(std::vector< std::vector< int > > posMat)
Definition: cohomo.cc:65
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:2528
m
int m
Definition: cfEzgcd.cc:121
getvector
std::vector< std::vector< int > > getvector(ideal h, int n)
Definition: cohomo.cc:2202
NULL
#define NULL
Definition: omList.c:11
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:2593
p
int p
Definition: cfModGcd.cc:4019
idMaken
ideal idMaken(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:590
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
qringadd
ideal qringadd(ideal h1, ideal h2, int deg)
Definition: cohomo.cc:880
POLY_CMD
Definition: grammar.cc:289
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:174
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:23
rCopy
ring rCopy(ring r)
Definition: ring.cc:1644
Nabv
std::vector< std::vector< int > > Nabv(std::vector< std::vector< int > > hvs, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:2506
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:2726
gradedpiece1n
intvec * gradedpiece1n(ideal h, poly a, poly b)
Definition: cohomo.cc:2766
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:2626
pWrite
void pWrite(poly p)
Definition: polys.h:292