
(/VERSIONCHECK 2) 

(DEFUN |CARTEN;sample;$;1| ($) (SPADCALL (QREFELT $ 16))) 

(DEFUN |CARTEN;int2index| (|n| |indv| $)
  (PROG (|qr| |i| |rnk|)
    (RETURN
     (SEQ
      (COND ((< |n| 0) (|error| "Index error (too small)"))
            (#1='T
             (SEQ (LETT |rnk| (QVSIZE |indv|) . #2=(|CARTEN;int2index|))
                  (SEQ (LETT |i| 1 . #2#) G190
                       (COND ((QSGREATERP |i| |rnk|) (GO G191)))
                       (SEQ (LETT |qr| (DIVIDE2 |n| (QREFELT $ 7)) . #2#)
                            (LETT |n| (QCAR |qr|) . #2#)
                            (EXIT
                             (SPADCALL |indv| (+ (- |rnk| |i|) 1)
                                       (+ (QCDR |qr|) (QREFELT $ 6))
                                       (QREFELT $ 20))))
                       (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
                  (EXIT
                   (COND ((EQL |n| 0) |indv|)
                         (#1# (|error| "Index error (too big)"))))))))))) 

(DEFUN |CARTEN;index2int| (|indv| $)
  (PROG (|n| |ix| #1=#:G1829 |i|)
    (RETURN
     (SEQ (LETT |n| 0 . #2=(|CARTEN;index2int|))
          (SEQ (LETT |i| 1 . #2#) (LETT #1# (QVSIZE |indv|) . #2#) G190
               (COND ((QSGREATERP |i| #1#) (GO G191)))
               (SEQ
                (LETT |ix|
                      (- (SPADCALL |indv| |i| (QREFELT $ 21)) (QREFELT $ 6))
                      . #2#)
                (COND
                 ((OR (< |ix| 0) (< (- (QREFELT $ 7) 1) |ix|))
                  (EXIT (|error| "Index error (out of range)"))))
                (EXIT
                 (LETT |n| (+ (SPADCALL (QREFELT $ 7) |n| (QREFELT $ 22)) |ix|)
                       . #2#)))
               (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
          (EXIT |n|))))) 

(DEFUN |CARTEN;lengthRankOrElse| (|v| $)
  (PROG (|rx| |qr|)
    (RETURN
     (SEQ
      (COND ((EQL |v| 1) 0) ((EQL |v| (QREFELT $ 7)) 1)
            ((EQL |v| (QREFELT $ 13)) 2) ((EQL |v| (QREFELT $ 14)) 3)
            ((EQL |v| (QREFELT $ 15)) 4)
            ('T
             (SEQ (LETT |rx| 0 . #1=(|CARTEN;lengthRankOrElse|))
                  (SEQ G190
                       (COND
                        ((NULL (COND ((EQL |v| 0) 'NIL) ('T 'T))) (GO G191)))
                       (SEQ (LETT |qr| (DIVIDE2 |v| (QREFELT $ 7)) . #1#)
                            (LETT |v| (QCAR |qr|) . #1#)
                            (EXIT
                             (COND
                              ((NULL (EQL |v| 0))
                               (COND
                                ((NULL (EQL (QCDR |qr|) 0))
                                 (|error| "Rank is not a whole number"))
                                ('T (LETT |rx| (+ |rx| 1) . #1#)))))))
                       NIL (GO G190) G191 (EXIT NIL))
                  (EXIT |rx|)))))))) 

(DEFUN |CARTEN;mkPerm| (|n| |l| $)
  (PROG (#1=#:G1849 |e| |i| #2=#:G1852 |seen| |p|)
    (RETURN
     (SEQ
      (COND
       ((NULL (EQL (LENGTH |l|) |n|))
        (|error| "The list is not a permutation."))
       ('T
        (SEQ (LETT |p| (MAKEARR1 |n| 0) . #3=(|CARTEN;mkPerm|))
             (LETT |seen| (MAKEARR1 |n| 'NIL) . #3#)
             (SEQ (LETT |e| NIL . #3#) (LETT #2# |l| . #3#) (LETT |i| 1 . #3#)
                  G190
                  (COND
                   ((OR (QSGREATERP |i| |n|) (ATOM #2#)
                        (PROGN (LETT |e| (CAR #2#) . #3#) NIL))
                    #4=(GO G191)))
                  (SEQ
                   (EXIT
                    (COND
                     ((OR (< |e| 1) (< |n| |e|))
                      (|error| "The list is not a permutation."))
                     ('T
                      (SEQ (SPADCALL |p| |i| |e| (QREFELT $ 20))
                           (EXIT (SPADCALL |seen| |e| 'T (QREFELT $ 25))))))))
                  (LETT |i| (PROG1 (QSADD1 |i|) (LETT #2# (CDR #2#) . #3#))
                        . #3#)
                  #5=(GO G190) G191 (EXIT NIL))
             (SEQ
              (EXIT
               (SEQ (LETT |e| 1 . #3#) G190 (COND ((QSGREATERP |e| |n|) #4#))
                    (SEQ
                     (EXIT
                      (COND
                       ((NULL (SPADCALL |seen| |e| (QREFELT $ 26)))
                        (PROGN
                         (LETT #1# (|error| "The list is not a permutation.")
                               . #3#)
                         (GO #1#))))))
                    (LETT |e| (QSADD1 |e|) . #3#) #5# G191 (EXIT NIL)))
              #1# (EXIT #1#))
             (EXIT |p|)))))))) 

(DEFUN |CARTEN;permute!| (|t| |s| |p| $)
  (PROG (#1=#:G1856 |i|)
    (RETURN
     (SEQ
      (SEQ (LETT |i| 1 . #2=(|CARTEN;permute!|)) (LETT #1# (QVSIZE |p|) . #2#)
           G190 (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |t| |i|
                       (SPADCALL |s| (SPADCALL |p| |i| (QREFELT $ 21))
                                 (QREFELT $ 21))
                       (QREFELT $ 20))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |t|))))) 

(DEFUN |CARTEN;permsign!| (|v| $)
  (PROG (#1=#:G1873 #2=#:G1877 |i| |totTrans| |e| |nTrans| #3=#:G1875
         #4=#:G1876 |j| |n| #5=#:G1874 |psum| #6=#:G1861 |maxix|)
    (RETURN
     (SEQ
      (EXIT
       (SEQ
        (LETT |maxix| (- (+ (QREFELT $ 6) (QVSIZE |v|)) 1)
              . #7=(|CARTEN;permsign!|))
        (LETT |psum|
              (PROG2
                  (LETT #6#
                        (SPADCALL
                         (- (* (+ |maxix| 1) |maxix|)
                            (* (QREFELT $ 6) (- (QREFELT $ 6) 1)))
                         2 (QREFELT $ 28))
                        . #7#)
                  (QCDR #6#)
                (|check-union| (QEQCAR #6# 0) (|Integer|) #6#))
              . #7#)
        (LETT |n| 0 . #7#)
        (SEQ (LETT |i| 1 . #7#) (LETT #5# (QVSIZE |v|) . #7#) G190
             (COND ((QSGREATERP |i| #5#) #8=(GO G191)))
             (SEQ
              (EXIT
               (LETT |n| (+ |n| (SPADCALL |v| |i| (QREFELT $ 21))) . #7#)))
             (LETT |i| (QSADD1 |i|) . #7#) #9=(GO G190) G191 (EXIT NIL))
        (EXIT
         (COND
          ((EQL |n| |psum|)
           (SEQ (LETT |totTrans| 0 . #7#) (LETT |nTrans| 1 . #7#)
                (SEQ G190
                     (COND ((NULL (COND ((EQL |nTrans| 0) 'NIL) ('T 'T))) #8#))
                     (SEQ (LETT |nTrans| 0 . #7#)
                          (SEQ (LETT |j| 2 . #7#) (LETT #4# (QVSIZE |v|) . #7#)
                               (LETT |i| 1 . #7#)
                               (LETT #3# (- (QVSIZE |v|) 1) . #7#) G190
                               (COND
                                ((OR (QSGREATERP |i| #3#) (QSGREATERP |j| #4#))
                                 #8#))
                               (SEQ
                                (EXIT
                                 (COND
                                  ((< (SPADCALL |v| |j| (QREFELT $ 21))
                                      (SPADCALL |v| |i| (QREFELT $ 21)))
                                   (SEQ (LETT |nTrans| (+ |nTrans| 1) . #7#)
                                        (LETT |e|
                                              (SPADCALL |v| |i| (QREFELT $ 21))
                                              . #7#)
                                        (SPADCALL |v| |i|
                                                  (SPADCALL |v| |j|
                                                            (QREFELT $ 21))
                                                  (QREFELT $ 20))
                                        (EXIT
                                         (SPADCALL |v| |j| |e|
                                                   (QREFELT $ 20))))))))
                               (LETT |i|
                                     (PROG1 (QSADD1 |i|)
                                       (LETT |j| (QSADD1 |j|) . #7#))
                                     . #7#)
                               #9# G191 (EXIT NIL))
                          (EXIT
                           (LETT |totTrans| (+ |totTrans| |nTrans|) . #7#)))
                     NIL #9# G191 (EXIT NIL))
                (SEQ (LETT |i| 1 . #7#) (LETT #2# (QREFELT $ 7) . #7#) G190
                     (COND ((QSGREATERP |i| #2#) #8#))
                     (SEQ
                      (EXIT
                       (COND
                        ((NULL
                          (EQL (SPADCALL |v| |i| (QREFELT $ 21))
                               (- (+ (QREFELT $ 6) |i|) 1)))
                         (PROGN (LETT #1# 0 . #7#) (GO #1#))))))
                     (LETT |i| (QSADD1 |i|) . #7#) #9# G191 (EXIT NIL))
                (EXIT (COND ((ODDP |totTrans|) -1) (#10='T 1)))))
          (#10# 0)))))
      #1# (EXIT #1#))))) 

(DEFUN |CARTEN;ravel;$L;8| (|x| $)
  (PROG (#1=#:G1881 |i| #2=#:G1880)
    (RETURN
     (SEQ
      (PROGN
       (LETT #2# NIL . #3=(|CARTEN;ravel;$L;8|))
       (SEQ (LETT |i| 0 . #3#)
            (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #3#) G190
            (COND ((QSGREATERP |i| #1#) (GO G191)))
            (SEQ
             (EXIT
              (LETT #2# (CONS (SPADCALL |x| |i| (QREFELT $ 30)) #2#) . #3#)))
            (LETT |i| (QSADD1 |i|) . #3#) (GO G190) G191
            (EXIT (NREVERSE0 #2#)))))))) 

(DEFUN |CARTEN;unravel;L$;9| (|l| $)
  (PROG (#1=#:G1885 |i| #2=#:G1886 |r| |z| |nz|)
    (RETURN
     (SEQ (LETT |nz| (LENGTH |l|) . #3=(|CARTEN;unravel;L$;9|))
          (|CARTEN;lengthRankOrElse| |nz| $)
          (LETT |z| (SPADCALL |nz| (|spadConstant| $ 33) (QREFELT $ 34)) . #3#)
          (SEQ (LETT |r| NIL . #3#) (LETT #2# |l| . #3#) (LETT |i| 0 . #3#)
               (LETT #1# (- |nz| 1) . #3#) G190
               (COND
                ((OR (QSGREATERP |i| #1#) (ATOM #2#)
                     (PROGN (LETT |r| (CAR #2#) . #3#) NIL))
                 (GO G191)))
               (SEQ (EXIT (SPADCALL |z| |i| |r| (QREFELT $ 35))))
               (LETT |i| (PROG1 (QSADD1 |i|) (LETT #2# (CDR #2#) . #3#)) . #3#)
               (GO G190) G191 (EXIT NIL))
          (EXIT |z|))))) 

(DEFUN |CARTEN;kroneckerDelta;$;10| ($)
  (PROG (#1=#:G1890 |i| #2=#:G1891 |zi| |z|)
    (RETURN
     (SEQ
      (LETT |z| (SPADCALL (QREFELT $ 13) (|spadConstant| $ 33) (QREFELT $ 34))
            . #3=(|CARTEN;kroneckerDelta;$;10|))
      (SEQ (LETT |zi| 0 . #3#) (LETT #2# (+ (QREFELT $ 7) 1) . #3#)
           (LETT |i| 1 . #3#) (LETT #1# (QREFELT $ 7) . #3#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT (SPADCALL |z| |zi| (|spadConstant| $ 37) (QREFELT $ 35))))
           (LETT |i| (PROG1 (QSADD1 |i|) (LETT |zi| (QSPLUS |zi| #2#) . #3#))
                 . #3#)
           (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;leviCivitaSymbol;$;11| ($)
  (PROG (#1=#:G1895 |i| |indv| |z| |nz|)
    (RETURN
     (SEQ
      (LETT |nz| (EXPT (QREFELT $ 7) (QREFELT $ 7))
            . #2=(|CARTEN;leviCivitaSymbol;$;11|))
      (LETT |z| (SPADCALL |nz| (|spadConstant| $ 33) (QREFELT $ 34)) . #2#)
      (LETT |indv| (MAKEARR1 (QREFELT $ 7) 0) . #2#)
      (SEQ (LETT |i| 0 . #2#) (LETT #1# (- |nz| 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i|
                       (SPADCALL
                        (|CARTEN;permsign!| (|CARTEN;int2index| |i| |indv| $)
                         $)
                        (QREFELT $ 38))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;degree;$Nni;12| (|x| $) (SPADCALL |x| (QREFELT $ 40))) 

(DEFUN |CARTEN;rank;$Nni;13| (|x| $)
  (PROG (|n|)
    (RETURN
     (SEQ (LETT |n| (SPADCALL |x| (QREFELT $ 29)) |CARTEN;rank;$Nni;13|)
          (EXIT (|CARTEN;lengthRankOrElse| |n| $)))))) 

(DEFUN |CARTEN;elt;$R;14| (|x| $)
  (COND
   ((NULL (EQL (SPADCALL |x| (QREFELT $ 29)) 1))
    (|error| "Index error (the rank is not 0)"))
   ('T (SPADCALL |x| 0 (QREFELT $ 30))))) 

(DEFUN |CARTEN;elt;$IR;15| (|x| |i| $)
  (COND
   ((NULL (EQL (SPADCALL |x| (QREFELT $ 29)) (QREFELT $ 7)))
    (|error| "Index error (the rank is not 1)"))
   ('T (SPADCALL |x| (- |i| (QREFELT $ 6)) (QREFELT $ 30))))) 

(DEFUN |CARTEN;elt;$2IR;16| (|x| |i| |j| $)
  (COND
   ((NULL (EQL (SPADCALL |x| (QREFELT $ 29)) (QREFELT $ 13)))
    (|error| "Index error (the rank is not 2)"))
   ('T
    (SPADCALL |x|
              (+ (SPADCALL (QREFELT $ 7) (- |i| (QREFELT $ 6)) (QREFELT $ 22))
                 (- |j| (QREFELT $ 6)))
              (QREFELT $ 30))))) 

(DEFUN |CARTEN;elt;$3IR;17| (|x| |i| |j| |k| $)
  (COND
   ((NULL (EQL (SPADCALL |x| (QREFELT $ 29)) (QREFELT $ 14)))
    (|error| "Index error (the rank is not 3)"))
   ('T
    (SPADCALL |x|
              (+
               (+
                (SPADCALL (QREFELT $ 13) (- |i| (QREFELT $ 6)) (QREFELT $ 22))
                (SPADCALL (QREFELT $ 7) (- |j| (QREFELT $ 6)) (QREFELT $ 22)))
               (- |k| (QREFELT $ 6)))
              (QREFELT $ 30))))) 

(DEFUN |CARTEN;elt;$4IR;18| (|x| |i| |j| |k| |l| $)
  (COND
   ((NULL (EQL (SPADCALL |x| (QREFELT $ 29)) (QREFELT $ 15)))
    (|error| "Index error (the rank is not 4)"))
   ('T
    (SPADCALL |x|
              (+
               (+
                (+
                 (SPADCALL (QREFELT $ 14) (- |i| (QREFELT $ 6)) (QREFELT $ 22))
                 (SPADCALL (QREFELT $ 13) (- |j| (QREFELT $ 6))
                           (QREFELT $ 22)))
                (SPADCALL (QREFELT $ 7) (- |k| (QREFELT $ 6)) (QREFELT $ 22)))
               (- |l| (QREFELT $ 6)))
              (QREFELT $ 30))))) 

(DEFUN |CARTEN;elt;$LR;19| (|x| |i| $)
  (PROG (|n| |ix| #1=#:G1920 |ii|)
    (RETURN
     (SEQ
      (COND
       ((NULL (EQL (LENGTH |i|) (SPADCALL |x| (QREFELT $ 40))))
        (|error| "Index error (wrong rank)"))
       ('T
        (SEQ (LETT |n| 0 . #2=(|CARTEN;elt;$LR;19|))
             (SEQ (LETT |ii| NIL . #2#) (LETT #1# |i| . #2#) G190
                  (COND
                   ((OR (ATOM #1#) (PROGN (LETT |ii| (CAR #1#) . #2#) NIL))
                    (GO G191)))
                  (SEQ (LETT |ix| (- |ii| (QREFELT $ 6)) . #2#)
                       (COND
                        ((OR (< |ix| 0) (< (- (QREFELT $ 7) 1) |ix|))
                         (EXIT (|error| "Index error (out of range)"))))
                       (EXIT
                        (LETT |n|
                              (+ (SPADCALL (QREFELT $ 7) |n| (QREFELT $ 22))
                                 |ix|)
                              . #2#)))
                  (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
             (EXIT (SPADCALL |x| |n| (QREFELT $ 30)))))))))) 

(DEFUN |CARTEN;coerce;L$;20| (|lr| $)
  (PROG (#1=#:G1925 |r| #2=#:G1926 |i| |z|)
    (RETURN
     (SEQ
      (COND
       ((NULL (EQL (LENGTH |lr|) (QREFELT $ 7)))
        (|error| "Incorrect number of components"))
       ('T
        (SEQ
         (LETT |z|
               (SPADCALL (QREFELT $ 7) (|spadConstant| $ 33) (QREFELT $ 34))
               . #3=(|CARTEN;coerce;L$;20|))
         (SEQ (LETT |i| 0 . #3#) (LETT #2# (- (QREFELT $ 7) 1) . #3#)
              (LETT |r| NIL . #3#) (LETT #1# |lr| . #3#) G190
              (COND
               ((OR (ATOM #1#) (PROGN (LETT |r| (CAR #1#) . #3#) NIL)
                    (QSGREATERP |i| #2#))
                (GO G191)))
              (SEQ (EXIT (SPADCALL |z| |i| |r| (QREFELT $ 35))))
              (LETT #1# (PROG1 (CDR #1#) (LETT |i| (QSADD1 |i|) . #3#)) . #3#)
              (GO G190) G191 (EXIT NIL))
         (EXIT |z|)))))))) 

(DEFUN |CARTEN;coerce;L$;21| (|lx| $)
  (PROG (#1=#:G1938 |i| #2=#:G1937 |x| |offz| |z| |nx| #3=#:G1931 #4=#:G1936
         |rx|)
    (RETURN
     (SEQ
      (COND
       ((NULL (EQL (SPADCALL |lx| (QREFELT $ 51)) (QREFELT $ 7)))
        (|error| "Incorrect number of slices"))
       ('T
        (SEQ
         (LETT |rx| (SPADCALL (SPADCALL |lx| (QREFELT $ 52)) (QREFELT $ 40))
               . #5=(|CARTEN;coerce;L$;21|))
         (SEQ
          (EXIT
           (SEQ (LETT |x| NIL . #5#) (LETT #4# |lx| . #5#) G190
                (COND
                 ((OR (ATOM #4#) (PROGN (LETT |x| (CAR #4#) . #5#) NIL))
                  #6=(GO G191)))
                (SEQ
                 (EXIT
                  (COND
                   ((NULL (EQL (SPADCALL |x| (QREFELT $ 40)) |rx|))
                    (PROGN
                     (LETT #3# (|error| "Inhomogeneous slice ranks") . #5#)
                     (GO #3#))))))
                (LETT #4# (CDR #4#) . #5#) #7=(GO G190) G191 (EXIT NIL)))
          #3# (EXIT #3#))
         (LETT |nx| (SPADCALL (SPADCALL |lx| (QREFELT $ 52)) (QREFELT $ 29))
               . #5#)
         (LETT |z|
               (SPADCALL (* (QREFELT $ 7) |nx|) (|spadConstant| $ 33)
                         (QREFELT $ 34))
               . #5#)
         (SEQ (LETT |offz| 0 . #5#) (LETT |x| NIL . #5#) (LETT #2# |lx| . #5#)
              G190
              (COND
               ((OR (ATOM #2#) (PROGN (LETT |x| (CAR #2#) . #5#) NIL)) #6#))
              (SEQ
               (EXIT
                (SEQ (LETT |i| 0 . #5#) (LETT #1# (- |nx| 1) . #5#) G190
                     (COND ((QSGREATERP |i| #1#) #6#))
                     (SEQ
                      (EXIT
                       (SPADCALL |z| (+ |offz| |i|)
                                 (SPADCALL |x| |i| (QREFELT $ 30))
                                 (QREFELT $ 35))))
                     (LETT |i| (QSADD1 |i|) . #5#) #7# G191 (EXIT NIL))))
              (LETT #2#
                    (PROG1 (CDR #2#) (LETT |offz| (QSPLUS |offz| |nx|) . #5#))
                    . #5#)
              #7# G191 (EXIT NIL))
         (EXIT |z|)))))))) 

(DEFUN |CARTEN;retractIfCan;$U;22| (|x| $)
  (COND
   ((ZEROP (SPADCALL |x| (QREFELT $ 40)))
    (CONS 0 (SPADCALL |x| (QREFELT $ 42))))
   ('T (CONS 1 "failed")))) 

(DEFUN |CARTEN;mkOutf| (|x| |i0| |rnk| $)
  (PROG (#1=#:G1959 |j| #2=#:G1958 #3=#:G1957 |i| #4=#:G1956 |nskip| |rnk1|
         #5=#:G1955 #6=#:G1954)
    (RETURN
     (SEQ
      (COND
       ((ODDP |rnk|)
        (SEQ (LETT |rnk1| (- |rnk| 1) . #7=(|CARTEN;mkOutf|))
             (LETT |nskip| (EXPT (QREFELT $ 7) |rnk1|) . #7#)
             (EXIT
              (SPADCALL
               (PROGN
                (LETT #6# NIL . #7#)
                (SEQ (LETT |i| 0 . #7#) (LETT #5# (- (QREFELT $ 7) 1) . #7#)
                     G190 (COND ((QSGREATERP |i| #5#) #8=(GO G191)))
                     (SEQ
                      (EXIT
                       (LETT #6#
                             (CONS
                              (|CARTEN;mkOutf| |x| (+ |i0| (* |nskip| |i|))
                               |rnk1| $)
                              #6#)
                             . #7#)))
                     (LETT |i| (QSADD1 |i|) . #7#) #9=(GO G190) G191
                     (EXIT (NREVERSE0 #6#))))
               (QREFELT $ 59)))))
       ((EQL |rnk| 0)
        (SPADCALL (SPADCALL |x| |i0| (QREFELT $ 30)) (QREFELT $ 60)))
       ('T
        (SEQ (LETT |rnk1| (- |rnk| 2) . #7#)
             (LETT |nskip| (EXPT (QREFELT $ 7) |rnk1|) . #7#)
             (EXIT
              (SPADCALL
               (PROGN
                (LETT #4# NIL . #7#)
                (SEQ (LETT |i| 0 . #7#) (LETT #3# (- (QREFELT $ 7) 1) . #7#)
                     G190 (COND ((QSGREATERP |i| #3#) #8#))
                     (SEQ
                      (EXIT
                       (LETT #4#
                             (CONS
                              (PROGN
                               (LETT #2# NIL . #7#)
                               (SEQ (LETT |j| 0 . #7#)
                                    (LETT #1# (- (QREFELT $ 7) 1) . #7#) G190
                                    (COND ((QSGREATERP |j| #1#) #8#))
                                    (SEQ
                                     (EXIT
                                      (LETT #2#
                                            (CONS
                                             (|CARTEN;mkOutf| |x|
                                              (+ |i0|
                                                 (* |nskip|
                                                    (+ (* (QREFELT $ 7) |i|)
                                                       |j|)))
                                              |rnk1| $)
                                             #2#)
                                            . #7#)))
                                    (LETT |j| (QSADD1 |j|) . #7#) #9# G191
                                    (EXIT (NREVERSE0 #2#))))
                              #4#)
                             . #7#)))
                     (LETT |i| (QSADD1 |i|) . #7#) #9# G191
                     (EXIT (NREVERSE0 #4#))))
               (QREFELT $ 62)))))))))) 

(DEFUN |CARTEN;coerce;$Of;24| (|x| $)
  (|CARTEN;mkOutf| |x| 0 (SPADCALL |x| (QREFELT $ 40)) $)) 

(DEFUN |CARTEN;Zero;$;25| ($) (SPADCALL (|spadConstant| $ 33) (QREFELT $ 64))) 

(DEFUN |CARTEN;One;$;26| ($) (SPADCALL (|spadConstant| $ 37) (QREFELT $ 64))) 

(DEFUN |CARTEN;coerce;R$;27| (|r| $) (SPADCALL 1 |r| (QREFELT $ 34))) 

(DEFUN |CARTEN;coerce;Dp$;28| (|v| $)
  (PROG (#1=#:G1967 |i| #2=#:G1968 |j| |z|)
    (RETURN
     (SEQ
      (LETT |z| (SPADCALL (QREFELT $ 7) (|spadConstant| $ 33) (QREFELT $ 34))
            . #3=(|CARTEN;coerce;Dp$;28|))
      (SEQ (LETT |j| (SPADCALL |v| (QREFELT $ 68)) . #3#)
           (LETT #2# (SPADCALL |v| (QREFELT $ 69)) . #3#) (LETT |i| 0 . #3#)
           (LETT #1# (- (QREFELT $ 7) 1) . #3#) G190
           (COND ((OR (QSGREATERP |i| #1#) (> |j| #2#)) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i| (SPADCALL |v| |j| (QREFELT $ 70))
                       (QREFELT $ 35))))
           (LETT |i| (PROG1 (QSADD1 |i|) (LETT |j| (+ |j| 1) . #3#)) . #3#)
           (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;coerce;Sm$;29| (|m| $)
  (PROG (|offz| #1=#:G1975 |j| #2=#:G1974 |i| |z|)
    (RETURN
     (SEQ
      (LETT |z|
            (SPADCALL (SPADCALL (QREFELT $ 7) 2 (QREFELT $ 12))
                      (|spadConstant| $ 33) (QREFELT $ 34))
            . #3=(|CARTEN;coerce;Sm$;29|))
      (LETT |offz| 0 . #3#)
      (SEQ (LETT |i| 0 . #3#) (LETT #2# (- (QREFELT $ 7) 1) . #3#) G190
           (COND ((QSGREATERP |i| #2#) #4=(GO G191)))
           (SEQ
            (SEQ (LETT |j| 0 . #3#) (LETT #1# (- (QREFELT $ 7) 1) . #3#) G190
                 (COND ((QSGREATERP |j| #1#) #4#))
                 (SEQ
                  (EXIT
                   (SPADCALL |z| (+ |offz| |j|)
                             (SPADCALL |m| (+ |i| 1) (+ |j| 1) (QREFELT $ 73))
                             (QREFELT $ 35))))
                 (LETT |j| (QSADD1 |j|) . #3#) #5=(GO G190) G191 (EXIT NIL))
            (EXIT (LETT |offz| (+ |offz| (QREFELT $ 7)) . #3#)))
           (LETT |i| (QSADD1 |i|) . #3#) #5# G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;=;2$B;30| (|x| |y| $)
  (PROG (#1=#:G1980 #2=#:G1981 |i|)
    (RETURN
     (SEQ
      (EXIT
       (COND
        ((NULL
          (EQL (SPADCALL |x| (QREFELT $ 29)) (SPADCALL |y| (QREFELT $ 29))))
         'NIL)
        ('T
         (SEQ
          (SEQ (LETT |i| 0 . #3=(|CARTEN;=;2$B;30|))
               (LETT #2# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #3#) G190
               (COND ((QSGREATERP |i| #2#) (GO G191)))
               (SEQ
                (EXIT
                 (COND
                  ((NULL
                    (SPADCALL (SPADCALL |x| |i| (QREFELT $ 30))
                              (SPADCALL |y| |i| (QREFELT $ 30))
                              (QREFELT $ 75)))
                   (PROGN (LETT #1# 'NIL . #3#) (GO #1#))))))
               (LETT |i| (QSADD1 |i|) . #3#) (GO G190) G191 (EXIT NIL))
          (EXIT 'T)))))
      #1# (EXIT #1#))))) 

(DEFUN |CARTEN;+;3$;31| (|x| |y| $)
  (PROG (#1=#:G1986 |i| |z|)
    (RETURN
     (SEQ
      (COND
       ((NULL
         (EQL (SPADCALL |x| (QREFELT $ 29)) (SPADCALL |y| (QREFELT $ 29))))
        (|error| "Rank mismatch"))
       ('T
        (SEQ
         (LETT |z|
               (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                         (QREFELT $ 34))
               . #2=(|CARTEN;+;3$;31|))
         (SEQ (LETT |i| 0 . #2#)
              (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
              (COND ((QSGREATERP |i| #1#) (GO G191)))
              (SEQ
               (EXIT
                (SPADCALL |z| |i|
                          (SPADCALL (SPADCALL |x| |i| (QREFELT $ 30))
                                    (SPADCALL |y| |i| (QREFELT $ 30))
                                    (QREFELT $ 77))
                          (QREFELT $ 35))))
              (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
         (EXIT |z|)))))))) 

(DEFUN |CARTEN;-;3$;32| (|x| |y| $)
  (PROG (#1=#:G1991 |i| |z|)
    (RETURN
     (SEQ
      (COND
       ((NULL
         (EQL (SPADCALL |x| (QREFELT $ 29)) (SPADCALL |y| (QREFELT $ 29))))
        (|error| "Rank mismatch"))
       ('T
        (SEQ
         (LETT |z|
               (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                         (QREFELT $ 34))
               . #2=(|CARTEN;-;3$;32|))
         (SEQ (LETT |i| 0 . #2#)
              (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
              (COND ((QSGREATERP |i| #1#) (GO G191)))
              (SEQ
               (EXIT
                (SPADCALL |z| |i|
                          (SPADCALL (SPADCALL |x| |i| (QREFELT $ 30))
                                    (SPADCALL |y| |i| (QREFELT $ 30))
                                    (QREFELT $ 79))
                          (QREFELT $ 35))))
              (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
         (EXIT |z|)))))))) 

(DEFUN |CARTEN;-;2$;33| (|x| $)
  (PROG (#1=#:G1995 |i| |z|)
    (RETURN
     (SEQ
      (LETT |z|
            (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2=(|CARTEN;-;2$;33|))
      (SEQ (LETT |i| 0 . #2#)
           (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i|
                       (SPADCALL (SPADCALL |x| |i| (QREFELT $ 30))
                                 (QREFELT $ 81))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;*;I2$;34| (|n| |x| $)
  (PROG (#1=#:G1999 |i| |z|)
    (RETURN
     (SEQ
      (LETT |z|
            (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2=(|CARTEN;*;I2$;34|))
      (SEQ (LETT |i| 0 . #2#)
           (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i|
                       (SPADCALL |n| (SPADCALL |x| |i| (QREFELT $ 30))
                                 (QREFELT $ 83))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;*;$I$;35| (|x| |n| $)
  (PROG (#1=#:G2003 |i| |z|)
    (RETURN
     (SEQ
      (LETT |z|
            (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2=(|CARTEN;*;$I$;35|))
      (SEQ (LETT |i| 0 . #2#)
           (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i|
                       (SPADCALL |n| (SPADCALL |x| |i| (QREFELT $ 30))
                                 (QREFELT $ 83))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;*;R2$;36| (|r| |x| $)
  (PROG (#1=#:G2007 |i| |z|)
    (RETURN
     (SEQ
      (LETT |z|
            (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2=(|CARTEN;*;R2$;36|))
      (SEQ (LETT |i| 0 . #2#)
           (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i|
                       (SPADCALL |r| (SPADCALL |x| |i| (QREFELT $ 30))
                                 (QREFELT $ 86))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;*;$R$;37| (|x| |r| $)
  (PROG (#1=#:G2011 |i| |z|)
    (RETURN
     (SEQ
      (LETT |z|
            (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2=(|CARTEN;*;$R$;37|))
      (SEQ (LETT |i| 0 . #2#)
           (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (EXIT
             (SPADCALL |z| |i|
                       (SPADCALL |r| (SPADCALL |x| |i| (QREFELT $ 30))
                                 (QREFELT $ 86))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;product;3$;38| (|x| |y| $)
  (PROG (#1=#:G2017 |j| #2=#:G2016 |i| |ioff| |z| |ny| |nx|)
    (RETURN
     (SEQ
      (LETT |nx| (SPADCALL |x| (QREFELT $ 29)) . #3=(|CARTEN;product;3$;38|))
      (LETT |ny| (SPADCALL |y| (QREFELT $ 29)) . #3#)
      (LETT |z| (SPADCALL (* |nx| |ny|) (|spadConstant| $ 33) (QREFELT $ 34))
            . #3#)
      (SEQ (LETT |ioff| 0 . #3#) (LETT |i| 0 . #3#) (LETT #2# (- |nx| 1) . #3#)
           G190 (COND ((QSGREATERP |i| #2#) #4=(GO G191)))
           (SEQ
            (EXIT
             (SEQ (LETT |j| 0 . #3#) (LETT #1# (- |ny| 1) . #3#) G190
                  (COND ((QSGREATERP |j| #1#) #4#))
                  (SEQ
                   (EXIT
                    (SPADCALL |z| (+ |ioff| |j|)
                              (SPADCALL (SPADCALL |x| |i| (QREFELT $ 30))
                                        (SPADCALL |y| |j| (QREFELT $ 30))
                                        (QREFELT $ 86))
                              (QREFELT $ 35))))
                  (LETT |j| (QSADD1 |j|) . #3#) #5=(GO G190) G191 (EXIT NIL))))
           (LETT |i|
                 (PROG1 (QSADD1 |i|) (LETT |ioff| (QSPLUS |ioff| |ny|) . #3#))
                 . #3#)
           #5# G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;*;3$;39| (|x| |y| $)
  (PROG (|ry| |rx|)
    (RETURN
     (SEQ (LETT |rx| (SPADCALL |x| (QREFELT $ 40)) . #1=(|CARTEN;*;3$;39|))
          (LETT |ry| (SPADCALL |y| (QREFELT $ 40)) . #1#)
          (EXIT
           (COND
            ((EQL |rx| 0)
             (SPADCALL (SPADCALL |x| 0 (QREFELT $ 30)) |y| (QREFELT $ 87)))
            ((EQL |ry| 0)
             (SPADCALL |x| (SPADCALL |y| 0 (QREFELT $ 30)) (QREFELT $ 88)))
            ('T (SPADCALL |x| |rx| |y| 1 (QREFELT $ 90))))))))) 

(DEFUN |CARTEN;contract;$2I$;40| (|x| |i| |j| $)
  (PROG (#1=#:G2027 |k| |xk| |l| |xl| |zl| |m| |xm| |zm| |h| |xh| |zh| |z|
         |xok| |xoh| |zoh| |nh| |rh| |xom| |zom| |nm| |rm| |xol| |zol| |nl|
         |rl| |#G111| |#G110| |rx|)
    (RETURN
     (SEQ
      (LETT |rx| (SPADCALL |x| (QREFELT $ 40))
            . #2=(|CARTEN;contract;$2I$;40|))
      (COND
       ((OR (OR (OR (OR (< |i| 1) (< |rx| |i|)) (< |j| 1)) (< |rx| |j|))
            (EQL |i| |j|))
        (EXIT (|error| "Improper index for contraction"))))
      (COND
       ((< |j| |i|)
        (PROGN
         (LETT |#G110| |j| . #2#)
         (LETT |#G111| |i| . #2#)
         (LETT |i| |#G110| . #2#)
         (LETT |j| |#G111| . #2#))))
      (LETT |rl| (- |rx| |j|) . #2#)
      (LETT |nl| (EXPT (QREFELT $ 7) |rl|) . #2#) (LETT |zol| 1 . #2#)
      (LETT |xol| |zol| . #2#) (LETT |rm| (- (- |j| |i|) 1) . #2#)
      (LETT |nm| (EXPT (QREFELT $ 7) |rm|) . #2#) (LETT |zom| |nl| . #2#)
      (LETT |xom| (* |zom| (QREFELT $ 7)) . #2#) (LETT |rh| (- |i| 1) . #2#)
      (LETT |nh| (EXPT (QREFELT $ 7) |rh|) . #2#)
      (LETT |zoh| (* |nl| |nm|) . #2#)
      (LETT |xoh| (* |zoh| (SPADCALL (QREFELT $ 7) 2 (QREFELT $ 12))) . #2#)
      (LETT |xok| (* |nl| (+ 1 (* |nm| (QREFELT $ 7)))) . #2#)
      (LETT |z|
            (SPADCALL (* (* |nl| |nm|) |nh|) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2#)
      (SEQ (LETT |zh| 0 . #2#) (LETT |xh| 0 . #2#) (LETT |h| 1 . #2#) G190
           (COND ((QSGREATERP |h| |nh|) #3=(GO G191)))
           (SEQ
            (EXIT
             (SEQ (LETT |zm| |zh| . #2#) (LETT |xm| |xh| . #2#)
                  (LETT |m| 1 . #2#) G190 (COND ((QSGREATERP |m| |nm|) #3#))
                  (SEQ
                   (EXIT
                    (SEQ (LETT |zl| |zm| . #2#) (LETT |xl| |xm| . #2#)
                         (LETT |l| 1 . #2#) G190
                         (COND ((QSGREATERP |l| |nl|) #3#))
                         (SEQ
                          (SPADCALL |z| |zl| (|spadConstant| $ 33)
                                    (QREFELT $ 35))
                          (EXIT
                           (SEQ (LETT |xk| |xl| . #2#) (LETT |k| 1 . #2#)
                                (LETT #1# (QREFELT $ 7) . #2#) G190
                                (COND ((QSGREATERP |k| #1#) #3#))
                                (SEQ
                                 (EXIT
                                  (SPADCALL |z| |zl|
                                            (SPADCALL
                                             (SPADCALL |z| |zl| (QREFELT $ 30))
                                             (SPADCALL |x| |xk| (QREFELT $ 30))
                                             (QREFELT $ 77))
                                            (QREFELT $ 35))))
                                (LETT |k|
                                      (PROG1 (QSADD1 |k|)
                                        (LETT |xk| (+ |xk| |xok|) . #2#))
                                      . #2#)
                                #4=(GO G190) G191 (EXIT NIL))))
                         (LETT |l|
                               (PROG1 (QSADD1 |l|)
                                 (LETT |xl|
                                       (PROG1 (+ |xl| |xol|)
                                         (LETT |zl| (+ |zl| |zol|) . #2#))
                                       . #2#))
                               . #2#)
                         #4# G191 (EXIT NIL))))
                  (LETT |m|
                        (PROG1 (QSADD1 |m|)
                          (LETT |xm|
                                (PROG1 (+ |xm| |xom|)
                                  (LETT |zm| (+ |zm| |zom|) . #2#))
                                . #2#))
                        . #2#)
                  #4# G191 (EXIT NIL))))
           (LETT |h|
                 (PROG1 (QSADD1 |h|)
                   (LETT |xh|
                         (PROG1 (QSPLUS |xh| |xoh|)
                           (LETT |zh| (QSPLUS |zh| |zoh|) . #2#))
                         . #2#))
                 . #2#)
           #4# G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;contract;$I$I$;41| (|x| |i| |y| |j| $)
  (PROG (#1=#:G2036 |k| |xk| |yk| |dyl| |yl| |zly| |dyh| |yh| |zhy| |dxl| |xl|
         |zlx| |dxh| |xh| |zhx| |z| |zohx| |ohx| |nhx| |rhx| |zolx| |olx| |nlx|
         |rlx| |zohy| |ohy| |nhy| |rhy| |zoly| |oly| |nly| |rly| |ry| |rx|)
    (RETURN
     (SEQ
      (LETT |rx| (SPADCALL |x| (QREFELT $ 40))
            . #2=(|CARTEN;contract;$I$I$;41|))
      (LETT |ry| (SPADCALL |y| (QREFELT $ 40)) . #2#)
      (COND
       ((OR (OR (OR (< |i| 1) (< |rx| |i|)) (< |j| 1)) (< |ry| |j|))
        (EXIT (|error| "Improper index for contraction"))))
      (LETT |rly| (- |ry| |j|) . #2#)
      (LETT |nly| (EXPT (QREFELT $ 7) |rly|) . #2#) (LETT |oly| 1 . #2#)
      (LETT |zoly| 1 . #2#) (LETT |rhy| (- |j| 1) . #2#)
      (LETT |nhy| (EXPT (QREFELT $ 7) |rhy|) . #2#)
      (LETT |ohy| (* |nly| (QREFELT $ 7)) . #2#)
      (LETT |zohy| (SPADCALL |zoly| |nly| (QREFELT $ 93)) . #2#)
      (LETT |rlx| (- |rx| |i|) . #2#)
      (LETT |nlx| (EXPT (QREFELT $ 7) |rlx|) . #2#) (LETT |olx| 1 . #2#)
      (LETT |zolx| (* |zohy| |nhy|) . #2#) (LETT |rhx| (- |i| 1) . #2#)
      (LETT |nhx| (EXPT (QREFELT $ 7) |rhx|) . #2#)
      (LETT |ohx| (* |nlx| (QREFELT $ 7)) . #2#)
      (LETT |zohx| (* |zolx| |nlx|) . #2#)
      (LETT |z|
            (SPADCALL (* (* (* |nlx| |nhx|) |nly|) |nhy|) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #2#)
      (SEQ (LETT |zhx| 0 . #2#) (LETT |xh| 0 . #2#) (LETT |dxh| 1 . #2#) G190
           (COND ((QSGREATERP |dxh| |nhx|) #3=(GO G191)))
           (SEQ
            (EXIT
             (SEQ (LETT |zlx| |zhx| . #2#) (LETT |xl| |xh| . #2#)
                  (LETT |dxl| 1 . #2#) G190
                  (COND ((QSGREATERP |dxl| |nlx|) #3#))
                  (SEQ
                   (EXIT
                    (SEQ (LETT |zhy| |zlx| . #2#) (LETT |yh| 0 . #2#)
                         (LETT |dyh| 1 . #2#) G190
                         (COND ((QSGREATERP |dyh| |nhy|) #3#))
                         (SEQ
                          (EXIT
                           (SEQ (LETT |zly| |zhy| . #2#) (LETT |yl| |yh| . #2#)
                                (LETT |dyl| 1 . #2#) G190
                                (COND ((QSGREATERP |dyl| |nly|) #3#))
                                (SEQ
                                 (SPADCALL |z| |zly| (|spadConstant| $ 33)
                                           (QREFELT $ 35))
                                 (EXIT
                                  (SEQ (LETT |yk| |yl| . #2#)
                                       (LETT |xk| |xl| . #2#)
                                       (LETT |k| 1 . #2#)
                                       (LETT #1# (QREFELT $ 7) . #2#) G190
                                       (COND ((QSGREATERP |k| #1#) #3#))
                                       (SEQ
                                        (EXIT
                                         (SPADCALL |z| |zly|
                                                   (SPADCALL
                                                    (SPADCALL |z| |zly|
                                                              (QREFELT $ 30))
                                                    (SPADCALL
                                                     (SPADCALL |x| |xk|
                                                               (QREFELT $ 30))
                                                     (SPADCALL |y| |yk|
                                                               (QREFELT $ 30))
                                                     (QREFELT $ 86))
                                                    (QREFELT $ 77))
                                                   (QREFELT $ 35))))
                                       (LETT |k|
                                             (PROG1 (QSADD1 |k|)
                                               (LETT |xk|
                                                     (PROG1 (+ |xk| |nlx|)
                                                       (LETT |yk|
                                                             (+ |yk| |nly|)
                                                             . #2#))
                                                     . #2#))
                                             . #2#)
                                       #4=(GO G190) G191 (EXIT NIL))))
                                (LETT |dyl|
                                      (PROG1 (QSADD1 |dyl|)
                                        (LETT |yl|
                                              (PROG1 (+ |yl| |oly|)
                                                (LETT |zly| (+ |zly| |zoly|)
                                                      . #2#))
                                              . #2#))
                                      . #2#)
                                #4# G191 (EXIT NIL))))
                         (LETT |dyh|
                               (PROG1 (QSADD1 |dyh|)
                                 (LETT |yh|
                                       (PROG1 (QSPLUS |yh| |ohy|)
                                         (LETT |zhy| (+ |zhy| |zohy|) . #2#))
                                       . #2#))
                               . #2#)
                         #4# G191 (EXIT NIL))))
                  (LETT |dxl|
                        (PROG1 (QSADD1 |dxl|)
                          (LETT |xl|
                                (PROG1 (+ |xl| |olx|)
                                  (LETT |zlx| (+ |zlx| |zolx|) . #2#))
                                . #2#))
                        . #2#)
                  #4# G191 (EXIT NIL))))
           (LETT |dxh|
                 (PROG1 (QSADD1 |dxh|)
                   (LETT |xh|
                         (PROG1 (QSPLUS |xh| |ohx|)
                           (LETT |zhx| (QSPLUS |zhx| |zohx|) . #2#))
                         . #2#))
                 . #2#)
           #4# G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;transpose;2$;42| (|x| $)
  (SPADCALL |x| 1 (SPADCALL |x| (QREFELT $ 40)) (QREFELT $ 94))) 

(DEFUN |CARTEN;transpose;$2I$;43| (|x| |i| |j| $)
  (PROG (#1=#:G2046 |q| |zq| |xq| #2=#:G2045 |p| |zp| |xp| |l| |zl| |m| |zm|
         |h| |zh| |z| |zoh| |nh| |rh| |zoj| |zom| |nm| |rm| |zoi| |zol| |nl|
         |rl| |#G147| |#G146| |rx|)
    (RETURN
     (SEQ
      (LETT |rx| (SPADCALL |x| (QREFELT $ 40))
            . #3=(|CARTEN;transpose;$2I$;43|))
      (COND
       ((OR (OR (OR (OR (< |i| 1) (< |rx| |i|)) (< |j| 1)) (< |rx| |j|))
            (EQL |i| |j|))
        (EXIT (|error| "Improper indicies for transposition"))))
      (COND
       ((< |j| |i|)
        (PROGN
         (LETT |#G146| |j| . #3#)
         (LETT |#G147| |i| . #3#)
         (LETT |i| |#G146| . #3#)
         (LETT |j| |#G147| . #3#))))
      (LETT |rl| (- |rx| |j|) . #3#)
      (LETT |nl| (EXPT (QREFELT $ 7) |rl|) . #3#) (LETT |zol| 1 . #3#)
      (LETT |zoi| (SPADCALL |zol| |nl| (QREFELT $ 93)) . #3#)
      (LETT |rm| (- (- |j| |i|) 1) . #3#)
      (LETT |nm| (EXPT (QREFELT $ 7) |rm|) . #3#)
      (LETT |zom| (* |nl| (QREFELT $ 7)) . #3#)
      (LETT |zoj| (* |zom| |nm|) . #3#) (LETT |rh| (- |i| 1) . #3#)
      (LETT |nh| (EXPT (QREFELT $ 7) |rh|) . #3#)
      (LETT |zoh| (* (* |nl| |nm|) (SPADCALL (QREFELT $ 7) 2 (QREFELT $ 12)))
            . #3#)
      (LETT |z|
            (SPADCALL (SPADCALL |x| (QREFELT $ 29)) (|spadConstant| $ 33)
                      (QREFELT $ 34))
            . #3#)
      (SEQ (LETT |zh| 0 . #3#) (LETT |h| 1 . #3#) G190
           (COND ((QSGREATERP |h| |nh|) #4=(GO G191)))
           (SEQ
            (EXIT
             (SEQ (LETT |zm| |zh| . #3#) (LETT |m| 1 . #3#) G190
                  (COND ((QSGREATERP |m| |nm|) #4#))
                  (SEQ
                   (EXIT
                    (SEQ (LETT |zl| |zm| . #3#) (LETT |l| 1 . #3#) G190
                         (COND ((QSGREATERP |l| |nl|) #4#))
                         (SEQ
                          (EXIT
                           (SEQ (LETT |xp| |zl| . #3#) (LETT |zp| |zl| . #3#)
                                (LETT |p| 1 . #3#)
                                (LETT #2# (QREFELT $ 7) . #3#) G190
                                (COND ((QSGREATERP |p| #2#) #4#))
                                (SEQ
                                 (EXIT
                                  (SEQ (LETT |xq| |xp| . #3#)
                                       (LETT |zq| |zp| . #3#)
                                       (LETT |q| 1 . #3#)
                                       (LETT #1# (QREFELT $ 7) . #3#) G190
                                       (COND ((QSGREATERP |q| #1#) #4#))
                                       (SEQ
                                        (EXIT
                                         (SPADCALL |z| |zq|
                                                   (SPADCALL |x| |xq|
                                                             (QREFELT $ 30))
                                                   (QREFELT $ 35))))
                                       (LETT |q|
                                             (PROG1 (QSADD1 |q|)
                                               (LETT |zq|
                                                     (PROG1 (+ |zq| |zoj|)
                                                       (LETT |xq|
                                                             (+ |xq| |zoi|)
                                                             . #3#))
                                                     . #3#))
                                             . #3#)
                                       #5=(GO G190) G191 (EXIT NIL))))
                                (LETT |p|
                                      (PROG1 (QSADD1 |p|)
                                        (LETT |zp|
                                              (PROG1 (+ |zp| |zoi|)
                                                (LETT |xp| (+ |xp| |zoj|)
                                                      . #3#))
                                              . #3#))
                                      . #3#)
                                #5# G191 (EXIT NIL))))
                         (LETT |l|
                               (PROG1 (QSADD1 |l|)
                                 (LETT |zl| (+ |zl| |zol|) . #3#))
                               . #3#)
                         #5# G191 (EXIT NIL))))
                  (LETT |m|
                        (PROG1 (QSADD1 |m|) (LETT |zm| (+ |zm| |zom|) . #3#))
                        . #3#)
                  #5# G191 (EXIT NIL))))
           (LETT |h| (PROG1 (QSADD1 |h|) (LETT |zh| (QSPLUS |zh| |zoh|) . #3#))
                 . #3#)
           #5# G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CARTEN;reindex;$L$;44| (|x| |l| $)
  (PROG (|pi| #1=#:G2051 |i| |ziv| |xiv| |p| |rx| |z| |nx|)
    (RETURN
     (SEQ
      (LETT |nx| (SPADCALL |x| (QREFELT $ 29)) . #2=(|CARTEN;reindex;$L$;44|))
      (LETT |z| (SPADCALL |nx| (|spadConstant| $ 33) (QREFELT $ 34)) . #2#)
      (LETT |rx| (SPADCALL |x| (QREFELT $ 40)) . #2#)
      (LETT |p| (|CARTEN;mkPerm| |rx| |l| $) . #2#)
      (LETT |xiv| (MAKEARR1 |rx| 0) . #2#) (LETT |ziv| (MAKEARR1 |rx| 0) . #2#)
      (SEQ (LETT |i| 0 . #2#)
           (LETT #1# (- (SPADCALL |x| (QREFELT $ 29)) 1) . #2#) G190
           (COND ((QSGREATERP |i| #1#) (GO G191)))
           (SEQ
            (LETT |pi|
                  (|CARTEN;index2int|
                   (|CARTEN;permute!| |ziv| (|CARTEN;int2index| |i| |xiv| $)
                    |p| $)
                   $)
                  . #2#)
            (EXIT
             (SPADCALL |z| |pi| (SPADCALL |x| |i| (QREFELT $ 30))
                       (QREFELT $ 35))))
           (LETT |i| (QSADD1 |i|) . #2#) (GO G190) G191 (EXIT NIL))
      (EXIT |z|))))) 

(DEFUN |CartesianTensor| (&REST #1=#:G2052)
  (PROG ()
    (RETURN
     (PROG (#2=#:G2053)
       (RETURN
        (COND
         ((LETT #2#
                (|lassocShiftWithFunction| (|devaluateList| #1#)
                                           (HGET |$ConstructorCache|
                                                 '|CartesianTensor|)
                                           '|domainEqualList|)
                . #3=(|CartesianTensor|))
          (|CDRwithIncrement| #2#))
         ('T
          (UNWIND-PROTECT
              (PROG1 (APPLY (|function| |CartesianTensor;|) #1#)
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#) (HREM |$ConstructorCache| '|CartesianTensor|))))))))))) 

(DEFUN |CartesianTensor;| (|#1| |#2| |#3|)
  (PROG (|pv$| $ |dv$| DV$3 DV$2 DV$1)
    (RETURN
     (PROGN
      (LETT DV$1 (|devaluate| |#1|) . #1=(|CartesianTensor|))
      (LETT DV$2 (|devaluate| |#2|) . #1#)
      (LETT DV$3 (|devaluate| |#3|) . #1#)
      (LETT |dv$| (LIST '|CartesianTensor| DV$1 DV$2 DV$3) . #1#)
      (LETT $ (GETREFV 99) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|CartesianTensor| (LIST DV$1 DV$2 DV$3)
                  (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 |#1|)
      (QSETREFV $ 7 |#2|)
      (QSETREFV $ 8 |#3|)
      (QSETREFV $ 9 (|IndexedVector| |#3| 0))
      (QSETREFV $ 13 (SPADCALL |#2| 2 (QREFELT $ 12)))
      (QSETREFV $ 14 (SPADCALL |#2| 3 (QREFELT $ 12)))
      (QSETREFV $ 15 (SPADCALL |#2| 4 (QREFELT $ 12)))
      $)))) 

(MAKEPROP '|CartesianTensor| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL (|local| |#1|) (|local| |#2|)
              (|local| |#3|) '|Rep| (|PositiveInteger|) (|NonNegativeInteger|)
              (0 . ^) '|dim2| '|dim3| '|dim4| |CARTEN;kroneckerDelta;$;10|
              |CARTEN;sample;$;1| (|Integer|) (|Vector| 18) (6 . |setelt|)
              (13 . |elt|) (19 . *) (|Boolean|) (|Vector| 23) (25 . |setelt|)
              (32 . |elt|) (|Union| $ '"failed") (38 . |exquo|) (44 . |#|)
              (49 . |elt|) (|List| 8) |CARTEN;ravel;$L;8| (55 . |Zero|)
              (59 . |new|) (65 . |setelt|) |CARTEN;unravel;L$;9| (72 . |One|)
              (76 . |coerce|) |CARTEN;leviCivitaSymbol;$;11|
              |CARTEN;rank;$Nni;13| |CARTEN;degree;$Nni;12| |CARTEN;elt;$R;14|
              |CARTEN;elt;$IR;15| |CARTEN;elt;$2IR;16| |CARTEN;elt;$3IR;17|
              |CARTEN;elt;$4IR;18| (|List| 18) |CARTEN;elt;$LR;19|
              |CARTEN;coerce;L$;20| (|List| $$) (81 . |#|) (86 . |first|)
              (|List| $) |CARTEN;coerce;L$;21| (|Union| 8 '"failed")
              |CARTEN;retractIfCan;$U;22| (|OutputForm|) (|List| 57)
              (91 . |coerce|) (96 . |coerce|) (|List| 53) (101 . |matrix|)
              |CARTEN;coerce;$Of;24| |CARTEN;coerce;R$;27|
              (CONS IDENTITY
                    (FUNCALL (|dispatchFunction| |CARTEN;Zero;$;25|) $))
              (CONS IDENTITY
                    (FUNCALL (|dispatchFunction| |CARTEN;One;$;26|) $))
              (|DirectProduct| 7 8) (106 . |minIndex|) (111 . |maxIndex|)
              (116 . |elt|) |CARTEN;coerce;Dp$;28| (|SquareMatrix| 7 8)
              (122 . |elt|) |CARTEN;coerce;Sm$;29| (129 . =) |CARTEN;=;2$B;30|
              (135 . +) |CARTEN;+;3$;31| (141 . -) |CARTEN;-;3$;32| (147 . -)
              |CARTEN;-;2$;33| (152 . *) |CARTEN;*;I2$;34| |CARTEN;*;$I$;35|
              (158 . *) |CARTEN;*;R2$;36| |CARTEN;*;$R$;37|
              |CARTEN;product;3$;38| |CARTEN;contract;$I$I$;41|
              |CARTEN;*;3$;39| |CARTEN;contract;$2I$;40| (164 . *)
              |CARTEN;transpose;$2I$;43| |CARTEN;transpose;2$;42|
              |CARTEN;reindex;$L$;44| (|SingleInteger|) (|String|))
           '#(~= 170 |unravel| 176 |transpose| 181 |sample| 193 |retractIfCan|
              197 |retract| 202 |reindex| 207 |ravel| 213 |rank| 218 |product|
              223 |leviCivitaSymbol| 229 |latex| 233 |kroneckerDelta| 238
              |hash| 242 |elt| 247 |degree| 288 |contract| 293 |coerce| 308
              |Zero| 338 |One| 342 = 346 - 352 + 363 * 369)
           'NIL
           (CONS (|makeByteWordVec2| 1 '(0 0 0 0 0 0 0))
                 (CONS
                  '#(|GradedAlgebra&| |GradedModule&| |GradedModule&|
                     |SetCategory&| |BasicType&| |RetractableTo&| NIL)
                  (CONS
                   '#((|GradedAlgebra| 8 11) (|GradedModule| 8 11)
                      (|GradedModule| 18 11) (|SetCategory|) (|BasicType|)
                      (|RetractableTo| 8) (|CoercibleTo| 57))
                   (|makeByteWordVec2| 98
                                       '(2 11 0 0 10 12 3 19 18 0 18 18 20 2 19
                                         18 0 18 21 2 18 0 11 0 22 3 24 23 0 18
                                         23 25 2 24 23 0 18 26 2 18 27 0 0 28 1
                                         9 11 0 29 2 9 8 0 18 30 0 8 0 33 2 9 0
                                         11 8 34 3 9 8 0 18 8 35 0 8 0 37 1 8 0
                                         18 38 1 50 11 0 51 1 50 2 0 52 1 58 57
                                         0 59 1 8 57 0 60 1 57 0 61 62 1 67 18
                                         0 68 1 67 18 0 69 2 67 8 0 18 70 3 72
                                         8 0 18 18 73 2 8 23 0 0 75 2 8 0 0 0
                                         77 2 8 0 0 0 79 1 8 0 0 81 2 8 0 18 0
                                         83 2 8 0 0 0 86 2 11 0 10 0 93 2 0 23
                                         0 0 1 1 0 0 31 36 3 0 0 0 18 18 94 1 0
                                         0 0 95 0 0 0 17 1 0 55 0 56 1 0 8 0 1
                                         2 0 0 0 47 96 1 0 31 0 32 1 0 11 0 40
                                         2 0 0 0 0 89 0 0 0 39 1 0 98 0 1 0 0 0
                                         16 1 0 97 0 1 2 0 8 0 47 48 5 0 8 0 18
                                         18 18 18 46 3 0 8 0 18 18 44 4 0 8 0
                                         18 18 18 45 1 0 8 0 42 2 0 8 0 18 43 1
                                         0 11 0 41 4 0 0 0 18 0 18 90 3 0 0 0
                                         18 18 92 1 0 0 31 49 1 0 0 53 54 1 0 0
                                         67 71 1 0 0 72 74 1 0 0 8 64 1 0 57 0
                                         63 0 0 0 65 0 0 0 66 2 0 23 0 0 76 2 0
                                         0 0 0 80 1 0 0 0 82 2 0 0 0 0 78 2 0 0
                                         0 0 91 2 0 0 18 0 84 2 0 0 0 18 85 2 0
                                         0 0 8 88 2 0 0 8 0 87)))))
           '|lookupComplete|)) 
