
(/VERSIONCHECK 2) 

(DEFUN |RMATCAT-;size;Nni;1| ($)
  (EXPT (SPADCALL (QREFELT $ 13)) (* (QREFELT $ 7) (QREFELT $ 8)))) 

(DEFUN |RMATCAT-;random;S;2| ($)
  (PROG (#1=#:G12077 |i| #2=#:G12076 #3=#:G12075 |j| #4=#:G12074)
    (RETURN
     (SEQ
      (SPADCALL
       (PROGN
        (LETT #4# NIL . #5=(|RMATCAT-;random;S;2|))
        (SEQ (LETT |j| 1 . #5#) (LETT #3# (QREFELT $ 7) . #5#) G190
             (COND ((QSGREATERP |j| #3#) #6=(GO G191)))
             (SEQ
              (EXIT
               (LETT #4#
                     (CONS
                      (PROGN
                       (LETT #2# NIL . #5#)
                       (SEQ (LETT |i| 1 . #5#) (LETT #1# (QREFELT $ 8) . #5#)
                            G190 (COND ((QSGREATERP |i| #1#) #6#))
                            (SEQ
                             (EXIT
                              (LETT #2# (CONS (SPADCALL (QREFELT $ 15)) #2#)
                                    . #5#)))
                            (LETT |i| (QSADD1 |i|) . #5#) #7=(GO G190) G191
                            (EXIT (NREVERSE0 #2#))))
                      #4#)
                     . #5#)))
             (LETT |j| (QSADD1 |j|) . #5#) #7# G191 (EXIT (NREVERSE0 #4#))))
       (QREFELT $ 17)))))) 

(DEFUN |RMATCAT-;lookup;SPi;3| (|x| $)
  (PROG (#1=#:G12081 |pow| |res| #2=#:G12085 |c| #3=#:G12084 |r| |l| |s|)
    (RETURN
     (SEQ (LETT |s| (SPADCALL (QREFELT $ 13)) . #4=(|RMATCAT-;lookup;SPi;3|))
          (LETT |pow| 1 . #4#) (LETT |l| (SPADCALL |x| (QREFELT $ 19)) . #4#)
          (LETT |res| 1 . #4#)
          (SEQ (LETT |r| NIL . #4#) (LETT #3# |l| . #4#) G190
               (COND
                ((OR (ATOM #3#) (PROGN (LETT |r| (CAR #3#) . #4#) NIL))
                 #5=(GO G191)))
               (SEQ
                (EXIT
                 (SEQ (LETT |c| NIL . #4#) (LETT #2# |r| . #4#) G190
                      (COND
                       ((OR (ATOM #2#) (PROGN (LETT |c| (CAR #2#) . #4#) NIL))
                        #5#))
                      (SEQ
                       (LETT |res|
                             (+ |res|
                                (* (- (SPADCALL |c| (QREFELT $ 21)) 1) |pow|))
                             . #4#)
                       (EXIT (LETT |pow| (* |pow| |s|) . #4#)))
                      (LETT #2# (CDR #2#) . #4#) #6=(GO G190) G191
                      (EXIT NIL))))
               (LETT #3# (CDR #3#) . #4#) #6# G191 (EXIT NIL))
          (EXIT
           (PROG1 (LETT #1# |res| . #4#)
             (|check-subtype| (> #1# 0) '(|PositiveInteger|) #1#))))))) 

(DEFUN |RMATCAT-;index;PiS;4| (|i| $)
  (PROG (|res| |old| |row| |el| #1=#:G12087 #2=#:G12096 |j| #3=#:G12095 |s|)
    (RETURN
     (SEQ (LETT |s| (SPADCALL (QREFELT $ 13)) . #4=(|RMATCAT-;index;PiS;4|))
          (LETT |old| (DIVIDE2 (- |i| 1) |s|) . #4#) (LETT |res| NIL . #4#)
          (SEQ (LETT |i| 1 . #4#) (LETT #3# (QREFELT $ 7) . #4#) G190
               (COND ((QSGREATERP |i| #3#) #5=(GO G191)))
               (SEQ (LETT |row| NIL . #4#)
                    (SEQ (LETT |j| 1 . #4#) (LETT #2# (QREFELT $ 8) . #4#) G190
                         (COND ((QSGREATERP |j| #2#) #5#))
                         (SEQ
                          (LETT |el|
                                (SPADCALL
                                 (PROG1 (LETT #1# (+ (QCDR |old|) 1) . #4#)
                                   (|check-subtype| (> #1# 0)
                                                    '(|PositiveInteger|) #1#))
                                 (QREFELT $ 23))
                                . #4#)
                          (LETT |row| (CONS |el| |row|) . #4#)
                          (EXIT (LETT |old| (DIVIDE2 (QCAR |old|) |s|) . #4#)))
                         (LETT |j| (QSADD1 |j|) . #4#) #6=(GO G190) G191
                         (EXIT NIL))
                    (EXIT (LETT |res| (CONS (NREVERSE |row|) |res|) . #4#)))
               (LETT |i| (QSADD1 |i|) . #4#) #6# G191 (EXIT NIL))
          (EXIT (SPADCALL (NREVERSE |res|) (QREFELT $ 17))))))) 

(DEFUN |RMATCAT-;nrows;SNni;5| (|x| $) (QREFELT $ 7)) 

(DEFUN |RMATCAT-;ncols;SNni;6| (|x| $) (QREFELT $ 8)) 

(DEFUN |RMATCAT-;square?;SB;7| (|x| $) (EQL (QREFELT $ 7) (QREFELT $ 8))) 

(DEFUN |RMATCAT-;diagonal?;SB;8| (|x| $)
  (PROG (#1=#:G12103 #2=#:G12106 #3=#:G12108 |j| #4=#:G12107 |i|)
    (RETURN
     (SEQ
      (EXIT
       (COND ((NULL (SPADCALL |x| (QREFELT $ 29))) 'NIL)
             ('T
              (SEQ
               (SEQ
                (LETT |i| (SPADCALL |x| (QREFELT $ 31))
                      . #5=(|RMATCAT-;diagonal?;SB;8|))
                (LETT #4# (SPADCALL |x| (QREFELT $ 32)) . #5#) G190
                (COND ((> |i| #4#) #6=(GO G191)))
                (SEQ
                 (EXIT
                  (SEQ (LETT |j| (SPADCALL |x| (QREFELT $ 33)) . #5#)
                       (LETT #3# (SPADCALL |x| (QREFELT $ 34)) . #5#) G190
                       (COND ((> |j| #3#) #6#))
                       (SEQ
                        (EXIT
                         (COND
                          ((COND
                            ((EQL (- |j| (SPADCALL |x| (QREFELT $ 33)))
                                  (- |i| (SPADCALL |x| (QREFELT $ 31))))
                             'NIL)
                            ('T 'T))
                           (COND
                            ((NULL
                              (SPADCALL (SPADCALL |x| |i| |j| (QREFELT $ 35))
                                        (QREFELT $ 36)))
                             (PROGN
                              (LETT #1# (PROGN (LETT #2# 'NIL . #5#) (GO #2#))
                                    . #5#)
                              (GO #1#))))))))
                       (LETT |j| (+ |j| 1) . #5#) #7=(GO G190) G191
                       (EXIT NIL)))
                 #1# (EXIT #1#))
                (LETT |i| (+ |i| 1) . #5#) #7# G191 (EXIT NIL))
               (EXIT 'T)))))
      #2# (EXIT #2#))))) 

(DEFUN |RMATCAT-;symmetric?;SB;9| (|x| $)
  (PROG (#1=#:G12110 #2=#:G12113 #3=#:G12115 |j| #4=#:G12114 |i| |mc| |mr|)
    (RETURN
     (SEQ
      (EXIT
       (COND
        ((EQL (QREFELT $ 7) (QREFELT $ 8))
         (SEQ
          (LETT |mr| (SPADCALL |x| (QREFELT $ 31))
                . #5=(|RMATCAT-;symmetric?;SB;9|))
          (LETT |mc| (SPADCALL |x| (QREFELT $ 33)) . #5#)
          (SEQ (LETT |i| 0 . #5#) (LETT #4# (- (QREFELT $ 8) 1) . #5#) G190
               (COND ((QSGREATERP |i| #4#) #6=(GO G191)))
               (SEQ
                (EXIT
                 (SEQ (LETT |j| (+ |i| 1) . #5#)
                      (LETT #3# (- (QREFELT $ 8) 1) . #5#) G190
                      (COND ((> |j| #3#) #6#))
                      (SEQ
                       (EXIT
                        (COND
                         ((NULL
                           (SPADCALL
                            (SPADCALL |x| (+ |mr| |i|) (+ |mc| |j|)
                                      (QREFELT $ 35))
                            (SPADCALL |x| (+ |mr| |j|) (+ |mc| |i|)
                                      (QREFELT $ 35))
                            (QREFELT $ 38)))
                          (PROGN
                           (LETT #1# (PROGN (LETT #2# 'NIL . #5#) (GO #2#))
                                 . #5#)
                           (GO #1#))))))
                      (LETT |j| (+ |j| 1) . #5#) #7=(GO G190) G191 (EXIT NIL)))
                #1# (EXIT #1#))
               (LETT |i| (QSADD1 |i|) . #5#) #7# G191 (EXIT NIL))
          (EXIT 'T)))
        ('T 'NIL)))
      #2# (EXIT #2#))))) 

(DEFUN |RMATCAT-;antisymmetric?;SB;10| (|x| $)
  (PROG (#1=#:G12117 #2=#:G12120 #3=#:G12122 |j| #4=#:G12121 |i| |mc| |mr|)
    (RETURN
     (SEQ
      (EXIT
       (COND
        ((EQL (QREFELT $ 7) (QREFELT $ 8))
         (SEQ
          (LETT |mr| (SPADCALL |x| (QREFELT $ 31))
                . #5=(|RMATCAT-;antisymmetric?;SB;10|))
          (LETT |mc| (SPADCALL |x| (QREFELT $ 33)) . #5#)
          (SEQ (LETT |i| 0 . #5#) (LETT #4# (- (QREFELT $ 8) 1) . #5#) G190
               (COND ((QSGREATERP |i| #4#) #6=(GO G191)))
               (SEQ
                (EXIT
                 (SEQ (LETT |j| |i| . #5#) (LETT #3# (- (QREFELT $ 8) 1) . #5#)
                      G190 (COND ((> |j| #3#) #6#))
                      (SEQ
                       (EXIT
                        (COND
                         ((NULL
                           (SPADCALL
                            (SPADCALL |x| (+ |mr| |i|) (+ |mc| |j|)
                                      (QREFELT $ 35))
                            (SPADCALL
                             (SPADCALL |x| (+ |mr| |j|) (+ |mc| |i|)
                                       (QREFELT $ 35))
                             (QREFELT $ 40))
                            (QREFELT $ 38)))
                          (PROGN
                           (LETT #1# (PROGN (LETT #2# 'NIL . #5#) (GO #2#))
                                 . #5#)
                           (GO #1#))))))
                      (LETT |j| (+ |j| 1) . #5#) #7=(GO G190) G191 (EXIT NIL)))
                #1# (EXIT #1#))
               (LETT |i| (QSADD1 |i|) . #5#) #7# G191 (EXIT NIL))
          (EXIT 'T)))
        ('T 'NIL)))
      #2# (EXIT #2#))))) 

(DEFUN |RectangularMatrixCategory&| (|#1| |#2| |#3| |#4| |#5| |#6|)
  (PROG (|pv$| $ |dv$| DV$6 DV$5 DV$4 DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|RectangularMatrixCategory&|))
      (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$6 (|devaluate| |#6|) . #1#)
      (LETT |dv$|
            (LIST '|RectangularMatrixCategory&| DV$1 DV$2 DV$3 DV$4 DV$5 DV$6)
            . #1#)
      (LETT $ (GETREFV 42) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3
                (LETT |pv$|
                      (|buildPredVector| 0 0
                                         (LIST
                                          (|HasCategory| |#4|
                                                         '(|EuclideanDomain|))
                                          (|HasCategory| |#4| '(|Field|))
                                          (|HasCategory| |#4|
                                                         '(|IntegralDomain|))
                                          (|HasCategory| |#4|
                                                         '(|CommutativeRing|))
                                          (|HasCategory| |#4| '(|Finite|))))
                      . #1#))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 |#4|)
      (QSETREFV $ 10 |#5|)
      (QSETREFV $ 11 |#6|)
      (COND
       ((|testBitVector| |pv$| 5)
        (PROGN
         (QSETREFV $ 14 (CONS (|dispatchFunction| |RMATCAT-;size;Nni;1|) $))
         (QSETREFV $ 18 (CONS (|dispatchFunction| |RMATCAT-;random;S;2|) $))
         (QSETREFV $ 22 (CONS (|dispatchFunction| |RMATCAT-;lookup;SPi;3|) $))
         (QSETREFV $ 24
                   (CONS (|dispatchFunction| |RMATCAT-;index;PiS;4|) $)))))
      $)))) 

(MAKEPROP '|RectangularMatrixCategory&| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) (|local| |#4|) (|local| |#5|) (|local| |#6|)
              (|NonNegativeInteger|) (0 . |size|) (4 . |size|) (8 . |random|)
              (|List| (|List| 9)) (12 . |matrix|) (17 . |random|)
              (21 . |listOfLists|) (|PositiveInteger|) (26 . |lookup|)
              (31 . |lookup|) (36 . |index|) (41 . |index|)
              |RMATCAT-;nrows;SNni;5| |RMATCAT-;ncols;SNni;6| (|Boolean|)
              |RMATCAT-;square?;SB;7| (46 . |square?|) (|Integer|)
              (51 . |minRowIndex|) (56 . |maxRowIndex|) (61 . |minColIndex|)
              (66 . |maxColIndex|) (71 . |qelt|) (78 . |zero?|)
              |RMATCAT-;diagonal?;SB;8| (83 . =) |RMATCAT-;symmetric?;SB;9|
              (89 . -) |RMATCAT-;antisymmetric?;SB;10|)
           '#(|symmetric?| 94 |square?| 99 |size| 104 |random| 108 |nrows| 112
              |ncols| 117 |lookup| 122 |index| 127 |diagonal?| 132
              |antisymmetric?| 137)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 41
                                                 '(0 9 12 13 0 0 12 14 0 9 0 15
                                                   1 6 0 16 17 0 0 0 18 1 6 16
                                                   0 19 1 9 20 0 21 1 0 20 0 22
                                                   1 9 0 20 23 1 0 0 20 24 1 6
                                                   27 0 29 1 6 30 0 31 1 6 30 0
                                                   32 1 6 30 0 33 1 6 30 0 34 3
                                                   6 9 0 30 30 35 1 9 27 0 36 2
                                                   9 27 0 0 38 1 9 0 0 40 1 0
                                                   27 0 39 1 0 27 0 28 0 0 12
                                                   14 0 0 0 18 1 0 12 0 25 1 0
                                                   12 0 26 1 0 20 0 22 1 0 0 20
                                                   24 1 0 27 0 37 1 0 27 0
                                                   41)))))
           '|lookupComplete|)) 
