| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% TENSPOL = TENSOR POLYNOMIAL |
| 3 |
% represented in a semi-distributed form. |
| 4 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 5 |
|
| 6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 7 |
%% Copyright (C) 1996 |
| 8 |
%% Alexander Podoplelov |
| 9 |
%% |
| 10 |
%% Bergman and Anick are distributed in the hope that they will be |
| 11 |
%% useful, but WITHOUT ANY WARRANTY. No author or distributor |
| 12 |
%% accepts responsibility to anyone for the consequences of using them |
| 13 |
%% or for whether they serve any particular purpose or work at all, |
| 14 |
%% unless (s)he says so in writing. Refer to the Bergman General |
| 15 |
%% Public License for full details. |
| 16 |
|
| 17 |
%% Everyone is granted permission to copy, modify and redistribute |
| 18 |
%% bergman, but only under the conditions described in the |
| 19 |
%% Bergman General Public License. A copy of this license is |
| 20 |
%% supposed to have been given to you along with bergman so you |
| 21 |
%% can know your rights and responsibilities. It should be in a |
| 22 |
%% file named copyright. Among other things, the copyright notice |
| 23 |
%% and this notice must be preserved on all copies. |
| 24 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 25 |
|
| 26 |
|
| 27 |
(OFF RAISE) |
| 28 |
|
| 29 |
% Internal representation of the TENSPOL is as following: |
| 30 |
% (NIL (Chn1,QPol1) (Chn2,QPol2) ... ) |
| 31 |
% where Chni - chains, QPoli - augmented polynomials |
| 32 |
% (Access the parts only by means of anSDP2... macros!) |
| 33 |
|
| 34 |
% anCONCATTENSPOLMON (pol:sdtp, mon:augmon) : sdtp ; |
| 35 |
% Concatenates mon to each element of the tensor polynomial pol |
| 36 |
% to the right side, reduces them by means of the current |
| 37 |
% Groebner basis, and returns the result. |
| 38 |
%Concatenates h to each polynomail in cp and reduces them |
| 39 |
(DE anCONCATTENSPOLMON (cp h) |
| 40 |
% cp : semidestributedtensorpolynomial |
| 41 |
% h : augmon |
| 42 |
(PROG (i j rt) |
| 43 |
(SETQ rt (SETQ i (CONS NIL (DPLISTCOPY (CDR cp))))) |
| 44 |
Lp (COND |
| 45 |
( (CDR i) |
| 46 |
(SETQ j (NORMALFORM (QPOLMONMULT (anSDP2NextQPol i) (PMon h)))) |
| 47 |
(COND ((NOT j) (anRemoveSDPTm i)) |
| 48 |
(T |
| 49 |
(anReplaceQPolinSDPTm (anSDP2NextSDPTm i) j) |
| 50 |
(anNextSDPTail i))) |
| 51 |
(GO Lp) |
| 52 |
) |
| 53 |
)%COND |
| 54 |
(RETURN rt) |
| 55 |
) |
| 56 |
) |
| 57 |
|
| 58 |
% anMAKETENSPOL (inchain:chn, mon:augmon) : sdtp ; |
| 59 |
% Creates and returns the tensor polynomial which contains only |
| 60 |
% one element: inchain tensor multiplied by mon. |
| 61 |
(DE anMAKETENSPOL (g h) |
| 62 |
% g : chain |
| 63 |
% h : augmon |
| 64 |
(CONS NIL |
| 65 |
(NCONS (anChn!&QPol2SDPTm g (Tm2QPol (Cf!&Mon2Tm REDANDCOEFFONE h)))) |
| 66 |
) |
| 67 |
) |
| 68 |
|
| 69 |
% anDESTRUCTADDTENSPOLS (pol1:sdtp,pol2:sdtp,cf:coeff):sdtp; DESTRUCTIVE(1) |
| 70 |
% Modifies pol1 so that pol1 = pol1+cf*pol2. |
| 71 |
% Returns the modified pol1. |
| 72 |
(DE anDESTRUCTADDTENSPOLS (sdp1 sdp2 cf) |
| 73 |
% sdp1, sdp2 : semi-destributed tensor polynomials |
| 74 |
% cf : coeffitient |
| 75 |
% result : sdp1=sdp1+cf*sdp2 |
| 76 |
(PROG (a b c p) |
| 77 |
(SETQ a sdp1) |
| 78 |
(SETQ b (CDR sdp2)) |
| 79 |
L4 (COND |
| 80 |
( (NULL b) (GO OUTLABEL) ) |
| 81 |
( (NULL (CDR a)) |
| 82 |
(GO L5) |
| 83 |
) |
| 84 |
( (anLESSCHAIN (anSDP2NextChn a) (anSDP2FirstChn b)) |
| 85 |
(DestructQPolCoeffTimes (anSDP2FirstQPol b) cf) |
| 86 |
(anInsertSDPTm a (anSDP2FirstSDPTm b)) |
| 87 |
(anNextSDPTail b) |
| 88 |
(anNextSDPTail a) |
| 89 |
(GO L4) |
| 90 |
) |
| 91 |
( (anChn!= (anSDP2NextChn a) (anSDP2FirstChn b)) |
| 92 |
(COND |
| 93 |
( (NULL (DestructQPolSimpSemiLinComb |
| 94 |
(anSDP2NextQPol a) |
| 95 |
(anSDP2FirstQPol b) |
| 96 |
cf) |
| 97 |
) |
| 98 |
(anRemoveSDPTm a) |
| 99 |
) |
| 100 |
)%COND |
| 101 |
(anNextSDPTail b) |
| 102 |
(GO L4) |
| 103 |
) |
| 104 |
(T (anNextSDPTail a) (GO L4)) |
| 105 |
)%COND |
| 106 |
L5 (RPLACD a b) |
| 107 |
L6 (COND |
| 108 |
( (NOT (NULL b)) |
| 109 |
(DestructQPolCoeffTimes (anSDP2FirstQPol b) cf) |
| 110 |
(anNextSDPTail b) |
| 111 |
(GO L6) |
| 112 |
) |
| 113 |
) |
| 114 |
OUTLABEL |
| 115 |
(RETURN sdp1) |
| 116 |
) |
| 117 |
) |
| 118 |
|
| 119 |
% anEXTRACTHIGHTENSMON (pol:sdtp) : (chn . augmon) ; |
| 120 |
% Returns a dotted pair which represents a highest |
| 121 |
% element in the deg-lex sense of pol. |
| 122 |
(DE anEXTRACTHIGHTENSMON (semidtpol) |
| 123 |
% semidtpol should not represent zero |
| 124 |
%return pair:(chain.term) |
| 125 |
(CONS (anSDP2NextChn semidtpol) (QPol2LRatTm (anSDP2NextQPol semidtpol))) |
| 126 |
)%DE |
| 127 |
|
| 128 |
|
| 129 |
% anPRINTQPOLORCONSTANT (pol:qpol) : - ; |
| 130 |
% Prints a rational coefficient cf, a *, and then within |
| 131 |
% parentheses the polynomial multiplied by the inverse of cf. |
| 132 |
% If the polynomial is constant, prints only it as a |
| 133 |
% rational coefficient. |
| 134 |
(DE antpPRINTQPOLORCONSTANT (quotpol) |
| 135 |
(COND ((NOT quotpol) |
| 136 |
(PRINT 0)) |
| 137 |
((Mon!= (APol2Lm quotpol) MONONE) |
| 138 |
(PRIN2 "(") (PRIN2 (PolNum quotpol)) (PRIN2 "*") |
| 139 |
(PRIN2 (RedandCoeff2OutCoeff (APol2Lc quotpol))) (PRIN2 "/") |
| 140 |
(PRIN2 (PolDen quotpol)) (PRIN2 ")") (TERPRI)) |
| 141 |
(T |
| 142 |
(PRIN2 "(") (PRIN2 (PolNum quotpol)) (PRIN2 "*") |
| 143 |
(PRIN2 (RedandCoeff2OutCoeff (APol2Lc quotpol))) (PRIN2 "/") |
| 144 |
(PRIN2 (PolDen quotpol)) (PRIN2 ")") (PRIN2 "*") (PRIN2 "(") |
| 145 |
(REDANDALGOUT quotpol) (PRIN2 ")") (TERPRI)) |
| 146 |
) |
| 147 |
) |
| 148 |
|
| 149 |
(ON RAISE) |