aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/strap/GCDDOM-.lsp
blob: 92b58126f622559c03504a8b19cc4405021c4d8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
(/VERSIONCHECK 2) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Thing|)
                |GCDDOM-;lcm;3S;1|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%Shell|) |%Thing|)
                |GCDDOM-;lcm;LS;2|)) 

(DECLAIM (FTYPE (FUNCTION (|%List| |%Shell|) |%Thing|)
                |GCDDOM-;gcd;LS;3|)) 

(DECLAIM (FTYPE (FUNCTION (|%Thing| |%Thing| |%Shell|) |%Thing|)
                |GCDDOM-;gcdPolynomial;3Sup;4|)) 

(DEFUN |GCDDOM-;lcm;3S;1| (|x| |y| $)
  (PROG (LCM)
    (RETURN
      (SEQ (COND
             ((OR (SPADCALL |y| (|spadConstant| $ 7)
                      (|getShellEntry| $ 9))
                  (SPADCALL |x| (|spadConstant| $ 7)
                      (|getShellEntry| $ 9)))
              (|spadConstant| $ 7))
             ('T
              (SEQ (LETT LCM
                         (SPADCALL |y|
                             (SPADCALL |x| |y| (|getShellEntry| $ 10))
                             (|getShellEntry| $ 12))
                         |GCDDOM-;lcm;3S;1|)
                   (EXIT (COND
                           ((EQL (CAR LCM) 0)
                            (SPADCALL |x| (CDR LCM)
                                (|getShellEntry| $ 13)))
                           ('T (|error| "bad gcd in lcm computation"))))))))))) 

(DEFUN |GCDDOM-;lcm;LS;2| (|l| $)
  (SPADCALL (ELT $ 15) |l| (|spadConstant| $ 16) (|spadConstant| $ 7)
      (|getShellEntry| $ 19))) 

(DEFUN |GCDDOM-;gcd;LS;3| (|l| $)
  (SPADCALL (ELT $ 10) |l| (|spadConstant| $ 7) (|spadConstant| $ 16)
      (|getShellEntry| $ 19))) 

(DEFUN |GCDDOM-;gcdPolynomial;3Sup;4| (|p1| |p2| $)
  (PROG (|c1| |c2| |e2| |e1| |p|)
    (RETURN
      (SEQ (COND
             ((SPADCALL |p1| (|getShellEntry| $ 24))
              (SPADCALL |p2| (|getShellEntry| $ 25)))
             ((SPADCALL |p2| (|getShellEntry| $ 24))
              (SPADCALL |p1| (|getShellEntry| $ 25)))
             ('T
              (SEQ (LETT |c1| (SPADCALL |p1| (|getShellEntry| $ 26))
                         |GCDDOM-;gcdPolynomial;3Sup;4|)
                   (LETT |c2| (SPADCALL |p2| (|getShellEntry| $ 26))
                         |GCDDOM-;gcdPolynomial;3Sup;4|)
                   (SETQ |p1|
                         (LET ((#0=#:G1418
                                   (SPADCALL |p1| |c1|
                                    (|getShellEntry| $ 27))))
                           (|check-union| (EQL (CAR #0#) 0)
                               (|SparseUnivariatePolynomial|
                                   (|getShellEntry| $ 6))
                               #0#)
                           (CDR #0#)))
                   (SETQ |p2|
                         (LET ((#0# (SPADCALL |p2| |c2|
                                     (|getShellEntry| $ 27))))
                           (|check-union| (EQL (CAR #0#) 0)
                               (|SparseUnivariatePolynomial|
                                   (|getShellEntry| $ 6))
                               #0#)
                           (CDR #0#)))
                   (SEQ (LETT |e1|
                              (SPADCALL |p1| (|getShellEntry| $ 29))
                              |GCDDOM-;gcdPolynomial;3Sup;4|)
                        (EXIT (COND
                                ((< 0 |e1|)
                                 (SETQ |p1|
                                       (LET
                                        ((#0#
                                          (SPADCALL |p1|
                                           (SPADCALL
                                            (|spadConstant| $ 16) |e1|
                                            (|getShellEntry| $ 34))
                                           (|getShellEntry| $ 35))))
                                         (|check-union|
                                          (EQL (CAR #0#) 0)
                                          (|SparseUnivariatePolynomial|
                                           (|getShellEntry| $ 6))
                                          #0#)
                                         (CDR #0#)))))))
                   (SEQ (LETT |e2|
                              (SPADCALL |p2| (|getShellEntry| $ 29))
                              |GCDDOM-;gcdPolynomial;3Sup;4|)
                        (EXIT (COND
                                ((< 0 |e2|)
                                 (SETQ |p2|
                                       (LET
                                        ((#0#
                                          (SPADCALL |p2|
                                           (SPADCALL
                                            (|spadConstant| $ 16) |e2|
                                            (|getShellEntry| $ 34))
                                           (|getShellEntry| $ 35))))
                                         (|check-union|
                                          (EQL (CAR #0#) 0)
                                          (|SparseUnivariatePolynomial|
                                           (|getShellEntry| $ 6))
                                          #0#)
                                         (CDR #0#)))))))
                   (LETT |e1| (MIN |e1| |e2|)
                         |GCDDOM-;gcdPolynomial;3Sup;4|)
                   (SETQ |c1|
                         (SPADCALL |c1| |c2| (|getShellEntry| $ 10)))
                   (SETQ |p1|
                         (COND
                           ((OR (EQL (SPADCALL |p1|
                                      (|getShellEntry| $ 37))
                                     0)
                                (EQL (SPADCALL |p2|
                                      (|getShellEntry| $ 37))
                                     0))
                            (SPADCALL |c1| 0 (|getShellEntry| $ 34)))
                           ('T
                            (SEQ (LETT |p|
                                       (SPADCALL |p1| |p2|
                                        (|getShellEntry| $ 39))
                                       |GCDDOM-;gcdPolynomial;3Sup;4|)
                                 (EXIT (COND
                                         ((EQL
                                           (SPADCALL |p|
                                            (|getShellEntry| $ 37))
                                           0)
                                          (SPADCALL |c1| 0
                                           (|getShellEntry| $ 34)))
                                         ('T
                                          (SEQ
                                           (SETQ |c2|
                                            (SPADCALL
                                             (SPADCALL |p1|
                                              (|getShellEntry| $ 40))
                                             (SPADCALL |p2|
                                              (|getShellEntry| $ 40))
                                             (|getShellEntry| $ 10)))
                                           (EXIT
                                            (SPADCALL
                                             (SPADCALL |c1|
                                              (SPADCALL
                                               (LET
                                                ((#0#
                                                  (SPADCALL
                                                   (SPADCALL |c2| |p|
                                                    (|getShellEntry| $
                                                     41))
                                                   (SPADCALL |p|
                                                    (|getShellEntry| $
                                                     40))
                                                   (|getShellEntry| $
                                                    27))))
                                                 (|check-union|
                                                  (EQL (CAR #0#) 0)
                                                  (|SparseUnivariatePolynomial|
                                                   (|getShellEntry| $
                                                    6))
                                                  #0#)
                                                 (CDR #0#))
                                               (|getShellEntry| $ 42))
                                              (|getShellEntry| $ 41))
                                             (|getShellEntry| $ 25)))))))))))
                   (EXIT (COND
                           ((ZEROP |e1|) |p1|)
                           ('T
                            (SPADCALL
                                (SPADCALL (|spadConstant| $ 16) |e1|
                                    (|getShellEntry| $ 34))
                                |p1| (|getShellEntry| $ 44)))))))))))) 

(DEFUN |GcdDomain&| (|#1|)
  (LET* ((|dv$1| (|devaluate| |#1|))
         (|dv$| (LIST '|GcdDomain&| |dv$1|)) ($ (|newShell| 47))
         (|pv$| (|buildPredVector| 0 0 NIL)))
    (|setShellEntry| $ 0 |dv$|)
    (|setShellEntry| $ 3 |pv$|)
    (|stuffDomainSlots| $)
    (|setShellEntry| $ 6 |#1|)
    $)) 

(MAKEPROP '|GcdDomain&| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (0 . |Zero|)
             (|Boolean|) (4 . =) (10 . |gcd|) (|Union| $ '"failed")
             (16 . |exquo|) (22 . *) |GCDDOM-;lcm;3S;1| (28 . |lcm|)
             (34 . |One|) (|Mapping| 6 6 6) (|List| 6) (38 . |reduce|)
             (|List| $) |GCDDOM-;lcm;LS;2| |GCDDOM-;gcd;LS;3|
             (|SparseUnivariatePolynomial| 6) (46 . |zero?|)
             (51 . |unitCanonical|) (56 . |content|) (61 . |exquo|)
             (|NonNegativeInteger|) (67 . |minimumDegree|)
             (72 . |Zero|) (76 . |Zero|) (80 . >) (86 . |One|)
             (90 . |monomial|) (96 . |exquo|) (102 . |min|)
             (108 . |degree|) (113 . =) (119 . |subResultantGcd|)
             (125 . |leadingCoefficient|) (130 . *)
             (136 . |primitivePart|) (141 . |zero?|) (146 . *)
             (|SparseUnivariatePolynomial| $)
             |GCDDOM-;gcdPolynomial;3Sup;4|)
          '#(|lcm| 152 |gcdPolynomial| 163 |gcd| 169) 'NIL
          (CONS (|makeByteWordVec2| 1 'NIL)
                (CONS '#()
                      (CONS '#()
                            (|makeByteWordVec2| 46
                                '(0 6 0 7 2 6 8 0 0 9 2 6 0 0 0 10 2 6
                                  11 0 0 12 2 6 0 0 0 13 2 6 0 0 0 15 0
                                  6 0 16 4 18 6 17 0 6 6 19 1 23 8 0 24
                                  1 23 0 0 25 1 23 6 0 26 2 23 11 0 6
                                  27 1 23 28 0 29 0 23 0 30 0 28 0 31 2
                                  28 8 0 0 32 0 23 0 33 2 23 0 6 28 34
                                  2 23 11 0 0 35 2 28 0 0 0 36 1 23 28
                                  0 37 2 28 8 0 0 38 2 23 0 0 0 39 1 23
                                  6 0 40 2 23 0 6 0 41 1 23 0 0 42 1 28
                                  8 0 43 2 23 0 0 0 44 1 0 0 20 21 2 0
                                  0 0 0 14 2 0 45 45 45 46 1 0 0 20 22)))))
          '|lookupComplete|))