1 
2 
3 #include "def.h"
4 #include "macro.h"
5 
ppe_ende()6 INT ppe_ende()
7 {
8     INT erg = OK;
9     ENDR("ppe_ende");
10 }
11 
12 INT m_merge_partition_partition();
13 INT ppe_integer_partition_();
14 INT ppe_integer_hashtable_();
15 INT ppe___();
ppe_null__(b,c,f)16 INT ppe_null__(b,c,f) OP b,c,f;
17 {
18     return mxx_null__(b,c,f);
19 }
20 
ppe_integer__(a,b,c,f)21 INT ppe_integer__(a,b,c,f) OP a,b,c; OP f;
22 /* AK 051201 */
23 {
24     INT erg = OK;
25 
26     CTO(INTEGER,"ppe_integer__(1)",a);
27     CTTTO(HASHTABLE,PARTITION,ELMSYM,"ppe_integer__(2)",b);
28     CTTO(HASHTABLE,ELMSYM,"ppe_integer__(3)",c);
29     SYMCHECK((S_I_I(a) < 0),"ppe_integer__:integer < 0");
30     if (S_I_I(a) == 0)
31         erg += ppe_null__(b,c,f);
32 
33 
34     if (S_O_K(b) == PARTITION)
35         erg += ppe_integer_partition_(a,b,c,f);
36     else
37         M_FORALL_MONOMIALS_IN_B(a,b,c,f,ppe_integer_partition_);
38 
39 
40     ENDR("ppe_integer__");
41 }
42 
43 INT mee_hashtable_hashtable_();
44 INT ppe_null_partition_();
45 
ppe_partition__(a,b,c,f)46 INT ppe_partition__(a,b,c,f) OP a,b,c; OP f;
47 {
48     INT erg = OK;
49     CTO(PARTITION,"ppe_partition__(1)",a);
50     CTTTO(HASHTABLE,ELMSYM,PARTITION,"ppe_partition__(2)",b);
51     CTTO(HASHTABLE,ELMSYM,"ppe_partition__(3)",c);
52 
53     if (S_PA_LI(a) == 0) {
54         erg += ppe_null__(b,c,f);
55         }
56     else if (S_PA_LI(a) == 1) {
57         erg += ppe_integer__(S_PA_I(a,0),b,c,f);
58         }
59     else{
60         erg += p_splitpart(a,b,c,f,ppe_partition__,
61                                    mee_hashtable_hashtable_);
62         }
63 
64     ENDR("ppe_partition__");
65 }
66 
67 
68 
ppe_powsym__(a,b,c,f)69 INT ppe_powsym__(a,b,c,f) OP a,b,c,f;
70 /* AK 051201 */
71 /* c += p_a [p_b]  \times f */
72 {
73     INT erg = OK;
74     CTO(POWSYM,"ppe_powsym__(1)",a);
75     CTTTO(HASHTABLE,PARTITION,ELMSYM,"ppe_powsym__(2)",b);
76     CTTO(HASHTABLE,ELMSYM,"ppe_powsym__(3)",c);
77     M_FORALL_MONOMIALS_IN_A(a,b,c,f,ppe_partition__);
78     ENDR("ppe_powsym__");
79 }
80 
ppe_hashtable__(a,b,c,f)81 INT ppe_hashtable__(a,b,c,f) OP a,b,c,f;
82 /* AK 051201 */
83 /* c += p_a [p_b]  \times f */
84 {
85     INT erg = OK;
86     CTO(HASHTABLE,"ppe_hashtable__(1)",a);
87     CTTTO(HASHTABLE,PARTITION,ELMSYM,"ppe_hashtable__(2)",b);
88     CTTO(HASHTABLE,ELMSYM,"ppe_hashtable__(3)",c);
89     M_FORALL_MONOMIALS_IN_A(a,b,c,f,ppe_partition__);
90     ENDR("ppe_hashtable__");
91 }
92 
ppe_hashtable_hashtable_(a,b,c,f)93 INT ppe_hashtable_hashtable_(a,b,c,f) OP a,b,c,f;
94 /* AK 051201 */
95 /* c += p_a [p_b]  \times f */
96 {
97     INT erg = OK;
98     CTO(HASHTABLE,"ppe_hashtable_hashtable_(1)",a);
99     CTO(HASHTABLE,"ppe_hashtable_hashtable_(2)",b);
100     CTTO(HASHTABLE,ELMSYM,"ppe_hashtable_hashtable_(3)",c);
101     NYI("ppe_hashtable_hashtable_");
102     ENDR("ppe_hashtable_hashtable_");
103 }
104 
ppe_null_partition_(b,c,f)105 INT ppe_null_partition_(b,c,f) OP b,c,f;
106 /* AK 061201 */
107 {
108     INT erg = OK;
109     CTO(PARTITION,"ppe_null_partition(1)",b);
110     CTTO(ELMSYM,HASHTABLE,"ppe_null_partition(2)",c);
111     _NULL_PARTITION_(b,c,f);
112     ENDR("ppe_null_partition");
113 }
114 
ppe_integer_integer_(a,b,c,f)115 INT ppe_integer_integer_(a,b,c,f) OP a,b,c,f;
116 /* AK 051201 */
117 {
118     INT erg = OK;
119     OP m;
120     INT i;
121 
122     CTO(INTEGER,"ppe_integer_integer_(1)",a);
123     CTO(INTEGER,"ppe_integer_integer_(2)",b);
124     CTTO(ELMSYM,HASHTABLE,"ppe_integer_integer_(3)",c);
125     SYMCHECK ((S_I_I(a) < 0),"ppe_integer_integer_:integer(1)<0");
126     SYMCHECK ((S_I_I(b) < 0),"ppe_integer_integer_:integer(2)<0");
127 
128     if (S_I_I(a) == 0) {
129         erg += ppe_null__(b,c,f);
130         goto ende;
131         }
132     m = CALLOCOBJECT();
133     erg += b_ks_pa(VECTOR,CALLOCOBJECT(),m);
134     erg += m_il_v(S_I_I(b),S_PA_S(m));
135     C_O_K(S_PA_S(m),INTEGERVECTOR);
136 
137     for (i=0;i<S_I_I(b);i++)
138         M_I_I(S_I_I(a),S_PA_I(m,i));
139 
140     tme_partition__faktor(m,c,f);
141 
142     FREEALL(m);
143 
144 ende:
145     CTTO(ELMSYM,HASHTABLE,"ppe_integer_integer_(3-ende)",c);
146     ENDR("ppe_integer_integer_");
147 }
148 
ppe_integer_partition_(a,b,c,f)149 INT ppe_integer_partition_(a,b,c,f) OP a,b,c,f;
150 /* AK 051201 */
151 {
152     INT erg = OK;
153     OP m;
154     INT i;
155 
156     CTO(INTEGER,"ppe_integer_partition_(1)",a);
157     CTO(PARTITION,"ppe_integer_partition_(2)",b);
158     CTTO(ELMSYM,HASHTABLE,"ppe_integer_partition_(3)",c);
159     SYMCHECK ((S_I_I(a) < 0),"ppe_integer_partition_:integer<0");
160 
161     if (S_I_I(a) == 0) {
162         erg += ppe_null__(b,c,f);
163         goto ende;
164         }
165     else if (S_PA_LI(b) == 0) {
166         erg += ppe_null__(b,c,f);
167         goto ende;
168         }
169     else if (S_PA_LI(b) == 1) {
170         erg += ppe_integer_integer_(a,S_PA_I(b,0),c,f);
171         goto ende;
172         }
173     else
174         erg += p_splitpart2(a,b,c,f,ppe_integer_partition_,
175                                    mee_hashtable_hashtable_);
176 
177 
178 
179 ende:
180     CTTO(ELMSYM,HASHTABLE,"ppe_integer_partition_(3-ende)",c);
181     ENDR("ppe_integer_partition_");
182 }
183 
ppe_integer_hashtable_(a,b,c,f)184 INT ppe_integer_hashtable_(a,b,c,f) OP a,b,c,f;
185 /* AK 061101 */
186 {
187     INT erg = OK;
188     CTO(INTEGER,"ppe_integer_hashtable_(1)",a);
189     CTTO(HASHTABLE,ELMSYM,"ppe_integer_hashtable_(2)",b);
190     CTTO(ELMSYM,HASHTABLE,"integer_hashtable_(3)",c);
191 
192     NYI("ppe_integer_hashtable_");
193 
194     ENDR("ppe_integer_hashtable_");
195 }
196 
197 
198 
plet_powsym_elmsym(a,b,c)199 INT plet_powsym_elmsym(a,b,c) OP a,b,c;
200 /* AK 051201
201 */
202 {
203     INT erg = OK;
204     INT t=0; /* is 1 if transfer HASHTABLE->ELMSYM necessary */
205     CTTTTO(HASHTABLE,INTEGER,PARTITION,POWSYM,"plet_powsym_elmsym(1)",a);
206     CTTTTO(HASHTABLE,PARTITION,ELMSYM,INTEGER,"plet_powsym_elmsym(2)",b);
207     CTTTO(EMPTY,HASHTABLE,ELMSYM,"plet_powsym_elmsym(3)",c);
208 
209     if (S_O_K(c) == EMPTY)
210         if (S_O_K(a) == INTEGER) init_elmsym(c);
211         else { t=1; init_hashtable(c); }
212 
213     ppe___(a,b,c,cons_eins);
214     if (t==1) t_HASHTABLE_ELMSYM(c,c);
215     ENDR("plet_powsym_elmsym");
216 }
217 
ppe___(a,b,c,f)218 INT ppe___(a,b,c,f) OP a,b,c,f;
219 {
220     INT erg = OK;
221     CTTTTO(HASHTABLE,INTEGER,PARTITION,POWSYM,"ppe___(1)",a);
222     CTTTTO(HASHTABLE,PARTITION,ELMSYM,INTEGER,"ppe___(2)",b);
223     CTTO(HASHTABLE,ELMSYM,"ppe___(3)",c);
224     if (S_O_K(b) == INTEGER)
225         {
226         OP d;
227         d = CALLOCOBJECT();
228         erg += m_i_pa(b,d);
229         erg += ppe___(a,d,c,f);
230         FREEALL(d);
231         }
232     else if (S_O_K(a) == INTEGER)
233         {
234         erg += ppe_integer__(a,b,c,f);
235         }
236     else if (S_O_K(a) == PARTITION)
237         {
238         erg += ppe_partition__(a,b,c,f);
239         }
240     else if (S_O_K(a) == POWSYM)
241         {
242         erg += ppe_powsym__(a,b,c,f);
243         }
244     else /* if (S_O_K(a) == HASHTABLE) */
245         {
246         erg += ppe_hashtable__(a,b,c,f);
247         }
248 
249     ENDR("ppe___");
250 }
251 
252