1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | |
---|
5 | /*************************************************************** |
---|
6 | * File: pProcs.h |
---|
7 | * Purpose: declaration of primitive procs for polys |
---|
8 | * Author: obachman (Olaf Bachmann) |
---|
9 | * Created: 8/00 |
---|
10 | * Version: $Id: p_Procs.h,v 1.2 2000-08-29 14:10:28 obachman Exp $ |
---|
11 | *******************************************************************/ |
---|
12 | #ifndef P_PROCS_H |
---|
13 | #define P_PROCS_H |
---|
14 | #include "structs.h" |
---|
15 | |
---|
16 | // define/undef P_INLINE to inline some procedures |
---|
17 | #undef NO_P_INLINE |
---|
18 | #if defined(NDEBUG) && !defined(NO_INLINE) |
---|
19 | #define P_INLINE inline |
---|
20 | #else |
---|
21 | #define NO_P_INLINE 1 |
---|
22 | #define P_INLINE |
---|
23 | #endif |
---|
24 | |
---|
25 | |
---|
26 | // NOTE: the actual procedures below are not inlined, |
---|
27 | // only the dispatching function call |
---|
28 | |
---|
29 | /*------------- Allocation/Deletion ----------------------*/ |
---|
30 | // returns a copy of p |
---|
31 | P_INLINE poly p_Copy(poly p, const ring r = currRing); |
---|
32 | // deletes *p, and sets *p to NULL |
---|
33 | P_INLINE void p_Delete(poly *p, const ring r = currRing); |
---|
34 | |
---|
35 | /*------------- comparisons ----------------------*/ |
---|
36 | // returns 1 if Lm(p) > Lm(q) |
---|
37 | // 0 if Lm(p) = Lm(q) |
---|
38 | // -1 if Lm(p) < Lm(q) |
---|
39 | // assumes p != NULL && q != NULL |
---|
40 | P_INLINE int p_LmCmp(const poly p, const poly q, const ring r = currRing); |
---|
41 | |
---|
42 | /*------------- Arithmetic operations ----------------------*/ |
---|
43 | /* NOTE as a general rule that |
---|
44 | pp means input is constant; p means input is destroyed */ |
---|
45 | // returns -p |
---|
46 | P_INLINE poly p_Neg(poly p, const ring r = currRing); |
---|
47 | // returns p*n, p is const |
---|
48 | P_INLINE poly pp_Mult_nn(poly p, number n, const ring r = currRing); |
---|
49 | // returns p*n, destroys p |
---|
50 | P_INLINE poly p_Mult_nn(poly p, number n, const ring r = currRing); |
---|
51 | // returns p*m, does neither destroy p nor m |
---|
52 | P_INLINE poly pp_Mult_mm(poly p, poly m, const ring r = currRing); |
---|
53 | // returns p*m, destroys p, const: m |
---|
54 | P_INLINE poly p_Mult_mm(poly p, poly m, const ring r = currRing); |
---|
55 | // returns p+q, destroys p and q |
---|
56 | P_INLINE poly p_Add_q(poly p, poly q, const ring r = currRing); |
---|
57 | // return p - m*q, destroys p; const: q,m |
---|
58 | P_INLINE poly p_Minus_mm_Mult_qq(poly p, poly m, poly q, const ring r = currRing); |
---|
59 | // returns p*q, destroys p and q |
---|
60 | P_INLINE poly p_Mult_q(poly p, poly q, const ring r = currRing); |
---|
61 | // returns p*q, does neither destroy p nor q |
---|
62 | P_INLINE poly pp_Mult_qq(poly p, poly q, const ring r = currRing); |
---|
63 | |
---|
64 | /*------------- p_Proc stuff ----------------------*/ |
---|
65 | typedef poly (*p_Copy_Proc_Ptr)(poly p, const ring r); |
---|
66 | typedef void (*p_Delete_Proc_Ptr)(poly *p, const ring r); |
---|
67 | typedef poly (*p_ShallowCopyDelete_Proc_Ptr)(poly p, const ring r, omBin_s* dest_bin); |
---|
68 | typedef poly (*p_Mult_nn_Proc_Ptr)(poly p, number n, const ring r); |
---|
69 | typedef poly (*pp_Mult_nn_Proc_Ptr)(poly p, number n, const ring r); |
---|
70 | typedef poly (*p_Mult_mm_Proc_Ptr)(poly p, poly m, const ring r); |
---|
71 | typedef poly (*pp_Mult_mm_Proc_Ptr)(poly p, poly m, |
---|
72 | poly spNoether, const ring r); |
---|
73 | typedef poly (*p_Add_q_Proc_Ptr)(poly p, poly q, int & shorter, const ring r); |
---|
74 | typedef poly (*p_Minus_mm_Mult_qq_Proc_Ptr)(poly p, poly m, poly q, |
---|
75 | int &shorter, poly spNoether, |
---|
76 | const ring r); |
---|
77 | typedef poly (*p_ReverseNeg_Proc_Ptr)(poly p, const ring r); |
---|
78 | typedef poly (*p_Neg_Proc_Ptr)(poly p, const ring r); |
---|
79 | |
---|
80 | typedef struct p_Procs_s |
---|
81 | { |
---|
82 | p_Copy_Proc_Ptr p_Copy; |
---|
83 | p_Delete_Proc_Ptr p_Delete; |
---|
84 | p_ShallowCopyDelete_Proc_Ptr p_ShallowCopyDelete; |
---|
85 | p_Mult_nn_Proc_Ptr p_Mult_nn; |
---|
86 | pp_Mult_nn_Proc_Ptr pp_Mult_nn; |
---|
87 | pp_Mult_mm_Proc_Ptr pp_Mult_mm; |
---|
88 | p_Mult_mm_Proc_Ptr p_Mult_mm; |
---|
89 | p_Add_q_Proc_Ptr p_Add_q; |
---|
90 | p_Minus_mm_Mult_qq_Proc_Ptr p_Minus_mm_Mult_qq; |
---|
91 | p_ReverseNeg_Proc_Ptr p_ReverseNeg; |
---|
92 | p_Neg_Proc_Ptr p_Neg; |
---|
93 | } pProcs_s; |
---|
94 | |
---|
95 | |
---|
96 | void p_SetProcs(ring r, p_Procs_s* p_Procs); |
---|
97 | #ifdef RDEBUG |
---|
98 | void p_Debug_GetSpecNames(const ring r, char* &field, char* &length, |
---|
99 | char* &ord); |
---|
100 | void p_Debug_GetProcNames(const ring r, p_Procs_s* p_Procs); |
---|
101 | #endif |
---|
102 | |
---|
103 | #include "p_Inline.cc" |
---|
104 | |
---|
105 | #endif /* ! P_PROCS_H */ |
---|