1
2 #include "def.h"
3 #include "macro.h"
4
5
6 static OP tem_sp = NULL;
7
tem_ende()8 INT tem_ende()
9 {
10 INT erg = OK;
11 if (tem_sp!= NULL) {
12 FREEALL(tem_sp);
13 tem_sp=NULL;
14 }
15 ENDR("tem_ende");
16 }
17
18
tsp2_co(a,b,c,f)19 static INT tsp2_co(a,b,c,f) OP a,b,c,f;
20 {
21 OP m;
22 INT erg = OK;
23 m = CALLOCOBJECT();
24 b_sk_mo(CALLOCOBJECT(),CALLOCOBJECT(),m);
25 COPY(a,S_MO_S(m));
26 COPY(f,S_MO_K(m));
27 if (S_O_K(c) == HASHTABLE)
28 insert_scalar_hashtable(m,c,add_koeff,eq_monomsymfunc,hash_monompartition);
29 else
30 insert_list(m,c,add_koeff,comp_monommonomial);
31 ENDR("tsp2_co");
32 }
33
find_tem_integer(a)34 OP find_tem_integer(a) OP a;
35 {
36 INT erg = OK;
37 CTO(INTEGER,"find_tem_integer(1)",a);
38 SYMCHECK( (S_I_I(a) < 0) ,"find_tem_integer:parameter <0");
39 if (tem_sp==NULL){ tem_sp=CALLOCOBJECT();m_il_v(100,tem_sp);}
40 if (S_I_I(a)>S_V_LI(tem_sp)) { erg += inc_vector_co(S_I_I(a)-S_V_LI(tem_sp)+30);}
41 if (EMPTYP(S_V_I(tem_sp,S_I_I(a))))
42 {
43 OP c;
44 c = CALLOCOBJECT();
45 first_partition(cons_null,c);
46 init_hashtable(S_V_I(tem_sp,S_I_I(a)));
47 mem_integer__(a,c,S_V_I(tem_sp,S_I_I(a)),cons_eins);
48 FREEALL(c);
49 }
50
51 return S_V_I(tem_sp,S_I_I(a));
52
53 ENDO("find_tem_integer");
54 }
55
tem_integer__faktor(a,b,f)56 INT tem_integer__faktor(a,b,f) OP a,b,f;
57 {
58 OP c;
59 INT erg = OK;
60 CTTO(HASHTABLE,MONOMIAL,"tem_integer__faktor(2)",b);
61 CTO(INTEGER,"tem_integer__faktor(1)",a);
62 SYMCHECK( (S_I_I(a) < 0) ,"tem_integer__faktor:parameter <0");
63
64 if (tem_sp==NULL){ tem_sp=CALLOCOBJECT();m_il_v(100,tem_sp);}
65 if (S_I_I(a)>S_V_LI(tem_sp)) { erg += inc_vector_co(S_I_I(a)-S_V_LI(tem_sp)+30);}
66
67 if (EMPTYP(S_V_I(tem_sp,S_I_I(a))))
68 {
69 c = CALLOCOBJECT();
70 first_partition(cons_null,c);
71 init_hashtable(S_V_I(tem_sp,S_I_I(a)));
72 mem_integer__(a,c,S_V_I(tem_sp,S_I_I(a)),cons_eins);
73 FREEALL(c);
74 }
75 M_FORALL_MONOMIALS_IN_A(S_V_I(tem_sp,S_I_I(a)),cons_eins,b,f,tsp2_co);
76
77 ENDR("tem_integer__factor");
78 }
79
tem_partition__faktor(a,b,f)80 INT tem_partition__faktor(a,b,f) OP a,b,f;
81 {
82 OP c;
83 INT erg = OK;
84 CTTO(HASHTABLE,MONOMIAL,"tem_partition__faktor(2)",b);
85 CTO(PARTITION,"tem_partition__faktor(1)",a);
86
87
88 c = CALLOCOBJECT();
89 erg += first_partition(cons_null,c);
90 erg += mem_partition__(a,c,b,f);
91 FREEALL(c);
92
93 ENDR("tem_partition__factor");
94 }
95
96