
(/VERSIONCHECK 2) 

(DEFUN |SMATCAT-;positivePower| (|x| |n| $)
  (PROG (|y|)
    (RETURN
     (SEQ
      (COND ((EQL |n| 1) |x|)
            ((ODDP |n|)
             (SPADCALL |x| (|SMATCAT-;positivePower| |x| (- |n| 1) $)
                       (QREFELT $ 11)))
            ('T
             (SEQ
              (LETT |y| (|SMATCAT-;positivePower| |x| (QUOTIENT2 |n| 2) $)
                    |SMATCAT-;positivePower|)
              (EXIT (SPADCALL |y| |y| (QREFELT $ 11)))))))))) 

(DEFUN |SMATCAT-;^;SNniS;2| (|x| |n| $)
  (COND ((ZEROP |n|) (SPADCALL (|spadConstant| $ 12) (QREFELT $ 13)))
        ('T (|SMATCAT-;positivePower| |x| |n| $)))) 

(DEFUN |SMATCAT-;coerce;RS;3| (|r| $) (SPADCALL |r| (QREFELT $ 13))) 

(DEFUN |SMATCAT-;differentiate;SMS;4| (|x| |d| $)
  (SPADCALL |d| |x| (QREFELT $ 18))) 

(DEFUN |SMATCAT-;diagonal;SRow;5| (|x| $)
  (PROG (#1=#:G13084 |i| #2=#:G13085 |j| #3=#:G13086 |k| |v|)
    (RETURN
     (SEQ
      (LETT |v| (MAKEARR1 (QREFELT $ 7) (|spadConstant| $ 20))
            . #4=(|SMATCAT-;diagonal;SRow;5|))
      (SEQ (LETT |k| (SPADCALL |v| (QREFELT $ 27)) . #4#)
           (LETT #3# (QVSIZE |v|) . #4#)
           (LETT |j| (SPADCALL |x| (QREFELT $ 24)) . #4#)
           (LETT #2# (SPADCALL |x| (QREFELT $ 25)) . #4#)
           (LETT |i| (SPADCALL |x| (QREFELT $ 22)) . #4#)
           (LETT #1# (SPADCALL |x| (QREFELT $ 23)) . #4#) G190
           (COND ((OR (> |i| #1#) (> |j| #2#) (> |k| #3#)) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |v| |k| (SPADCALL |x| |i| |j| (QREFELT $ 28))
                       (QREFELT $ 29))))
           (LETT |i|
                 (PROG1 (+ |i| 1)
                   (LETT |j| (PROG1 (+ |j| 1) (LETT |k| (+ |k| 1) . #4#))
                         . #4#))
                 . #4#)
           (GO G190) G191 (EXIT NIL))
      (EXIT (SPADCALL |v| (QREFELT $ 30))))))) 

(DEFUN |SMATCAT-;retract;SR;6| (|x| $)
  (COND
   ((SPADCALL |x| (QREFELT $ 33))
    (SPADCALL (SPADCALL |x| (QREFELT $ 34)) (QREFELT $ 35)))
   ('T (|error| "Not retractable")))) 

(DEFUN |SMATCAT-;retractIfCan;SU;7| (|x| $)
  (COND
   ((SPADCALL |x| (QREFELT $ 33))
    (SPADCALL (SPADCALL |x| (QREFELT $ 34)) (QREFELT $ 38)))
   ('T (CONS 1 "failed")))) 

(DEFUN |SMATCAT-;equation2R| (|v| $)
  (PROG (#1=#:G13104 |j| #2=#:G13103 |i| |ans|)
    (RETURN
     (SEQ
      (LETT |ans|
            (SPADCALL (QREFELT $ 7) (QVSIZE |v|) (|spadConstant| $ 40)
                      (QREFELT $ 42))
            . #3=(|SMATCAT-;equation2R|))
      (SEQ (LETT |i| (SPADCALL |ans| (QREFELT $ 43)) . #3#)
           (LETT #2# (SPADCALL |ans| (QREFELT $ 44)) . #3#) G190
           (COND ((> |i| #2#) #4=(GO G191)))
           (SEQ
            (EXIT
             (SEQ (LETT |j| (SPADCALL |ans| (QREFELT $ 45)) . #3#)
                  (LETT #1# (SPADCALL |ans| (QREFELT $ 46)) . #3#) G190
                  (COND ((> |j| #1#) #4#))
                  (SEQ
                   (EXIT
                    (SPADCALL |ans| |i| |j|
                              (SPADCALL (SPADCALL |v| |j| (QREFELT $ 48)) |i|
                                        (QREFELT $ 49))
                              (QREFELT $ 50))))
                  (LETT |j| (+ |j| 1) . #3#) #5=(GO G190) G191 (EXIT NIL))))
           (LETT |i| (+ |i| 1) . #3#) #5# G191 (EXIT NIL))
      (EXIT (SPADCALL |ans| (QREFELT $ 53))))))) 

(DEFUN |SMATCAT-;reducedSystem;MM;9| (|x| $)
  (PROG (#1=#:G13111 |i| #2=#:G13110)
    (RETURN
     (SEQ
      (COND
       ((SPADCALL |x| (QREFELT $ 55))
        (SPADCALL 0 0 (|spadConstant| $ 20) (QREFELT $ 56)))
       ('T
        (SPADCALL (ELT $ 57)
                  (PROGN
                   (LETT #2# NIL . #3=(|SMATCAT-;reducedSystem;MM;9|))
                   (SEQ (LETT |i| (SPADCALL |x| (QREFELT $ 58)) . #3#)
                        (LETT #1# (SPADCALL |x| (QREFELT $ 59)) . #3#) G190
                        (COND ((> |i| #1#) (GO G191)))
                        (SEQ
                         (EXIT
                          (LETT #2#
                                (CONS
                                 (|SMATCAT-;equation2R|
                                  (SPADCALL |x| |i| (QREFELT $ 60)) $)
                                 #2#)
                                . #3#)))
                        (LETT |i| (+ |i| 1) . #3#) (GO G190) G191
                        (EXIT (NREVERSE0 #2#))))
                  (QREFELT $ 63)))))))) 

(DEFUN |SMATCAT-;reducedSystem;MVR;10| (|m| |v| $)
  (PROG (|vh| |rh|)
    (RETURN
     (SEQ
      (LETT |vh|
            (COND
             ((SPADCALL |v| (QREFELT $ 65)) (MAKEARR1 0 (|spadConstant| $ 20)))
             ('T
              (SEQ
               (LETT |rh|
                     (SPADCALL (SPADCALL |v| (QREFELT $ 66)) (QREFELT $ 67))
                     . #1=(|SMATCAT-;reducedSystem;MVR;10|))
               (EXIT
                (SPADCALL |rh| (SPADCALL |rh| (QREFELT $ 68))
                          (QREFELT $ 69))))))
            . #1#)
      (EXIT (CONS (SPADCALL |m| (QREFELT $ 67)) |vh|)))))) 

(DEFUN |SMATCAT-;trace;SR;11| (|x| $)
  (PROG (|tr| #1=#:G13121 |i| #2=#:G13122 |j|)
    (RETURN
     (SEQ (LETT |tr| (|spadConstant| $ 20) . #3=(|SMATCAT-;trace;SR;11|))
          (SEQ (LETT |j| (SPADCALL |x| (QREFELT $ 24)) . #3#)
               (LETT #2# (SPADCALL |x| (QREFELT $ 25)) . #3#)
               (LETT |i| (SPADCALL |x| (QREFELT $ 22)) . #3#)
               (LETT #1# (SPADCALL |x| (QREFELT $ 23)) . #3#) G190
               (COND ((OR (> |i| #1#) (> |j| #2#)) (GO G191)))
               (SEQ
                (EXIT
                 (LETT |tr|
                       (SPADCALL |tr| (SPADCALL |x| |i| |j| (QREFELT $ 73))
                                 (QREFELT $ 74))
                       . #3#)))
               (LETT |i| (PROG1 (+ |i| 1) (LETT |j| (+ |j| 1) . #3#)) . #3#)
               (GO G190) G191 (EXIT NIL))
          (EXIT |tr|))))) 

(DEFUN |SMATCAT-;diagonalProduct;SR;12| (|x| $)
  (PROG (|pr| #1=#:G13126 |i| #2=#:G13127 |j|)
    (RETURN
     (SEQ
      (LETT |pr| (|spadConstant| $ 12) . #3=(|SMATCAT-;diagonalProduct;SR;12|))
      (SEQ (LETT |j| (SPADCALL |x| (QREFELT $ 24)) . #3#)
           (LETT #2# (SPADCALL |x| (QREFELT $ 25)) . #3#)
           (LETT |i| (SPADCALL |x| (QREFELT $ 22)) . #3#)
           (LETT #1# (SPADCALL |x| (QREFELT $ 23)) . #3#) G190
           (COND ((OR (> |i| #1#) (> |j| #2#)) (GO G191)))
           (SEQ
            (EXIT
             (LETT |pr|
                   (SPADCALL |pr| (SPADCALL |x| |i| |j| (QREFELT $ 73))
                             (QREFELT $ 76))
                   . #3#)))
           (LETT |i| (PROG1 (+ |i| 1) (LETT |j| (+ |j| 1) . #3#)) . #3#)
           (GO G190) G191 (EXIT NIL))
      (EXIT |pr|))))) 

(DEFUN |SMATCAT-;^;SIS;13| (|x| |n| $)
  (PROG (|xInv|)
    (RETURN
     (SEQ
      (COND ((ZEROP |n|) (SPADCALL (|spadConstant| $ 12) (QREFELT $ 13)))
            ((SPADCALL |n| (QREFELT $ 78))
             (|SMATCAT-;positivePower| |x| |n| $))
            (#1='T
             (SEQ
              (LETT |xInv| (SPADCALL |x| (QREFELT $ 80)) |SMATCAT-;^;SIS;13|)
              (EXIT
               (COND
                ((QEQCAR |xInv| 1) (|error| "^: matrix must be invertible"))
                (#1#
                 (|SMATCAT-;positivePower| (QCDR |xInv|) (- |n|) $))))))))))) 

(DEFUN |SquareMatrixCategory&| (|#1| |#2| |#3| |#4| |#5|)
  (PROG (|pv$| $ |dv$| DV$5 DV$4 DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|SquareMatrixCategory&|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT DV$3 (|devaluate| |#3|) . #1#)
      (LETT DV$4 (|devaluate| |#4|) . #1#)
      (LETT DV$5 (|devaluate| |#5|) . #1#)
      (LETT |dv$| (LIST '|SquareMatrixCategory&| DV$1 DV$2 DV$3 DV$4 DV$5)
            . #1#)
      (LETT $ (GETREFV 92) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST (|HasCategory| |#3| '(|Field|))
                                               (|HasCategory| |#3|
                                                              '(|CommutativeRing|))))
                      . #1#))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 |#4|)
      (QSETREFV $ 10 |#5|)
      (COND
       ((|testBitVector| |pv$| 1)
        (QSETREFV $ 81 (CONS (|dispatchFunction| |SMATCAT-;^;SIS;13|) $))))
      $)))) 

(MAKEPROP '|SquareMatrixCategory&| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) (|local| |#4|) (|local| |#5|) (0 . *) (6 . |One|)
              (10 . |scalarMatrix|) (|NonNegativeInteger|) |SMATCAT-;^;SNniS;2|
              |SMATCAT-;coerce;RS;3| (|Mapping| 8 8) (15 . |map|)
              |SMATCAT-;differentiate;SMS;4| (21 . |Zero|) (|Integer|)
              (25 . |minRowIndex|) (30 . |maxRowIndex|) (35 . |minColIndex|)
              (40 . |maxColIndex|) (|Vector| 8) (45 . |minIndex|) (50 . |qelt|)
              (57 . |qsetelt!|) (64 . |directProduct|)
              |SMATCAT-;diagonal;SRow;5| (|Boolean|) (69 . |diagonal?|)
              (74 . |diagonal|) (79 . |retract|) |SMATCAT-;retract;SR;6|
              (|Union| 8 '#1="failed") (84 . |retractIfCan|)
              |SMATCAT-;retractIfCan;SU;7| (89 . |Zero|) (|Matrix| 10)
              (93 . |new|) (100 . |minRowIndex|) (105 . |maxRowIndex|)
              (110 . |minColIndex|) (115 . |maxColIndex|) (|Vector| 6)
              (120 . |qelt|) (126 . |column|) (132 . |qsetelt!|) (|Matrix| 8)
              (|Matrix| $) (140 . |reducedSystem|) (|Matrix| 6)
              (145 . |empty?|) (150 . |new|) (157 . |vertConcat|)
              (163 . |minRowIndex|) (168 . |maxRowIndex|) (173 . |row|)
              (|Mapping| 51 51 51) (|List| 51) (179 . |reduce|)
              |SMATCAT-;reducedSystem;MM;9| (185 . |empty?|) (190 . |coerce|)
              (195 . |reducedSystem|) (200 . |minColIndex|) (205 . |column|)
              (|Record| (|:| |mat| 51) (|:| |vec| 26)) (|Vector| $)
              |SMATCAT-;reducedSystem;MVR;10| (211 . |elt|) (218 . +)
              |SMATCAT-;trace;SR;11| (224 . *) |SMATCAT-;diagonalProduct;SR;12|
              (230 . |positive?|) (|Union| $ '"failed") (235 . |inverse|)
              (240 . ^) (|Record| (|:| |mat| 83) (|:| |vec| (|Vector| 21)))
              (|Matrix| 21) (|Fraction| 21) (|Union| 84 '#1#) (|Union| 21 '#1#)
              (|Symbol|) (|List| 87) (|List| 14) (|OutputForm|)
              (|PositiveInteger|))
           '#(|trace| 246 |retractIfCan| 251 |retract| 256 |reducedSystem| 261
              |differentiate| 272 |diagonalProduct| 278 |diagonal| 283 |coerce|
              288 ^ 293)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 81
                                                 '(2 6 0 0 0 11 0 8 0 12 1 6 0
                                                   8 13 2 6 0 17 0 18 0 8 0 20
                                                   1 6 21 0 22 1 6 21 0 23 1 6
                                                   21 0 24 1 6 21 0 25 1 26 21
                                                   0 27 3 6 8 0 21 21 28 3 26 8
                                                   0 21 8 29 1 9 0 26 30 1 6 32
                                                   0 33 1 6 9 0 34 1 9 8 0 35 1
                                                   9 37 0 38 0 10 0 40 3 41 0
                                                   14 14 10 42 1 41 21 0 43 1
                                                   41 21 0 44 1 41 21 0 45 1 41
                                                   21 0 46 2 47 6 0 21 48 2 6
                                                   10 0 21 49 4 41 10 0 21 21
                                                   10 50 1 10 51 52 53 1 54 32
                                                   0 55 3 51 0 14 14 8 56 2 51
                                                   0 0 0 57 1 54 21 0 58 1 54
                                                   21 0 59 2 54 47 0 21 60 2 62
                                                   51 61 0 63 1 47 32 0 65 1 54
                                                   0 47 66 1 6 51 52 67 1 51 21
                                                   0 68 2 51 26 0 21 69 3 6 8 0
                                                   21 21 73 2 8 0 0 0 74 2 8 0
                                                   0 0 76 1 21 32 0 78 1 6 79 0
                                                   80 2 0 0 0 21 81 1 0 8 0 75
                                                   1 0 37 0 39 1 0 8 0 36 1 0
                                                   51 52 64 2 0 70 52 71 72 2 0
                                                   0 0 17 19 1 0 8 0 77 1 0 9 0
                                                   31 1 0 0 8 16 2 0 0 0 21 81
                                                   2 0 0 0 14 15)))))
           '|lookupComplete|)) 
