1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /*************************************************************** |
---|
5 | * File: kInline.cc |
---|
6 | * Purpose: implementation of std related inline routines |
---|
7 | * Author: obachman (Olaf Bachmann) |
---|
8 | * Created: 8/00 |
---|
9 | * Version: $Id: kInline.cc,v 1.1 2000-09-12 16:09:55 obachman Exp $ |
---|
10 | *******************************************************************/ |
---|
11 | #ifndef KINLINE_CC |
---|
12 | #define KINLINE_CC |
---|
13 | |
---|
14 | #if !defined(NO_KINLINE) || defined(KUTIL_CC) |
---|
15 | |
---|
16 | #include "polys.h" |
---|
17 | |
---|
18 | KINLINE TSet initT () { return (TSet)omAlloc0(setmax*sizeof(TObject)); } |
---|
19 | |
---|
20 | KINLINE poly sTObject::SetP(poly new_p) |
---|
21 | { |
---|
22 | poly old_p = p; |
---|
23 | memset((void*) this, 0, sizeof(sTObject)); |
---|
24 | p = new_p; |
---|
25 | sev = pGetShortExpVector(p); |
---|
26 | return p; |
---|
27 | } |
---|
28 | |
---|
29 | // this should be made more efficient |
---|
30 | KINLINE poly k_LmShallowCopyDelete_lmRing_2_tailRing(poly p, ring lmRing, ring tailRing) |
---|
31 | { |
---|
32 | int i; |
---|
33 | poly np = p_New(tailRing); |
---|
34 | pNext(np) = pNext(p); |
---|
35 | pSetCoeff0(np, pGetCoeff(p)); |
---|
36 | |
---|
37 | for (i=1; i<=tailRing->N;i++) |
---|
38 | { |
---|
39 | p_SetExp(np, i, p_GetExp(p, i,lmRing), tailRing); |
---|
40 | } |
---|
41 | if (rRing_has_Comp(tailRing)) |
---|
42 | { |
---|
43 | p_SetComp(np, p_GetComp(p,lmRing), tailRing); |
---|
44 | } |
---|
45 | p_Setm(np, tailRing); |
---|
46 | p_Free(p, lmRing); |
---|
47 | return np; |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | #if 0 |
---|
52 | // spoly related stuff |
---|
53 | KINLINE poly sLObject::Iter() |
---|
54 | { |
---|
55 | if (bucket != NULL) |
---|
56 | { |
---|
57 | p = kBucketExtractLm(bucket); |
---|
58 | if (p == NULL) kBucketDestroy(&bucket); |
---|
59 | } |
---|
60 | else |
---|
61 | { |
---|
62 | if (p != NULL && pNext(p) != NULL) |
---|
63 | p = pNext(p); |
---|
64 | } |
---|
65 | lmRing = tailRing; |
---|
66 | return p; |
---|
67 | } |
---|
68 | KINLINE void sLObject::Tail_Minus_mm_Mult_qq(poly m, poly qq, int lq, poly spNoether) |
---|
69 | { |
---|
70 | if (is_bucket) |
---|
71 | { |
---|
72 | kBucket_Minus_m_Mult_p(bucket, m, &lq, spNoether); |
---|
73 | } |
---|
74 | else |
---|
75 | { |
---|
76 | pNext(p) = tailRing->p_Procs->p_Minus_mm_Mult_qq(pNext(p), |
---|
77 | m, qq, lq, spNoether, tailRing); |
---|
78 | } |
---|
79 | } |
---|
80 | KINLINE poly sLObject::GetP(ring LmRing) |
---|
81 | { |
---|
82 | assume(p != NULL); |
---|
83 | if (bucket != NULL) |
---|
84 | { |
---|
85 | poly new_tail; |
---|
86 | kBucketClear((kBucket_pt) bucket, &new_tail, &pLength); |
---|
87 | kBucketDestroy(&bucket); |
---|
88 | pLength++; |
---|
89 | pNext(p) = new_tail; |
---|
90 | } |
---|
91 | if (lmRing != LmRing) |
---|
92 | { |
---|
93 | p = p_LmShallowMoveDelete(p, LmRing, lmRing); |
---|
94 | lmRing = LmRing; |
---|
95 | } |
---|
96 | return p; |
---|
97 | } |
---|
98 | |
---|
99 | #endif |
---|
100 | |
---|
101 | #endif // defined(KINLINE) || defined(KUTIL_CC) |
---|
102 | #endif // KINLINE_CC |
---|
103 | |
---|