
(/VERSIONCHECK 2) 

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

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

(DEFUN |CARTEN;index2int| (|indv| $)
  (PROG (|i| #0=#:G1850 |ix| |n|)
    (RETURN
      (SEQ (LETT |n| 0 . #1=(|CARTEN;index2int|))
           (SEQ (LETT |i| 1 . #1#) (LETT #0# (QVSIZE |indv|) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (LETT |ix|
                           (- (SPADCALL |indv| |i| (QREFELT $ 21))
                              (QREFELT $ 6)) . #1#)
                     (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|) . #1#)))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |n|))))) 

(DEFUN |CARTEN;lengthRankOrElse| (|v| $)
  (PROG (|qr| |rx|)
    (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 . #0=(|CARTEN;lengthRankOrElse|))
                   (SEQ G190
                        (COND
                          ((NULL (COND ((EQL |v| 0) 'NIL) ('T 'T)))
                           (GO G191)))
                        (SEQ (LETT |qr|
                                   (DIVIDE2 |v| (QREFELT $ 7)) . #0#)
                             (LETT |v| (QCAR |qr|) . #0#)
                             (EXIT (COND
                                     ((NULL (EQL |v| 0))
                                      (COND
                                        ((NULL (EQL (QCDR |qr|) 0))
                                         (|error|
                                          "Rank is not a whole number"))
                                        ('T
                                         (LETT |rx| (+ |rx| 1) . #0#)))))))
                        NIL (GO G190) G191 (EXIT NIL))
                   (EXIT |rx|)))))))) 

(DEFUN |CARTEN;mkPerm| (|n| |l| $)
  (PROG (|p| |seen| #0=#:G1865 |i| |e| #1=#:G1862)
    (RETURN
      (SEQ (COND
             ((NULL (EQL (LENGTH |l|) |n|))
              (|error| "The list is not a permutation."))
             ('T
              (SEQ (LETT |p| (SPADCALL |n| 0 (QREFELT $ 23))
                         . #2=(|CARTEN;mkPerm|))
                   (LETT |seen|
                         (SPADCALL |n| 'NIL (QREFELT $ 26)) . #2#)
                   (SEQ (LETT |e| NIL . #2#) (LETT #0# |l| . #2#)
                        (LETT |i| 1 . #2#) G190
                        (COND
                          ((OR (QSGREATERP |i| |n|) (ATOM #0#)
                               (PROGN (LETT |e| (CAR #0#) . #2#) NIL))
                           #3=(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 $ 27))))))))
                        (LETT |i|
                              (PROG1 (QSADD1 |i|)
                                (LETT #0# (CDR #0#) . #2#)) . #2#)
                        #4=(GO G190) G191 (EXIT NIL))
                   (SEQ (EXIT (SEQ (LETT |e| 1 . #2#) G190
                                   (COND ((QSGREATERP |e| |n|) #3#))
                                   (SEQ
                                    (EXIT
                                     (COND
                                       ((NULL
                                         (SPADCALL |seen| |e|
                                          (QREFELT $ 28)))
                                        (PROGN
                                          (LETT #1#
                                           (|error|
                                            "The list is not a permutation.") . #2#)
                                          (GO #1#))))))
                                   (LETT |e| (QSADD1 |e|) . #2#) #4#
                                   G191 (EXIT NIL)))
                        #1# (EXIT #1#))
                   (EXIT |p|)))))))) 

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

(DEFUN |CARTEN;permsign!| (|v| $)
  (PROG (|maxix| #0=#:G1874 |psum| #1=#:G1887 |n| |j| #2=#:G1889
                 #3=#:G1888 |nTrans| |e| |totTrans| |i| #4=#:G1890
                 #5=#:G1886)
    (RETURN
      (SEQ (EXIT (SEQ (LETT |maxix|
                            (- (+ (QREFELT $ 6) (QVSIZE |v|)) 1)
                            . #6=(|CARTEN;permsign!|))
                      (LETT |psum|
                            (PROG2 (LETT #0#
                                    (SPADCALL
                                     (- (* (+ |maxix| 1) |maxix|)
                                      (* (QREFELT $ 6)
                                       (- (QREFELT $ 6) 1)))
                                     2 (QREFELT $ 30)) . #6#)
                                   (QCDR #0#)
                              (|check-union| (QEQCAR #0# 0) (|Integer|)
                                  #0#)) . #6#)
                      (LETT |n| 0 . #6#)
                      (SEQ (LETT |i| 1 . #6#)
                           (LETT #1# (QVSIZE |v|) . #6#) G190
                           (COND ((QSGREATERP |i| #1#) #7=(GO G191)))
                           (SEQ (EXIT (LETT |n|
                                       (+ |n|
                                        (SPADCALL |v| |i|
                                         (QREFELT $ 21))) . #6#)))
                           (LETT |i| (QSADD1 |i|) . #6#) #8=(GO G190)
                           G191 (EXIT NIL))
                      (EXIT (COND
                              ((EQL |n| |psum|)
                               (SEQ (LETT |totTrans| 0 . #6#)
                                    (LETT |nTrans| 1 . #6#)
                                    (SEQ G190
                                     (COND
                                       ((NULL
                                         (COND
                                           ((EQL |nTrans| 0) 'NIL)
                                           ('T 'T)))
                                        #7#))
                                     (SEQ (LETT |nTrans| 0 . #6#)
                                      (SEQ (LETT |j| 2 . #6#)
                                       (LETT #2# (QVSIZE |v|) . #6#)
                                       (LETT |i| 1 . #6#)
                                       (LETT #3#
                                        (- (QVSIZE |v|) 1) . #6#)
                                       G190
                                       (COND
                                         ((OR (QSGREATERP |i| #3#)
                                           (QSGREATERP |j| #2#))
                                          #7#))
                                       (SEQ
                                        (EXIT
                                         (COND
                                           ((<
                                             (SPADCALL |v| |j|
                                              (QREFELT $ 21))
                                             (SPADCALL |v| |i|
                                              (QREFELT $ 21)))
                                            (SEQ
                                             (LETT |nTrans|
                                              (+ |nTrans| 1) . #6#)
                                             (LETT |e|
                                              (SPADCALL |v| |i|
                                               (QREFELT $ 21)) . #6#)
                                             (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|) . #6#)) . #6#)
                                       #8# G191 (EXIT NIL))
                                      (EXIT
                                       (LETT |totTrans|
                                        (+ |totTrans| |nTrans|) . #6#)))
                                     NIL #8# G191 (EXIT NIL))
                                    (SEQ (LETT |i| 1 . #6#)
                                     (LETT #4# (QREFELT $ 7) . #6#)
                                     G190
                                     (COND ((QSGREATERP |i| #4#) #7#))
                                     (SEQ
                                      (EXIT
                                       (COND
                                         ((NULL
                                           (EQL
                                            (SPADCALL |v| |i|
                                             (QREFELT $ 21))
                                            (- (+ (QREFELT $ 6) |i|) 1)))
                                          (PROGN
                                            (LETT #5# 0 . #6#)
                                            (GO #5#))))))
                                     (LETT |i| (QSADD1 |i|) . #6#) #8#
                                     G191 (EXIT NIL))
                                    (EXIT
                                     (COND
                                       ((ODDP |totTrans|) -1)
                                       ('T 1)))))
                              ('T 0)))))
           #5# (EXIT #5#))))) 

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

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

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

(DEFUN |CARTEN;leviCivitaSymbol;$;11| ($)
  (PROG (|nz| |z| |indv| |i| #0=#:G1908)
    (RETURN
      (SEQ (LETT |nz| (EXPT (QREFELT $ 7) (QREFELT $ 7))
                 . #1=(|CARTEN;leviCivitaSymbol;$;11|))
           (LETT |z|
                 (SPADCALL |nz| (|spadConstant| $ 35) (QREFELT $ 36)) . #1#)
           (LETT |indv|
                 (SPADCALL (QREFELT $ 7) 0 (QREFELT $ 23)) . #1#)
           (SEQ (LETT |i| 0 . #1#) (LETT #0# (- |nz| 1) . #1#) G190
                (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL
                                   (|CARTEN;permsign!|
                                    (|CARTEN;int2index| |i| |indv| $)
                                    $)
                                   (QREFELT $ 40))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

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

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

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

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

(DEFUN |CARTEN;elt;$2IR;16| (|x| |i| |j| $)
  (COND
    ((NULL (EQL (SPADCALL |x| (QREFELT $ 31)) (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 $ 32))))) 

(DEFUN |CARTEN;elt;$3IR;17| (|x| |i| |j| |k| $)
  (COND
    ((NULL (EQL (SPADCALL |x| (QREFELT $ 31)) (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 $ 32))))) 

(DEFUN |CARTEN;elt;$4IR;18| (|x| |i| |j| |k| |l| $)
  (COND
    ((NULL (EQL (SPADCALL |x| (QREFELT $ 31)) (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 $ 32))))) 

(DEFUN |CARTEN;elt;$LR;19| (|x| |i| $)
  (PROG (|ii| #0=#:G1933 |ix| |n|)
    (RETURN
      (SEQ (COND
             ((NULL (EQL (LENGTH |i|) (SPADCALL |x| (QREFELT $ 42))))
              (|error| "Index error (wrong rank)"))
             ('T
              (SEQ (LETT |n| 0 . #1=(|CARTEN;elt;$LR;19|))
                   (SEQ (LETT |ii| NIL . #1#) (LETT #0# |i| . #1#) G190
                        (COND
                          ((OR (ATOM #0#)
                               (PROGN (LETT |ii| (CAR #0#) . #1#) NIL))
                           (GO G191)))
                        (SEQ (LETT |ix| (- |ii| (QREFELT $ 6)) . #1#)
                             (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|) . #1#)))
                        (LETT #0# (CDR #0#) . #1#) (GO G190) G191
                        (EXIT NIL))
                   (EXIT (SPADCALL |x| |n| (QREFELT $ 32)))))))))) 

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

(DEFUN |CARTEN;coerce;L$;21| (|lx| $)
  (PROG (|rx| #0=#:G1947 #1=#:G1942 |nx| |z| |offz| |x| #2=#:G1948 |i|
              #3=#:G1949)
    (RETURN
      (SEQ (COND
             ((NULL (EQL (SPADCALL |lx| (QREFELT $ 53)) (QREFELT $ 7)))
              (|error| "Incorrect number of slices"))
             ('T
              (SEQ (LETT |rx|
                         (SPADCALL (SPADCALL |lx| (QREFELT $ 54))
                             (QREFELT $ 42))
                         . #4=(|CARTEN;coerce;L$;21|))
                   (SEQ (EXIT (SEQ (LETT |x| NIL . #4#)
                                   (LETT #0# |lx| . #4#) G190
                                   (COND
                                     ((OR (ATOM #0#)
                                       (PROGN
                                         (LETT |x| (CAR #0#) . #4#)
                                         NIL))
                                      #5=(GO G191)))
                                   (SEQ
                                    (EXIT
                                     (COND
                                       ((NULL
                                         (EQL
                                          (SPADCALL |x| (QREFELT $ 42))
                                          |rx|))
                                        (PROGN
                                          (LETT #1#
                                           (|error|
                                            "Inhomogeneous slice ranks") . #4#)
                                          (GO #1#))))))
                                   (LETT #0# (CDR #0#) . #4#)
                                   #6=(GO G190) G191 (EXIT NIL)))
                        #1# (EXIT #1#))
                   (LETT |nx|
                         (SPADCALL (SPADCALL |lx| (QREFELT $ 54))
                             (QREFELT $ 31)) . #4#)
                   (LETT |z|
                         (SPADCALL (* (QREFELT $ 7) |nx|)
                             (|spadConstant| $ 35) (QREFELT $ 36)) . #4#)
                   (SEQ (LETT |offz| 0 . #4#) (LETT |x| NIL . #4#)
                        (LETT #2# |lx| . #4#) G190
                        (COND
                          ((OR (ATOM #2#)
                               (PROGN (LETT |x| (CAR #2#) . #4#) NIL))
                           #5#))
                        (SEQ (EXIT (SEQ (LETT |i| 0 . #4#)
                                    (LETT #3# (- |nx| 1) . #4#) G190
                                    (COND ((QSGREATERP |i| #3#) #5#))
                                    (SEQ
                                     (EXIT
                                      (SPADCALL |z| (+ |offz| |i|)
                                       (SPADCALL |x| |i|
                                        (QREFELT $ 32))
                                       (QREFELT $ 37))))
                                    (LETT |i| (QSADD1 |i|) . #4#) #6#
                                    G191 (EXIT NIL))))
                        (LETT #2#
                              (PROG1 (CDR #2#)
                                (LETT |offz|
                                      (QSPLUS |offz| |nx|) . #4#)) . #4#)
                        #6# G191 (EXIT NIL))
                   (EXIT |z|)))))))) 

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

(DEFUN |CARTEN;mkOutf| (|x| |i0| |rnk| $)
  (PROG (#0=#:G1965 #1=#:G1966 |rnk1| |nskip| #2=#:G1967 |i| #3=#:G1968
            #4=#:G1969 |j| #5=#:G1970)
    (RETURN
      (SEQ (COND
             ((ODDP |rnk|)
              (SEQ (LETT |rnk1| (- |rnk| 1) . #6=(|CARTEN;mkOutf|))
                   (LETT |nskip| (EXPT (QREFELT $ 7) |rnk1|) . #6#)
                   (EXIT (SPADCALL
                             (PROGN
                               (LETT #0# NIL . #6#)
                               (SEQ (LETT |i| 0 . #6#)
                                    (LETT #1#
                                     (- (QREFELT $ 7) 1) . #6#)
                                    G190
                                    (COND
                                      ((QSGREATERP |i| #1#)
                                       #7=(GO G191)))
                                    (SEQ
                                     (EXIT
                                      (LETT #0#
                                       (CONS
                                        (|CARTEN;mkOutf| |x|
                                         (+ |i0| (* |nskip| |i|))
                                         |rnk1| $)
                                        #0#) . #6#)))
                                    (LETT |i| (QSADD1 |i|) . #6#)
                                    #8=(GO G190) G191
                                    (EXIT (NREVERSE0 #0#))))
                             (QREFELT $ 61)))))
             ((EQL |rnk| 0)
              (SPADCALL (SPADCALL |x| |i0| (QREFELT $ 32))
                  (QREFELT $ 62)))
             ('T
              (SEQ (LETT |rnk1| (- |rnk| 2) . #6#)
                   (LETT |nskip| (EXPT (QREFELT $ 7) |rnk1|) . #6#)
                   (EXIT (SPADCALL
                             (PROGN
                               (LETT #2# NIL . #6#)
                               (SEQ (LETT |i| 0 . #6#)
                                    (LETT #3#
                                     (- (QREFELT $ 7) 1) . #6#)
                                    G190
                                    (COND ((QSGREATERP |i| #3#) #7#))
                                    (SEQ
                                     (EXIT
                                      (LETT #2#
                                       (CONS
                                        (PROGN
                                          (LETT #4# NIL . #6#)
                                          (SEQ (LETT |j| 0 . #6#)
                                           (LETT #5#
                                            (- (QREFELT $ 7) 1) . #6#)
                                           G190
                                           (COND
                                             ((QSGREATERP |j| #5#) #7#))
                                           (SEQ
                                            (EXIT
                                             (LETT #4#
                                              (CONS
                                               (|CARTEN;mkOutf| |x|
                                                (+ |i0|
                                                 (* |nskip|
                                                  (+
                                                   (* (QREFELT $ 7)
                                                    |i|)
                                                   |j|)))
                                                |rnk1| $)
                                               #4#) . #6#)))
                                           (LETT |j|
                                            (QSADD1 |j|) . #6#)
                                           #8# G191
                                           (EXIT (NREVERSE0 #4#))))
                                        #2#) . #6#)))
                                    (LETT |i| (QSADD1 |i|) . #6#) #8#
                                    G191 (EXIT (NREVERSE0 #2#))))
                             (QREFELT $ 64)))))))))) 

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

(DEFUN |CARTEN;Zero;$;25| ($)
  (SPADCALL (|spadConstant| $ 35) (QREFELT $ 66))) 

(DEFUN |CARTEN;One;$;26| ($)
  (SPADCALL (|spadConstant| $ 39) (QREFELT $ 66))) 

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

(DEFUN |CARTEN;coerce;Dp$;28| (|v| $)
  (PROG (|z| |j| #0=#:G1979 |i| #1=#:G1978)
    (RETURN
      (SEQ (LETT |z|
                 (SPADCALL (QREFELT $ 7) (|spadConstant| $ 35)
                     (QREFELT $ 36))
                 . #2=(|CARTEN;coerce;Dp$;28|))
           (SEQ (LETT |j| (SPADCALL |v| (QREFELT $ 70)) . #2#)
                (LETT #0# (SPADCALL |v| (QREFELT $ 71)) . #2#)
                (LETT |i| 0 . #2#) (LETT #1# (- (QREFELT $ 7) 1) . #2#)
                G190
                (COND
                  ((OR (QSGREATERP |i| #1#) (> |j| #0#)) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL |v| |j| (QREFELT $ 72))
                               (QREFELT $ 37))))
                (LETT |i|
                      (PROG1 (QSADD1 |i|) (LETT |j| (+ |j| 1) . #2#)) . #2#)
                (GO G190) G191 (EXIT NIL))
           (EXIT |z|))))) 

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

(DEFUN |CARTEN;=;2$B;30| (|x| |y| $)
  (PROG (|i| #0=#:G1992 #1=#:G1991)
    (RETURN
      (SEQ (EXIT (COND
                   ((NULL (EQL (SPADCALL |x| (QREFELT $ 31))
                               (SPADCALL |y| (QREFELT $ 31))))
                    'NIL)
                   ('T
                    (SEQ (SEQ (LETT |i| 0 . #2=(|CARTEN;=;2$B;30|))
                              (LETT #0#
                                    (- (SPADCALL |x| (QREFELT $ 31)) 1) . #2#)
                              G190
                              (COND ((QSGREATERP |i| #0#) (GO G191)))
                              (SEQ (EXIT
                                    (COND
                                      ((NULL
                                        (SPADCALL
                                         (SPADCALL |x| |i|
                                          (QREFELT $ 32))
                                         (SPADCALL |y| |i|
                                          (QREFELT $ 32))
                                         (QREFELT $ 77)))
                                       (PROGN
                                         (LETT #1# 'NIL . #2#)
                                         (GO #1#))))))
                              (LETT |i| (QSADD1 |i|) . #2#) (GO G190)
                              G191 (EXIT NIL))
                         (EXIT 'T)))))
           #1# (EXIT #1#))))) 

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

(DEFUN |CARTEN;-;3$;32| (|x| |y| $)
  (PROG (|z| |i| #0=#:G2002)
    (RETURN
      (SEQ (COND
             ((NULL (EQL (SPADCALL |x| (QREFELT $ 31))
                         (SPADCALL |y| (QREFELT $ 31))))
              (|error| "Rank mismatch"))
             ('T
              (SEQ (LETT |z|
                         (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                             (|spadConstant| $ 35) (QREFELT $ 36))
                         . #1=(|CARTEN;-;3$;32|))
                   (SEQ (LETT |i| 0 . #1#)
                        (LETT #0#
                              (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                        G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                        (SEQ (EXIT (SPADCALL |z| |i|
                                    (SPADCALL
                                     (SPADCALL |x| |i| (QREFELT $ 32))
                                     (SPADCALL |y| |i| (QREFELT $ 32))
                                     (QREFELT $ 81))
                                    (QREFELT $ 37))))
                        (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                        (EXIT NIL))
                   (EXIT |z|)))))))) 

(DEFUN |CARTEN;-;2$;33| (|x| $)
  (PROG (|z| |i| #0=#:G2006)
    (RETURN
      (SEQ (LETT |z|
                 (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                     (|spadConstant| $ 35) (QREFELT $ 36))
                 . #1=(|CARTEN;-;2$;33|))
           (SEQ (LETT |i| 0 . #1#)
                (LETT #0# (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL
                                   (SPADCALL |x| |i| (QREFELT $ 32))
                                   (QREFELT $ 83))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;*;I2$;34| (|n| |x| $)
  (PROG (|z| |i| #0=#:G2010)
    (RETURN
      (SEQ (LETT |z|
                 (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                     (|spadConstant| $ 35) (QREFELT $ 36))
                 . #1=(|CARTEN;*;I2$;34|))
           (SEQ (LETT |i| 0 . #1#)
                (LETT #0# (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL |n|
                                   (SPADCALL |x| |i| (QREFELT $ 32))
                                   (QREFELT $ 85))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;*;$I$;35| (|x| |n| $)
  (PROG (|z| |i| #0=#:G2014)
    (RETURN
      (SEQ (LETT |z|
                 (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                     (|spadConstant| $ 35) (QREFELT $ 36))
                 . #1=(|CARTEN;*;$I$;35|))
           (SEQ (LETT |i| 0 . #1#)
                (LETT #0# (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL |n|
                                   (SPADCALL |x| |i| (QREFELT $ 32))
                                   (QREFELT $ 85))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;*;R2$;36| (|r| |x| $)
  (PROG (|z| |i| #0=#:G2018)
    (RETURN
      (SEQ (LETT |z|
                 (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                     (|spadConstant| $ 35) (QREFELT $ 36))
                 . #1=(|CARTEN;*;R2$;36|))
           (SEQ (LETT |i| 0 . #1#)
                (LETT #0# (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL |r|
                                   (SPADCALL |x| |i| (QREFELT $ 32))
                                   (QREFELT $ 88))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;*;$R$;37| (|x| |r| $)
  (PROG (|z| |i| #0=#:G2022)
    (RETURN
      (SEQ (LETT |z|
                 (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                     (|spadConstant| $ 35) (QREFELT $ 36))
                 . #1=(|CARTEN;*;$R$;37|))
           (SEQ (LETT |i| 0 . #1#)
                (LETT #0# (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (EXIT (SPADCALL |z| |i|
                               (SPADCALL |r|
                                   (SPADCALL |x| |i| (QREFELT $ 32))
                                   (QREFELT $ 88))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;product;3$;38| (|x| |y| $)
  (PROG (|nx| |ny| |z| |ioff| |i| #0=#:G2027 |j| #1=#:G2028)
    (RETURN
      (SEQ (LETT |nx| (SPADCALL |x| (QREFELT $ 31))
                 . #2=(|CARTEN;product;3$;38|))
           (LETT |ny| (SPADCALL |y| (QREFELT $ 31)) . #2#)
           (LETT |z|
                 (SPADCALL (* |nx| |ny|) (|spadConstant| $ 35)
                     (QREFELT $ 36)) . #2#)
           (SEQ (LETT |ioff| 0 . #2#) (LETT |i| 0 . #2#)
                (LETT #0# (- |nx| 1) . #2#) G190
                (COND ((QSGREATERP |i| #0#) #3=(GO G191)))
                (SEQ (EXIT (SEQ (LETT |j| 0 . #2#)
                                (LETT #1# (- |ny| 1) . #2#) G190
                                (COND ((QSGREATERP |j| #1#) #3#))
                                (SEQ (EXIT
                                      (SPADCALL |z| (+ |ioff| |j|)
                                       (SPADCALL
                                        (SPADCALL |x| |i|
                                         (QREFELT $ 32))
                                        (SPADCALL |y| |j|
                                         (QREFELT $ 32))
                                        (QREFELT $ 88))
                                       (QREFELT $ 37))))
                                (LETT |j| (QSADD1 |j|) . #2#)
                                #4=(GO G190) G191 (EXIT NIL))))
                (LETT |i|
                      (PROG1 (QSADD1 |i|)
                        (LETT |ioff| (QSPLUS |ioff| |ny|) . #2#)) . #2#)
                #4# G191 (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;*;3$;39| (|x| |y| $)
  (PROG (|rx| |ry|)
    (RETURN
      (SEQ (LETT |rx| (SPADCALL |x| (QREFELT $ 42))
                 . #0=(|CARTEN;*;3$;39|))
           (LETT |ry| (SPADCALL |y| (QREFELT $ 42)) . #0#)
           (EXIT (COND
                   ((EQL |rx| 0)
                    (SPADCALL (SPADCALL |x| 0 (QREFELT $ 32)) |y|
                        (QREFELT $ 89)))
                   ((EQL |ry| 0)
                    (SPADCALL |x| (SPADCALL |y| 0 (QREFELT $ 32))
                        (QREFELT $ 90)))
                   ('T (SPADCALL |x| |rx| |y| 1 (QREFELT $ 92))))))))) 

(DEFUN |CARTEN;contract;$2I$;40| (|x| |i| |j| $)
  (PROG (|rx| |#G110| |#G111| |rl| |nl| |zol| |xol| |rm| |nm| |zom|
              |xom| |rh| |nh| |zoh| |xoh| |xok| |z| |zh| |xh| |h| |zm|
              |xm| |m| |zl| |xl| |l| |xk| |k| #0=#:G2038)
    (RETURN
      (SEQ (LETT |rx| (SPADCALL |x| (QREFELT $ 42))
                 . #1=(|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| . #1#)
                (LETT |#G111| |i| . #1#)
                (LETT |i| |#G110| . #1#)
                (LETT |j| |#G111| . #1#))))
           (LETT |rl| (- |rx| |j|) . #1#)
           (LETT |nl| (EXPT (QREFELT $ 7) |rl|) . #1#)
           (LETT |zol| 1 . #1#) (LETT |xol| |zol| . #1#)
           (LETT |rm| (- (- |j| |i|) 1) . #1#)
           (LETT |nm| (EXPT (QREFELT $ 7) |rm|) . #1#)
           (LETT |zom| |nl| . #1#)
           (LETT |xom| (* |zom| (QREFELT $ 7)) . #1#)
           (LETT |rh| (- |i| 1) . #1#)
           (LETT |nh| (EXPT (QREFELT $ 7) |rh|) . #1#)
           (LETT |zoh| (* |nl| |nm|) . #1#)
           (LETT |xoh|
                 (* |zoh| (SPADCALL (QREFELT $ 7) 2 (QREFELT $ 12))) . #1#)
           (LETT |xok| (* |nl| (+ 1 (* |nm| (QREFELT $ 7)))) . #1#)
           (LETT |z|
                 (SPADCALL (* (* |nl| |nm|) |nh|) (|spadConstant| $ 35)
                     (QREFELT $ 36)) . #1#)
           (SEQ (LETT |zh| 0 . #1#) (LETT |xh| 0 . #1#)
                (LETT |h| 1 . #1#) G190
                (COND ((QSGREATERP |h| |nh|) #2=(GO G191)))
                (SEQ (EXIT (SEQ (LETT |zm| |zh| . #1#)
                                (LETT |xm| |xh| . #1#)
                                (LETT |m| 1 . #1#) G190
                                (COND ((QSGREATERP |m| |nm|) #2#))
                                (SEQ (EXIT
                                      (SEQ (LETT |zl| |zm| . #1#)
                                       (LETT |xl| |xm| . #1#)
                                       (LETT |l| 1 . #1#) G190
                                       (COND
                                         ((QSGREATERP |l| |nl|) #2#))
                                       (SEQ
                                        (SPADCALL |z| |zl|
                                         (|spadConstant| $ 35)
                                         (QREFELT $ 37))
                                        (EXIT
                                         (SEQ (LETT |xk| |xl| . #1#)
                                          (LETT |k| 1 . #1#)
                                          (LETT #0#
                                           (QREFELT $ 7) . #1#)
                                          G190
                                          (COND
                                            ((QSGREATERP |k| #0#) #2#))
                                          (SEQ
                                           (EXIT
                                            (SPADCALL |z| |zl|
                                             (SPADCALL
                                              (SPADCALL |z| |zl|
                                               (QREFELT $ 32))
                                              (SPADCALL |x| |xk|
                                               (QREFELT $ 32))
                                              (QREFELT $ 79))
                                             (QREFELT $ 37))))
                                          (LETT |k|
                                           (PROG1 (QSADD1 |k|)
                                             (LETT |xk|
                                              (+ |xk| |xok|) . #1#)) . #1#)
                                          #3=(GO G190) G191 (EXIT NIL))))
                                       (LETT |l|
                                        (PROG1 (QSADD1 |l|)
                                          (LETT |xl|
                                           (PROG1 (+ |xl| |xol|)
                                             (LETT |zl|
                                              (+ |zl| |zol|) . #1#)) . #1#)) . #1#)
                                       #3# G191 (EXIT NIL))))
                                (LETT |m|
                                      (PROG1 (QSADD1 |m|)
                                        (LETT |xm|
                                         (PROG1 (+ |xm| |xom|)
                                           (LETT |zm|
                                            (+ |zm| |zom|) . #1#)) . #1#)) . #1#)
                                #3# G191 (EXIT NIL))))
                (LETT |h|
                      (PROG1 (QSADD1 |h|)
                        (LETT |xh|
                              (PROG1 (QSPLUS |xh| |xoh|)
                                (LETT |zh| (QSPLUS |zh| |zoh|) . #1#)) . #1#)) . #1#)
                #3# G191 (EXIT NIL))
           (EXIT |z|))))) 

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

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

(DEFUN |CARTEN;transpose;$2I$;43| (|x| |i| |j| $)
  (PROG (|rx| |#G146| |#G147| |rl| |nl| |zol| |zoi| |rm| |nm| |zom|
              |zoj| |rh| |nh| |zoh| |z| |zh| |h| |zm| |m| |zl| |l| |xp|
              |zp| |p| #0=#:G2056 |xq| |zq| |q| #1=#:G2057)
    (RETURN
      (SEQ (LETT |rx| (SPADCALL |x| (QREFELT $ 42))
                 . #2=(|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| . #2#)
                (LETT |#G147| |i| . #2#)
                (LETT |i| |#G146| . #2#)
                (LETT |j| |#G147| . #2#))))
           (LETT |rl| (- |rx| |j|) . #2#)
           (LETT |nl| (EXPT (QREFELT $ 7) |rl|) . #2#)
           (LETT |zol| 1 . #2#)
           (LETT |zoi| (SPADCALL |zol| |nl| (QREFELT $ 95)) . #2#)
           (LETT |rm| (- (- |j| |i|) 1) . #2#)
           (LETT |nm| (EXPT (QREFELT $ 7) |rm|) . #2#)
           (LETT |zom| (* |nl| (QREFELT $ 7)) . #2#)
           (LETT |zoj| (* |zom| |nm|) . #2#)
           (LETT |rh| (- |i| 1) . #2#)
           (LETT |nh| (EXPT (QREFELT $ 7) |rh|) . #2#)
           (LETT |zoh|
                 (* (* |nl| |nm|)
                    (SPADCALL (QREFELT $ 7) 2 (QREFELT $ 12))) . #2#)
           (LETT |z|
                 (SPADCALL (SPADCALL |x| (QREFELT $ 31))
                     (|spadConstant| $ 35) (QREFELT $ 36)) . #2#)
           (SEQ (LETT |zh| 0 . #2#) (LETT |h| 1 . #2#) G190
                (COND ((QSGREATERP |h| |nh|) #3=(GO G191)))
                (SEQ (EXIT (SEQ (LETT |zm| |zh| . #2#)
                                (LETT |m| 1 . #2#) G190
                                (COND ((QSGREATERP |m| |nm|) #3#))
                                (SEQ (EXIT
                                      (SEQ (LETT |zl| |zm| . #2#)
                                       (LETT |l| 1 . #2#) G190
                                       (COND
                                         ((QSGREATERP |l| |nl|) #3#))
                                       (SEQ
                                        (EXIT
                                         (SEQ (LETT |xp| |zl| . #2#)
                                          (LETT |zp| |zl| . #2#)
                                          (LETT |p| 1 . #2#)
                                          (LETT #0#
                                           (QREFELT $ 7) . #2#)
                                          G190
                                          (COND
                                            ((QSGREATERP |p| #0#) #3#))
                                          (SEQ
                                           (EXIT
                                            (SEQ (LETT |xq| |xp| . #2#)
                                             (LETT |zq| |zp| . #2#)
                                             (LETT |q| 1 . #2#)
                                             (LETT #1#
                                              (QREFELT $ 7) . #2#)
                                             G190
                                             (COND
                                               ((QSGREATERP |q| #1#)
                                                #3#))
                                             (SEQ
                                              (EXIT
                                               (SPADCALL |z| |zq|
                                                (SPADCALL |x| |xq|
                                                 (QREFELT $ 32))
                                                (QREFELT $ 37))))
                                             (LETT |q|
                                              (PROG1 (QSADD1 |q|)
                                                (LETT |zq|
                                                 (PROG1 (+ |zq| |zoj|)
                                                   (LETT |xq|
                                                    (+ |xq| |zoi|) . #2#)) . #2#)) . #2#)
                                             #4=(GO G190) G191
                                             (EXIT NIL))))
                                          (LETT |p|
                                           (PROG1 (QSADD1 |p|)
                                             (LETT |zp|
                                              (PROG1 (+ |zp| |zoi|)
                                                (LETT |xp|
                                                 (+ |xp| |zoj|) . #2#)) . #2#)) . #2#)
                                          #4# G191 (EXIT NIL))))
                                       (LETT |l|
                                        (PROG1 (QSADD1 |l|)
                                          (LETT |zl|
                                           (+ |zl| |zol|) . #2#)) . #2#)
                                       #4# G191 (EXIT NIL))))
                                (LETT |m|
                                      (PROG1 (QSADD1 |m|)
                                        (LETT |zm|
                                         (+ |zm| |zom|) . #2#)) . #2#)
                                #4# G191 (EXIT NIL))))
                (LETT |h|
                      (PROG1 (QSADD1 |h|)
                        (LETT |zh| (QSPLUS |zh| |zoh|) . #2#)) . #2#)
                #4# G191 (EXIT NIL))
           (EXIT |z|))))) 

(DEFUN |CARTEN;reindex;$L$;44| (|x| |l| $)
  (PROG (|nx| |z| |rx| |p| |xiv| |ziv| |i| #0=#:G2062 |pi|)
    (RETURN
      (SEQ (LETT |nx| (SPADCALL |x| (QREFELT $ 31))
                 . #1=(|CARTEN;reindex;$L$;44|))
           (LETT |z|
                 (SPADCALL |nx| (|spadConstant| $ 35) (QREFELT $ 36)) . #1#)
           (LETT |rx| (SPADCALL |x| (QREFELT $ 42)) . #1#)
           (LETT |p| (|CARTEN;mkPerm| |rx| |l| $) . #1#)
           (LETT |xiv| (SPADCALL |rx| 0 (QREFELT $ 23)) . #1#)
           (LETT |ziv| (SPADCALL |rx| 0 (QREFELT $ 23)) . #1#)
           (SEQ (LETT |i| 0 . #1#)
                (LETT #0# (- (SPADCALL |x| (QREFELT $ 31)) 1) . #1#)
                G190 (COND ((QSGREATERP |i| #0#) (GO G191)))
                (SEQ (LETT |pi|
                           (|CARTEN;index2int|
                               (|CARTEN;permute!| |ziv|
                                   (|CARTEN;int2index| |i| |xiv| $) |p|
                                   $)
                               $) . #1#)
                     (EXIT (SPADCALL |z| |pi|
                               (SPADCALL |x| |i| (QREFELT $ 32))
                               (QREFELT $ 37))))
                (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191
                (EXIT NIL))
           (EXIT |z|))))) 

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

(DEFUN |CartesianTensor;| (|#1| |#2| |#3|)
  (PROG (DV$1 DV$2 DV$3 |dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT DV$1 (|devaluate| |#1|) . #0=(|CartesianTensor|))
        (LETT DV$2 (|devaluate| |#2|) . #0#)
        (LETT DV$3 (|devaluate| |#3|) . #0#)
        (LETT |dv$| (LIST '|CartesianTensor| DV$1 DV$2 DV$3) . #0#)
        (LETT $ (GETREFV 101) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|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 . *) (25 . |new|) (|Boolean|) (|Vector| 24)
             (31 . |new|) (37 . |setelt|) (44 . |elt|)
             (|Union| $ '"failed") (50 . |exquo|) (56 . |#|)
             (61 . |elt|) (|List| 8) |CARTEN;ravel;$L;8| (67 . |Zero|)
             (71 . |new|) (77 . |setelt|) |CARTEN;unravel;L$;9|
             (84 . |One|) (88 . |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| $$)
             (93 . |#|) (98 . |first|) (|List| $) |CARTEN;coerce;L$;21|
             (|Union| 8 '"failed") |CARTEN;retractIfCan;$U;22|
             (|OutputForm|) (|List| 59) (103 . |coerce|)
             (108 . |coerce|) (|List| 55) (113 . |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) (118 . |minIndex|)
             (123 . |maxIndex|) (128 . |elt|) |CARTEN;coerce;Dp$;28|
             (|SquareMatrix| 7 8) (134 . |elt|) |CARTEN;coerce;Sm$;29|
             (141 . =) |CARTEN;=;2$B;30| (147 . +) |CARTEN;+;3$;31|
             (153 . -) |CARTEN;-;3$;32| (159 . -) |CARTEN;-;2$;33|
             (164 . *) |CARTEN;*;I2$;34| |CARTEN;*;$I$;35| (170 . *)
             |CARTEN;*;R2$;36| |CARTEN;*;$R$;37| |CARTEN;product;3$;38|
             |CARTEN;contract;$I$I$;41| |CARTEN;*;3$;39|
             |CARTEN;contract;$2I$;40| (176 . *)
             |CARTEN;transpose;$2I$;43| |CARTEN;transpose;2$;42|
             |CARTEN;reindex;$L$;44| (|SingleInteger|) (|String|))
          '#(~= 182 |unravel| 188 |transpose| 193 |sample| 205
             |retractIfCan| 209 |retract| 214 |reindex| 219 |ravel| 225
             |rank| 230 |product| 235 |leviCivitaSymbol| 241 |latex|
             245 |kroneckerDelta| 250 |hash| 254 |elt| 259 |degree| 300
             |contract| 305 |coerce| 320 |Zero| 350 |One| 354 = 358 -
             364 + 375 * 381)
          '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| 59))
                            (|makeByteWordVec2| 100
                                '(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 2 19 0
                                  11 18 23 2 25 0 11 24 26 3 25 24 0 18
                                  24 27 2 25 24 0 18 28 2 18 29 0 0 30
                                  1 9 11 0 31 2 9 8 0 18 32 0 8 0 35 2
                                  9 0 11 8 36 3 9 8 0 18 8 37 0 8 0 39
                                  1 8 0 18 40 1 52 11 0 53 1 52 2 0 54
                                  1 60 59 0 61 1 8 59 0 62 1 59 0 63 64
                                  1 69 18 0 70 1 69 18 0 71 2 69 8 0 18
                                  72 3 74 8 0 18 18 75 2 8 24 0 0 77 2
                                  8 0 0 0 79 2 8 0 0 0 81 1 8 0 0 83 2
                                  8 0 18 0 85 2 8 0 0 0 88 2 11 0 10 0
                                  95 2 0 24 0 0 1 1 0 0 33 38 3 0 0 0
                                  18 18 96 1 0 0 0 97 0 0 0 17 1 0 57 0
                                  58 1 0 8 0 1 2 0 0 0 49 98 1 0 33 0
                                  34 1 0 11 0 42 2 0 0 0 0 91 0 0 0 41
                                  1 0 100 0 1 0 0 0 16 1 0 99 0 1 2 0 8
                                  0 49 50 5 0 8 0 18 18 18 18 48 3 0 8
                                  0 18 18 46 4 0 8 0 18 18 18 47 1 0 8
                                  0 44 2 0 8 0 18 45 1 0 11 0 43 4 0 0
                                  0 18 0 18 92 3 0 0 0 18 18 94 1 0 0
                                  33 51 1 0 0 55 56 1 0 0 69 73 1 0 0
                                  74 76 1 0 0 8 66 1 0 59 0 65 0 0 0 67
                                  0 0 0 68 2 0 24 0 0 78 2 0 0 0 0 82 1
                                  0 0 0 84 2 0 0 0 0 80 2 0 0 0 0 93 2
                                  0 0 18 0 86 2 0 0 0 18 87 2 0 0 0 8
                                  90 2 0 0 8 0 89)))))
          '|lookupComplete|)) 
