My Project
Functions | Variables
cohomo.cc File Reference
#include "kernel/mod2.h"
#include "omalloc/omalloc.h"
#include "misc/mylimits.h"
#include "libpolys/misc/intvec.h"
#include <assert.h>
#include <unistd.h>
#include "kernel/combinatorics/hilb.h"
#include "kernel/combinatorics/stairc.h"
#include "kernel/combinatorics/hutil.h"
#include "cohomo.h"
#include "kernel/GBEngine/tgb.h"
#include "Singular/ipid.h"
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "polys/simpleideals.h"
#include "Singular/lists.h"
#include "kernel/linear_algebra/linearAlgebra.h"
#include "kernel/GBEngine/kstd1.h"
#include <kernel/ideals.h>
#include <libpolys/polys/ext_fields/transext.h>
#include <libpolys/coeffs/coeffs.h>
#include <coeffs/numbers.h>
#include <vector>
#include <Singular/ipshell.h>
#include <Singular/libsingular.h>
#include <time.h>

Go to the source code of this file.

Functions

void listprint (std::vector< int > vec)
 
void listsprint (std::vector< std::vector< int > > posMat)
 
void id_print (ideal h)
 
void lpprint (std::vector< poly > pv)
 
void lpsprint (std::vector< std::vector< poly > > pvs)
 
bool IsinL (int a, std::vector< int > vec)
 
std::vector< int > vecIntersection (std::vector< int > p, std::vector< int > q)
 
bool vEv (std::vector< int > vec1, std::vector< int > vec2)
 
bool vsubset (std::vector< int > vec1, std::vector< int > vec2)
 
bool vEvl (std::vector< int > vec1, std::vector< int > vec2)
 
bool vInvsl (std::vector< int > vec, std::vector< std::vector< int > > vecs)
 
int vInvs (std::vector< int > vec, std::vector< std::vector< int > > vecs)
 
std::vector< int > vecUnion (std::vector< int > vec1, std::vector< int > vec2)
 
std::vector< int > vecMinus (std::vector< int > vec1, std::vector< int > vec2)
 
std::vector< std::vector< int > > vsMinusv (std::vector< std::vector< int > > vecs, std::vector< int > vec)
 
std::vector< std::vector< int > > vsUnion (std::vector< std::vector< int > > vs1, std::vector< std::vector< int > > vs2)
 
std::vector< std::vector< int > > vsIntersection (std::vector< std::vector< int > > vs1, std::vector< std::vector< int > > vs2)
 
std::vector< int > support1 (poly p)
 
std::vector< std::vector< int > > supports (ideal h)
 
std::vector< int > support2 (poly p)
 
std::vector< std::vector< int > > supports2 (ideal h)
 
poly pMake (std::vector< int > vbase)
 
ideal idMake (std::vector< std::vector< int > > vecs)
 
ideal idmodulo (ideal h1, ideal h2)
 
int pcoef (poly p, int m)
 
bool vInp (int m, poly p)
 
std::vector< int > vMake (poly p)
 
std::vector< std::vector< int > > vsMake (ideal h)
 
std::vector< std::vector< int > > vecqring (std::vector< std::vector< int > > vec1, std::vector< std::vector< int > > vec2)
 
poly pMaken (std::vector< int > vbase)
 
ideal idMaken (std::vector< std::vector< int > > vecs)
 
std::vector< std::vector< int > > b_subsets (std::vector< int > vec)
 
int idvert (ideal h)
 
int pvert (poly p)
 
ideal idMinus (ideal h1, ideal h2)
 
bool p_Ifsfree (poly P)
 
ideal sfreemon (ideal h, int deg)
 
ideal id_sfmon (ideal h)
 
ideal id_complement (ideal h)
 
bool IsInX (poly p, ideal X)
 
ideal qringadd (ideal h1, ideal h2, int deg)
 
int id_maxdeg (ideal h)
 
ideal idsrRing (ideal h)
 
ideal SimFacset (poly p)
 
ideal idadda (ideal h1, ideal h2)
 
ideal IsSimplex (ideal h)
 
ideal complementsimplex (ideal h)
 
int dim_sim (ideal h)
 
int num4dim (ideal h, int n)
 
ideal findb (ideal h)
 
ideal finda (ideal h, poly S, int ddeg)
 
bool mabconditionv (std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
 
std::vector< std::vector< int > > Mabv (ideal h, poly a, poly b)
 
std::vector< int > eli1 (std::vector< int > eq1, std::vector< int > eq2)
 
std::vector< int > keeporder (std::vector< int > vec)
 
std::vector< std::vector< int > > soleli1 (std::vector< std::vector< int > > eqs)
 
std::vector< int > freevars (int n, std::vector< int > bset, std::vector< std::vector< int > > gset)
 
std::vector< int > fvarsvalue (int vnum, std::vector< int > fvars)
 
std::vector< std::vector< int > > vAbsorb (std::vector< int > bset, std::vector< std::vector< int > > gset)
 
std::vector< int > vecbase1 (int num, std::vector< int > oset)
 
std::vector< int > make0 (int n)
 
std::vector< int > make1 (int n)
 
std::vector< int > ofindbases1 (int num, int vnum, std::vector< int > bset, std::vector< std::vector< int > > gset)
 
std::vector< std::vector< int > > ofindbases (int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
 
std::vector< std::vector< int > > eli2 (int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
 
std::vector< std::vector< int > > links (poly a, ideal h)
 
int redefinedeg (poly p, int num)
 
ideal p_a (ideal h)
 
std::vector< std::vector< int > > id_subsets (std::vector< std::vector< int > > vecs)
 
std::vector< int > vertset (std::vector< std::vector< int > > vecs)
 
ideal p_b (ideal h, poly a)
 
ideal psubset (poly p)
 
std::vector< std::vector< int > > listsinsertlist (std::vector< std::vector< int > > gset, int a, int b)
 
std::vector< int > makeequation (int i, int j, int t)
 
poly pMake3 (std::vector< int > vbase)
 
ideal idMake3 (std::vector< std::vector< int > > vecs)
 
void equmab (int num)
 
std::vector< int > subspace1 (std::vector< std::vector< int > > mv, std::vector< int > bv)
 
std::vector< poly > pMakei (std::vector< std::vector< int > > mv, std::vector< int > vbase)
 
std::vector< std::vector< poly > > idMakei (std::vector< std::vector< int > > mv, std::vector< std::vector< int > > vecs)
 
void gradedpiece1 (ideal h, poly a, poly b)
 
bool condition1for2 (std::vector< int > pv, std::vector< int > qv, std::vector< int > bv)
 
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)
 
bool condition3for2 (std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv, std::vector< int > av, std::vector< int > bv)
 
ideal getpresolve (ideal h)
 
std::vector< int > numfree (ideal h)
 
std::vector< std::vector< int > > canonicalbase (int n)
 
std::vector< std::vector< int > > getvector (ideal h, int n)
 
std::vector< int > findalpha (std::vector< std::vector< int > > mv, std::vector< int > bv)
 
std::vector< int > subspacet1 (int num, std::vector< std::vector< int > > ntvs)
 
std::vector< std::vector< int > > subspacet (std::vector< std::vector< int > > mv, std::vector< int > bv, std::vector< std::vector< int > > ntvs)
 
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)
 
void gradedpiece2 (ideal h, poly a, poly b)
 
bool nabconditionv (std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
 
std::vector< std::vector< int > > Nabv (std::vector< std::vector< int > > hvs, std::vector< int > av, std::vector< int > bv)
 
static bool nabtconditionv (std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv)
 
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)
 
bool tNab (std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< std::vector< int > > bvs)
 
std::vector< int > tnab (std::vector< std::vector< int > > hvs, std::vector< std::vector< int > > nvs, std::vector< std::vector< int > > bvs)
 
std::vector< int > phimage (std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
 
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)
 
intvecTmat (std::vector< std::vector< int > > vecs)
 
std::vector< int > gensindex (ideal M, ideal ids)
 
ideal mingens (ideal h, poly a, poly b)
 
std::vector< std::vector< int > > minisolve (std::vector< std::vector< int > > solve, std::vector< int > index)
 
intvecgradedpiece1n (ideal h, poly a, poly b)
 
void T1 (ideal h)
 
bool condition2for2nv (std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv, std::vector< int > fv)
 
std::vector< int > findalphan (std::vector< std::vector< int > > N, std::vector< int > tN)
 
std::vector< std::vector< int > > subspacetn (std::vector< std::vector< int > > N, std::vector< int > tN, std::vector< std::vector< int > > ntvs)
 
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)
 
ideal genst (ideal h, poly a, poly b)
 
intvecgradedpiece2n (ideal h, poly a, poly b)
 
void T2 (ideal h)
 
std::vector< int > phimagel (std::vector< int > fv, std::vector< int > av, std::vector< int > bv)
 
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)
 
static void TimeShow (clock_t t_construct, clock_t t_solve, clock_t t_value, clock_t t_total)
 
std::vector< std::vector< int > > gpl (ideal h, poly a, poly b)
 
intvecgradedpiece1nl (ideal h, poly a, poly b, int set)
 
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)
 
std::vector< std::vector< int > > gpl2 (ideal h, poly a, poly b)
 
intvecgradedpiece2nl (ideal h, poly a, poly b)
 
ideal trisets (ideal h)
 
std::vector< std::vector< int > > triface (poly p, int vert)
 
ideal triangulations1 (ideal h, poly p, int vert)
 
std::vector< int > commonedge (poly p, poly q)
 
intvecedgemat (poly p, poly q)
 
std::vector< std::vector< int > > tetraface (poly p, poly q, int vert)
 
ideal triangulations2 (ideal h, poly p, poly q, int vert)
 
std::vector< std::vector< int > > penface (poly p, poly q, poly g, int vert)
 
ideal triangulations3 (ideal h, poly p, poly q, poly g, int vert)
 
int valency (ideal h, poly p)
 
std::vector< std::vector< int > > vsMinusvs (std::vector< std::vector< int > > vs1, std::vector< std::vector< int > > vs2)
 
std::vector< std::vector< int > > vs_subsets (std::vector< std::vector< int > > vs)
 
std::vector< std::vector< int > > p_constant (ideal Xo, ideal Sigma)
 
std::vector< std::vector< int > > p_change (ideal Sigma)
 
std::vector< std::vector< int > > p_new (ideal Xo, ideal Sigma)
 
ideal c_New (ideal Io, ideal sig)
 
std::vector< std::vector< int > > phi1 (poly a, ideal Sigma)
 
static std::vector< std::vector< int > > phi2 (poly a, ideal Xo, ideal Sigma)
 
std::vector< std::vector< int > > links_new (poly a, ideal Xo, ideal Sigma, int vert, int ord)
 
int existIn (poly b, ideal Xs)
 
int isoNum (poly p, ideal I, poly a, poly b)
 
int ifIso (poly p, poly q, poly f, poly g, poly a, poly b)
 
ideal idMinusp (ideal I, poly p)
 
ideal makemab (ideal h, poly a, poly b)
 
std::vector< int > v_minus (std::vector< int > v1, std::vector< int > v2)
 
std::vector< int > gdegree (poly a, poly b)
 
std::vector< std::vector< int > > star (poly a, ideal h)
 
std::vector< std::vector< int > > boundary (poly a)
 
std::vector< std::vector< int > > stellarsub (poly a, ideal h)
 
std::vector< std::vector< int > > bsubsets_1 (poly b)
 
ideal T_1h (ideal h)
 
BOOLEAN SRideal (leftv res, leftv args)
 
BOOLEAN idcomplement (leftv res, leftv args)
 
BOOLEAN t1h (leftv res, leftv args)
 
BOOLEAN idsr (leftv res, leftv args)
 
intvecdmat (poly a, poly b)
 
BOOLEAN gd (leftv res, leftv args)
 
BOOLEAN comedg (leftv res, leftv args)
 
BOOLEAN fb (leftv res, leftv args)
 
BOOLEAN pa (leftv res, leftv args)
 
BOOLEAN makeSimplex (leftv res, leftv args)
 
BOOLEAN pb (leftv res, leftv args)
 
BOOLEAN fa (leftv res, leftv args)
 
BOOLEAN fgp (leftv res, leftv args)
 
BOOLEAN fgpl (leftv res, leftv args)
 
BOOLEAN genstt (leftv res, leftv args)
 
BOOLEAN sgp (leftv res, leftv args)
 
BOOLEAN sgpl (leftv res, leftv args)
 
BOOLEAN Links (leftv res, leftv args)
 
BOOLEAN isSim (leftv res, leftv args)
 
BOOLEAN nfaces1 (leftv res, leftv args)
 
BOOLEAN nfaces2 (leftv res, leftv args)
 
BOOLEAN nfaces3 (leftv res, leftv args)
 
BOOLEAN eqsolve1 (leftv res, leftv args)
 
BOOLEAN tsets (leftv res, leftv args)
 
BOOLEAN Valency (leftv res, leftv args)
 
BOOLEAN nabvl (leftv res, leftv args)
 
BOOLEAN tnabvl (leftv res, leftv args)
 
BOOLEAN vsIntersec (leftv res, leftv args)
 
BOOLEAN mabvl (leftv res, leftv args)
 
BOOLEAN nabtvl (leftv res, leftv args)
 
BOOLEAN linkn (leftv res, leftv args)
 
BOOLEAN existsub (leftv res, leftv args)
 
BOOLEAN pConstant (leftv res, leftv args)
 
BOOLEAN pChange (leftv res, leftv args)
 
BOOLEAN p_New (leftv res, leftv args)
 
BOOLEAN support (leftv res, leftv args)
 
BOOLEAN bprime (leftv res, leftv args)
 
BOOLEAN psMinusp (leftv res, leftv args)
 
BOOLEAN stellarremain (leftv res, leftv args)
 
BOOLEAN cNew (leftv res, leftv args)
 
BOOLEAN stars (leftv res, leftv args)
 
BOOLEAN stellarsubdivision (leftv res, leftv args)
 
BOOLEAN idModulo (leftv res, leftv args)
 
BOOLEAN idminus (leftv res, leftv args)
 
BOOLEAN isoNumber (leftv res, leftv args)
 
BOOLEAN ifIsomorphism (leftv res, leftv args)
 
BOOLEAN newDegree (leftv res, leftv args)
 
BOOLEAN nonf2f (leftv res, leftv args)
 
BOOLEAN dimsim (leftv res, leftv args)
 
BOOLEAN numdim (leftv res, leftv args)
 
void firstorderdef_setup (SModulFunctions *p)
 
int SI_MOD_INIT() cohomo (SModulFunctions *p)
 

Variables

VAR clock_t t_begin
 
VAR clock_t t_mark
 
VAR clock_t t_start
 
VAR clock_t t_construct =0
 
VAR clock_t t_solve =0
 
VAR clock_t t_value =0
 
VAR clock_t t_total =0
 

Function Documentation

◆ b_subsets()

std::vector< std::vector< int > > b_subsets ( std::vector< int >  vec)

Definition at line 607 of file cohomo.cc.

608{
609 int i,j;
610 std::vector<int> bv;
611 std::vector<std::vector<int> > vecs;
612 for(i=0;i<vec.size();i++)
613 {
614 bv.push_back(vec[i]);
615 vecs.push_back(bv);
616 bv.clear();
617 }
618 //listsprint(vecs);
619 for(i=0;i<vecs.size();i++)
620 {
621 for(j=i+1;j<vecs.size();j++)
622 {
623 bv=vecUnion(vecs[i], vecs[j]);
624 if(!vInvsl(bv,vecs))
625 vecs.push_back(bv);
626 }
627 }
628 //listsprint(vecs);
629 return(vecs);
630}
int i
Definition: cfEzgcd.cc:132
std::vector< int > vecUnion(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:267
bool vInvsl(std::vector< int > vec, std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:233
fq_nmod_poly_t * vec
Definition: facHensel.cc:108
int j
Definition: facHensel.cc:110

◆ boundary()

std::vector< std::vector< int > > boundary ( poly  a)

Definition at line 4059 of file cohomo.cc.

4060{
4061 std::vector<int> av=support1(a), vec;
4062 std::vector<std::vector<int> > vecs;
4063 vecs=b_subsets(av);
4064 vecs.push_back(vec);
4065 vecs=vsMinusv(vecs, av);
4066 return vecs;
4067}
std::vector< std::vector< int > > b_subsets(std::vector< int > vec)
Definition: cohomo.cc:607
std::vector< std::vector< int > > vsMinusv(std::vector< std::vector< int > > vecs, std::vector< int > vec)
Definition: cohomo.cc:299
std::vector< int > support1(poly p)
Definition: cohomo.cc:355

◆ bprime()

BOOLEAN bprime ( leftv  res,
leftv  args 
)

Definition at line 4966 of file cohomo.cc.

4967{
4968 leftv h=args;
4969 if((h != NULL)&&(h->Typ() == POLY_CMD))
4970 {
4971 poly p= (poly)h->Data();
4972 res->rtyp =IDEAL_CMD;
4973 res->data =idMaken(bsubsets_1(p));
4974 }
4975 return false;
4976}
int p
Definition: cfModGcd.cc:4078
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
std::vector< std::vector< int > > bsubsets_1(poly b)
Definition: cohomo.cc:4108
ideal idMaken(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:587
CanonicalForm res
Definition: facAbsFact.cc:60
@ IDEAL_CMD
Definition: grammar.cc:284
@ POLY_CMD
Definition: grammar.cc:289
STATIC_VAR Poly * h
Definition: janet.cc:971
#define NULL
Definition: omList.c:12

◆ bsubsets_1()

std::vector< std::vector< int > > bsubsets_1 ( poly  b)

Definition at line 4108 of file cohomo.cc.

4109{
4110 std::vector<int> bvs=support1(b), vs;
4111 std::vector<std::vector<int> > bset;
4112 for(int i=0;i<bvs.size();i++)
4113 {
4114 for(int j=0;j!=i; j++)
4115 {
4116 vs.push_back(bvs[j]);
4117 }
4118 bset.push_back(vs);
4119 vs.resize(0);
4120 }
4121 return bset;
4122}
CanonicalForm b
Definition: cfModGcd.cc:4103

◆ c_New()

ideal c_New ( ideal  Io,
ideal  sig 
)

Definition at line 3830 of file cohomo.cc.

3831{
3832 std::vector<std::vector<int> > vs1=p_constant(Io, sig), vs2=p_change(sig), vs3=p_new(Io, sig), vsig=supports(sig), vs;
3833 std::vector<int> ev;
3834 int ednum=vsig.size();
3835 if(ednum==2)
3836 {
3837 vsig.push_back(commonedge(sig->m[0], sig->m[1]));
3838 }
3839 else if(ednum==3)
3840 {
3841 for(int i=0;i<IDELEMS(sig);i++)
3842 {
3843 for(int j=i+1;j<IDELEMS(sig);j++)
3844 {
3845 ev=commonedge(sig->m[i], sig->m[j]);
3846 if(ev.size()==2)
3847 {
3848 vsig.push_back(ev);
3849 }
3850 }
3851 }
3852 }
3853//PrintS("the first part is:\n");id_print(idMaken(vs1));
3854//PrintS("the second part is:\n");id_print(idMaken(vsig));
3855//PrintS("the third part is:\n");id_print(idMaken(vs3));
3856 vs2=vsMinusvs(vs2, vsig);
3857//PrintS("the constant part2 is:\n");id_print(idMaken(vs2));
3858 vs=vsUnion(vs2, vs1);
3859//PrintS("the constant part is:\n");id_print(idMaken(vs));
3860 vs=vsUnion(vs, vs3);
3861//PrintS("the whole part is:\n");id_print(idMaken(vs));
3862 return(idMaken(vs));
3863}
std::vector< std::vector< int > > p_constant(ideal Xo, ideal Sigma)
Definition: cohomo.cc:3778
std::vector< std::vector< int > > vsMinusvs(std::vector< std::vector< int > > vs1, std::vector< std::vector< int > > vs2)
Definition: cohomo.cc:3754
std::vector< int > commonedge(poly p, poly q)
Definition: cohomo.cc:3560
std::vector< std::vector< int > > p_change(ideal Sigma)
Definition: cohomo.cc:3787
std::vector< std::vector< int > > vsUnion(std::vector< std::vector< int > > vs1, std::vector< std::vector< int > > vs2)
Definition: cohomo.cc:314
std::vector< std::vector< int > > p_new(ideal Xo, ideal Sigma)
Definition: cohomo.cc:3796
std::vector< std::vector< int > > supports(ideal h)
Definition: cohomo.cc:376
#define IDELEMS(i)
Definition: simpleideals.h:23

◆ canonicalbase()

std::vector< std::vector< int > > canonicalbase ( int  n)

Definition at line 2172 of file cohomo.cc.

2173{
2174 std::vector<std::vector<int> > vecs;
2175 std::vector<int> vec;
2176 int i,j;
2177 for(i=0;i<n;i++)
2178 {
2179 for(j=0;j<n;j++)
2180 {
2181 if(i==j)
2182 vec.push_back(1);
2183 else
2184 vec.push_back(0);
2185 }
2186 vecs.push_back(vec);
2187 vec.clear();
2188 }
2189 return vecs;
2190}

◆ cNew()

BOOLEAN cNew ( leftv  res,
leftv  args 
)

Definition at line 5020 of file cohomo.cc.

5021{
5022 leftv h=args;
5023 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5024 {
5025 ideal h1= (ideal)h->Data();
5026 h = h->next;
5027 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5028 {
5029 ideal h2= (ideal)h->Data();
5030 res->rtyp =IDEAL_CMD;
5031 res->data =c_New(h1, h2);
5032 }
5033 }
5034 return false;
5035}
ideal c_New(ideal Io, ideal sig)
Definition: cohomo.cc:3830

◆ cohomo()

int SI_MOD_INIT() cohomo ( SModulFunctions p)

Definition at line 5307 of file cohomo.cc.

5308{
5310 return MAX_TOK;
5311}
void firstorderdef_setup(SModulFunctions *p)
Definition: cohomo.cc:5251
@ MAX_TOK
Definition: tok.h:218

◆ comedg()

BOOLEAN comedg ( leftv  res,
leftv  args 
)

Definition at line 4290 of file cohomo.cc.

4291{
4292 leftv h=args;
4293 if((h != NULL)&&(h->Typ() == POLY_CMD))
4294 {
4295 poly p= (poly)h->Data();
4296 h = h->next;
4297 if((h != NULL)&&(h->Typ() == POLY_CMD))
4298 {
4299 poly q= (poly)h->Data();
4300 res->rtyp =INTVEC_CMD;
4301 res->data =edgemat(p,q);
4302 }
4303 }
4304 return false;
4305}
intvec * edgemat(poly p, poly q)
Definition: cohomo.cc:3572
@ INTVEC_CMD
Definition: tok.h:101

◆ commonedge()

std::vector< int > commonedge ( poly  p,
poly  q 
)

Definition at line 3560 of file cohomo.cc.

3561{
3562 std::vector<int> ev, fv1= support1(p), fv2= support2(q);
3563 for(unsigned i=0;i<fv1.size();i++)
3564 {
3565 if(IsinL(fv1[i], fv2))
3566 ev.push_back(fv1[i]);
3567 }
3568 return ev;
3569}
std::vector< int > support2(poly p)
Definition: cohomo.cc:396
bool IsinL(int a, std::vector< int > vec)
Definition: cohomo.cc:143

◆ complementsimplex()

ideal complementsimplex ( ideal  h)

Definition at line 1011 of file cohomo.cc.

1012{
1013 int i,j;poly p,e=pOne();
1014 ideal h1=idInit(1,1), pp, h3;
1015 for(i=1;i<=rVar(currRing);i++)
1016 {
1017 p = pOne(); pSetExp(p, i, 2); pSetm(p); pSetCoeff(p, nInit(1));
1018 idInsertPoly(h1, p);
1019 }
1020 idSkipZeroes(h1);
1021 ideal h2=idAdd(h,h1);
1022 pp=scKBase(1,h2);
1023 h3=idCopy(pp);
1024 for(j=2;j<=rVar(currRing);j++)
1025 {
1026 pp=scKBase(j,h2);
1027 h3=idAdd(h3,pp);
1028 }
1029 idInsertPoly(h3, e);
1030 idSkipZeroes(h3);
1031 return (h3);
1032}
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1449
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:68
#define nInit(i)
Definition: numbers.h:24
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetm(p)
Definition: polys.h:271
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
#define pSetExp(p, i, v)
Definition: polys.h:42
#define pOne()
Definition: polys.h:315
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:593
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ condition1for2()

bool condition1for2 ( std::vector< int >  pv,
std::vector< int >  qv,
std::vector< int >  bv 
)

Definition at line 2059 of file cohomo.cc.

2060{
2061 std::vector<int > vec=vecUnion(pv,qv);
2062 if(vsubset(bv,vec))
2063 {
2064 //PrintS("condition1for2 yes\n");
2065 return true;
2066 }
2067 //PrintS("condition1for2 no\n");
2068 return false;
2069}
bool vsubset(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:206

◆ 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 at line 2074 of file cohomo.cc.

2075{
2076 std::vector<int> vec=vecUnion(pv,qv);
2077 vec=vecUnion(vec,sv);
2078 if(mabconditionv(hvs,vec,av,bv))
2079 {
2080 //PrintS("condition2for2 yes\n");
2081 return (true);
2082 }
2083 //PrintS("condition2for2 no\n");
2084 return (false);
2085}
bool mabconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:1140

◆ condition2for2nv()

bool condition2for2nv ( std::vector< std::vector< int > >  hvs,
std::vector< int >  pv,
std::vector< int >  qv,
std::vector< int >  fv 
)

Definition at line 2868 of file cohomo.cc.

2869{
2870 std::vector<int> vec=vecUnion(pv,qv);
2871 vec=vecUnion(vec,fv);
2872 if(vInvsl(vec,hvs))
2873 {
2874 //PrintS("condition2for2 yes\n");
2875 return (true);
2876 }
2877 //PrintS("condition2for2 no\n");
2878 return (false);
2879}

◆ 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 at line 2092 of file cohomo.cc.

2093{
2094 std::vector<int> v1,v2,v3;
2095 v1=vecIntersection(pv,qv);//intersection
2096 v2=vecUnion(pv,qv);
2097 v2=vecUnion(v2,av);
2098 v2=vecMinus(v2,bv);
2099 v3=vecUnion(v1,v2);
2100 if(vInvsl(v3,hvs))
2101 {
2102 //PrintS("condition3for2 yes\n");
2103 return(true);
2104 }
2105 //PrintS("condition3for2 no\n");
2106 return(false);
2107}
std::vector< int > vecMinus(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:281
std::vector< int > vecIntersection(std::vector< int > p, std::vector< int > q)
Definition: cohomo.cc:162

◆ dim_sim()

int dim_sim ( ideal  h)

Definition at line 1036 of file cohomo.cc.

1037{
1038 int dim=pTotaldegree(h->m[0]), i;
1039 for(i=1; i<IDELEMS(h);i++)
1040 {
1041 if(dim<pTotaldegree(h->m[i]))
1042 {
1043 dim=pTotaldegree(h->m[i]);
1044 }
1045 }
1046 return dim;
1047}
static long pTotaldegree(poly p)
Definition: polys.h:282
int dim(ideal I, ring r)

◆ dimsim()

BOOLEAN dimsim ( leftv  res,
leftv  args 
)

Definition at line 5216 of file cohomo.cc.

5217{
5218 leftv h=args;
5219 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5220 {
5221 ideal h1= (ideal)h->Data();
5222 res->rtyp =INT_CMD;
5223 res->data =(void *)(long)dim_sim(h1);
5224 }
5225 return false;
5226}
int dim_sim(ideal h)
Definition: cohomo.cc:1036
@ INT_CMD
Definition: tok.h:96

◆ dmat()

intvec * dmat ( poly  a,
poly  b 
)

Definition at line 4251 of file cohomo.cc.

4252{
4253 intvec *m;
4254 int i;
4255 std::vector<int> dg=gdegree(a,b);
4256 int lg=dg.size();
4257 m=new intvec(lg);
4258 if(lg!=0)
4259 {
4260 m=new intvec(lg);
4261 for(i=0;i<lg;i++)
4262 {
4263 (*m)[i]=dg[i];
4264 }
4265 }
4266 return (m);
4267}
int m
Definition: cfEzgcd.cc:128
Definition: intvec.h:23
std::vector< int > gdegree(poly a, poly b)
Definition: cohomo.cc:4019

◆ edgemat()

intvec * edgemat ( poly  p,
poly  q 
)

Definition at line 3572 of file cohomo.cc.

3573{
3574 intvec *m;
3575 int i;
3576 std::vector<int> dg=commonedge(p, q);
3577 int lg=dg.size();
3578 m=new intvec(lg);
3579 if(lg!=0)
3580 {
3581 m=new intvec(lg);
3582 for(i=0;i<lg;i++)
3583 {
3584 (*m)[i]=dg[i];
3585 }
3586 }
3587 return (m);
3588}

◆ eli1()

std::vector< int > eli1 ( std::vector< int >  eq1,
std::vector< int >  eq2 
)

Definition at line 1186 of file cohomo.cc.

1187{
1188 int i,j;
1189 std::vector<int> eq;
1190 if(eq1[0]==eq2[0])
1191 {
1192 i=eq1[1];j=eq2[1];
1193 eq.push_back(i);
1194 eq.push_back(j);
1195 }
1196 else
1197 {
1198 eq=eq2;
1199 }
1200 return(eq);
1201}

◆ eli2()

std::vector< std::vector< int > > eli2 ( int  num,
std::vector< int >  bset,
std::vector< std::vector< int > >  gset 
)

Definition at line 1476 of file cohomo.cc.

1477{
1478 std::vector<int> badset;
1479 std::vector<std::vector<int> > goodset, solve;
1480//PrintS("This is the input bset\n");listprint(bset);
1481//PrintS("This is the input gset\n");listsprint(gset);
1482 if(gset.size()!=0)//gset is not empty
1483 {
1484 //find all the variables which are zeroes
1485
1486 if(bset.size()!=0)//bset is not empty
1487 {
1488 goodset=vAbsorb(bset, gset);//e.g. x_1=0, put x_i into the badset if x_i-x_1=0 or x_1-x_i=0
1489 int m=goodset.size();
1490 badset=goodset[m-1];
1491 goodset.erase(goodset.end());
1492 }
1493 else //bset is empty
1494 {
1495 goodset=gset;//badset is empty
1496 }//goodset is already the set which doesn't contain zero variables
1497//PrintS("This is the badset after absorb \n");listprint(badset);
1498//PrintS("This is the goodset after absorb \n");listsprint(goodset);
1499 goodset=soleli1(goodset);//get the triangular form of goodset
1500//PrintS("This is the goodset after triangulization \n");listsprint(goodset);
1501 solve=ofindbases(num,badset,goodset);
1502 }
1503 else
1504 {
1505 solve=ofindbases(num,bset,gset);
1506 }
1507//PrintS("This is the solution\n");listsprint(solve);
1508 return solve;
1509}
CanonicalForm num(const CanonicalForm &f)
bool solve(int **extmat, int nrows, int ncols)
Definition: cf_linsys.cc:504
std::vector< std::vector< int > > ofindbases(int num, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1442
std::vector< std::vector< int > > vAbsorb(std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1322
std::vector< std::vector< int > > soleli1(std::vector< std::vector< int > > eqs)
Definition: cohomo.cc:1243

◆ eqsolve1()

BOOLEAN eqsolve1 ( leftv  res,
leftv  args 
)

Definition at line 4631 of file cohomo.cc.

4632{
4633 leftv h=args;int i;
4634 std::vector<int> bset,bs;
4635 std::vector<std::vector<int> > gset;
4636 if((h != NULL)&&(h->Typ() == INT_CMD))
4637 {
4638 int n= (int)(long)h->Data();
4639 h = h->next;
4640 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4641 {
4642 ideal bi= (ideal)h->Data();
4643 h = h->next;
4644 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4645 {
4646 ideal gi= (ideal)h->Data();
4647 for(i=0;i<IDELEMS(bi);i++)
4648 {
4649 bs=support1(bi->m[i]);
4650 if(bs.size()==1)
4651 bset.push_back(bs[0]);
4652 else if(bs.size()==0)
4653 ;
4654 else
4655 {
4656 WerrorS("Errors in T^1 Equations Solving!");
4657 usleep(1000000);
4658 assert(false);
4659 }
4660
4661 }
4662 gset=supports2(gi);
4663 res->rtyp =INTVEC_CMD;
4664 std::vector<std::vector<int> > vecs=eli2(n,bset,gset);
4665 res->data =Tmat(vecs);
4666 }
4667 }
4668 }
4669 return false;
4670}
intvec * Tmat(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:2665
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 > > supports2(ideal h)
Definition: cohomo.cc:420
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define assert(A)
Definition: svd_si.h:3

◆ equmab()

void equmab ( int  num)

Definition at line 1891 of file cohomo.cc.

1892{
1893 int i;
1894 //Print("There are %d new variables for equations solving.\n",num);
1895 ring r=currRing;
1896 char** tt;
1897 coeffs cf=nCopyCoeff(r->cf);
1898 tt=(char**)omAlloc(num*sizeof(char *));
1899 for(i=0; i <num; i++)
1900 {
1901 tt[i] = (char*)omalloc(10); //if required enlarge it later
1902 sprintf (tt[i], "t(%d)", i+1);
1903 tt[i]=omStrDup(tt[i]);
1904 }
1905 ring R=rDefault(cf,num,tt,ringorder_lp);
1907 IDRING(h)=rCopy(R);
1908 rSetHdl(h);
1909}
#define FALSE
Definition: auxiliary.h:96
CanonicalForm cf
Definition: cfModGcd.cc:4083
Definition: idrec.h:35
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
@ RING_CMD
Definition: grammar.cc:281
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:279
#define IDROOT
Definition: ipid.h:19
#define IDRING(a)
Definition: ipid.h:127
void rSetHdl(idhdl h)
Definition: ipshell.cc:5125
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omalloc(size)
Definition: omAllocDecl.h:228
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:102
ring rCopy(ring r)
Definition: ring.cc:1731
@ ringorder_lp
Definition: ring.h:77
#define R
Definition: sirandom.c:27

◆ existIn()

int existIn ( poly  b,
ideal  Xs 
)

Definition at line 3932 of file cohomo.cc.

3933{
3934 std::vector<int> bv=support1(pCopy(b));
3935 std::vector<std::vector<int> > xvs=supports(idCopy(Xs)), bs=b_subsets(bv);
3936 bs=vsMinusv(bs, bv);
3937 for(unsigned i=0;i<bs.size();i++)
3938 {
3939 if(!vInvsl(bs[i], xvs))
3940 {
3941 return 1;
3942 }
3943 }
3944 return 0;
3945}
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ existsub()

BOOLEAN existsub ( leftv  res,
leftv  args 
)

Definition at line 4880 of file cohomo.cc.

4881{
4882 leftv h=args;
4883 if((h != NULL)&&(h->Typ() == POLY_CMD))
4884 {
4885 poly p= (poly)h->Data();
4886 h = h->next;
4887 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4888 {
4889 ideal h1= (ideal)h->Data();
4890 res->rtyp =INT_CMD;
4891 res->data =(void *)(long)existIn(p, h1);
4892 }
4893 }
4894 return false;
4895}
int existIn(poly b, ideal Xs)
Definition: cohomo.cc:3932

◆ fa()

BOOLEAN fa ( leftv  res,
leftv  args 
)

Definition at line 4369 of file cohomo.cc.

4370{
4371 leftv h=args;
4372 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4373 {
4374 ideal h1= (ideal)h->Data();
4375 h = h->next;
4376 if((h != NULL)&&(h->Typ() == POLY_CMD))
4377 {
4378 poly q= (poly)h->Data();
4379 h = h->next;
4380 if((h != NULL)&&(h->Typ() == INT_CMD))
4381 {
4382 int d= (int)(long)h->Data();
4383 res->rtyp =IDEAL_CMD;
4384 res->data =finda(h1,q,d);
4385 }
4386 }
4387 }
4388 return false;
4389}
ideal finda(ideal h, poly S, int ddeg)
Definition: cohomo.cc:1104

◆ fb()

BOOLEAN fb ( leftv  res,
leftv  args 
)

Definition at line 4310 of file cohomo.cc.

4311{
4312 leftv h=args;
4313 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4314 {
4315 ideal h1= (ideal)h->Data();
4316 res->rtyp =IDEAL_CMD;
4317 res->data =findb(h1);
4318 }
4319 return false;
4320}
ideal findb(ideal h)
Definition: cohomo.cc:1075

◆ fgp()

BOOLEAN fgp ( leftv  res,
leftv  args 
)

Definition at line 4392 of file cohomo.cc.

4393{
4394 leftv h=args;
4395 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4396 {
4397 ideal h1= (ideal)h->Data();
4398 h = h->next;
4399 if((h != NULL)&&(h->Typ() == POLY_CMD))
4400 {
4401 poly p= (poly)h->Data();
4402 h = h->next;
4403 if((h != NULL)&&(h->Typ() == POLY_CMD))
4404 {
4405 poly q= (poly)h->Data();
4406 res->rtyp =INTVEC_CMD;
4407 res->data =gradedpiece1n(h1,p,q);
4408 }
4409 }
4410 }
4411 return false;
4412}
intvec * gradedpiece1n(ideal h, poly a, poly b)
Definition: cohomo.cc:2759

◆ fgpl()

BOOLEAN fgpl ( leftv  res,
leftv  args 
)

Definition at line 4415 of file cohomo.cc.

4416{
4417 leftv h=args;
4418 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4419 {
4420 ideal h1= (ideal)h->Data();
4421 h = h->next;
4422 if((h != NULL)&&(h->Typ() == POLY_CMD))
4423 {
4424 poly p= (poly)h->Data();
4425 h = h->next;
4426 if((h != NULL)&&(h->Typ() == POLY_CMD))
4427 {
4428 poly q= (poly)h->Data();
4429 h = h->next;
4430 if((h != NULL)&&(h->Typ() == INT_CMD))
4431 {
4432 int d= (int)(long)h->Data();
4433 res->rtyp =INTVEC_CMD;
4434 res->data =gradedpiece1nl(h1,p,q,d);
4435 }
4436 }
4437 }
4438 }
4439 return false;
4440}
intvec * gradedpiece1nl(ideal h, poly a, poly b, int set)
Definition: cohomo.cc:3262

◆ finda()

ideal finda ( ideal  h,
poly  S,
int  ddeg 
)

Definition at line 1104 of file cohomo.cc.

1105{
1106 poly e=pOne();
1107 ideal h2=id_complement(h), aset=idInit(1,1);
1108 int i,deg1=pTotaldegree(S);
1109 int tdeg=deg1+ddeg;
1110 if(tdeg!=0)
1111 {
1112 std::vector<int> v,bv=support1(S),in;
1113 std::vector<std::vector<int> > hvs=supports(h);
1114 ideal ia=id_MaxIdeal(tdeg, currRing);
1115 for(i=0;i<IDELEMS(ia);i++)
1116 {
1117 v=support1(ia->m[i]);
1118 in=vecIntersection(v,bv);
1119 if(vInvsl(v,hvs)&&in.size()==0)
1120 {
1121 idInsertPoly(aset, ia->m[i]);
1122 }
1123 }
1124 idSkipZeroes(aset);
1125 }
1126 else idInsertPoly(aset,e);
1127 return(aset);
1128}
ideal id_complement(ideal h)
Definition: cohomo.cc:832
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
ideal id_MaxIdeal(const ring r)
initialise the maximal ideal (at 0)
Definition: simpleideals.cc:98
int tdeg(poly p)
Definition: walkSupport.cc:35

◆ findalpha()

std::vector< int > findalpha ( std::vector< std::vector< int > >  mv,
std::vector< int >  bv 
)

Definition at line 2270 of file cohomo.cc.

2271{
2272 std::vector<int> alset;
2273 for(int i=0;i<mv.size();i++)
2274 {
2275 if(vsubset(bv,mv[i]))
2276 {
2277 alset.push_back(i);
2278 }
2279 }
2280 //Print("This is the alpha set, and the subspace is dim-%ld\n",alset.size());
2281 //listprint(alset);
2282 return alset;
2283}

◆ findalphan()

std::vector< int > findalphan ( std::vector< std::vector< int > >  N,
std::vector< int >  tN 
)

Definition at line 2886 of file cohomo.cc.

2887{
2888 int i;std::vector<int> alset,vec;
2889 for(i=0;i<N.size();i++)
2890 {
2891 // vec=N[i];
2892 if(!IsinL(i,tN))
2893 {
2894 alset.push_back(i);
2895 }
2896 }
2897 //listprint(alset);
2898 return alset;
2899}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56

◆ findb()

ideal findb ( ideal  h)

Definition at line 1075 of file cohomo.cc.

1076{
1077 ideal ib=id_sfmon(h), nonf=id_complement(h), bset=idInit(1,1);
1078 poly e=pOne();
1079 int i,j;
1080 for(i=0;i<IDELEMS(ib);i++)
1081 {
1082 for(j=0;j<IDELEMS(nonf);j++)
1083 {
1084 if(p_DivisibleBy(ib->m[i],nonf->m[j],currRing))
1085 {
1086 idInsertPoly(bset, ib->m[i]);
1087 break;
1088 }
1089 }
1090 }
1091 idInsertPoly(bset,e);
1092 idSkipZeroes(bset);
1093 return bset;
1094}
ideal id_sfmon(ideal h)
Definition: cohomo.cc:808
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1906

◆ firstorderdef_setup()

void firstorderdef_setup ( SModulFunctions p)

Definition at line 5251 of file cohomo.cc.

5252{
5253 p->iiAddCproc("","mg",FALSE,idsr);
5254 p->iiAddCproc("","gd",FALSE,gd);
5255 p->iiAddCproc("","findbset",FALSE,fb);
5256 p->iiAddCproc("","findaset",FALSE,fa);
5257 p->iiAddCproc("","fgp",FALSE,fgp);
5258 p->iiAddCproc("","fgpl",FALSE,fgpl);
5259 p->iiAddCproc("","idcomplement",FALSE,idcomplement);
5260 p->iiAddCproc("","genst",FALSE,genstt);
5261 p->iiAddCproc("","sgp",FALSE,sgp);
5262 p->iiAddCproc("","sgpl",FALSE,sgpl);
5263 p->iiAddCproc("","Links",FALSE,Links);
5264 p->iiAddCproc("","eqsolve1",FALSE,eqsolve1);
5265 p->iiAddCproc("","pb",FALSE,pb);
5266 p->iiAddCproc("","pa",FALSE,pa);
5267 p->iiAddCproc("","makeSimplex",FALSE,makeSimplex);
5268 p->iiAddCproc("","isSim",FALSE,isSim);
5269 p->iiAddCproc("","nfaces1",FALSE,nfaces1);
5270 p->iiAddCproc("","nfaces2",FALSE,nfaces2);
5271 p->iiAddCproc("","nfaces3",FALSE,nfaces3);
5272 p->iiAddCproc("","comedg",FALSE,comedg);
5273 p->iiAddCproc("","tsets",FALSE,tsets);
5274 p->iiAddCproc("","valency",FALSE,Valency);
5275 p->iiAddCproc("","nab",FALSE,nabvl);
5276 p->iiAddCproc("","tnab",FALSE,tnabvl);
5277 p->iiAddCproc("","mab",FALSE,mabvl);
5278 p->iiAddCproc("","SRideal",FALSE,SRideal);
5279 p->iiAddCproc("","Linkn",FALSE,linkn);
5280 p->iiAddCproc("","Existb",FALSE,existsub);
5281 p->iiAddCproc("","pConstant",FALSE,pConstant);
5282 p->iiAddCproc("","pChange",FALSE,pChange);
5283 p->iiAddCproc("","pNew",FALSE,p_New);
5284 p->iiAddCproc("","pSupport",FALSE,support);
5285 p->iiAddCproc("","psMinusp",FALSE,psMinusp);
5286 p->iiAddCproc("","cNew",FALSE,cNew);
5287 p->iiAddCproc("","isoNumber",FALSE,isoNumber);
5288 p->iiAddCproc("","vsInsec",FALSE,vsIntersec);
5289 p->iiAddCproc("","getnabt",FALSE,nabtvl);
5290 p->iiAddCproc("","idmodulo",FALSE,idModulo);
5291 p->iiAddCproc("","ndegree",FALSE,newDegree);
5292 p->iiAddCproc("","nonf2f",FALSE,nonf2f);
5293 p->iiAddCproc("","ifIsom",FALSE,ifIsomorphism);
5294 p->iiAddCproc("","stellarsubdivision",FALSE,stellarsubdivision);
5295 p->iiAddCproc("","star",FALSE,stars);
5296 p->iiAddCproc("","numdim",FALSE,numdim);
5297 p->iiAddCproc("","dimsim",FALSE,dimsim);
5298 p->iiAddCproc("","bprime",FALSE,bprime);
5299 p->iiAddCproc("","remainpart",FALSE,stellarremain);
5300 p->iiAddCproc("","idminus",FALSE,idminus);
5301 p->iiAddCproc("","time1",FALSE,t1h);
5302
5303}
BOOLEAN idModulo(leftv res, leftv args)
Definition: cohomo.cc:5079
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4323
BOOLEAN sgpl(leftv res, leftv args)
Definition: cohomo.cc:4490
BOOLEAN nfaces1(leftv res, leftv args)
Definition: cohomo.cc:4544
BOOLEAN psMinusp(leftv res, leftv args)
Definition: cohomo.cc:4980
BOOLEAN nfaces3(leftv res, leftv args)
Definition: cohomo.cc:4595
BOOLEAN cNew(leftv res, leftv args)
Definition: cohomo.cc:5020
BOOLEAN isoNumber(leftv res, leftv args)
Definition: cohomo.cc:5116
BOOLEAN pb(leftv res, leftv args)
Definition: cohomo.cc:4350
BOOLEAN fgp(leftv res, leftv args)
Definition: cohomo.cc:4392
BOOLEAN fa(leftv res, leftv args)
Definition: cohomo.cc:4369
BOOLEAN ifIsomorphism(leftv res, leftv args)
Definition: cohomo.cc:5145
BOOLEAN tnabvl(leftv res, leftv args)
Definition: cohomo.cc:4735
BOOLEAN genstt(leftv res, leftv args)
Definition: cohomo.cc:4444
BOOLEAN Links(leftv res, leftv args)
Definition: cohomo.cc:4513
BOOLEAN idcomplement(leftv res, leftv args)
Definition: cohomo.cc:4199
BOOLEAN p_New(leftv res, leftv args)
Definition: cohomo.cc:4929
BOOLEAN fgpl(leftv res, leftv args)
Definition: cohomo.cc:4415
BOOLEAN SRideal(leftv res, leftv args)
Definition: cohomo.cc:4182
BOOLEAN linkn(leftv res, leftv args)
Definition: cohomo.cc:4846
BOOLEAN newDegree(leftv res, leftv args)
Definition: cohomo.cc:5183
BOOLEAN idsr(leftv res, leftv args)
Definition: cohomo.cc:4229
BOOLEAN isSim(leftv res, leftv args)
Definition: cohomo.cc:4531
BOOLEAN Valency(leftv res, leftv args)
Definition: cohomo.cc:4689
BOOLEAN sgp(leftv res, leftv args)
Definition: cohomo.cc:4467
BOOLEAN pChange(leftv res, leftv args)
Definition: cohomo.cc:4915
BOOLEAN gd(leftv res, leftv args)
Definition: cohomo.cc:4271
BOOLEAN makeSimplex(leftv res, leftv args)
Definition: cohomo.cc:4337
BOOLEAN stellarremain(leftv res, leftv args)
Definition: cohomo.cc:4999
BOOLEAN bprime(leftv res, leftv args)
Definition: cohomo.cc:4966
BOOLEAN vsIntersec(leftv res, leftv args)
Definition: cohomo.cc:4768
BOOLEAN tsets(leftv res, leftv args)
Definition: cohomo.cc:4673
BOOLEAN numdim(leftv res, leftv args)
Definition: cohomo.cc:5230
BOOLEAN pConstant(leftv res, leftv args)
Definition: cohomo.cc:4898
BOOLEAN nabvl(leftv res, leftv args)
Definition: cohomo.cc:4709
BOOLEAN support(leftv res, leftv args)
Definition: cohomo.cc:4949
BOOLEAN existsub(leftv res, leftv args)
Definition: cohomo.cc:4880
BOOLEAN stellarsubdivision(leftv res, leftv args)
Definition: cohomo.cc:5060
BOOLEAN dimsim(leftv res, leftv args)
Definition: cohomo.cc:5216
BOOLEAN comedg(leftv res, leftv args)
Definition: cohomo.cc:4290
BOOLEAN nfaces2(leftv res, leftv args)
Definition: cohomo.cc:4567
BOOLEAN stars(leftv res, leftv args)
Definition: cohomo.cc:5040
BOOLEAN fb(leftv res, leftv args)
Definition: cohomo.cc:4310
BOOLEAN idminus(leftv res, leftv args)
Definition: cohomo.cc:5097
BOOLEAN nonf2f(leftv res, leftv args)
Definition: cohomo.cc:5202
BOOLEAN mabvl(leftv res, leftv args)
Definition: cohomo.cc:4787
BOOLEAN nabtvl(leftv res, leftv args)
Definition: cohomo.cc:4811
BOOLEAN t1h(leftv res, leftv args)
Definition: cohomo.cc:4216
BOOLEAN eqsolve1(leftv res, leftv args)
Definition: cohomo.cc:4631

◆ freevars()

std::vector< int > freevars ( int  n,
std::vector< int >  bset,
std::vector< std::vector< int > >  gset 
)

Definition at line 1278 of file cohomo.cc.

1279{
1280 int ql=gset.size(), bl=bset.size(), i;
1281 std::vector<int> mvar, fvar;
1282 for(i=0;i<bl;i++)
1283 {
1284 mvar.push_back(bset[i]);
1285 }
1286 for(i=0;i<ql;i++)
1287 {
1288 mvar.push_back(gset[i][0]);
1289 }
1290 for(i=1;i<=n;i++)
1291 {
1292 if(!IsinL(i,mvar))
1293 {
1294 fvar.push_back(i);
1295 }
1296 }
1297 return fvar;
1298}
Variable mvar(const CanonicalForm &f)

◆ fvarsvalue()

std::vector< int > fvarsvalue ( int  vnum,
std::vector< int >  fvars 
)

Definition at line 1302 of file cohomo.cc.

1303{
1304 int i;
1305 std::vector<int> fset=fvars;
1306 for(i=0;i<fset.size();i++)
1307 {
1308 if(fset[i]==vnum)
1309 {
1310 fset.erase(fset.begin()+i);
1311 break;
1312 }
1313 }
1314 return fset;
1315}

◆ 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}
intvec * dmat(poly a, poly b)
Definition: cohomo.cc:4251

◆ gdegree()

std::vector< int > gdegree ( poly  a,
poly  b 
)

Definition at line 4019 of file cohomo.cc.

4020{
4021 int i;
4022 std::vector<int> av,bv;
4023 for(i=1;i<=currRing->N;i++)
4024 {
4025 av.push_back(pGetExp(a,i));
4026 bv.push_back(pGetExp(b,i));
4027 }
4028 std::vector<int> vec=v_minus(av,bv);
4029 //PrintS("The degree is:\n");
4030 //listprint(vec);
4031 return vec;
4032}
std::vector< int > v_minus(std::vector< int > v1, std::vector< int > v2)
Definition: cohomo.cc:4008
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ gensindex()

std::vector< int > gensindex ( ideal  M,
ideal  ids 
)

Definition at line 2700 of file cohomo.cc.

2701{
2702 int i;
2703 std::vector<int> vec,index;
2704 if(!idIs0(M))
2705 {
2706 std::vector<std::vector<int> > vecs=supports(ids);
2707 for(i=0;i<IDELEMS(M);i++)
2708 {
2709 vec=support1(M->m[i]);
2710 if(vInvsl(vec,vecs))
2711 index.push_back(i);
2712 }
2713 }
2714 return (index);
2715}
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define M
Definition: sirandom.c:25

◆ genst()

ideal genst ( ideal  h,
poly  a,
poly  b 
)

Definition at line 2981 of file cohomo.cc.

2982{
2983 std::vector<std::vector<int> > hvs=supports(h),mv,mts;
2984 std::vector<int> av=support1(a), bv=support1(b);
2985 mv=Mabv(h,a,b);
2986 mts=mabtv(hvs,mv,av,bv);
2987 std::vector<std::vector<poly> > pvs=idMakei(mv,mts);
2988 ideal gens=idInit(1,1);
2989 for(unsigned i=0;i<pvs.size();i++)
2990 {
2991 idInsertPoly(gens,pvs[i][0]);
2992 idInsertPoly(gens,pvs[i][1]);
2993 }
2994 idSkipZeroes(gens);
2995 return (gens);
2996}
std::vector< std::vector< int > > Mabv(ideal h, poly a, poly b)
Definition: cohomo.cc:1153
std::vector< std::vector< poly > > idMakei(std::vector< std::vector< int > > mv, std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1956
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

◆ genstt()

BOOLEAN genstt ( leftv  res,
leftv  args 
)

Definition at line 4444 of file cohomo.cc.

4445{
4446 leftv h=args;
4447 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4448 {
4449 ideal h1= (ideal)h->Data();
4450 h = h->next;
4451 if((h != NULL)&&(h->Typ() == POLY_CMD))
4452 {
4453 poly p= (poly)h->Data();
4454 h = h->next;
4455 if((h != NULL)&&(h->Typ() == POLY_CMD))
4456 {
4457 poly q= (poly)h->Data();
4458 res->rtyp =IDEAL_CMD;
4459 res->data =genst(h1,p,q);
4460 }
4461 }
4462 }
4463 return false;
4464}
ideal genst(ideal h, poly a, poly b)
Definition: cohomo.cc:2981

◆ getpresolve()

ideal getpresolve ( ideal  h)

Definition at line 2119 of file cohomo.cc.

2120{
2121 //ring r=currRing;
2122 //assume (LIB "presolve.lib");
2123 sleftv a;a.Init();
2124 a.rtyp=IDEAL_CMD;a.data=(void*)h;
2125 idhdl solve=ggetid("elimlinearpart");
2126 if(solve==NULL)
2127 {
2128 WerrorS("presolve.lib are not loaded!");
2129 return NULL;
2130 }
2132 //PrintS("no errors here\n");
2133 if(sl)
2134 {
2135 WerrorS("error in solve!");
2136 }
2138 ideal re=(ideal)L->m[4].CopyD();
2139 //iiRETURNEXPR.CleanUp();
2141 //PrintS("no errors here\n");
2142 //idSkipZeroes(re);
2143 //id_print(re);
2144 return re;
2145}
int BOOLEAN
Definition: auxiliary.h:87
void * CopyD(int t)
Definition: subexpr.cc:710
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1154
void Init()
Definition: subexpr.h:107
void * data
Definition: subexpr.h:88
Definition: lists.h:24
sleftv * m
Definition: lists.h:46
idhdl ggetid(const char *n)
Definition: ipid.cc:581
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
Definition: iplib.cc:504
INST_VAR sleftv iiRETURNEXPR
Definition: iplib.cc:474
slists * lists
Definition: mpr_numeric.h:146

◆ getvector()

std::vector< std::vector< int > > getvector ( ideal  h,
int  n 
)

Definition at line 2196 of file cohomo.cc.

2197{
2198 std::vector<int> vec;
2199 std::vector<std::vector<int> > vecs;
2200 ideal h2=idCopy(h);
2201 if(!idIs0(h))
2202 {
2203 ideal h1=getpresolve(h2);
2204 poly q,e=pOne();
2205 int lg=IDELEMS(h1),n,i,j,t;
2206 std::vector<int> fvar=numfree(h1);
2207 n=fvar.size();
2208 if(n==0)
2209 {
2210 vec=make0(IDELEMS(h1));vecs.push_back(vec);//listsprint(vecs);
2211 }
2212 else
2213 {
2214 for(t=0;t<n;t++)
2215 {
2216 vec.clear();
2217 for(i=0;i<lg;i++)
2218 {
2219 q=pCopy(h1->m[i]);
2220 //pWrite(q);
2221 if(q==0)
2222 {
2223 vec.push_back(0);
2224 }
2225 else
2226 {
2227 q=p_Subst(q, fvar[t], e,currRing);
2228 //Print("the %dth variable was substituted by 1:\n",fvar[t]);
2229 //pWrite(q);
2230 for(j=0;j<n;j++)
2231 {
2232 //Print("the %dth variable was substituted by 0:\n",fvar[j]);
2233 q=p_Subst(q, fvar[j],0,currRing);
2234 //pWrite(q);
2235 }
2236 if(q==0)
2237 {
2238 vec.push_back(0);
2239 }
2240 else
2241 {
2242 vec.push_back(n_Int(pGetCoeff(q),currRing->cf));
2243 }
2244 }
2245 }
2246 //listprint(vec);
2247 vecs.push_back(vec);
2248 }
2249 }
2250 }
2251 else
2252 {vecs=canonicalbase(n);}
2253 //listsprint(vecs);
2254 return vecs;
2255}
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:547
std::vector< int > numfree(ideal h)
Definition: cohomo.cc:2149
ideal getpresolve(ideal h)
Definition: cohomo.cc:2119
std::vector< std::vector< int > > canonicalbase(int n)
Definition: cohomo.cc:2172
std::vector< int > make0(int n)
Definition: cohomo.cc:1389
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
poly p_Subst(poly p, int n, poly e, const ring r)
Definition: p_polys.cc:4074

◆ gpl()

std::vector< std::vector< int > > gpl ( ideal  h,
poly  a,
poly  b 
)

Definition at line 3197 of file cohomo.cc.

3198{
3199 int i,j,co;
3200 std::vector<std::vector<int> > hvs=supports(h),sbv,nv,mv,good,solve;
3201 std::vector<int> av=support1(a), bv=support1(b),index,bad,tnv;
3202 ideal sub=psubset(b);
3203 sbv=supports(sub);
3204 nv=Nabv(hvs,av,bv);
3205 mv=Mabv(h,a,b);
3206 ideal M=idMaken(mv);
3207 index = gensindex(M, idsrRing(h));
3208 int n=nv.size();
3209 ring r=currRing;
3210 t_begin=clock();
3211 if(n > 0)
3212 {
3213 tnv=tnab(hvs,nv,sbv);
3214 for(i=0;i<tnv.size();i++)
3215 {
3216 co=tnv[i];
3217 bad.push_back(co+1);
3218 }
3219 for(i=0;i<n;i++)
3220 {
3221 for(j=i+1;j<n;j++)
3222 {
3223 if(nabtconditionv(hvs,nv[i],nv[j]))
3224 {
3225 good=listsinsertlist(good,i+1,j+1);
3226 }
3227 else
3228 {
3229 ;
3230 }
3231 }
3232 }
3234 t_begin=clock();
3235 solve=eli2(n,bad,good);
3236 t_solve=t_solve+clock()-t_begin;
3237 if(bv.size()!=1)
3238 {;
3239 }
3240 else
3241 {
3242 std::vector<int> su=make1(n);
3243 std::vector<std::vector<int> > suu;
3244 suu.push_back(su);
3245 equmab(n);
3246 solve=vecqring(solve,suu);
3247 rChangeCurrRing(r);
3248 }
3249 }
3250 else
3251 {
3252 solve.clear();
3253 }
3254 //listsprint(solve);
3255 //sl->show(0,0);
3256 return solve;
3257}
VAR clock_t t_construct
Definition: cohomo.cc:3182
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
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 > > 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
VAR clock_t t_begin
Definition: cohomo.cc:3182
std::vector< std::vector< int > > listsinsertlist(std::vector< std::vector< int > > gset, int a, int b)
Definition: cohomo.cc:1825
std::vector< int > gensindex(ideal M, ideal ids)
Definition: cohomo.cc:2700
void equmab(int num)
Definition: cohomo.cc:1891
ideal psubset(poly p)
Definition: cohomo.cc:1801
std::vector< int > make1(int n)
Definition: cohomo.cc:1403
VAR clock_t t_solve
Definition: cohomo.cc:3182
ideal idsrRing(ideal h)
Definition: cohomo.cc:909
bool bad
Definition: facFactorize.cc:64
void rChangeCurrRing(ring r)
Definition: polys.cc:15

◆ gpl2()

std::vector< std::vector< int > > gpl2 ( ideal  h,
poly  a,
poly  b 
)

Definition at line 3343 of file cohomo.cc.

3344{
3345 int i,j,t,n;
3346 std::vector<std::vector<int> > hvs=supports(h),sbv,nv,mv,mts,vecs,vars,ntvs,solve;
3347 std::vector<int> av=support1(a), bv=support1(b),vec,var,tnv;
3348 ideal sub=psubset(b);
3349 sbv=supports(sub);
3350 nv=Nabv(hvs,av,bv);
3351 n=nv.size();
3352 tnv=tnab(hvs,nv,sbv);
3353 ring r=currRing;
3354 mv=Mabv(h,a,b);
3355 mts=mabtv(hvs,mv,av,bv);
3356 if(n>0)
3357 {
3358 ntvs=nabtv( hvs, nv, av, bv);
3359 int l=ntvs.size();
3360 if(l>0)
3361 {
3362 for(int t0=0;t0<l;t0++)
3363 {
3364 i=ntvs[t0][0];
3365 j=ntvs[t0][1];
3366 if(tNab(hvs,nv[i],sbv)&&tNab(hvs,nv[j],sbv))//condition 1
3367 {
3368 vec=makeequation(t0+1,0,0);
3369 vecs.push_back(vec);
3370 vec.clear();
3371 }
3372 for(int t1=t0+1;t1<ntvs.size();t1++)
3373 {
3374 for(int t2=t1+1;t2<ntvs.size();t2++)
3375 {
3376 if(ntvs[t0][0]==ntvs[t1][0]&&ntvs[t1][1]==ntvs[t2][1]&&ntvs[t0][1]==ntvs[t2][0])
3377 {
3378 i=ntvs[t0][0];
3379 j=ntvs[t0][1];
3380 t=ntvs[t1][1];
3381 if(condition2for2nv(hvs,nv[i],nv[j],nv[t]))
3382 {
3383 vec=makeequation(t0+1,t1+1,t2+1);
3384 vecs.push_back(vec);
3385 vec.clear();
3386 }
3387 }
3388 }
3389 }
3390 }
3391 if(n==1) {l=1;}
3392 equmab(l);
3393 ideal id_re=idMake3(vecs);
3394 std::vector<std::vector<int> > re=getvector(id_re,l);
3395 rChangeCurrRing(r);
3396 std::vector<std::vector<int> > sub=subspacetn(nv, tnv,ntvs);
3397 equmab(l);
3398 solve=vecqring(re, sub);
3399 rChangeCurrRing(r);
3400 }
3401 else
3402 {
3403 solve.clear();
3404 }
3405 }
3406 else
3407 solve.clear();
3408 return solve;
3409}
int l
Definition: cfEzgcd.cc:100
ideal idMake3(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1874
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)
Definition: cohomo.cc:2534
bool condition2for2nv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > qv, std::vector< int > fv)
Definition: cohomo.cc:2868
std::vector< std::vector< int > > subspacetn(std::vector< std::vector< int > > N, std::vector< int > tN, std::vector< std::vector< int > > ntvs)
Definition: cohomo.cc:2905
bool tNab(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< std::vector< int > > bvs)
Definition: cohomo.cc:2565
std::vector< std::vector< int > > getvector(ideal h, int n)
Definition: cohomo.cc:2196
std::vector< int > makeequation(int i, int j, int t)
Definition: cohomo.cc:1838

◆ 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");
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
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
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}
std::vector< std::vector< int > > minisolve(std::vector< std::vector< int > > solve, std::vector< int > index)
Definition: cohomo.cc:2735
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

◆ gradedpiece1nl()

intvec * gradedpiece1nl ( ideal  h,
poly  a,
poly  b,
int  set 
)

Definition at line 3262 of file cohomo.cc.

3263{
3264 t_start=clock();
3265 poly e=pOne();
3266 std::vector<int> av=support1(a),bv=support1(b),index, em;
3267 std::vector<std::vector<int> > solve, hvs=supports(h), lks=links(a,h), mv=Mabv(h,a,b), nvl;
3268 ideal id_links=idMaken(lks);
3269 ideal M=idMaken(mv);
3270 index = gensindex(M, idsrRing(h));
3271 solve=gpl(id_links,e,b);
3272 t_mark=clock();
3273 nvl=Nabv(lks,em,bv);
3274 solve=value1l(mv, nvl , solve, av, bv);
3275 if(set==1)
3276 {
3278 }
3279 intvec *sl=Tmat(solve);
3280 t_value=t_value+clock()-t_mark;
3281 t_total=t_total+clock()-t_start;
3282 return sl;
3283}
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)
Definition: cohomo.cc:3147
VAR clock_t t_start
Definition: cohomo.cc:3182
std::vector< std::vector< int > > links(poly a, ideal h)
Definition: cohomo.cc:1524
VAR clock_t t_mark
Definition: cohomo.cc:3182
VAR clock_t t_value
Definition: cohomo.cc:3182
VAR clock_t t_total
Definition: cohomo.cc:3182
std::vector< std::vector< int > > gpl(ideal h, poly a, poly b)
Definition: cohomo.cc:3197

◆ 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");
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
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 > > subspacet(std::vector< std::vector< int > > mv, std::vector< int > bv, std::vector< std::vector< int > > ntvs)
Definition: cohomo.cc:2322
void lpsprint(std::vector< std::vector< poly > > pvs)
Definition: cohomo.cc:114

◆ gradedpiece2n()

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

Definition at line 3005 of file cohomo.cc.

3006{
3007 int i,j,t,n;
3008 std::vector<std::vector<int> > hvs=supports(h),nv,mv,mts,sbv,vecs,vars,ntvs,solve;
3009 std::vector<int> av=support1(a), bv=support1(b),tnv,vec,var;
3010 ideal sub=psubset(b);
3011 sbv=supports(sub);
3012 nv=Nabv(hvs,av,bv);
3013 n=nv.size();
3014 tnv=tnab(hvs,nv,sbv);
3015 ring r=currRing;
3016 mv=Mabv(h,a,b);
3017 mts=mabtv(hvs,mv,av,bv);
3018 //PrintS("The relations are:\n");
3019 //listsprint(mts);
3020 //PrintS("The homomorphism should map onto:\n");
3021 //lpsprint(idMakei(mv,mts));
3022 if(n>0)
3023 {
3024 ntvs=nabtv( hvs, nv, av, bv);
3025 //PrintS("The current homomorphism map onto###:\n");
3026 //lpsprint(idMakei(nv,ntvs));
3027 int l=ntvs.size();
3028 for(int t0=0;t0<l;t0++)
3029 {
3030 i=ntvs[t0][0];
3031 j=ntvs[t0][1];
3032 if(tNab(hvs,nv[i],sbv)&&tNab(hvs,nv[j],sbv))//condition 1
3033 {
3034 vec=makeequation(t0+1,0,0);
3035 vecs.push_back(vec);
3036 vec.clear();
3037 }
3038 for(int t1=t0+1;t1<ntvs.size();t1++)
3039 {
3040 for(int t2=t1+1;t2<ntvs.size();t2++)
3041 {
3042 if(ntvs[t0][0]==ntvs[t1][0]&&ntvs[t1][1]==ntvs[t2][1]&&ntvs[t0][1]==ntvs[t2][0])
3043 {
3044 i=ntvs[t0][0];
3045 j=ntvs[t0][1];
3046 t=ntvs[t1][1];
3047 if(condition2for2nv(hvs,nv[i],nv[j],nv[t]))
3048 {
3049 vec=makeequation(t0+1,t1+1,t2+1);
3050 vecs.push_back(vec);
3051 vec.clear();
3052 }
3053 }
3054 }
3055 }
3056 }
3057 //PrintS("this is EQUATIONS:\n");
3058 //listsprint(vecs);
3059 if(n==1) l=1;
3060 equmab(l);
3061 ideal id_re=idMake3(vecs);
3062 //id_print(id_re);
3063 std::vector<std::vector<int> > re=getvector(id_re,l);
3064 //PrintS("this is the solution for ideal :\n");
3065 //listsprint(re);
3066 rChangeCurrRing(r);
3067 std::vector<std::vector<int> > sub=subspacetn(nv, tnv,ntvs);
3068 //PrintS("this is the solution for subspace:\n");
3069 //listsprint(sub);
3070 equmab(l);
3071 solve=vecqring(re, sub);
3072 //PrintS("This is the solution of coefficients:\n");
3073 //listsprint(solve);
3074 rChangeCurrRing(r);
3075 solve=value2(mv,nv,mts,ntvs,solve,av,bv);
3076 }
3077 else
3078 solve.clear();
3079 intvec *sl=Tmat(solve);
3080 return sl;
3081}
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)
Definition: cohomo.cc:2926

◆ gradedpiece2nl()

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

Definition at line 3416 of file cohomo.cc.

3417{
3418 poly e=pOne();
3419 std::vector<int> av=support1(a), bv=support1(b), em;
3420 std::vector<std::vector<int> > hvs=supports(h), mv=Mabv(h,a,b),mts,solve,lks,nvl,ntsl;
3421 mts=mabtv(hvs,mv,av,bv);
3422 lks=links(a,h);
3423 ideal id_links=idMaken(lks);
3424//PrintS("This is the links of a:\n"); id_print(id_links);
3425 nvl=Nabv(lks,em,bv);
3426//PrintS("This is the N set:\n"); id_print(idMaken(nvl));
3427 ntsl=nabtv(lks,nvl,em,bv);
3428//PrintS("This is N^2:\n"); listsprint(ntsl);
3429 solve=gpl2(id_links,e,b);
3430//PrintS("This is pre solution of N:\n"); listsprint(solve);
3431 if(solve.size() > 0)
3432 {
3433 solve=value2l(mv, nvl, mts, ntsl, solve, av, bv);
3434 }
3435//PrintS("This is solution of N:\n"); listsprint(solve);
3436 intvec *sl=Tmat(solve);
3437 return sl;
3438}
std::vector< std::vector< int > > gpl2(ideal h, poly a, poly b)
Definition: cohomo.cc:3343
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)
Definition: cohomo.cc:3289

◆ id_complement()

ideal id_complement ( ideal  h)

Definition at line 832 of file cohomo.cc.

833{
834 int j, vert=idvert(h);
835 ideal i1=id_sfmon(h);
836 ideal i3=idInit(1,1);
837 poly p;
838 for(j=0;j<IDELEMS(i1);j++)
839 {
840 p=pCopy(i1->m[j]);
841 if(pvert(p)<=vert)
842 {
843 idInsertPoly(i3, p);
844 }
845 }
846 ideal i2=idMinus(i3,h);
847 idSkipZeroes(i2);
848 return (i2);
849}
int idvert(ideal h)
Definition: cohomo.cc:634
int pvert(poly p)
Definition: cohomo.cc:656
ideal idMinus(ideal h1, ideal h2)
Definition: cohomo.cc:736

◆ id_maxdeg()

int id_maxdeg ( ideal  h)

Definition at line 889 of file cohomo.cc.

890{
891 int i,max;
892 max=pTotaldegree(h->m[0]);
893 for(i=1;i<IDELEMS(h);i++)
894 {
895 if(pTotaldegree(h->m[i]) > max)
896 max=pTotaldegree(h->m[i]);
897 }
898 return (max);
899}
static int max(int a, int b)
Definition: fast_mult.cc:264

◆ id_print()

void id_print ( ideal  h)

Definition at line 84 of file cohomo.cc.

85{
86 int i;
87 for(i=0;i<IDELEMS(h);i++)
88 {
89 Print(" [%d]\n",i+1);
90 pWrite(h->m[i]);
91 PrintLn();
92 }
93}
#define Print
Definition: emacs.cc:80
void pWrite(poly p)
Definition: polys.h:308
void PrintLn()
Definition: reporter.cc:310

◆ id_sfmon()

ideal id_sfmon ( ideal  h)

Definition at line 808 of file cohomo.cc.

809{
810 ideal asfmons,sfmons,mons;
811 int j, vert=idvert(h);
812 mons=id_MaxIdeal(1, currRing);
813 asfmons=sfreemon(mons,1);
814 for(j=2;j<=vert;j++)
815 {
816 mons=id_MaxIdeal(j, currRing);
817 sfmons=sfreemon(mons,j);
818 asfmons=id_Add(asfmons,sfmons,currRing);
819 }
820 return asfmons;
821}
ideal sfreemon(ideal h, int deg)
Definition: cohomo.cc:781
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2

◆ id_subsets()

std::vector< std::vector< int > > id_subsets ( std::vector< std::vector< int > >  vecs)

Definition at line 1642 of file cohomo.cc.

1643{
1644 int i,j;
1645 std::vector<std::vector<int> > vvs, res;
1646 for(i=0;i<vecs.size();i++)
1647 {
1648 vvs=b_subsets(vecs[i]);
1649 //listsprint(vvs);
1650 for(j=0;j<vvs.size();j++)
1651 {
1652 if(!vInvsl(vvs[j],res))
1653 res.push_back(vvs[j]);
1654 }
1655 }
1656 //listsprint(res);
1657 return (res);
1658}

◆ idadda()

ideal idadda ( ideal  h1,
ideal  h2 
)

Definition at line 964 of file cohomo.cc.

965{
966 ideal h=idInit(1,1);
967 for(int i=0;i<IDELEMS(h1);i++)
968 {
969 if(!IsInX(h1->m[i],h))
970 {
971 idInsertPoly(h, h1->m[i]);
972 }
973 }
974 for(int i=0;i<IDELEMS(h2);i++)
975 {
976 if(!IsInX(h2->m[i],h))
977 {
978 idInsertPoly(h, h2->m[i]);
979 }
980 }
982 return h;
983}
bool IsInX(poly p, ideal X)
Definition: cohomo.cc:856

◆ idcomplement()

BOOLEAN idcomplement ( leftv  res,
leftv  args 
)

Definition at line 4199 of file cohomo.cc.

4200{
4201 leftv h=args;
4202 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4203 {
4204 ideal hh=(ideal)h->Data();
4205 ideal h2= id_complement(hh);
4206 res->rtyp =IDEAL_CMD;
4207 res->data =h2;
4208 }
4209 return false;
4210}

◆ idMake()

ideal idMake ( std::vector< std::vector< int > >  vecs)

Definition at line 455 of file cohomo.cc.

456{
457 int lv=vecs.size(), i, j;
458 poly p;
459 ideal id_re=idInit(1,1);
460 for(i=0;i<lv;i++)
461 {
462 p=pMake(vecs[i]);
463 idInsertPoly(id_re, p);
464 }
465 idSkipZeroes(id_re);
466 return id_re;
467}
poly pMake(std::vector< int > vbase)
Definition: cohomo.cc:436

◆ idMake3()

ideal idMake3 ( std::vector< std::vector< int > >  vecs)

Definition at line 1874 of file cohomo.cc.

1875{
1876 ideal id_re=idInit(1,1);
1877 poly p;
1878 int i,lv=vecs.size();
1879 for(i=0;i<lv;i++)
1880 {
1881 p=pMake3(vecs[i]);
1882 idInsertPoly(id_re, p);
1883 }
1884 idSkipZeroes(id_re);
1885 return id_re;
1886}
poly pMake3(std::vector< int > vbase)
Definition: cohomo.cc:1855

◆ idMakei()

std::vector< std::vector< poly > > idMakei ( std::vector< std::vector< int > >  mv,
std::vector< std::vector< int > >  vecs 
)

Definition at line 1956 of file cohomo.cc.

1957{
1958 int i,lv=vecs.size();
1959 std::vector<std::vector<poly> > re;
1960 std::vector<poly> h;
1961 for(i=0;i<lv;i++)
1962 {
1963 h=pMakei(mv,vecs[i]);
1964 re.push_back(h);
1965 }
1966 //PrintS("This is the metrix M:\n");
1967 //listsprint(vecs);
1968 //PrintS("the ideal according to metrix M is:\n");
1969 return re;
1970}
std::vector< poly > pMakei(std::vector< std::vector< int > > mv, std::vector< int > vbase)
Definition: cohomo.cc:1940

◆ idMaken()

ideal idMaken ( std::vector< std::vector< int > >  vecs)

Definition at line 587 of file cohomo.cc.

588{
589 ideal id_re=idInit(1,1);
590 poly p;
591 int i,lv=vecs.size();
592 for(i=0;i<lv;i++)
593 {
594 p=pMaken(vecs[i]);
595 idInsertPoly(id_re, p);
596 }
597 idSkipZeroes(id_re);
598 //id_print(id_re);
599 return id_re;
600}
poly pMaken(std::vector< int > vbase)
Definition: cohomo.cc:573

◆ idMinus()

ideal idMinus ( ideal  h1,
ideal  h2 
)

Definition at line 736 of file cohomo.cc.

737{
738 ideal h=idInit(1,1);
739 int i,j,eq=0;
740 for(i=0;i<IDELEMS(h1);i++)
741 {
742 eq=0;
743 for(j=0;j<IDELEMS(h2);j++)
744 {
745 if(p_EqualPolys(pCopy(h1->m[i]),pCopy(h2->m[j]), currRing))
746 {
747 eq=1;
748 break;
749 }
750 }
751 if(eq==0)
752 {
753 idInsertPoly(h, pCopy(h1->m[i]));
754 }
755 }
757 return h;
758}
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4628

◆ idminus()

BOOLEAN idminus ( leftv  res,
leftv  args 
)

Definition at line 5097 of file cohomo.cc.

5098{
5099 leftv h=args;
5100 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5101 {
5102 ideal h1= (ideal)h->Data();
5103 h = h->next;
5104 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5105 {
5106 ideal h2= (ideal)h->Data();
5107 res->rtyp =IDEAL_CMD;
5108 res->data =idMinus(h1, h2);
5109 }
5110 }
5111 return false;
5112}

◆ idMinusp()

ideal idMinusp ( ideal  I,
poly  p 
)

Definition at line 3982 of file cohomo.cc.

3983{
3984 ideal h=idInit(1,1);
3985 int i;
3986 for(i=0;i<IDELEMS(I);i++)
3987 {
3988 if(!p_EqualPolys(I->m[i], p, currRing))
3989 {
3990 idInsertPoly(h, pCopy(I->m[i]));
3991 }
3992 }
3993 idSkipZeroes(h);
3994 return h;
3995}

◆ idmodulo()

ideal idmodulo ( ideal  h1,
ideal  h2 
)

Definition at line 474 of file cohomo.cc.

475{
476 int i;
477 ideal gb=kStd(h2,NULL,testHomog,NULL,NULL,0,0,NULL);
478 idSkipZeroes(gb);
479 ideal idq=kNF(gb,NULL,h1);
480 idSkipZeroes(idq);
481 return idq;
482}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3167
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2433
@ testHomog
Definition: structs.h:38

◆ idModulo()

BOOLEAN idModulo ( leftv  res,
leftv  args 
)

Definition at line 5079 of file cohomo.cc.

5080{
5081 leftv h=args;
5082 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5083 {
5084 ideal h1= (ideal)h->Data();
5085 h = h->next;
5086 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5087 {
5088 ideal h2= (ideal)h->Data();
5089 res->rtyp =IDEAL_CMD;
5090 res->data =idmodulo(h1, h2);
5091 }
5092 }
5093 return false;
5094}
ideal idmodulo(ideal h1, ideal h2)
Definition: cohomo.cc:474

◆ 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

◆ 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}
ideal qringadd(ideal h1, ideal h2, int deg)
Definition: cohomo.cc:877

◆ idvert()

int idvert ( ideal  h)

Definition at line 634 of file cohomo.cc.

635{
636 int i, j, vert=0;
637 if(idIs0(h))
638 return vert;
639 for(i=currRing->N;i>0;i--)
640 {
641 for(j=0;j<IDELEMS(h);j++)
642 {
643 if(pGetExp(h->m[j],i)>0)
644 {
645 vert=i;
646 return vert;
647 }
648 }
649 }
650 return vert;
651}

◆ ifIso()

int ifIso ( poly  p,
poly  q,
poly  f,
poly  g,
poly  a,
poly  b 
)

Definition at line 3968 of file cohomo.cc.

3969{
3970 std::vector<int> va=support1(a), vb=support1(b), vp=support1(p), vq=support1(q), vf=support1(f), vg=support1(g);
3971 std::vector<int> v1=phimagel(vp, va, vb), v2=phimagel(vq, va, vb), v3=phimagel(vf, va, vb), v4=phimagel(vg, va, vb);
3972 if((vEvl(v1, v3)&& vEvl(v2,v4))||(vEvl(v1, v4)&& vEvl(v2,v3)) )
3973 {
3974 return (1);
3975 }
3976 return (0);
3977}
g
Definition: cfModGcd.cc:4090
FILE * f
Definition: checklibs.c:9
std::vector< int > phimagel(std::vector< int > fv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:3135
bool vEvl(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:220

◆ ifIsomorphism()

BOOLEAN ifIsomorphism ( leftv  res,
leftv  args 
)

Definition at line 5145 of file cohomo.cc.

5146{
5147 leftv h=args;
5148 if((h != NULL)&&(h->Typ() == POLY_CMD))
5149 {
5150 poly p= (poly)h->Data();
5151 h = h->next;
5152 if((h != NULL)&&(h->Typ() == POLY_CMD))
5153 {
5154 poly q= (poly)h->Data();
5155 h = h->next;
5156 if((h != NULL)&&(h->Typ() == POLY_CMD))
5157 {
5158 poly f= (poly)h->Data();
5159 h = h->next;
5160 if((h != NULL)&&(h->Typ() == POLY_CMD))
5161 {
5162 poly g= (poly)h->Data();
5163 h = h->next;
5164 if((h != NULL)&&(h->Typ() == POLY_CMD))
5165 {
5166 poly a= (poly)h->Data();
5167 h = h->next;
5168 if((h != NULL)&&(h->Typ() == POLY_CMD))
5169 {
5170 poly b= (poly)h->Data();
5171 res->rtyp =INT_CMD;
5172 res->data =(void *)(long)ifIso(p,q,f,g, a, b);
5173 }
5174 }
5175 }
5176 }
5177 }
5178 }
5179 return false;
5180}
int ifIso(poly p, poly q, poly f, poly g, poly a, poly b)
Definition: cohomo.cc:3968

◆ IsinL()

bool IsinL ( int  a,
std::vector< int >  vec 
)

Definition at line 143 of file cohomo.cc.

144{
145 int i;
146 for(i=0;i<vec.size();i++)
147 {
148 if(a==vec[i])
149 {
150 return true;
151 }
152 }
153 return false;
154}

◆ IsInX()

bool IsInX ( poly  p,
ideal  X 
)

Definition at line 856 of file cohomo.cc.

857{
858 int i;
859 for(i=0;i<IDELEMS(X);i++)
860 {
861 if(pEqualPolys(p,X->m[i]))
862 {
863 //PrintS("yes\n");
864 return(true);
865 }
866 }
867 //PrintS("no\n");
868 return(false);
869}
#define pEqualPolys(p1, p2)
Definition: polys.h:400

◆ isoNum()

int isoNum ( poly  p,
ideal  I,
poly  a,
poly  b 
)

Definition at line 3948 of file cohomo.cc.

3949{
3950 int i;
3951 std::vector<std::vector<int> > vs=supports(idCopy(I));
3952 std::vector<int> v1=support1(a), v2=support1(b), v=support1(p);
3953 std::vector<int> vp, iv=phimagel(v, v1, v2);
3954 for(i=0;i<IDELEMS(I);i++)
3955 {
3956 vp=support1(pCopy(I->m[i]));
3957 if(vEvl(iv, phimagel(vp, v1, v2)))
3958 {
3959 return (i+1);
3960 }
3961 }
3962 return (0);
3963}

◆ isoNumber()

BOOLEAN isoNumber ( leftv  res,
leftv  args 
)

Definition at line 5116 of file cohomo.cc.

5117{
5118 leftv h=args;
5119 if((h != NULL)&&(h->Typ() == POLY_CMD))
5120 {
5121 poly p= (poly)h->Data();
5122 h = h->next;
5123 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5124 {
5125 ideal h1= (ideal)h->Data();
5126 h = h->next;
5127 if((h != NULL)&&(h->Typ() == POLY_CMD))
5128 {
5129 poly a= (poly)h->Data();
5130 h = h->next;
5131 if((h != NULL)&&(h->Typ() == POLY_CMD))
5132 {
5133 poly b= (poly)h->Data();
5134 res->rtyp =INT_CMD;
5135 res->data =(void *)(long)isoNum(p, h1, a, b);
5136 }
5137 }
5138 }
5139 }
5140 return false;
5141}
int isoNum(poly p, ideal I, poly a, poly b)
Definition: cohomo.cc:3948

◆ isSim()

BOOLEAN isSim ( leftv  res,
leftv  args 
)

Definition at line 4531 of file cohomo.cc.

4532{
4533 leftv h=args;
4534 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4535 {
4536 ideal h1= (ideal)h->Data();
4537 res->rtyp =IDEAL_CMD;
4538 res->data =IsSimplex(h1);
4539 }
4540 return false;
4541}
ideal IsSimplex(ideal h)
Definition: cohomo.cc:989

◆ IsSimplex()

ideal IsSimplex ( ideal  h)

Definition at line 989 of file cohomo.cc.

990{
991 int i,max=id_maxdeg(h);
992 poly e=pOne();
993 ideal id_re, id_so=idCopy(h);
994 for(i=0;i<IDELEMS(h);i++)
995 {
996 id_re=SimFacset(h->m[i]);
997 if(!idIs0(id_re))
998 {
999 id_so=idadda(id_so, id_re);//idAdd(id_so,id_re);
1000 }
1001 }
1002 idInsertPoly(id_so,e);
1003 idSkipZeroes(id_so);
1004 return (idMinus(id_so,h));
1005}
int id_maxdeg(ideal h)
Definition: cohomo.cc:889
ideal SimFacset(poly p)
Definition: cohomo.cc:940
ideal idadda(ideal h1, ideal h2)
Definition: cohomo.cc:964

◆ keeporder()

std::vector< int > keeporder ( std::vector< int >  vec)

Definition at line 1229 of file cohomo.cc.

1230{
1231 std::vector<int> yaya;
1232 int n;
1233 if(vec[0]>vec[1])
1234 {
1235 n=vec[0];
1236 vec[0]=vec[1];
1237 vec[1]=n;
1238 }
1239 return vec;
1240}

◆ linkn()

BOOLEAN linkn ( leftv  res,
leftv  args 
)

Definition at line 4846 of file cohomo.cc.

4847{
4848 leftv h=args;
4849 if((h != NULL)&&(h->Typ() == POLY_CMD))
4850 {
4851 poly a= (poly)h->Data();
4852 h = h->next;
4853 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4854 {
4855 ideal Xo= (ideal)h->Data();
4856 h = h->next;
4857 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4858 {
4859 ideal Sigma= (ideal)h->Data();
4860 h = h->next;
4861 if((h != NULL)&&(h->Typ() == INT_CMD))
4862 {
4863 int vert= (int)(long)h->Data();
4864 h = h->next;
4865 if((h != NULL)&&(h->Typ() == INT_CMD))
4866 {
4867 int ord= (int)(long)h->Data();
4868 res->rtyp =IDEAL_CMD;
4869 res->data =idMaken(links_new(a, Xo, Sigma, vert, ord));
4870 }
4871 }
4872 }
4873 }
4874 }
4875 return false;
4876}
std::vector< std::vector< int > > links_new(poly a, ideal Xo, ideal Sigma, int vert, int ord)
Definition: cohomo.cc:3904

◆ Links()

BOOLEAN Links ( leftv  res,
leftv  args 
)

Definition at line 4513 of file cohomo.cc.

4514{
4515 leftv h=args;
4516 if((h != NULL)&&(h->Typ() == POLY_CMD))
4517 {
4518 poly p= (poly)h->Data();
4519 h = h->next;
4520 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4521 {
4522 ideal h1= (ideal)h->Data();
4523 res->rtyp =IDEAL_CMD;
4524 std::vector<std::vector<int> > vecs=links(p,h1);
4525 res->data =idMaken(vecs);
4526 }
4527 }
4528 return false;
4529}

◆ links()

std::vector< std::vector< int > > links ( poly  a,
ideal  h 
)

Definition at line 1524 of file cohomo.cc.

1525{
1526 int i;
1527 std::vector<std::vector<int> > lk,X=supports(h);
1528 std::vector<int> U,In,av=support1(a);
1529 for(i=0;i<X.size();i++)
1530 {
1531 U=vecUnion(av,X[i]);
1532 In=vecIntersection(av,X[i]);
1533 if( In.size()==0 && vInvsl(U,X))
1534 {
1535 //PrintS("The union of them is FACE and intersection is EMPTY!\n");
1536 lk.push_back(X[i]);
1537 }
1538 else
1539 {
1540 ;
1541 }
1542 }
1543 return lk;
1544}

◆ links_new()

std::vector< std::vector< int > > links_new ( poly  a,
ideal  Xo,
ideal  Sigma,
int  vert,
int  ord 
)

Definition at line 3904 of file cohomo.cc.

3905{
3906 std::vector<int> av=support1(a);
3907 std::vector<std::vector<int> > lko, lkn, lk1, lk2;
3908 lko=links(a, Xo);
3909 if(ord==1)
3910 return lko;
3911 if(ord==2)
3912 {
3913 lk1=phi1(a, Sigma);
3914 lk2=phi2(a, Xo, Sigma);
3915 lkn=vsMinusvs(lko, lk1);
3916 lkn=vsUnion(lkn, lk2);
3917 return lkn;
3918 }
3919 if(ord==3)
3920 {
3921 lkn=phi2(a, Xo, Sigma);
3922 return lkn;
3923 }
3924 WerrorS("Cannot find the links smartly!");
3925 return lko;
3926}
std::vector< std::vector< int > > phi1(poly a, ideal Sigma)
Definition: cohomo.cc:3868
static std::vector< std::vector< int > > phi2(poly a, ideal Xo, ideal Sigma)
Definition: cohomo.cc:3886

◆ listprint()

void listprint ( std::vector< int >  vec)

Definition at line 49 of file cohomo.cc.

50{
51 int i;
52 for(i=0;i<vec.size();i++)
53 {
54 Print(" _[%d]=%d\n",i+1,vec[i]);
55 PrintLn();
56 }
57 if(vec.size()==0)
58 {
59 PrintS(" _[1]= \n");
60 PrintLn();
61 }
62}

◆ listsinsertlist()

std::vector< std::vector< int > > listsinsertlist ( std::vector< std::vector< int > >  gset,
int  a,
int  b 
)

Definition at line 1825 of file cohomo.cc.

1826{
1827 std::vector<int> eq;
1828 eq.push_back(a);
1829 eq.push_back(b);
1830 gset.push_back(eq);
1831 return gset;
1832}

◆ listsprint()

void listsprint ( std::vector< std::vector< int > >  posMat)

Definition at line 65 of file cohomo.cc.

66{
67 int i,j;
68 for(i=0;i<posMat.size();i++)
69 {
70 Print("[%d]:\n",i+1);
71 listprint(posMat[i]);
72 Print("\n");
73 PrintLn();
74 }
75 if(posMat.size()==0)
76 {
77 PrintS("[1]:\n");
78 PrintLn();
79 }
80}
void listprint(std::vector< int > vec)
Definition: cohomo.cc:49

◆ lpprint()

void lpprint ( std::vector< poly >  pv)

Definition at line 97 of file cohomo.cc.

98{
99 for(int i=0;i<pv.size();i++)
100 {
101 Print(" _[%d]=",i+1);
102 pWrite(pv[i]);
103 }
104 if(pv.size()==0)
105 {
106 PrintS(" _[1]= \n");
107 PrintLn();
108 }
109}

◆ lpsprint()

void lpsprint ( std::vector< std::vector< poly > >  pvs)

Definition at line 114 of file cohomo.cc.

115{
116 for(int i=0;i<pvs.size();i++)
117 {
118 Print("[%d]:\n",i+1);
119 lpprint(pvs[i]);
120 Print("\n");
121 PrintLn();
122 }
123 if(pvs.size()==0)
124 {
125 PrintS("[1]:\n");
126 PrintLn();
127 }
128}
void lpprint(std::vector< poly > pv)
Definition: cohomo.cc:97

◆ mabconditionv()

bool mabconditionv ( std::vector< std::vector< int > >  hvs,
std::vector< int >  pv,
std::vector< int >  av,
std::vector< int >  bv 
)

Definition at line 1140 of file cohomo.cc.

1141{
1142 std::vector<int> uv=vecUnion(pv,av);
1143 uv=vecMinus(uv,bv);
1144 if(vInvsl(uv,hvs))
1145 {
1146 return(true);
1147 }
1148 return(false);
1149}

◆ 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 at line 2340 of file cohomo.cc.

2341{
2342 std::vector<int> v1,var;
2343 std::vector<std::vector<int> > vars;
2344 for(int i=0;i<Mv.size();i++)
2345 {
2346 for(int j=i+1;j<Mv.size();j++)
2347 {
2348 var.clear();
2349 v1=vecUnion(Mv[i],Mv[j]);
2350 if(mabconditionv(hvs, v1, av, bv))
2351 {
2352 var.push_back(i);
2353 var.push_back(j);
2354 vars.push_back(var);
2355 }
2356 }
2357 }
2358 return vars;
2359}

◆ Mabv()

std::vector< std::vector< int > > Mabv ( ideal  h,
poly  a,
poly  b 
)

Definition at line 1153 of file cohomo.cc.

1154{
1155 std::vector<int> av=support1(a), bv=support1(b), pv, vec;
1156 ideal h2=id_complement(h);
1157 std::vector<std::vector<int> > hvs=supports(h), h2v=supports(h2), vecs;
1158 for(int i=0;i<h2v.size();i++)
1159 {
1160 pv=h2v[i];
1161 if(mabconditionv(hvs,pv,av,bv))
1162 {
1163 vecs.push_back(pv);
1164 }
1165 }
1166 return vecs;
1167}

◆ mabvl()

BOOLEAN mabvl ( leftv  res,
leftv  args 
)

Definition at line 4787 of file cohomo.cc.

4788{
4789 leftv h=args;
4790 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4791 {
4792 ideal h1= (ideal)h->Data();
4793 h = h->next;
4794 if((h != NULL)&&(h->Typ() == POLY_CMD))
4795 {
4796 poly p= (poly)h->Data();
4797 h = h->next;
4798 if((h != NULL)&&(h->Typ() == POLY_CMD))
4799 {
4800 poly q= (poly)h->Data();
4801 res->rtyp =IDEAL_CMD;
4802 res->data =idMaken(Mabv(h1,p,q));
4803 }
4804 }
4805 }
4806 return false;
4807}

◆ make0()

std::vector< int > make0 ( int  n)

Definition at line 1389 of file cohomo.cc.

1390{
1391 int i;
1392 std::vector<int> vec;
1393 for(i=0;i<n;i++)
1394 {
1395 vec.push_back(0);
1396 }
1397 return vec;
1398}

◆ make1()

std::vector< int > make1 ( int  n)

Definition at line 1403 of file cohomo.cc.

1404{
1405 int i;
1406 std::vector<int> vec;
1407 for(i=0;i<n;i++)
1408 {
1409 vec.push_back(1);
1410 }
1411 return vec;
1412}

◆ makeequation()

std::vector< int > makeequation ( int  i,
int  j,
int  t 
)

Definition at line 1838 of file cohomo.cc.

1839{
1840 std::vector<int> equation;
1841 equation.push_back(i);
1842 equation.push_back(j);
1843 equation.push_back(t);
1844 //listprint(equation);
1845 return equation;
1846}

◆ makemab()

ideal makemab ( ideal  h,
poly  a,
poly  b 
)

Definition at line 4000 of file cohomo.cc.

4001{
4002 std::vector<std::vector<int> > mv=Mabv(h,a,b);
4003 ideal M=idMaken(mv);
4004 return M;
4005}

◆ makeSimplex()

BOOLEAN makeSimplex ( leftv  res,
leftv  args 
)

Definition at line 4337 of file cohomo.cc.

4338{
4339 leftv h=args;
4340 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4341 {
4342 ideal h1= (ideal)h->Data();
4343 res->rtyp =IDEAL_CMD;
4344 res->data =complementsimplex(h1);
4345 }
4346 return false;
4347}
ideal complementsimplex(ideal h)
Definition: cohomo.cc:1011

◆ mingens()

ideal mingens ( ideal  h,
poly  a,
poly  b 
)

Definition at line 2719 of file cohomo.cc.

2720{
2721 int i;
2722 std::vector<std::vector<int> > mv=Mabv(h,a,b);
2723 ideal M=idMaken(mv), hi=idInit(1,1);
2724 std::vector<int> index = gensindex(M, idsrRing(h));
2725 for(i=0;i<index.size();i++)
2726 {
2727 idInsertPoly(hi,M->m[index[i]]);
2728 }
2729 idSkipZeroes(hi);
2730 return (hi);
2731}

◆ minisolve()

std::vector< std::vector< int > > minisolve ( std::vector< std::vector< int > >  solve,
std::vector< int >  index 
)

Definition at line 2735 of file cohomo.cc.

2736{
2737 int i,j;
2738 std::vector<int> vec,solm;
2739 std::vector<std::vector<int> > solsm;
2740 for(i=0;i<solve.size();i++)
2741 {
2742 vec=solve[i];
2743 for(j=0;j<vec.size();j++)
2744 {
2745 if(IsinL(j,index))
2746 solm.push_back(vec[j]);
2747 }
2748 solsm.push_back(solm);
2749 solm.clear();
2750 }
2751 return (solsm);
2752}

◆ nabconditionv()

bool nabconditionv ( std::vector< std::vector< int > >  hvs,
std::vector< int >  pv,
std::vector< int >  av,
std::vector< int >  bv 
)

Definition at line 2480 of file cohomo.cc.

2481{
2482 std::vector<int> vec1=vecIntersection(pv,bv), vec2=vecUnion(pv,bv);
2483 int s1=vec1.size();
2484 if(!vInvsl(vec2,hvs) && s1==0 && vsubset(av,pv))
2485 {
2486 //PrintS("nab condition satisfied\n");
2487 return(true);
2488 }
2489 //PrintS("nab condition not satisfied\n");
2490 return(false);
2491}

◆ nabtconditionv()

static bool nabtconditionv ( std::vector< std::vector< int > >  hvs,
std::vector< int >  pv,
std::vector< int >  qv 
)
static

Definition at line 2521 of file cohomo.cc.

2522{
2523 std::vector<int> v1;
2524 v1=vecUnion(pv,qv);
2525 if(vInvsl(v1,hvs))
2526 {
2527 return (true);
2528 }
2529 return (false);
2530}

◆ nabtv()

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 
)

Definition at line 2534 of file cohomo.cc.

2535{
2536 std::vector<int> v1,var;
2537 std::vector<std::vector<int> > vars;
2538 for(int i=0;i<Nv.size();i++)
2539 {
2540 for(int j=i+1;j<Nv.size();j++)
2541 {
2542 var.clear();
2543 if(nabtconditionv(hvs, Nv[i], Nv[j]))
2544 {
2545 var.push_back(i);
2546 var.push_back(j);
2547 vars.push_back(var);
2548 }
2549 }
2550 }
2551 return vars;
2552}

◆ nabtvl()

BOOLEAN nabtvl ( leftv  res,
leftv  args 
)

Definition at line 4811 of file cohomo.cc.

4812{
4813 leftv h=args;
4814 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4815 {
4816 ideal h1= (ideal)h->Data();
4817 h = h->next;
4818 if((h != NULL)&&(h->Typ() == POLY_CMD))
4819 {
4820 poly p= (poly)h->Data();
4821 h = h->next;
4822 if((h != NULL)&&(h->Typ() == POLY_CMD))
4823 {
4824 poly q= (poly)h->Data();
4825 std::vector<std::vector<int> > hvs=supports(h1), nv, ntvs;
4826 std::vector<int> av=support1(p), bv=support1(q);
4827 nv=Nabv(hvs,av,bv);
4828 ntvs=nabtv( hvs, nv, av, bv);
4829 std::vector<std::vector<poly> > pvs=idMakei(nv,ntvs);
4830 ideal gens=idInit(1,1);
4831 for(int i=0;i<pvs.size();i++)
4832 {
4833 idInsertPoly(gens,pvs[i][0]);
4834 idInsertPoly(gens,pvs[i][1]);
4835 }
4836 idSkipZeroes(gens);
4837 res->rtyp =IDEAL_CMD;
4838 res->data =gens;
4839 }
4840 }
4841 }
4842 return false;
4843}

◆ Nabv()

std::vector< std::vector< int > > Nabv ( std::vector< std::vector< int > >  hvs,
std::vector< int >  av,
std::vector< int >  bv 
)

Definition at line 2499 of file cohomo.cc.

2500{
2501 std::vector<std::vector<int> > vecs;
2502 int num=hvs.size();
2503 for(int i=0;i<num;i++)
2504 {
2505 if(nabconditionv(hvs,hvs[i],av,bv))
2506 {
2507 //PrintS("satisfy:\n");
2508 vecs.push_back(hvs[i]);
2509 }
2510 }
2511 return vecs;
2512}
bool nabconditionv(std::vector< std::vector< int > > hvs, std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:2480

◆ nabvl()

BOOLEAN nabvl ( leftv  res,
leftv  args 
)

Definition at line 4709 of file cohomo.cc.

4710{
4711 leftv h=args;
4712 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4713 {
4714 ideal h1= (ideal)h->Data();
4715 h = h->next;
4716 if((h != NULL)&&(h->Typ() == POLY_CMD))
4717 {
4718 poly p= (poly)h->Data();
4719 h = h->next;
4720 if((h != NULL)&&(h->Typ() == POLY_CMD))
4721 {
4722 poly q= (poly)h->Data();
4723 res->rtyp =IDEAL_CMD;
4724 std::vector<std::vector<int> > vecs=supports(h1);
4725 std::vector<int> pv=support1(p), qv=support1(q);
4726 res->data =idMaken(Nabv(vecs,pv,qv));
4727 }
4728 }
4729 }
4730 return false;
4731}

◆ newDegree()

BOOLEAN newDegree ( leftv  res,
leftv  args 
)

Definition at line 5183 of file cohomo.cc.

5184{
5185 leftv h=args;
5186 if((h != NULL)&&(h->Typ() == POLY_CMD))
5187 {
5188 poly p= (poly)h->Data();
5189 h = h->next;
5190 if((h != NULL)&&(h->Typ() == INT_CMD))
5191 {
5192 int num= (int)(long)h->Data();
5193 res->rtyp =INT_CMD;
5194 res->data =(void *)(long)redefinedeg( p, num);
5195 }
5196 }
5197 return false;
5198}
int redefinedeg(poly p, int num)
Definition: cohomo.cc:1548

◆ nfaces1()

BOOLEAN nfaces1 ( leftv  res,
leftv  args 
)

Definition at line 4544 of file cohomo.cc.

4545{
4546 leftv h=args;
4547 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4548 {
4549 ideal h1= (ideal)h->Data();
4550 h = h->next;
4551 if((h != NULL)&&(h->Typ() == POLY_CMD))
4552 {
4553 poly p= (poly)h->Data();
4554 h = h->next;
4555 if((h != NULL)&&(h->Typ() == INT_CMD))
4556 {
4557 int d= (int)(long)h->Data();
4558 res->rtyp =IDEAL_CMD;
4559 res->data =triangulations1(h1, p, d);
4560 }
4561 }
4562 }
4563 return false;
4564}
ideal triangulations1(ideal h, poly p, int vert)
Definition: cohomo.cc:3516

◆ nfaces2()

BOOLEAN nfaces2 ( leftv  res,
leftv  args 
)

Definition at line 4567 of file cohomo.cc.

4568{
4569 leftv h=args;
4570 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4571 {
4572 ideal h1= (ideal)h->Data();
4573 h = h->next;
4574 if((h != NULL)&&(h->Typ() == POLY_CMD))
4575 {
4576 poly p= (poly)h->Data();
4577 h = h->next;
4578 if((h != NULL)&&(h->Typ() == POLY_CMD))
4579 {
4580 poly q= (poly)h->Data();
4581 h = h->next;
4582 if((h != NULL)&&(h->Typ() == INT_CMD))
4583 {
4584 int d= (int)(long)h->Data();
4585 res->rtyp =IDEAL_CMD;
4586 res->data =triangulations2(h1,p,q,d);
4587 }
4588 }
4589 }
4590 }
4591 return false;
4592}
ideal triangulations2(ideal h, poly p, poly q, int vert)
Definition: cohomo.cc:3614

◆ nfaces3()

BOOLEAN nfaces3 ( leftv  res,
leftv  args 
)

Definition at line 4595 of file cohomo.cc.

4596{
4597 leftv h=args;
4598 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4599 {
4600 ideal h1= (ideal)h->Data();
4601 h = h->next;
4602 if((h != NULL)&&(h->Typ() == POLY_CMD))
4603 {
4604 poly p= (poly)h->Data();
4605 h = h->next;
4606 if((h != NULL)&&(h->Typ() == POLY_CMD))
4607 {
4608 poly q= (poly)h->Data();
4609 h = h->next;
4610 if((h != NULL)&&(h->Typ() == POLY_CMD))
4611 {
4612 poly g= (poly)h->Data();
4613 h = h->next;
4614 if((h != NULL)&&(h->Typ() == INT_CMD))
4615 {
4616 int d= (int)(long)h->Data();
4617 res->rtyp =IDEAL_CMD;
4618 res->data =triangulations3(h1,p,q,g,d);
4619 }
4620 }
4621 }
4622 }
4623 }
4624 return false;
4625}
ideal triangulations3(ideal h, poly p, poly q, poly g, int vert)
Definition: cohomo.cc:3678

◆ nonf2f()

BOOLEAN nonf2f ( leftv  res,
leftv  args 
)

Definition at line 5202 of file cohomo.cc.

5203{
5204 leftv h=args;
5205 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5206 {
5207 ideal h1= (ideal)h->Data();
5208 res->rtyp =IDEAL_CMD;
5209 res->data =complementsimplex(h1);
5210 }
5211 return false;
5212}

◆ num4dim()

int num4dim ( ideal  h,
int  n 
)

Definition at line 1050 of file cohomo.cc.

1051{
1052 int num=0;
1053 for(int i=0; i<IDELEMS(h); i++)
1054 {
1055 if(pTotaldegree(h->m[i])==n)
1056 {
1057 num++;
1058 }
1059 }
1060 return num;
1061}

◆ numdim()

BOOLEAN numdim ( leftv  res,
leftv  args 
)

Definition at line 5230 of file cohomo.cc.

5231{
5232 leftv h=args;
5233 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5234 {
5235 ideal h1= (ideal)h->Data();
5236 h = h->next;
5237 if((h != NULL)&&(h->Typ() == INT_CMD))
5238 {
5239 int num= (int)(long)h->Data();
5240 res->rtyp =INT_CMD;
5241 res->data =(void *)(long)num4dim( h1, num);
5242 }
5243 }
5244 return false;
5245}
int num4dim(ideal h, int n)
Definition: cohomo.cc:1050

◆ numfree()

std::vector< int > numfree ( ideal  h)

Definition at line 2149 of file cohomo.cc.

2150{
2151 int i,j;
2152 std::vector<int> fvar;
2153 for(j=1;j<=currRing->N;j++)
2154 {
2155 for(i=0;i<IDELEMS(h);i++)
2156 {
2157 if(vInp(j,h->m[i]))
2158 {
2159 fvar.push_back(j);
2160 break;
2161 }
2162 }
2163 }
2164 //Print("There are %d free variables in total\n",num);
2165 return fvar;
2166}
bool vInp(int m, poly p)
Definition: cohomo.cc:505

◆ ofindbases()

std::vector< std::vector< int > > ofindbases ( int  num,
std::vector< int >  bset,
std::vector< std::vector< int > >  gset 
)

Definition at line 1442 of file cohomo.cc.

1443{
1444 int i,m;
1445 std::vector<std::vector<int> > bases;
1446 std::vector<int> fvars=freevars(num, bset, gset), base1;
1447 if (fvars.size()==0)
1448 {
1449 base1=make0(num);
1450 bases.push_back(base1);
1451 }
1452 else
1453 {
1454 for(i=0;i<fvars.size();i++)
1455 {
1456 m=fvars[i];
1457 base1=ofindbases1(num, m, bset, gset);
1458 bases.push_back(base1);
1459 }
1460 }
1461 //PrintS("They are the bases for the solution space:\n");
1462 //listsprint(bases);
1463 return bases;
1464}
std::vector< int > ofindbases1(int num, int vnum, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1419
std::vector< int > freevars(int n, std::vector< int > bset, std::vector< std::vector< int > > gset)
Definition: cohomo.cc:1278

◆ ofindbases1()

std::vector< int > ofindbases1 ( int  num,
int  vnum,
std::vector< int >  bset,
std::vector< std::vector< int > >  gset 
)

Definition at line 1419 of file cohomo.cc.

1420{
1421 std::vector<std::vector<int> > goodset;
1422 std::vector<int> fvars=freevars(num, bset, gset), oset, base;
1423 std::vector<int> zset=fvarsvalue(vnum, fvars);
1424 zset=vecUnion(zset,bset);
1425 oset.push_back(vnum);
1426 goodset=vAbsorb(oset, gset);
1427 oset=goodset[goodset.size()-1];
1428 goodset.erase(goodset.end());
1429 base= vecbase1(num, oset);
1430 return base;
1431}
std::vector< int > fvarsvalue(int vnum, std::vector< int > fvars)
Definition: cohomo.cc:1302
std::vector< int > vecbase1(int num, std::vector< int > oset)
Definition: cohomo.cc:1371
char N base
Definition: ValueTraits.h:144

◆ p_a()

ideal p_a ( ideal  h)

Definition at line 1569 of file cohomo.cc.

1570{
1571 poly p;
1572 int i,j,deg=0,deg0;
1573 ideal aset=idCopy(h),ia,h1=idsrRing(h);
1574//PrintS("idsrRing is:\n");id_print(h1);
1575 std::vector<int> as;
1576 std::vector<std::vector<int> > hvs=supports(h);
1577 for(i=0;i<IDELEMS(h1);i++)
1578 {
1579 deg0=pTotaldegree(h1->m[i]);
1580 if(deg < deg0)
1581 deg=deg0;
1582 }
1583 for(i=2;i<=deg;i++)
1584 {
1585 ia=id_MaxIdeal(i, currRing);
1586 for(j=0;j<IDELEMS(ia);j++)
1587 {
1588 p=pCopy(ia->m[j]);
1589 if(!IsInX(p,h))
1590 {
1591 as=support1(p);
1592 if(vInvsl(as,hvs))
1593 {
1594 idInsertPoly(aset, p);
1595 }
1596 }
1597 }
1598 }
1599 idSkipZeroes(aset);
1600 return(aset);
1601}

◆ p_b()

ideal p_b ( ideal  h,
poly  a 
)

Definition at line 1686 of file cohomo.cc.

1687{
1688 std::vector<std::vector<int> > pbv,lk=links(a,h), res;
1689 std::vector<int> vert=vertset(lk), bv;
1690 res=b_subsets(vert);
1691 int i, adg=pTotaldegree(a);
1692 poly e=pOne();
1693 ideal idd=idInit(1,1);
1694 for(i=0;i<res.size();i++)
1695 {
1696 if(res[i].size()==adg)
1697 pbv.push_back(res[i]);
1698 }
1699 if(pEqualPolys(a,e))
1700 {
1701 idInsertPoly(idd, e);
1702 idSkipZeroes(idd);
1703 return (idd);
1704 }
1705 idd=idMaken(pbv);
1706 return(idd);
1707}
std::vector< int > vertset(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:1663

◆ p_change()

std::vector< std::vector< int > > p_change ( ideal  Sigma)

Definition at line 3787 of file cohomo.cc.

3788{
3789 std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs;
3790 fvs=vs_subsets(ss);
3791 return (fvs);
3792}
std::vector< std::vector< int > > vs_subsets(std::vector< std::vector< int > > vs)
Definition: cohomo.cc:3765

◆ p_constant()

std::vector< std::vector< int > > p_constant ( ideal  Xo,
ideal  Sigma 
)

Definition at line 3778 of file cohomo.cc.

3779{
3780 std::vector<std::vector<int> > xs=supports(idCopy(Xo)), ss=supports(idCopy(Sigma)), fvs1;
3781 fvs1=vs_subsets(ss);
3782 fvs1=vsMinusvs(xs, fvs1);
3783 return fvs1;
3784}

◆ p_Ifsfree()

bool p_Ifsfree ( poly  P)

Definition at line 764 of file cohomo.cc.

765{
766 int i,sf=1;
767 for(i=1;i<=rVar(currRing);i++)
768 {
769 if (pGetExp(P,i)>1)
770 {
771 sf=0;
772 break;
773 }
774 }
775 return sf;
776}

◆ p_new()

std::vector< std::vector< int > > p_new ( ideal  Xo,
ideal  Sigma 
)

Definition at line 3796 of file cohomo.cc.

3797{
3798 int vert=0;
3799 std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs;
3800 for(int i=1;i<=currRing->N;i++)
3801 {
3802 for(int j=0;j<IDELEMS(Xo);j++)
3803 {
3804 if(pGetExp(Xo->m[j],i)>0)
3805 {
3806 vert=i+1;
3807 break;
3808 }
3809 }
3810 }
3811 int typ=ss.size();
3812 if(typ==1)
3813 {
3814 fvs=triface(Sigma->m[0], vert);
3815 }
3816 else if(typ==2)
3817 {
3818 fvs=tetraface(Sigma->m[0], Sigma->m[1], vert);
3819 }
3820 else
3821 {
3822 fvs=penface(Sigma->m[0], Sigma->m[1], Sigma->m[2], vert);
3823 }
3824 return (fvs);
3825}
std::vector< std::vector< int > > tetraface(poly p, poly q, int vert)
Definition: cohomo.cc:3591
std::vector< std::vector< int > > penface(poly p, poly q, poly g, int vert)
Definition: cohomo.cc:3632
std::vector< std::vector< int > > triface(poly p, int vert)
Definition: cohomo.cc:3497

◆ p_New()

BOOLEAN p_New ( leftv  res,
leftv  args 
)

Definition at line 4929 of file cohomo.cc.

4930{
4931 leftv h=args;
4932 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4933 {
4934 ideal h1= (ideal)h->Data();
4935 h = h->next;
4936 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4937 {
4938 ideal h2= (ideal)h->Data();
4939 res->rtyp =IDEAL_CMD;
4940 res->data =idMaken(p_new(h1,h2));
4941 }
4942 }
4943 return false;
4944}

◆ pa()

BOOLEAN pa ( leftv  res,
leftv  args 
)

Definition at line 4323 of file cohomo.cc.

4324{
4325 leftv h=args;
4326 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4327 {
4328 ideal h1= (ideal)h->Data();
4329 res->rtyp =IDEAL_CMD;
4330 res->data =p_a(h1);
4331 }
4332 return false;
4333}
ideal p_a(ideal h)
Definition: cohomo.cc:1569

◆ pb()

BOOLEAN pb ( leftv  res,
leftv  args 
)

Definition at line 4350 of file cohomo.cc.

4351{
4352 leftv h=args;
4353 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4354 {
4355 ideal h1= (ideal)h->Data();
4356 h = h->next;
4357 if((h != NULL)&&(h->Typ() == POLY_CMD))
4358 {
4359 poly p= (poly)h->Data();
4360 res->rtyp =IDEAL_CMD;
4361 res->data =p_b(h1,p);
4362 }
4363 }
4364 return false;
4365}
ideal p_b(ideal h, poly a)
Definition: cohomo.cc:1686

◆ pChange()

BOOLEAN pChange ( leftv  res,
leftv  args 
)

Definition at line 4915 of file cohomo.cc.

4916{
4917 leftv h=args;
4918 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4919 {
4920 ideal h1= (ideal)h->Data();
4921 res->rtyp =IDEAL_CMD;
4922 res->data =idMaken(p_change(h1));
4923 }
4924 return false;
4925}

◆ pcoef()

int pcoef ( poly  p,
int  m 
)

Definition at line 486 of file cohomo.cc.

487{
488 int i,j,co; poly q=pCopy(p);
489 for(i=1;i<=currRing->N;i++)
490 {
491 if(p_GetExp(q,m,currRing)!=0)
492 {
493 co=n_Int(pGetCoeff(q),currRing->cf);
494 return co;
495 }
496 else
497 q=pNext(q);
498 }
499 if(q!=NULL)
500 co=0;
501 return co;
502}
#define pNext(p)
Definition: monomials.h:36
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:471

◆ pConstant()

BOOLEAN pConstant ( leftv  res,
leftv  args 
)

Definition at line 4898 of file cohomo.cc.

4899{
4900 leftv h=args;
4901 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4902 {
4903 ideal h1= (ideal)h->Data();
4904 h = h->next;
4905 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4906 {
4907 ideal h2= (ideal)h->Data();
4908 res->rtyp =IDEAL_CMD;
4909 res->data =idMaken(p_constant(h1,h2));
4910 }
4911 }
4912 return false;
4913}

◆ penface()

std::vector< std::vector< int > > penface ( poly  p,
poly  q,
poly  g,
int  vert 
)

Definition at line 3632 of file cohomo.cc.

3633{
3634 int en=0;
3635 std::vector<int> ev1=commonedge(p, q), ev2=commonedge(p, g), ev3=commonedge(q, g), ind, vec, fv1=support1(p), fv2=support1(q), fv3=support1(g);
3636 std::vector<std::vector<int> > fvs1, fvs2, fvs3, fvs, evec;
3637 evec.push_back(ev1);
3638 evec.push_back(ev2);
3639 evec.push_back(ev3);
3640 for(unsigned i=0;i<evec.size();i++)
3641 {
3642 if(evec[i].size()==2)
3643 {
3644 en++;
3645 }
3646 }
3647 if(en==2)
3648 {
3649 vec.push_back(vert);
3650 fvs.push_back(vec);
3651 fvs1=b_subsets(fv1);
3652 fvs2=b_subsets(fv2);
3653 fvs3=b_subsets(fv3);
3654 fvs1=vsMinusv(fvs1, fv1);
3655 fvs2=vsMinusv(fvs2, fv2);
3656 fvs3=vsMinusv(fvs3, fv3);
3657 fvs3=vsUnion(fvs3, fvs2);
3658 fvs3=vsUnion(fvs3, fvs1);
3659 for(unsigned i=0;i<evec.size();i++)
3660 {
3661 if(evec[i].size()==2)
3662 {
3663 fvs3=vsMinusv(fvs3, evec[i]);
3664 }
3665 }
3666 for(unsigned i=0;i<fvs3.size();i++)
3667 {
3668 vec=fvs3[i];
3669 vec.push_back(vert);
3670 fvs.push_back(vec);
3671 }
3672 }
3673 return (fvs);
3674}

◆ phi1()

std::vector< std::vector< int > > phi1 ( poly  a,
ideal  Sigma 
)

Definition at line 3868 of file cohomo.cc.

3869{
3870 std::vector<std::vector<int> > ss=supports(idCopy(Sigma)), fvs;
3871 std::vector<int> av=support1(a), intvec, vv;
3872 for(unsigned i=0;i<ss.size();i++)
3873 {
3874 intvec=vecIntersection(ss[i], av);
3875 if(intvec.size()==av.size())
3876 {
3877 vv=vecMinus(ss[i], av);
3878 fvs.push_back(vv);
3879 }
3880 }
3881 return fvs;
3882}

◆ phi2()

static std::vector< std::vector< int > > phi2 ( poly  a,
ideal  Xo,
ideal  Sigma 
)
static

Definition at line 3886 of file cohomo.cc.

3887{
3888
3889 std::vector<std::vector<int> > ss=p_new(Sigma, Xo), fvs;
3890 std::vector<int> av=support1(a), intvec, vv;
3891 for(int i=0;i<ss.size();i++)
3892 {
3893 intvec=vecIntersection(ss[i], av);
3894 if(intvec.size()==av.size())
3895 {
3896 vv=vecMinus(ss[i], av);
3897 fvs.push_back(vv);
3898 }
3899 }
3900 return fvs;
3901}

◆ phimage()

std::vector< int > phimage ( std::vector< int >  pv,
std::vector< int >  av,
std::vector< int >  bv 
)

Definition at line 2608 of file cohomo.cc.

2609{
2610 std::vector<int> qv=vecUnion(pv,av);
2611 qv=vecMinus(qv,bv);
2612 return qv;
2613}

◆ phimagel()

std::vector< int > phimagel ( std::vector< int >  fv,
std::vector< int >  av,
std::vector< int >  bv 
)

Definition at line 3135 of file cohomo.cc.

3136{
3137 std::vector<int> nv;
3138 nv=vecMinus(fv,bv);
3139 nv=vecMinus(nv,av);
3140 return nv;
3141}

◆ pMake()

poly pMake ( std::vector< int >  vbase)

Definition at line 436 of file cohomo.cc.

437{
438 int n=vbase.size(); poly p,q=0;
439 for(int i=0;i<n;i++)
440 {
441 if(vbase[i]!=0)
442 {
443 p = pOne();pSetExp(p, i+1, 1);pSetm(p);pSetCoeff(p, nInit(vbase[i]));
444 q = pAdd(q, p);
445 }
446
447 }
448 return q;
449}
#define pAdd(p, q)
Definition: polys.h:203

◆ pMake3()

poly pMake3 ( std::vector< int >  vbase)

Definition at line 1855 of file cohomo.cc.

1856{
1857 int co=1;
1858 poly p,q=0;
1859 for(int i=0;i<3;i++)
1860 {
1861 if(vbase[i]!=0)
1862 {
1863 if(i==1) co=-1;
1864 p = pOne();pSetExp(p, vbase[i], 1);pSetm(p);pSetCoeff(p, nInit(co));
1865 }
1866 else p=0;
1867 q = pAdd(q, p);
1868 co=1;
1869 }
1870 return q;
1871}

◆ pMakei()

std::vector< poly > pMakei ( std::vector< std::vector< int > >  mv,
std::vector< int >  vbase 
)

Definition at line 1940 of file cohomo.cc.

1941{
1942 poly p;
1943 std::vector<poly> h1;
1944 int n=vbase.size();
1945 for(int i=0;i<n;i++)
1946 {
1947 p=pMaken(mv[vbase[i]]);
1948 h1.push_back(p);
1949 }
1950 return h1;
1951}

◆ pMaken()

poly pMaken ( std::vector< int >  vbase)

Definition at line 573 of file cohomo.cc.

574{
575 int n=vbase.size();
576 poly p,q=pOne();
577 for(int i=0;i<n;i++)
578 {
579 p = pOne();pSetExp(p, vbase[i], 1);pSetm(p);pSetCoeff(p, nInit(1));
580 //pWrite(p);
581 q=pp_Mult_mm(q,p,currRing);
582 }
583 return q;
584}
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:1033

◆ psMinusp()

BOOLEAN psMinusp ( leftv  res,
leftv  args 
)

Definition at line 4980 of file cohomo.cc.

4981{
4982 leftv h=args;
4983 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4984 {
4985 ideal h1= (ideal)h->Data();
4986 h = h->next;
4987 if((h != NULL)&&(h->Typ() == POLY_CMD))
4988 {
4989 poly p= (poly)h->Data();
4990 res->rtyp =IDEAL_CMD;
4991 res->data =idMinusp(h1, p);
4992 }
4993 }
4994 return false;
4995}
ideal idMinusp(ideal I, poly p)
Definition: cohomo.cc:3982

◆ psubset()

ideal psubset ( poly  p)

Definition at line 1801 of file cohomo.cc.

1802{
1803 int i,j,max=pTotaldegree(p);
1804 ideal h1,mons, id_re=idInit(1,1);
1805 for(i=1;i<max;i++)
1806 {
1807 mons=id_MaxIdeal(i, currRing);
1808 h1=sfreemon(mons,i);
1809 for(j=0;j<IDELEMS(h1);j++)
1810 {
1811 if(p_DivisibleBy(h1->m[j],p,currRing))
1812 idInsertPoly(id_re, h1->m[j]);
1813 }
1814 }
1815 idSkipZeroes(id_re);
1816 //PrintS("This is the facset\n");
1817 //id_print(id_re);
1818 return id_re;
1819}

◆ pvert()

int pvert ( poly  p)

Definition at line 656 of file cohomo.cc.

657{
658 int i, vert=0;
659 for(i=currRing->N;i>0;i--)
660 {
661 if(pGetExp(p,i)>0)
662 {
663 vert=i;
664 return vert;
665 }
666 }
667 return vert;
668}

◆ qringadd()

ideal qringadd ( ideal  h1,
ideal  h2,
int  deg 
)

Definition at line 877 of file cohomo.cc.

878{
879 ideal h,qrh;
880 h=idAdd(h1,h2);
881 qrh=scKBase(deg,h);
882 return qrh;
883}

◆ redefinedeg()

int redefinedeg ( poly  p,
int  num 
)

Definition at line 1548 of file cohomo.cc.

1549{
1550 int deg=0, deg0;
1551 for(int i=1;i<=currRing->N;i++)
1552 {
1553 deg0=pGetExp(p, i);
1554 if(i>num)
1555 {
1556 deg= deg+2*deg0;
1557 }
1558 else
1559 {
1560 deg=deg+deg0;
1561 }
1562 }
1563 //Print("the new degree is: %d\n", deg);
1564 return (deg);
1565}

◆ sfreemon()

ideal sfreemon ( ideal  h,
int  deg 
)

Definition at line 781 of file cohomo.cc.

782{
783 int j;
784 ideal temp;
785 temp=idInit(1,1);
786 if(!idIs0(h))
787 {
788 for(j=0;j<IDELEMS(h);j++)
789 {
790 if((p_Ifsfree(h->m[j]))&&(pTotaldegree(h->m[j])==deg))
791 {
792 idInsertPoly(temp, h->m[j]);
793 }
794 }
795 idSkipZeroes(temp);
796 }
797 return temp;
798}
bool p_Ifsfree(poly P)
Definition: cohomo.cc:764

◆ sgp()

BOOLEAN sgp ( leftv  res,
leftv  args 
)

Definition at line 4467 of file cohomo.cc.

4468{
4469 leftv h=args;
4470 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4471 {
4472 ideal h1= (ideal)h->Data();
4473 h = h->next;
4474 if((h != NULL)&&(h->Typ() == POLY_CMD))
4475 {
4476 poly p= (poly)h->Data();
4477 h = h->next;
4478 if((h != NULL)&&(h->Typ() == POLY_CMD))
4479 {
4480 poly q= (poly)h->Data();
4481 res->rtyp =INTVEC_CMD;
4482 res->data =gradedpiece2n(h1,p,q);
4483 }
4484 }
4485 }
4486 return false;
4487}
intvec * gradedpiece2n(ideal h, poly a, poly b)
Definition: cohomo.cc:3005

◆ sgpl()

BOOLEAN sgpl ( leftv  res,
leftv  args 
)

Definition at line 4490 of file cohomo.cc.

4491{
4492 leftv h=args;
4493 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4494 {
4495 ideal h1= (ideal)h->Data();
4496 h = h->next;
4497 if((h != NULL)&&(h->Typ() == POLY_CMD))
4498 {
4499 poly p= (poly)h->Data();
4500 h = h->next;
4501 if((h != NULL)&&(h->Typ() == POLY_CMD))
4502 {
4503 poly q= (poly)h->Data();
4504 res->rtyp =INTVEC_CMD;
4505 res->data =gradedpiece2nl(h1,p,q);
4506 }
4507 }
4508 }
4509 return false;
4510}
intvec * gradedpiece2nl(ideal h, poly a, poly b)
Definition: cohomo.cc:3416

◆ SimFacset()

ideal SimFacset ( poly  p)

Definition at line 940 of file cohomo.cc.

941{
942 int i,j,max=pTotaldegree(p);
943 ideal h1,mons,id_re=idInit(1,1);
944 for(i=1;i<max;i++)
945 {
946 mons=id_MaxIdeal(i, currRing);
947 h1=sfreemon(mons,i);
948
949 for(j=0;j<IDELEMS(h1);j++)
950 {
951 if(p_DivisibleBy(h1->m[j],p,currRing))
952 {
953 idInsertPoly(id_re, h1->m[j]);
954 }
955 }
956
957 }
958 idSkipZeroes(id_re);
959 return id_re;
960}

◆ soleli1()

std::vector< std::vector< int > > soleli1 ( std::vector< std::vector< int > >  eqs)

Definition at line 1243 of file cohomo.cc.

1244{
1245 int i,j;
1246 std::vector<int> yaya;
1247 std::vector<std::vector<int> > pre=eqs, ppre, re;
1248 if(eqs.size()>0)
1249 {
1250 re.push_back(eqs[0]);
1251 pre.erase(pre.begin());
1252 }
1253 while(pre.size()>0)
1254 {
1255 yaya=keeporder(eli1(re[0],pre[0]));
1256 for(i=1;i<re.size();i++)
1257 {
1258 if(!vInvsl(yaya, re))
1259 {
1260 yaya=eli1(re[i],yaya);
1261 yaya=keeporder(yaya);
1262 }
1263 }
1264 if(!vInvsl(yaya, re))
1265 {
1266 re.push_back(yaya);
1267 }
1268 pre.erase(pre.begin());
1269 }
1270 return re;
1271}
std::vector< int > eli1(std::vector< int > eq1, std::vector< int > eq2)
Definition: cohomo.cc:1186
std::vector< int > keeporder(std::vector< int > vec)
Definition: cohomo.cc:1229

◆ SRideal()

BOOLEAN SRideal ( leftv  res,
leftv  args 
)

Definition at line 4182 of file cohomo.cc.

4183{
4184 leftv h=args;
4185 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4186 {
4187 ideal hh=(ideal)h->Data();
4188 res->rtyp =IDEAL_CMD;
4189 res->data =idsrRing(hh);
4190 }
4191 return false;
4192}

◆ star()

std::vector< std::vector< int > > star ( poly  a,
ideal  h 
)

Definition at line 4042 of file cohomo.cc.

4043{
4044 int i;
4045 std::vector<std::vector<int> > st,X=supports(h);
4046 std::vector<int> U,av=support1(a);
4047 for(i=0;i<X.size();i++)
4048 {
4049 U=vecUnion(av,X[i]);
4050 if(vInvsl(U,X))
4051 {
4052 st.push_back(X[i]);
4053 }
4054 }
4055 return st;
4056}

◆ stars()

BOOLEAN stars ( leftv  res,
leftv  args 
)

Definition at line 5040 of file cohomo.cc.

5041{
5042 leftv h=args;
5043 if((h != NULL)&&(h->Typ() == POLY_CMD))
5044 {
5045 poly p= (poly)h->Data();
5046 h = h->next;
5047 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5048 {
5049 ideal h1= (ideal)h->Data();
5050 res->rtyp =IDEAL_CMD;
5051 res->data =idMaken(star(p, h1));
5052 }
5053 }
5054 return false;
5055}
std::vector< std::vector< int > > star(poly a, ideal h)
Definition: cohomo.cc:4042

◆ stellarremain()

BOOLEAN stellarremain ( leftv  res,
leftv  args 
)

Definition at line 4999 of file cohomo.cc.

5000{
5001 leftv h=args;
5002 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5003 {
5004 ideal h1= (ideal)h->Data();
5005 h = h->next;
5006 if((h != NULL)&&(h->Typ() == POLY_CMD))
5007 {
5008 poly p= (poly)h->Data();
5009 std::vector<std::vector<int> > st=star(p, h1);
5010 std::vector<std::vector<int> > hvs=supports(h1);
5011 std::vector<std::vector<int> > re= vsMinusvs(hvs, st);
5012 res->rtyp =IDEAL_CMD;
5013 res->data =idMaken(re);
5014 }
5015 }
5016 return false;
5017}

◆ stellarsub()

std::vector< std::vector< int > > stellarsub ( poly  a,
ideal  h 
)

Definition at line 4074 of file cohomo.cc.

4075{
4076 std::vector<std::vector<int> > vecs_minus, vecs_plus, lk=links(a,h), hvs=supports(h), sub, bys=boundary(a);
4077 std::vector<int> av=support1(a), vec, vec_n;
4078 int i,j,vert=0;
4079 for(i=1;i<=currRing->N;i++)
4080 {
4081 for(j=0;j<IDELEMS(h);j++)
4082 {
4083 if(pGetExp(h->m[j],i)>0)
4084 {
4085 vert=i+1;
4086 break;
4087 }
4088 }
4089 }
4090 vec_n.push_back(vert);
4091 for(i=0;i<lk.size();i++)
4092 {
4093 vec=vecUnion(av, lk[i]);
4094 vecs_minus.push_back(vec);
4095 for(j=0;j<bys.size();j++)
4096 {
4097 vec=vecUnion(lk[i], vec_n);
4098 vec=vecUnion(vec, bys[j]);
4099 vecs_plus.push_back(vec);
4100 }
4101 }
4102 sub=vsMinusvs(hvs, vecs_minus);
4103 sub=vsUnion(sub, vecs_plus);
4104 return(sub);
4105}
std::vector< std::vector< int > > boundary(poly a)
Definition: cohomo.cc:4059

◆ stellarsubdivision()

BOOLEAN stellarsubdivision ( leftv  res,
leftv  args 
)

Definition at line 5060 of file cohomo.cc.

5061{
5062 leftv h=args;
5063 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
5064 {
5065 ideal h2= (ideal)h->Data();
5066 h = h->next;
5067 if((h != NULL)&&(h->Typ() == POLY_CMD))
5068 {
5069 poly p= (poly)h->Data();
5070 res->rtyp =IDEAL_CMD;
5071 res->data =idMaken(stellarsub(p, h2));
5072 }
5073 }
5074 return false;
5075}
std::vector< std::vector< int > > stellarsub(poly a, ideal h)
Definition: cohomo.cc:4074

◆ subspace1()

std::vector< int > subspace1 ( std::vector< std::vector< int > >  mv,
std::vector< int >  bv 
)

Definition at line 1914 of file cohomo.cc.

1915{
1916 int i, num=mv.size();
1917 std::vector<int> base;
1918 for(i=0;i<num;i++)
1919 {
1920 if(IsinL(bv[0],mv[i]))
1921 base.push_back(1);
1922 else
1923 base.push_back(0);
1924 }
1925 return base;
1926}

◆ subspacet()

std::vector< std::vector< int > > subspacet ( std::vector< std::vector< int > >  mv,
std::vector< int >  bv,
std::vector< std::vector< int > >  ntvs 
)

Definition at line 2322 of file cohomo.cc.

2323{
2324 std::vector<int> alset=findalpha(mv,bv), subase;
2325 std::vector<std::vector<int> > subases;
2326 for(unsigned i=0;i<alset.size();i++)
2327 {
2328 subase=subspacet1(alset[i],ntvs);
2329 subases.push_back(subase);
2330 }
2331 //PrintS("These are the bases for the subspace:\n");
2332 //listsprint(subases);
2333 return subases;
2334}
std::vector< int > findalpha(std::vector< std::vector< int > > mv, std::vector< int > bv)
Definition: cohomo.cc:2270
std::vector< int > subspacet1(int num, std::vector< std::vector< int > > ntvs)
Definition: cohomo.cc:2292

◆ subspacet1()

std::vector< int > subspacet1 ( int  num,
std::vector< std::vector< int > >  ntvs 
)

Definition at line 2292 of file cohomo.cc.

2293{
2294 int i, j, t, n=ntvs.size();
2295 std::vector<int> subase;
2296 for(t=0;t<n;t++)
2297 {
2298 i=ntvs[t][0];
2299 j=ntvs[t][1];
2300 if(i==(num))
2301 {
2302 subase.push_back(1);
2303 }
2304 else if(j==num)
2305 {
2306 subase.push_back(-1);
2307 }
2308 else
2309 {
2310 subase.push_back(0);
2311 }
2312 }
2313 //Print("This is the basis w.r.t. %dth polynomial in alpha set\n",num);
2314 //listprint(subase);
2315 return subase;
2316}

◆ subspacetn()

std::vector< std::vector< int > > subspacetn ( std::vector< std::vector< int > >  N,
std::vector< int >  tN,
std::vector< std::vector< int > >  ntvs 
)

Definition at line 2905 of file cohomo.cc.

2906{
2907 int i,j;
2908 std::vector<int> alset=findalphan(N,tN), subase;
2909 std::vector<std::vector<int> > subases;
2910 for(i=0;i<alset.size();i++)
2911 {
2912 subase=subspacet1(alset[i],ntvs);
2913 subases.push_back(subase);
2914 }
2915 //PrintS("These are the bases for the subspace:\n");
2916 //listsprint(subases);
2917 return subases;
2918}
std::vector< int > findalphan(std::vector< std::vector< int > > N, std::vector< int > tN)
Definition: cohomo.cc:2886

◆ support()

BOOLEAN support ( leftv  res,
leftv  args 
)

Definition at line 4949 of file cohomo.cc.

4950{
4951 leftv h=args;
4952 if((h != NULL)&&(h->Typ() == POLY_CMD))
4953 {
4954 poly p= (poly)h->Data();
4955 res->rtyp =INT_CMD;
4956 res->data =(void *)(long)(support1(p).size());
4957 }
4958 return false;
4959}

◆ support1()

std::vector< int > support1 ( poly  p)

Definition at line 355 of file cohomo.cc.

356{
357 int j;
358 std::vector<int> supset;
359 if(p==0) return supset;
360 for(j=1;j<=rVar(currRing);j++)
361 {
362 if(pGetExp(p,j)>0)
363 {
364 supset.push_back(j);
365 }
366 }
367 return (supset);
368}

◆ support2()

std::vector< int > support2 ( poly  p)

Definition at line 396 of file cohomo.cc.

397{
398 int j;
399 poly q;
400 std::vector<int> supset;
401 for(j=1;j<=rVar(currRing);j++)
402 {
403 q=pCopy(p);
404 while (q!=NULL)
405 {
406 if(p_GetExp(q,j,currRing)!=0)
407 {
408 supset.push_back(j);
409 break;
410 }
411 q=pNext(q);
412 }
413 }
414 return (supset);
415}

◆ supports()

std::vector< std::vector< int > > supports ( ideal  h)

Definition at line 376 of file cohomo.cc.

377{
378 std::vector<std::vector<int> > vecs;
379 std::vector<int> vec;
380 if(!idIs0(h))
381 {
382 for(int s=0;s<IDELEMS(h);s++)
383 {
384 vec=support1(h->m[s]);
385 vecs.push_back(vec);
386 }
387 }
388 return vecs;
389}
const CanonicalForm int s
Definition: facAbsFact.cc:51

◆ supports2()

std::vector< std::vector< int > > supports2 ( ideal  h)

Definition at line 420 of file cohomo.cc.

421{
422 std::vector<std::vector<int> > vecs;
423 std::vector<int> vec;
424 if(!idIs0(h))
425 {
426 for(int s=0;s<IDELEMS(h);s++)
427 {
428 vec=support2(h->m[s]);
429 vecs.push_back(vec);
430 }
431 }
432 return vecs;
433}

◆ 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}
void id_print(ideal h)
Definition: cohomo.cc:84
#define IMATELEM(M, I, J)
Definition: intvec.h:85

◆ t1h()

BOOLEAN t1h ( leftv  res,
leftv  args 
)

Definition at line 4216 of file cohomo.cc.

4217{
4218 leftv h=args;
4219 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4220 {
4221 ideal hh=(ideal)h->Data();
4222 res->rtyp =IDEAL_CMD;
4223 res->data =T_1h(hh);
4224 }
4225 return false;
4226}
ideal T_1h(ideal h)
Definition: cohomo.cc:4127

◆ 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;
3095std::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);
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

◆ T_1h()

ideal T_1h ( ideal  h)

Definition at line 4127 of file cohomo.cc.

4128{
4129 int i, j;
4130 //std::vector < intvec > T1;
4131 ideal ai=p_a(h), bi;
4132 //intvec *L;
4133 for(i=0;i<IDELEMS(ai);i++)
4134 {
4135 bi=p_b(h,ai->m[i]);
4136 if(!idIs0(bi))
4137 {
4138 for(j=0;j<IDELEMS(bi);j++)
4139 {
4140 //PrintS("This is for:\n");pWrite(ai->m[i]); pWrite(bi->m[j]);
4141 gradedpiece1nl(h,ai->m[i],bi->m[j], 0);
4142 //PrintS("Succeed!\n");
4143 //T1.push_back(L);
4144 }
4145 }
4146 }
4148 return h;
4149
4150}
static void TimeShow(clock_t t_construct, clock_t t_solve, clock_t t_value, clock_t t_total)
Definition: cohomo.cc:3186

◆ tetraface()

std::vector< std::vector< int > > tetraface ( poly  p,
poly  q,
int  vert 
)

Definition at line 3591 of file cohomo.cc.

3592{
3593 std::vector<int> ev=commonedge(p, q), vec, fv1=support1(p), fv2=support1(q);
3594 std::vector<std::vector<int> > fvs1, fvs2, fvs;
3595 vec.push_back(vert);
3596 fvs.push_back(vec);
3597 fvs1=b_subsets(fv1);
3598 fvs2=b_subsets(fv2);
3599 fvs1=vsMinusv(fvs1, fv1);
3600 fvs2=vsMinusv(fvs2, fv2);
3601 fvs2=vsUnion(fvs1, fvs2);
3602 fvs2=vsMinusv(fvs2, ev);
3603 for(unsigned i=0;i<fvs2.size();i++)
3604 {
3605 vec=fvs2[i];
3606 vec.push_back(vert);
3607 fvs.push_back(vec);
3608 }
3609 return (fvs);
3610}

◆ TimeShow()

static void TimeShow ( clock_t  t_construct,
clock_t  t_solve,
clock_t  t_value,
clock_t  t_total 
)
static

Definition at line 3186 of file cohomo.cc.

3187{
3188 Print("The time of value matching for first order deformation: %.2f sec ;\n", ((double) t_value)/CLOCKS_PER_SEC);
3189 Print("The total time of fpiece: %.2f sec ;\n", ((double) t_total)/CLOCKS_PER_SEC);
3190 Print("The time of equations construction for fpiece: %.2f sec ;\n", ((double) t_construct)/CLOCKS_PER_SEC);
3191 Print("The total time of equations solving for fpiece: %.2f sec ;\n", ((double) t_solve)/CLOCKS_PER_SEC);
3192 PrintS("__________________________________________________________\n");
3193}

◆ Tmat()

intvec * Tmat ( std::vector< std::vector< int > >  vecs)

Definition at line 2665 of file cohomo.cc.

2666{
2667 //std::vector<std::vector<int> > solve=gradedpiece1n(h,a,b);
2668 //Print("the size of solve is: %ld\n",solve.size());
2669 //vtm(solve);
2670 intvec *m;
2671 int i,j, a=vecs.size();
2672 if(a==0)
2673 {
2674 m=new intvec(1,1,10);
2675 }
2676 else
2677 {
2678 int b=vecs[0].size();
2679 m=new intvec(a,b,0);
2680 for(i=1;i<=a;i++)
2681 {
2682 for(j=1;j<=b;j++)
2683 {
2684 IMATELEM(*m,i,j)=vecs[i-1][j-1];
2685 }
2686 }
2687 }
2688return (m);
2689}

◆ tNab()

bool tNab ( std::vector< std::vector< int > >  hvs,
std::vector< int >  pv,
std::vector< std::vector< int > >  bvs 
)

Definition at line 2565 of file cohomo.cc.

2566{
2567 std::vector<int> sv;
2568 if(bvs.size()<=1) return false;
2569 for(int i=0;i<bvs.size();i++)
2570 {
2571 sv=vecUnion(pv,bvs[i]);
2572 if(!vInvsl(sv,hvs))
2573 {
2574 return true;
2575 }
2576 }
2577 return false;
2578}

◆ tnab()

std::vector< int > tnab ( std::vector< std::vector< int > >  hvs,
std::vector< std::vector< int > >  nvs,
std::vector< std::vector< int > >  bvs 
)

Definition at line 2586 of file cohomo.cc.

2587{
2588 std::vector<int> pv, vec;
2589 for(int j=0;j<nvs.size();j++)
2590 {
2591 pv=nvs[j];
2592 if(tNab(hvs, pv, bvs))
2593 {
2594 vec.push_back(j);
2595 }
2596 }
2597 return vec;
2598}

◆ tnabvl()

BOOLEAN tnabvl ( leftv  res,
leftv  args 
)

Definition at line 4735 of file cohomo.cc.

4736{
4737 leftv h=args;
4738 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4739 {
4740 ideal h1= (ideal)h->Data();
4741 h = h->next;
4742 if((h != NULL)&&(h->Typ() == POLY_CMD))
4743 {
4744 poly p= (poly)h->Data();
4745 h = h->next;
4746 if((h != NULL)&&(h->Typ() == POLY_CMD))
4747 {
4748 poly q= (poly)h->Data();
4749 res->rtyp =IDEAL_CMD;
4750 std::vector<std::vector<int> > vecs=supports(h1), sbv,tnbr;
4751 std::vector<int> pv=support1(p), qv=support1(q);
4752 std::vector<std::vector<int> > nvs=Nabv(vecs, pv, qv);
4753 ideal sub=psubset(q);
4754 sbv=supports(sub);
4755 std::vector<int> tnv =tnab(vecs,nvs,sbv);
4756 for(int i=0;i<tnv.size();i++)
4757 {
4758 tnbr.push_back(nvs[tnv[i]]);
4759 }
4760 res->data =idMaken(tnbr);
4761 }
4762 }
4763 }
4764 return false;
4765}

◆ triangulations1()

ideal triangulations1 ( ideal  h,
poly  p,
int  vert 
)

Definition at line 3516 of file cohomo.cc.

3517{
3518 std::vector<int> vec, pv=support1(p);
3519 std::vector<std::vector<int> > vecs=supports(h),vs,vs0;
3520 vs0=triface(p,vert);
3521 vecs=vsMinusv(vecs, pv);
3522 vecs=vsUnion(vecs,vs0);
3523 //PrintS("This is the new simplicial complex according to the face \n"); pWrite(p);
3524 //PrintS("is:\n");
3525 //listsprint(vecs);
3526
3527 ideal re=idMaken(vecs);
3528
3529 return re;
3530}

◆ triangulations2()

ideal triangulations2 ( ideal  h,
poly  p,
poly  q,
int  vert 
)

Definition at line 3614 of file cohomo.cc.

3615{
3616 std::vector<int> ev, fv1=support1(p), fv2=support1(q);
3617 std::vector<std::vector<int> > vecs=supports(h), vs1;
3618 ev=commonedge(p, q);
3619 vecs=vsMinusv(vecs, ev);
3620 vecs=vsMinusv(vecs,fv1);
3621 vecs=vsMinusv(vecs,fv2);
3622 vs1=tetraface(p, q, vert);
3623 vecs=vsUnion(vecs,vs1);
3624 ideal hh=idMaken(vecs);
3625 return hh;
3626}

◆ triangulations3()

ideal triangulations3 ( ideal  h,
poly  p,
poly  q,
poly  g,
int  vert 
)

Definition at line 3678 of file cohomo.cc.

3679{
3680 std::vector<int> ev1=commonedge(p, q), ev2=commonedge(p, g), ev3=commonedge(q, g), fv1=support1(p), fv2=support1(q), fv3=support1(g);
3681 std::vector<std::vector<int> > vecs=supports(h), vs1, evec;
3682 evec.push_back(ev1);
3683 evec.push_back(ev2);
3684 evec.push_back(ev3);
3685 for(unsigned i=0;i<evec.size();i++)
3686 {
3687 if(evec[i].size()==2)
3688 {
3689 vecs=vsMinusv(vecs, evec[i]);
3690 }
3691 }
3692 vecs=vsMinusv(vecs,fv1);
3693 vecs=vsMinusv(vecs,fv2);
3694 vecs=vsMinusv(vecs,fv3);
3695 vs1=penface(p, q, g, vert);
3696 vecs=vsUnion(vecs,vs1);
3697 ideal hh=idMaken(vecs);
3698 return hh;
3699}

◆ triface()

std::vector< std::vector< int > > triface ( poly  p,
int  vert 
)

Definition at line 3497 of file cohomo.cc.

3498{
3499 std::vector<int> vec, fv=support1(p);
3500 std::vector<std::vector<int> > fvs0, fvs;
3501 vec.push_back(vert);
3502 fvs.push_back(vec);
3503 fvs0=b_subsets(fv);
3504 fvs0=vsMinusv(fvs0,fv);
3505 for(unsigned i=0;i<fvs0.size();i++)
3506 {
3507 vec=fvs0[i];
3508 vec.push_back(vert);
3509 fvs.push_back(vec);
3510 }
3511 return (fvs);
3512}

◆ trisets()

ideal trisets ( ideal  h)

Definition at line 3478 of file cohomo.cc.

3479{
3480 int i;
3481 ideal ids=idInit(1,1);
3482 std::vector<int> pv;
3483 for(i=0;i<IDELEMS(h);i++)
3484 {
3485 pv= support1(h->m[i]);
3486 if(pv.size()==3)
3487 idInsertPoly(ids, pCopy(h->m[i]));
3488 }
3489 idSkipZeroes(ids);
3490 return ids;
3491}

◆ tsets()

BOOLEAN tsets ( leftv  res,
leftv  args 
)

Definition at line 4673 of file cohomo.cc.

4674{
4675 leftv h=args;
4676 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4677 {
4678 ideal h1= (ideal)h->Data();
4679 res->rtyp =IDEAL_CMD;
4680 res->data =trisets(h1);
4681 }
4682 return false;
4683}
ideal trisets(ideal h)
Definition: cohomo.cc:3478

◆ v_minus()

std::vector< int > v_minus ( std::vector< int >  v1,
std::vector< int >  v2 
)

Definition at line 4008 of file cohomo.cc.

4009{
4010 std::vector<int> vec;
4011 for(unsigned i=0;i<v1.size();i++)
4012 {
4013 vec.push_back(v1[i]-v2[i]);
4014 }
4015 return vec;
4016}

◆ vAbsorb()

std::vector< std::vector< int > > vAbsorb ( std::vector< int >  bset,
std::vector< std::vector< int > >  gset 
)

Definition at line 1322 of file cohomo.cc.

1323{
1324 std::vector<int> badset=bset;
1325 int i,j,m, bl=bset.size(), gl=gset.size();
1326 for(i=0;i<bl;i++)
1327 {
1328 m=badset[i];
1329 for(j=0;j<gl;j++)
1330 {
1331 if(gset[j][0]==m && !IsinL(gset[j][1],badset))
1332 {
1333 badset.push_back(gset[j][1]);
1334 gset.erase(gset.begin()+j);
1335 j--;
1336 gl--;
1337 bl++;
1338 }
1339 else if(!IsinL(gset[j][0],badset) && gset[j][1]==m)
1340 {
1341 badset.push_back(gset[j][0]);
1342 gset.erase(gset.begin()+j);
1343 j--;
1344 gl--;
1345 bl++;
1346 }
1347 else if(IsinL(gset[j][0],badset) && IsinL(gset[j][1],badset))
1348 {
1349 gset.erase(gset.begin()+j);
1350 j--;
1351 gl--;
1352 }
1353 else
1354 {
1355 ;
1356 }
1357 }
1358 }
1359 if(badset.size()==0) badset.push_back(0);
1360 gset.push_back(badset);
1361 return gset;
1362}

◆ valency()

int valency ( ideal  h,
poly  p 
)

Definition at line 3704 of file cohomo.cc.

3705{
3706 int val=0;
3707 std::vector<int> ev=support1(pCopy(p));
3708 int ver=ev[0];
3709//PrintS("the vertex is :\n"); listprint(p);
3710 std::vector<std::vector<int> > vecs=supports(idCopy(h));
3711 for(unsigned i=0;i<vecs.size();i++)
3712 {
3713 if(vecs[i].size()==2 && IsinL(ver, vecs[i]))
3714 val++;
3715 }
3716 return (val);
3717}

◆ Valency()

BOOLEAN Valency ( leftv  res,
leftv  args 
)

Definition at line 4689 of file cohomo.cc.

4690{
4691 leftv h=args;
4692 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4693 {
4694 ideal h1= (ideal)h->Data();
4695 h = h->next;
4696 if((h != NULL)&&(h->Typ() == POLY_CMD))
4697 {
4698 poly p= (poly)h->Data();
4699 res->rtyp =INT_CMD;
4700 res->data =(void *)(long)valency(h1,p);
4701 }
4702 }
4703 return false;
4704}
int valency(ideal h, poly p)
Definition: cohomo.cc:3704

◆ 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 at line 2619 of file cohomo.cc.

2620{
2621 int j;
2622 std::vector<int> pv, base;
2623 std::vector<std::vector<int> > bases;
2624 for(int t=0;t<vecs.size();t++)
2625 {
2626 for(int i=0;i<mvs.size();i++)
2627 {
2628 pv=phimage(mvs[i],av,bv);
2629 for( j=0;j<nvs.size();j++)
2630 {
2631 if(vEvl(pv,nvs[j]))
2632 {
2633 base.push_back(vecs[t][j]);
2634 break;
2635 }
2636 }
2637 if(j==nvs.size())
2638 {
2639 base.push_back(0);
2640 }
2641 }
2642 if(base.size()!=mvs.size())
2643 {
2644 //WerrorS("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1");
2645 WerrorS("Errors in Equations solving (Values Finding)!");
2646 usleep(1000000);
2647 assert(false);
2648
2649 }
2650
2651 bases.push_back(base);
2652 base.clear();
2653 }
2654 return bases;
2655}
std::vector< int > phimage(std::vector< int > pv, std::vector< int > av, std::vector< int > bv)
Definition: cohomo.cc:2608

◆ value1l()

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 
)

Definition at line 3147 of file cohomo.cc.

3148{
3149 int j;
3150 std::vector<int> pv;
3151 std::vector<int> base;
3152 std::vector<std::vector<int> > bases;
3153 for(int t=0;t<vecs.size();t++)
3154 {
3155 for(int i=0;i<mvs.size();i++)
3156 {
3157 pv=phimagel(mvs[i], av, bv);
3158 for(j=0;j<lks.size();j++)
3159 {
3160 if(vEvl(pv,lks[j]))
3161 {
3162 base.push_back(vecs[t][j]);break;
3163 }
3164 }
3165 //if(j==lks.size()) {base.push_back(0);}
3166 }
3167 if(base.size()!=mvs.size())
3168 {
3169 WerrorS("Errors in Values Finding(value1l)!");
3170 usleep(1000000);
3171 assert(false);
3172
3173 }
3174
3175 bases.push_back(base);
3176 base.clear();
3177 }
3178 return bases;
3179}

◆ value2()

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 
)

Definition at line 2926 of file cohomo.cc.

2927{
2928 int row,col,j;
2929 std::vector<int> pv,qv, base;
2930 std::vector<std::vector<int> > bases;
2931 //PrintS("This is the nabt:\n");
2932 //listsprint(nts);
2933 //PrintS("nabt ends:\n");
2934 //PrintS("This is the mabt:\n");
2935 //listsprint(mts);
2936 //PrintS("mabt ends:\n");
2937 for(int t=0;t<vecs.size();t++)
2938 {
2939 for(int i=0;i<mts.size();i++)
2940 {
2941 row=mts[i][0];
2942 col=mts[i][1];
2943 pv=phimage(mvs[row],av,bv);
2944 qv=phimage(mvs[col],av,bv);
2945 if(vEvl(pv,qv))
2946 base.push_back(0);
2947 else
2948 {
2949 for(j=0;j<nts.size();j++)
2950 {
2951 row=nts[j][0];
2952 col=nts[j][1];
2953 if(vEvl(pv,nvs[row])&&vEvl(qv,nvs[col]))
2954 {
2955 base.push_back(vecs[t][j]);break;
2956 }
2957 else if(vEvl(pv,nvs[col])&&vEvl(qv,nvs[row]))
2958 {
2959 base.push_back(-vecs[t][j]);break;
2960 }
2961 }
2962 if(j==nts.size()) {base.push_back(0);}
2963 }
2964 }
2965 if(base.size()!=mts.size())
2966 {
2967 WerrorS("Errors in Values Finding(value2)!");
2968 //WerrorS("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1");
2969 usleep(1000000);
2970 assert(false);
2971 }
2972 bases.push_back(base);
2973 base.clear();
2974 }
2975 return bases;
2976}

◆ value2l()

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 
)

Definition at line 3289 of file cohomo.cc.

3290{
3291 std::vector<int> pv,qv,base;
3292 int row,col,j;
3293 std::vector<std::vector<int> > bases;
3294 if(vecs.size()==0)
3295 {
3296
3297 }
3298 for(int t=0;t<vecs.size();t++)
3299 {
3300 for(int i=0;i<mts.size();i++)
3301 {
3302 row=mts[i][0];
3303 col=mts[i][1];
3304 pv=phimagel(mvs[row],av,bv);
3305 qv=phimagel(mvs[col],av,bv);
3306 if(vEvl(pv,qv))
3307 base.push_back(0);
3308 else
3309 {
3310 for(j=0;j<lkts.size();j++)
3311 {
3312 row=lkts[j][0];
3313 col=lkts[j][1];
3314 if(vEvl(pv,lks[row])&&vEvl(qv,lks[col]))
3315 {
3316 base.push_back(vecs[t][j]);break;
3317 }
3318 else if(vEvl(qv,lks[row])&&vEvl(pv,lks[col]))
3319 {
3320 base.push_back(-vecs[t][j]);break;
3321 }
3322 }
3323 //if(j==lkts.size())
3324 //{
3325 //base.push_back(0);
3326 //}
3327 }
3328 }
3329 if(base.size()!=mts.size())
3330 {
3331 WerrorS("Errors in Values Finding!");
3332 //WerrorS("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1");
3333 usleep(1000000);
3334 assert(false);
3335 }
3336 bases.push_back(base);
3337 base.clear();
3338 }
3339 return bases;
3340}

◆ vecbase1()

std::vector< int > vecbase1 ( int  num,
std::vector< int >  oset 
)

Definition at line 1371 of file cohomo.cc.

1372{
1373 int i;
1374 std::vector<int> base;
1375 for(i=0;i<num;i++)
1376 {
1377 if(IsinL(i+1,oset))
1378 base.push_back(1);
1379 else
1380 base.push_back(0);
1381 }
1382 return base;
1383}

◆ vecIntersection()

std::vector< int > vecIntersection ( std::vector< int >  p,
std::vector< int >  q 
)

Definition at line 162 of file cohomo.cc.

163{
164 int i;
165 std::vector<int> inte;
166 for(i=0;i<p.size();i++)
167 {
168 if(IsinL(p[i],q))
169 inte.push_back(p[i]);
170 }
171 return inte;
172}

◆ vecMinus()

std::vector< int > vecMinus ( std::vector< int >  vec1,
std::vector< int >  vec2 
)

Definition at line 281 of file cohomo.cc.

282{
283 std::vector<int> vec;
284 for(int i=0;i<vec1.size();i++)
285 {
286 if(!IsinL(vec1[i],vec2))
287 {
288 vec.push_back(vec1[i]);
289 }
290 }
291 return vec;
292}

◆ vecqring()

std::vector< std::vector< int > > vecqring ( std::vector< std::vector< int > >  vec1,
std::vector< std::vector< int > >  vec2 
)

Definition at line 559 of file cohomo.cc.

560{
561 int i,j;
562 ideal h1=idMake(vec1), h2=idMake(vec2);
563 ideal h=idmodulo(h1,h2);
564 std::vector<std::vector<int> > vecs= vsMake(h);
565 return vecs;
566}
std::vector< std::vector< int > > vsMake(ideal h)
Definition: cohomo.cc:543
ideal idMake(std::vector< std::vector< int > > vecs)
Definition: cohomo.cc:455

◆ vecUnion()

std::vector< int > vecUnion ( std::vector< int >  vec1,
std::vector< int >  vec2 
)

Definition at line 267 of file cohomo.cc.

268{
269 std::vector<int> vec=vec1;
270 int i;
271 for(i=0;i<vec2.size();i++)
272 {
273 if(!IsinL(vec2[i],vec))
274 vec.push_back(vec2[i]);
275 }
276 return vec;
277}

◆ vertset()

std::vector< int > vertset ( std::vector< std::vector< int > >  vecs)

Definition at line 1663 of file cohomo.cc.

1664{
1665 int i,j;
1666 std::vector<int> vert;
1667 std::vector<std::vector<int> > vvs;
1668 for(i=1;i<=currRing->N;i++)
1669 {
1670 for(j=0;j<vecs.size();j++)
1671 {
1672 if(IsinL(i, vecs[j]))
1673 {
1674 if(!IsinL(i , vert))
1675 {
1676 vert.push_back(i);
1677 }
1678 break;
1679 }
1680 }
1681 }
1682 return (vert);
1683}

◆ vEv()

bool vEv ( std::vector< int >  vec1,
std::vector< int >  vec2 
)

Definition at line 184 of file cohomo.cc.

185{
186 int i,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}

◆ vEvl()

bool vEvl ( std::vector< int >  vec1,
std::vector< int >  vec2 
)

Definition at line 220 of file cohomo.cc.

221{
222 if(vec1.size()==0 && vec2.size()==0)
223 return true;
224 if(vsubset(vec1,vec2)&&vsubset(vec2,vec1))
225 return true;
226 return false;
227}

◆ vInp()

bool vInp ( int  m,
poly  p 
)

Definition at line 505 of file cohomo.cc.

506{
507 int i;
508 poly q=pCopy(p);
509 while (q!=NULL)
510 {
511 if(p_GetExp(q,m,currRing)!=0)
512 {
513 return true;
514 }
515 q=pNext(q);
516 }
517 return false;
518}

◆ vInvs()

int vInvs ( std::vector< int >  vec,
std::vector< std::vector< int > >  vecs 
)

Definition at line 251 of file cohomo.cc.

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}
bool vEv(std::vector< int > vec1, std::vector< int > vec2)
Definition: cohomo.cc:184

◆ vInvsl()

bool vInvsl ( std::vector< int >  vec,
std::vector< std::vector< int > >  vecs 
)

Definition at line 233 of file cohomo.cc.

234{
235 int i;
236 for(i=0;i<vecs.size();i++)
237 {
238 if(vEvl(vec,vecs[i]))
239 {
240 return true;
241 }
242 }
243 return false;
244}

◆ vMake()

std::vector< int > vMake ( poly  p)

Definition at line 523 of file cohomo.cc.

524{
525 int i; poly q=pCopy(p);
526 std::vector<int> vbase;
527 for(i=1;i<=currRing->N;i++)
528 {
529 if(vInp(i,p))
530 {
531 vbase.push_back(pcoef(p,i));
532 }
533 else
534 {
535 vbase.push_back(0);
536 }
537 }
538 return (vbase);
539}
int pcoef(poly p, int m)
Definition: cohomo.cc:486

◆ vs_subsets()

std::vector< std::vector< int > > vs_subsets ( std::vector< std::vector< int > >  vs)

Definition at line 3765 of file cohomo.cc.

3766{
3767 std::vector<std::vector<int> > sset, bv;
3768 for(unsigned i=0;i<vs.size();i++)
3769 {
3770 bv=b_subsets(vs[i]);
3771 sset=vsUnion(sset, bv);
3772 }
3773 return sset;
3774}

◆ vsIntersec()

BOOLEAN vsIntersec ( leftv  res,
leftv  args 
)

Definition at line 4768 of file cohomo.cc.

4769{
4770 leftv h=args;
4771 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4772 {
4773 ideal h1= (ideal)h->Data();
4774 h = h->next;
4775 if((h != NULL)&&(h->Typ() == IDEAL_CMD))
4776 {
4777 ideal h2= (ideal)h->Data();
4778 res->rtyp =INT_CMD;
4779 std::vector<std::vector<int> > vs1=supports(h1), vs2=supports(h2);
4780 res->data =(void *)(long)(vsIntersection(vs1, vs2).size());
4781 }
4782 }
4783 return false;
4784}
std::vector< std::vector< int > > vsIntersection(std::vector< std::vector< int > > vs1, std::vector< std::vector< int > > vs2)
Definition: cohomo.cc:333

◆ vsIntersection()

std::vector< std::vector< int > > vsIntersection ( std::vector< std::vector< int > >  vs1,
std::vector< std::vector< int > >  vs2 
)

Definition at line 333 of file cohomo.cc.

334{
335 int i;
336 std::vector<std::vector<int> > vs;
337 for(i=0;i<vs2.size();i++)
338 {
339 if(vInvsl(vs2[i],vs1))
340 {
341 vs.push_back(vs2[i]);
342 }
343 }
344 return vs;
345}

◆ vsMake()

std::vector< std::vector< int > > vsMake ( ideal  h)

Definition at line 543 of file cohomo.cc.

544{
545 std::vector<int> vec;
546 std::vector<std::vector<int> > vecs;
547 int i;
548 for(i=0;i<IDELEMS(h);i++)
549 {
550 vec=vMake(h->m[i]);
551 vecs.push_back(vec);
552 }
553 return vecs;
554}
std::vector< int > vMake(poly p)
Definition: cohomo.cc:523

◆ vsMinusv()

std::vector< std::vector< int > > vsMinusv ( std::vector< std::vector< int > >  vecs,
std::vector< int >  vec 
)

Definition at line 299 of file cohomo.cc.

300{
301 int i;
302 std::vector<std::vector<int> > rem;
303 for(i=0;i<vecs.size();i++)
304 {
305 if(!vEvl(vecs[i],vec))
306 {
307 rem.push_back(vecs[i]);
308 }
309 }
310 return (rem);
311}
void rem(unsigned long *a, unsigned long *q, unsigned long p, int &dega, int degq)
Definition: minpoly.cc:572

◆ vsMinusvs()

std::vector< std::vector< int > > vsMinusvs ( std::vector< std::vector< int > >  vs1,
std::vector< std::vector< int > >  vs2 
)

Definition at line 3754 of file cohomo.cc.

3755{
3756 std::vector<std::vector<int> > vs=vs1;
3757 for(unsigned i=0;i<vs2.size();i++)
3758 {
3759 vs=vsMinusv(vs, vs2[i]);
3760 }
3761 return vs;
3762}

◆ vsubset()

bool vsubset ( std::vector< int >  vec1,
std::vector< int >  vec2 
)

Definition at line 206 of file cohomo.cc.

207{
208 int i;
209 if(vec1.size()>vec2.size())
210 return false;
211 for(i=0;i<vec1.size();i++)
212 {
213 if(!IsinL(vec1[i],vec2))
214 return false;
215 }
216 return true;
217}

◆ vsUnion()

std::vector< std::vector< int > > vsUnion ( std::vector< std::vector< int > >  vs1,
std::vector< std::vector< int > >  vs2 
)

Definition at line 314 of file cohomo.cc.

315{
316 int i;
317 std::vector<std::vector<int> > vs=vs1;
318 for(i=0;i<vs2.size();i++)
319 {
320 if(!vInvsl(vs2[i],vs))
321 {
322 vs.push_back(vs2[i]);
323 }
324 }
325 return vs;
326}

Variable Documentation

◆ t_begin

VAR clock_t t_begin

Definition at line 3182 of file cohomo.cc.

◆ t_construct

VAR clock_t t_construct =0

Definition at line 3182 of file cohomo.cc.

◆ t_mark

VAR clock_t t_mark

Definition at line 3182 of file cohomo.cc.

◆ t_solve

VAR clock_t t_solve =0

Definition at line 3182 of file cohomo.cc.

◆ t_start

VAR clock_t t_start

Definition at line 3182 of file cohomo.cc.

◆ t_total

VAR clock_t t_total =0

Definition at line 3182 of file cohomo.cc.

◆ t_value

VAR clock_t t_value =0

Definition at line 3182 of file cohomo.cc.