My Project
Loading...
Searching...
No Matches
sca.h
Go to the documentation of this file.
1#ifndef SCA_H
2#define SCA_H
3
4#ifdef HAVE_PLURAL
5
6#include "polys/nc/nc.h"
7#include "misc/intvec.h"
8
9// we must always have this test!
10inline ideal SCAQuotient(const ring r)
11{
12 assume(rIsSCA(r));
13 return r->GetNC()->SCAQuotient();
14}
15
16
17
18static inline short scaFirstAltVar(ring r)
19{
20 assume(rIsSCA(r));
21
22 return (r->GetNC()->FirstAltVar());
23}
24
25static inline short scaLastAltVar(ring r)
26{
27 assume(rIsSCA(r));
28
29 return (r->GetNC()->LastAltVar());
30}
31
32
33// The following inlines are just helpers for setup functions.
34static inline void scaFirstAltVar(ring r, short n)
35{
36 assume(rIsSCA(r));
37
38 r->GetNC()->FirstAltVar() = n;
39}
40
41static inline void scaLastAltVar(ring r, short n)
42{
43 assume(rIsSCA(r));
44
45 r->GetNC()->LastAltVar() = n;
46}
47
48
49
50///////////////////////////////////////////////////////////////////////////////////////////
51// fast procedures for for SuperCommutative Algebras:
52///////////////////////////////////////////////////////////////////////////////////////////
53
54// this is not a basic operation... but it for efficiency we did it specially for SCA:
55// return x_i * pPoly; preserve pPoly.
56poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing);
57
58//////////////////////////////////////////////////////////////////////////////////////
59
60// TODO: correct the following descriptions...
61
62// tests whether p is bi-homogeneous with respect to the given variable'(component')-weights
63// ps: polynomial is bi-homogeneous iff all terms have the same bi-degree (x,y).
64bool p_IsBiHomogeneous(const poly p,
65 const intvec *wx, const intvec *wy,
66 const intvec *wCx, const intvec *wCy,
67 int &dx, int &dy,
68 const ring r);
69
70
71//////////////////////////////////////////////////////////////////////////////////////
72
73// tests whether p is bi-homogeneous with respect to the given variable'(component')-weights
74// ps: ideal is bi-homogeneous iff all its generators are bi-homogeneous polynomials.
75bool id_IsBiHomogeneous(const ideal id,
76 const intvec *wx, const intvec *wy,
77 const intvec *wCx, const intvec *wCy,
78 const ring r);
79
80
81//////////////////////////////////////////////////////////////////////////////////////
82
83// Scecial for SCA:
84
85// returns an intvector with [nvars(r)] integers [1/0]
86// 1 - for commutative variables
87// 0 - for anticommutative variables
88intvec *ivGetSCAXVarWeights(const ring r);
89
90// returns an intvector with [nvars(r)] integers [1/0]
91// 0 - for commutative variables
92// 1 - for anticommutative variables
93intvec *ivGetSCAYVarWeights(const ring r);
94
95
96static inline bool p_IsSCAHomogeneous(const poly p,
97 const intvec *wCx, const intvec *wCy,
98 const ring r)
99{
100 // inefficient! don't use it in time-critical code!
103
104 int x,y;
105
106 bool homog = p_IsBiHomogeneous( p, wx, wy, wCx, wCy, x, y, r );
107
108 delete wx;
109 delete wy;
110
111 return homog;
112}
113
114
115static inline bool id_IsSCAHomogeneous(const ideal id,
116 const intvec *wCx, const intvec *wCy,
117 const ring r)
118{
119 // inefficient! don't use it in time-critical code!
122
123 bool homog = id_IsBiHomogeneous( id, wx, wy, wCx, wCy, r );
124
125 delete wx;
126 delete wy;
127
128 return homog;
129}
130
131
132//////////////////////////////////////////////////////////////////////////////////////
133
134// reduce polynomial p modulo <y_i^2> , i = iFirstAltVar .. iLastAltVar
135poly p_KillSquares(const poly p,
136 const short iFirstAltVar, const short iLastAltVar,
137 const ring r);
138
139//////////////////////////////////////////////////////////////////////////////////////
140
141// reduce ideal id modulo <y_i^2> , i = iFirstAltVar .. iLastAltVar
142// optional argument bSkipZeroes allow skipping of zero entries, by
143// default - no skipping!
144ideal id_KillSquares(const ideal id,
145 const short iFirstAltVar, const short iLastAltVar,
146 const ring r, const bool bSkipZeroes = false);
147
148// for benchmarking
149bool sca_Force(ring rGR, int b, int e);
150
151
152#ifdef PLURAL_INTERNAL_DECLARATIONS
153
154// set pProcs for r and the variable p_Procs
155// should be used by nc_p_ProcsSet in "gring.h"
156void sca_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
157
158// should be used only inside nc_SetupQuotient!
159// Check whether this our case:
160// 1. rG is a commutative polynomial ring \otimes anticommutative algebra
161// 2. factor ideal rGR->qideal contains squares of all alternating variables.
162//
163// if yes, make rGR a super-commutative algebra!
164// NOTE: Factors of SuperCommutative Algebras are supported this way!
165//
166// rG == NULL means that there is no separate base G-algebra in this
167// case take rGR == rG
168
169// special case: bCopy == true (default value: false)
170// meaning: rGR copies structure from rG
171// (maybe with some minor changes, which don't change the type!)
172bool sca_SetupQuotient(ring rGR, ring rG, bool bCopy);
173
174#endif // PLURAL_INTERNAL_DECLARATIONS
175
176
177#else
178// these must not be used at all.
179// #define scaFirstAltVar(R) 0
180// #define scaLastAltVar(R) 0
181#endif // HAVE_PLURAL
182
183#endif // #ifndef SCA_H
int i
Definition: cfEzgcd.cc:132
Variable x
Definition: cfModGcd.cc:4082
int p
Definition: cfModGcd.cc:4078
CanonicalForm b
Definition: cfModGcd.cc:4103
Definition: intvec.h:23
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:53
static bool rIsSCA(const ring r)
Definition: nc.h:190
#define assume(x)
Definition: mod2.h:389
struct p_Procs_s p_Procs_s
Definition: ring.h:23
void sca_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: sca.cc:1225
bool sca_SetupQuotient(ring rGR, ring rG, bool bCopy)
Definition: sca.cc:911
ideal SCAQuotient(const ring r)
Definition: sca.h:10
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1465
bool p_IsBiHomogeneous(const poly p, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, int &dx, int &dy, const ring r)
Definition: sca.cc:1320
intvec * ivGetSCAXVarWeights(const ring r)
Definition: sca.cc:1383
static bool p_IsSCAHomogeneous(const poly p, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:96
poly sca_pp_Mult_xi_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:1203
intvec * ivGetSCAYVarWeights(const ring r)
Definition: sca.cc:1411
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes=false)
Definition: sca.cc:1520
static short scaLastAltVar(ring r)
Definition: sca.h:25
bool sca_Force(ring rGR, int b, int e)
Definition: sca.cc:1161
bool id_IsBiHomogeneous(const ideal id, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.cc:1359
static short scaFirstAltVar(ring r)
Definition: sca.h:18
static bool id_IsSCAHomogeneous(const ideal id, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.h:115