1 | #ifndef GRING_SUPER_COMMUTATIVE_ALGEBRA_H |
---|
2 | #define GRING_SUPER_COMMUTATIVE_ALGEBRA_H |
---|
3 | |
---|
4 | /**************************************** |
---|
5 | * Computer Algebra System SINGULAR * |
---|
6 | ****************************************/ |
---|
7 | /* $Id: sca.h,v 1.7 2007-01-31 23:51:25 motsak Exp $ */ |
---|
8 | |
---|
9 | #include <ring.h> |
---|
10 | #include <gring.h> |
---|
11 | #include <structs.h> |
---|
12 | |
---|
13 | |
---|
14 | // we must always have this test! |
---|
15 | inline bool rIsSCA(const ring r) |
---|
16 | { |
---|
17 | #ifdef HAVE_PLURAL |
---|
18 | return rIsPluralRing(r) && (ncRingType(r) == nc_exterior); |
---|
19 | #else |
---|
20 | return false; |
---|
21 | #endif |
---|
22 | } |
---|
23 | |
---|
24 | #ifdef HAVE_PLURAL |
---|
25 | #include <gring.h> |
---|
26 | |
---|
27 | |
---|
28 | inline unsigned int scaFirstAltVar(ring r) |
---|
29 | { |
---|
30 | assume(rIsSCA(r)); |
---|
31 | |
---|
32 | return (r->nc->FirstAltVar()); |
---|
33 | }; |
---|
34 | |
---|
35 | inline unsigned int scaLastAltVar(ring r) |
---|
36 | { |
---|
37 | assume(rIsSCA(r)); |
---|
38 | |
---|
39 | return (r->nc->LastAltVar()); |
---|
40 | }; |
---|
41 | |
---|
42 | |
---|
43 | // The following inlines are just helpers for setup functions. |
---|
44 | inline void scaFirstAltVar(ring r, int n) |
---|
45 | { |
---|
46 | assume(rIsSCA(r)); |
---|
47 | |
---|
48 | r->nc->FirstAltVar() = n; |
---|
49 | }; |
---|
50 | |
---|
51 | inline void scaLastAltVar(ring r, int n) |
---|
52 | { |
---|
53 | assume(rIsSCA(r)); |
---|
54 | |
---|
55 | r->nc->LastAltVar() = n; |
---|
56 | }; |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | /////////////////////////////////////////////////////////////////////////////////////////// |
---|
61 | // fast procedures for for SuperCommutative Algebras: |
---|
62 | /////////////////////////////////////////////////////////////////////////////////////////// |
---|
63 | |
---|
64 | // this is not a basic operation... but it for efficiency we did it specially for SCA: |
---|
65 | // return x_i * pPoly; preserve pPoly. |
---|
66 | poly sca_pp_Mult_xi_pp(unsigned int i, const poly pPoly, const ring rRing); |
---|
67 | |
---|
68 | // set pProcs for r and the variable p_Procs |
---|
69 | // should be used by nc_p_ProcsSet in "gring.h" |
---|
70 | void sca_p_ProcsSet(ring rGR, p_Procs_s* p_Procs); |
---|
71 | |
---|
72 | ////////////////////////////////////////////////////////////////////////////////////// |
---|
73 | |
---|
74 | // tests whether p is bi-homogeneous without respect to the actual weigths(=>all ones) |
---|
75 | // Polynomial is bi-homogeneous iff all monomials have the same bi-degree (x,y). |
---|
76 | // Y are ones from iFirstAltVar up to iLastAltVar |
---|
77 | bool p_IsBiHomogeneous(const poly p, |
---|
78 | const unsigned int iFirstAltVar, const unsigned int iLastAltVar, |
---|
79 | const ring r); |
---|
80 | |
---|
81 | ////////////////////////////////////////////////////////////////////////////////////// |
---|
82 | |
---|
83 | // returns true if id is bi-homogenous without respect to the aktual weights(=> all ones) |
---|
84 | // Ideal is bi-homogeneous iff all its generators are bi-homogeneous. |
---|
85 | bool id_IsBiHomogeneous(const ideal id, |
---|
86 | const unsigned int iFirstAltVar, const unsigned int iLastAltVar, |
---|
87 | const ring r); |
---|
88 | |
---|
89 | ////////////////////////////////////////////////////////////////////////////////////// |
---|
90 | |
---|
91 | // reduce polynomial p modulo <y_i^2> , i = iFirstAltVar .. iLastAltVar |
---|
92 | poly p_KillSquares(const poly p, |
---|
93 | const unsigned int iFirstAltVar, const unsigned int iLastAltVar, |
---|
94 | const ring r); |
---|
95 | |
---|
96 | ////////////////////////////////////////////////////////////////////////////////////// |
---|
97 | |
---|
98 | // reduce ideal id modulo <y_i^2> , i = iFirstAltVar .. iLastAltVar |
---|
99 | ideal id_KillSquares(const ideal id, |
---|
100 | const unsigned int iFirstAltVar, const unsigned int iLastAltVar, |
---|
101 | const ring r); |
---|
102 | |
---|
103 | |
---|
104 | #ifdef PLURAL_INTERNAL_DECLARATIONS |
---|
105 | |
---|
106 | // should be used only inside nc_SetupQuotient! |
---|
107 | // Check whether this our case: |
---|
108 | // 1. rG is a commutative polynomial ring \otimes anticommutative algebra |
---|
109 | // 2. factor ideal rGR->qideal contains squares of all alternating variables. |
---|
110 | // |
---|
111 | // if yes, make rGR a super-commutative algebra! |
---|
112 | // NOTE: Factors of SuperCommutative Algebras are supported this way! |
---|
113 | bool sca_SetupQuotient(ring rGR, const ring rG); |
---|
114 | |
---|
115 | #endif // PLURAL_INTERNAL_DECLARATIONS |
---|
116 | |
---|
117 | |
---|
118 | #else |
---|
119 | // these must not be used at all. |
---|
120 | // #define scaFirstAltVar(R) 0 |
---|
121 | // #define scaLastAltVar(R) 0 |
---|
122 | #endif |
---|
123 | #endif // #ifndef GRING_SUPER_COMMUTATIVE_ALGEBRA_H |
---|