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 4292 of file cohomo.cc.

4293{
4294 leftv h=args;
4295 if((h != NULL)&&(h->Typ() == POLY_CMD))
4296 {
4297 poly p= (poly)h->Data();
4298 h = h->next;
4299 if((h != NULL)&&(h->Typ() == POLY_CMD))
4300 {
4301 poly q= (poly)h->Data();
4302 res->rtyp =INTVEC_CMD;
4303 res->data =dmat(p,q);
4304 }
4305 }
4306 return false;
4307}
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:4272
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 1986 of file cohomo.cc.

1987{
1988 int i,j,m;
1989 ideal sub=psubset(b);
1990 std::vector<int> av=support1(a), bv=support1(b), bad, vv;
1991 std::vector<std::vector<int> > hvs=supports(h), sbv=supports(sub), mv=Mabv(h,a,b),good;
1992 m=mv.size();
1993 ring r=currRing;
1994 if( m > 0 )
1995 {
1996 for(i=0;i<m;i++)
1997 {
1998 if(!vsubset(bv,mv[i]))
1999 {
2000 bad.push_back(i+1);
2001 }
2002 }
2003 for(i=0;i<m;i++)
2004 {
2005 for(j=i+1;j<m;j++)
2006 {
2007 vv=vecUnion(mv[i],mv[j]);
2008 if(mabconditionv(hvs,vv,av,bv))
2009 {
2010 good=listsinsertlist(good,i+1,j+1);
2011 }
2012 else
2013 {
2014 //PrintS("They are not in Mabt!\n");
2015 ;
2016 }
2017 }
2018 }
2019 std::vector<std::vector<int> > solve=eli2(m,bad,good);
2020 if(bv.size()!=1)
2021 {
2022 //PrintS("This is the solution of coefficients:\n");
2024 }
2025 else
2026 {
2027 std::vector<int> su=subspace1(mv,bv);
2028 //PrintS("This is the solution of subspace:\n");
2029 //listprint(su);
2030 std::vector<std::vector<int> > suu;
2031 suu.push_back(su);
2032 equmab(solve[0].size());
2033 std::vector<std::vector<int> > solves=vecqring(solve,suu);
2034 //PrintS("This is the solution of coefficients:\n");
2035 listsprint(solves);
2036 rChangeCurrRing(r);
2037 }
2038 }
2039 else
2040 {
2041 PrintS("No element considered!\n");
2042 }
2043}
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< int > vecUnion(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:267
std::vector< std::vector< int > > Mabv(ideal h, poly a, poly b)
Definition: cohomo.cc:1154
bool mabconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:1141
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:1828
std::vector< int > subspace1(std::vector< std::vector< int > > mv, std::vector< int > bv)
Definition: cohomo.cc:1917
void equmab(int num)
Definition: cohomo.cc:1894
ideal psubset(poly p)
Definition: cohomo.cc:1804
std::vector< std::vector< int > > eli2(int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1478
bool vsubset(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:206
std::vector< std::vector< int > > supports(ideal h)
Definition: cohomo.cc:376
std::vector< int > support1(poly p)
Definition: cohomo.cc:355
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 2764 of file cohomo.cc.

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

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

4251{
4252 leftv h=args;
4253 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4254 {
4255 ideal h1= (ideal)h->Data();
4256 h = h->next;
4257 if((h != NULL)&&(h->Typ() == POLY_CMD))
4258 {
4259 poly p= (poly)h->Data();
4260 h = h->next;
4261 if((h != NULL)&&(h->Typ() == POLY_CMD))
4262 {
4263 poly q= (poly)h->Data();
4264 res->rtyp =IDEAL_CMD;
4265 res->data =mingens(h1,p,q);
4266 }
4267 }
4268 }
4269 return false;
4270}
ideal mingens(ideal h, poly a, poly b)
Definition: cohomo.cc:2724
@ IDEAL_CMD
Definition: grammar.cc:284

◆ idsrRing()

ideal idsrRing ( ideal  h)

Definition at line 910 of file cohomo.cc.

911{
912 int max,i,j,n;
913 ideal pp,qq,rsr,ppp,hc=idCopy(h);
914 for(i=1;i<=rVar(currRing);i++)
915 {
916 pp=sfreemon(hc,i);
917 pp=scKBase(i,pp);//quotient ring (R/I_i)_i
918 if(!idIs0(pp))
919 {
920 pp=sfreemon(pp,i);
921 rsr=pp;
922 //Print("This is the first quotient generators %d:\n",i);
923 //id_print(rsr);
924 break;
925 }
926 }
927 for(n=i+1;n<=rVar(currRing);n++)
928 {
929 qq=sfreemon(hc,n);
930 pp=qringadd(qq,rsr,n);
931 ppp=sfreemon(pp,n);
932 rsr=idAdd(rsr,ppp);
933 }
934 idSkipZeroes(rsr);
935 return rsr;
936}
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
static int max(int a, int b)
Definition: fast_mult.cc:264
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1427
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 2836 of file cohomo.cc.

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

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

◆ Tlink()

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