1 #include "def.h"
2 #include "macro.h"
3
ppm_ende()4 INT ppm_ende()
5 {
6 return OK;
7 }
8
9 INT ppm_integer_partition_();
10 INT ppm_integer_hashtable_();
11 INT ppm_integer_integer_();
12 INT ppm___();
ppm_null__(b,c,f)13 INT ppm_null__(b,c,f) OP b,c,f;
14 {
15 INT mxx_null__();
16 return mxx_null__(b,c,f);
17 }
18
ppm_integer__(a,b,c,f)19 INT ppm_integer__(a,b,c,f) OP a,b,c; OP f;
20 /* AK 051201 */
21 {
22 INT erg = OK;
23
24 CTO(INTEGER,"ppm_integer__(1)",a);
25 CTTTTO(INTEGER,HASHTABLE,PARTITION,MONOMIAL,"ppm_integer__(2)",b);
26 CTTO(HASHTABLE,MONOMIAL,"ppm_integer__(3)",c);
27 SYMCHECK((S_I_I(a) < 0),"ppm_integer__:integer < 0");
28 if (S_I_I(a) == 0)
29 {
30 erg += ppm_null__(b,c,f);
31 goto ende;
32 }
33 else if (S_O_K(b) == PARTITION)
34 {
35 erg += ppm_integer_partition_(a,b,c,f);
36 goto ende;
37 }
38 else if (S_O_K(b) == INTEGER)
39 {
40 erg += ppm_integer_integer_(a,b,c,f);
41 goto ende;
42 }
43 else
44 {
45 M_FORALL_MONOMIALS_IN_B(a,b,c,f,ppm_integer_partition_);
46 goto ende;
47 }
48
49 ende:
50 CTTO(HASHTABLE,MONOMIAL,"ppm_integer__(e3)",c);
51 ENDR("ppm_integer__");
52 }
53
54 INT ppm_null_partition_();
55
ppm_partition__(a,b,c,f)56 INT ppm_partition__(a,b,c,f) OP a,b,c; OP f;
57 {
58 INT erg = OK;
59 CTO(PARTITION,"ppm_partition__(1)",a);
60 CTTTO(HASHTABLE,MONOMIAL,PARTITION,"ppm_partition__(2)",b);
61 CTTO(HASHTABLE,MONOMIAL,"ppm_partition__(3)",c);
62
63 if (S_PA_LI(a) == 0) {
64 erg += ppm_null__(b,c,f);
65 goto ende;
66 }
67 else if (S_PA_LI(a) == 1) {
68 erg += ppm_integer__(S_PA_I(a,0),b,c,f);
69 goto ende;
70 }
71 else{
72 INT mmm_hashtable_hashtable_();
73 INT p_splitpart();
74 erg += p_splitpart(a,b,c,f,ppm_partition__,
75 mmm_hashtable_hashtable_);
76 goto ende;
77 }
78
79 ende:
80 CTTO(HASHTABLE,MONOMIAL,"ppm_partition__(e3)",c);
81 ENDR("ppm_partition__");
82 }
83
84
85
ppm_powsym__(a,b,c,f)86 INT ppm_powsym__(a,b,c,f) OP a,b,c,f;
87 /* AK 051201 */
88 /* c += p_a [p_b] \times f */
89 {
90 INT erg = OK;
91 CTO(POWSYM,"ppm_powsym__(1)",a);
92 CTTTO(HASHTABLE,PARTITION,MONOMIAL,"ppm_powsym__(2)",b);
93 CTTO(HASHTABLE,MONOMIAL,"ppm_powsym__(3)",c);
94 M_FORALL_MONOMIALS_IN_A(a,b,c,f,ppm_partition__);
95 CTTO(HASHTABLE,MONOMIAL,"ppm_powsym__(e3)",c);
96 ENDR("ppm_powsym__");
97 }
98
ppm_hashtable__(a,b,c,f)99 INT ppm_hashtable__(a,b,c,f) OP a,b,c,f;
100 /* AK 051201 */
101 /* c += p_a [p_b] \times f */
102 {
103 INT erg = OK;
104 CTO(HASHTABLE,"ppm_hashtable__(1)",a);
105 CTTTO(HASHTABLE,PARTITION,MONOMIAL,"ppm_hashtable__(2)",b);
106 CTTO(HASHTABLE,MONOMIAL,"ppm_hashtable__(3)",c);
107 M_FORALL_MONOMIALS_IN_A(a,b,c,f,ppm_partition__);
108 CTTO(HASHTABLE,MONOMIAL,"ppm_hashtable__(e3)",c);
109 ENDR("ppm_hashtable__");
110 }
111
ppm_hashtable_hashtable_(a,b,c,f)112 INT ppm_hashtable_hashtable_(a,b,c,f) OP a,b,c,f;
113 /* AK 051201 */
114 /* c += p_a [p_b] \times f */
115 {
116 INT erg = OK;
117 CTO(HASHTABLE,"ppm_hashtable_hashtable_(1)",a);
118 CTO(HASHTABLE,"ppm_hashtable_hashtable_(2)",b);
119 CTTO(HASHTABLE,MONOMIAL,"ppm_hashtable_hashtable_(3)",c);
120 NYI("ppm_hashtable_hashtable_");
121 ENDR("ppm_hashtable_hashtable_");
122 }
123
ppm_null_partition_(b,c,f)124 INT ppm_null_partition_(b,c,f) OP b,c,f;
125 /* AK 061201 */
126 {
127 INT erg = OK;
128 CTO(PARTITION,"ppm_null_partition(1)",b);
129 CTTO(MONOMIAL,HASHTABLE,"ppm_null_partition(2)",c);
130 _NULL_PARTITION_(b,c,f);
131 ENDR("ppm_null_partition");
132 }
133
ppm_integer_integer_(a,b,c,f)134 INT ppm_integer_integer_(a,b,c,f) OP a,b,c,f;
135 /* AK 051201 */
136 {
137 INT erg = OK;
138
139 CTO(INTEGER,"ppm_integer_integer_(1)",a);
140 CTO(INTEGER,"ppm_integer_integer_(2)",b);
141 CTTO(MONOMIAL,HASHTABLE,"ppm_integer_integer_(3)",c);
142 SYMCHECK ((S_I_I(a) < 0),"ppm_integer_integer_:integer(1)<0");
143 SYMCHECK ((S_I_I(b) < 0),"ppm_integer_integer_:integer(2)<0");
144
145 if (S_I_I(a) == 0) {
146 erg += ppm_null__(b,c,f);
147 goto ende;
148 }
149 else {
150 OP m;
151 m = CALLOCOBJECT();
152 b_sk_mo(CALLOCOBJECT(),CALLOCOBJECT(),m);
153 COPY(f,S_MO_K(m));
154 b_ks_pa(VECTOR,CALLOCOBJECT(),S_MO_S(m));
155 m_il_integervector(1,S_PA_S(S_MO_S(m)));
156 M_I_I(S_I_I(b)*S_I_I(a), S_PA_I(S_MO_S(m),0));
157
158 if (S_O_K(c) == HASHTABLE)
159 insert_scalar_hashtable(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);
160 else
161 insert_list(m,c,add_koeff,comp_monommonomial);
162
163 goto ende;
164 }
165
166
167 ende:
168 CTTO(MONOMIAL,HASHTABLE,"ppm_integer_integer_(3-ende)",c);
169 ENDR("ppm_integer_integer_");
170 }
171
ppm_integer_partition_(a,b,c,f)172 INT ppm_integer_partition_(a,b,c,f) OP a,b,c,f;
173 /* AK 051201 */
174 {
175 INT erg = OK;
176
177 CTO(INTEGER,"ppm_integer_partition_(1)",a);
178 CTO(PARTITION,"ppm_integer_partition_(2)",b);
179 CTTO(MONOMIAL,HASHTABLE,"ppm_integer_partition_(3)",c);
180 SYMCHECK ((S_I_I(a) < 0),"ppm_integer_partition_:integer<0");
181
182 if (S_I_I(a) == 0) {
183 erg += ppm_null__(b,c,f);
184 goto ende;
185 }
186 else if (S_PA_LI(b) == 0) {
187 erg += ppm_null__(b,c,f);
188 goto ende;
189 }
190 else {
191 OP m;
192 INT i;
193 m = CALLOCOBJECT();
194 b_sk_mo(CALLOCOBJECT(),CALLOCOBJECT(),m);
195 COPY(f,S_MO_K(m));
196 b_ks_pa(VECTOR,CALLOCOBJECT(),S_MO_S(m));
197 m_il_integervector(S_PA_LI(b),S_PA_S(S_MO_S(m)));
198 for (i=0;i<S_PA_LI(b);i++)
199 M_I_I(S_PA_II(b,i)*S_I_I(a), S_PA_I(S_MO_S(m),i));
200
201 if (S_O_K(c) == HASHTABLE)
202 insert_scalar_hashtable(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);
203 else
204 insert_list(m,c,add_koeff,comp_monommonomial);
205
206 goto ende;
207 }
208
209
210
211 ende:
212 CTTO(MONOMIAL,HASHTABLE,"ppm_integer_partition_(3-ende)",c);
213 ENDR("ppm_integer_partition_");
214 }
215
ppm_integer_hashtable_(a,b,c,f)216 INT ppm_integer_hashtable_(a,b,c,f) OP a,b,c,f;
217 /* AK 061101 */
218 {
219 INT erg = OK;
220 CTO(INTEGER,"ppm_integer_hashtable_(1)",a);
221 CTTO(HASHTABLE,MONOMIAL,"ppm_integer_hashtable_(2)",b);
222 CTTO(MONOMIAL,HASHTABLE,"integer_hashtable_(3)",c);
223
224 M_FORALL_MONOMIALS_IN_B(a,b,c,f,ppm_integer_partition_);
225
226 ENDR("ppm_integer_hashtable_");
227 }
228
229
230
plet_powsym_monomial(a,b,c)231 INT plet_powsym_monomial(a,b,c) OP a,b,c;
232 /* AK 051201
233 */
234 {
235 INT erg = OK;
236 INT t=0; /* is 1 if transfer HASHTABLE->POWSYM necessary */
237 CTTTTO(HASHTABLE,INTEGER,PARTITION,POWSYM,"plet_powsym_monomial(1)",a);
238 CTTTO(HASHTABLE,PARTITION,MONOMIAL,"plet_powsym_monomial(2)",b);
239 CTTTO(EMPTY,HASHTABLE,MONOMIAL,"plet_powsym_monomial(3)",c);
240
241 if (S_O_K(c) == EMPTY)
242 if (S_O_K(a) == INTEGER) init_monomial(c);
243 else { t=1; init_hashtable(c); }
244
245 ppm___(a,b,c,cons_eins);
246 if (t==1) t_HASHTABLE_MONOMIAL(c,c);
247 ENDR("plet_powsym_monomial");
248 }
249
ppm___(a,b,c,f)250 INT ppm___(a,b,c,f) OP a,b,c,f;
251 {
252 INT erg = OK;
253 CTTTTO(HASHTABLE,INTEGER,PARTITION,POWSYM,"ppm___(1)",a);
254 CTTTO(HASHTABLE,PARTITION,MONOMIAL,"ppm___(2)",b);
255 CTTO(HASHTABLE,POWSYM,"ppm___(3)",c);
256 if (S_O_K(a) == INTEGER)
257 {
258 erg += ppm_integer__(a,b,c,f);
259 goto ende;
260 }
261 else if (S_O_K(a) == PARTITION)
262 {
263 erg += ppm_partition__(a,b,c,f);
264 goto ende;
265 }
266 else if (S_O_K(a) == POWSYM)
267 {
268 erg += ppm_powsym__(a,b,c,f);
269 goto ende;
270 }
271 else /* if (S_O_K(a) == HASHTABLE) */
272 {
273 erg += ppm_hashtable__(a,b,c,f);
274 goto ende;
275 }
276
277 ende:
278 CTTO(HASHTABLE,POWSYM,"ppm___(e3)",c);
279 ENDR("ppm___");
280 }
281
282