
(/VERSIONCHECK 2) 

(DEFUN |REP;evalvect| (|vect| |alg| |x| $)
  (PROG (|v| |i| |w| |xx| |n|)
    (RETURN
     (SEQ (LETT |n| (SPADCALL |vect| (QREFELT $ 9)) . #1=(|REP;evalvect|))
          (LETT |xx| (SPADCALL |x| (QREFELT $ 12)) . #1#)
          (LETT |w| (SPADCALL |n| 1 (QREFELT $ 16)) . #1#)
          (SEQ (LETT |i| 1 . #1#) G190 (COND ((QSGREATERP |i| |n|) (GO G191)))
               (SEQ
                (LETT |v|
                      (SPADCALL
                       (SPADCALL (SPADCALL |vect| |i| 1 (QREFELT $ 19))
                                 (QREFELT $ 20))
                       |xx| |alg| (QREFELT $ 22))
                      . #1#)
                (EXIT (SPADCALL |w| |i| 1 |v| (QREFELT $ 23))))
               (LETT |i| (QSADD1 |i|) . #1#) (GO G190) G191 (EXIT NIL))
          (EXIT |w|))))) 

(DEFUN |REP;innerprod| (|v1| |v2| $)
  (SPADCALL (SPADCALL (SPADCALL |v1| (QREFELT $ 24)) |v2| (QREFELT $ 25)) 1 1
            (QREFELT $ 26))) 

(DEFUN |REP;normalise;2M;3| (|v| $)
  (PROG (|normv|)
    (RETURN
     (SEQ
      (LETT |normv| (SPADCALL (|REP;innerprod| |v| |v| $) (QREFELT $ 27))
            |REP;normalise;2M;3|)
      (EXIT
       (COND ((SPADCALL |normv| (|spadConstant| $ 28) (QREFELT $ 30)) |v|)
             ('T
              (SPADCALL (SPADCALL (|spadConstant| $ 14) |normv| (QREFELT $ 31))
                        |v| (QREFELT $ 32))))))))) 

(DEFUN |REP;radicalEigenvalues;ML;4| (A $)
  (PROG (|pol| |x|)
    (RETURN
     (SEQ
      (LETT |x| (SPADCALL (QREFELT $ 34)) . #1=(|REP;radicalEigenvalues;ML;4|))
      (LETT |pol| (SPADCALL (SPADCALL A |x| (QREFELT $ 37)) (QREFELT $ 38))
            . #1#)
      (EXIT (SPADCALL |pol| |x| (QREFELT $ 40))))))) 

(DEFUN |REP;radicalEigenvector;EML;5| (|alpha| A $)
  (PROG (#1=#:G682 |v| #2=#:G681 |j| |i| B |n|)
    (RETURN
     (SEQ
      (LETT |n| (SPADCALL A (QREFELT $ 9))
            . #3=(|REP;radicalEigenvector;EML;5|))
      (LETT B (SPADCALL |n| |n| (QREFELT $ 16)) . #3#)
      (SEQ (LETT |i| 1 . #3#) G190 (COND ((QSGREATERP |i| |n|) #4=(GO G191)))
           (SEQ
            (SEQ (LETT |j| 1 . #3#) G190 (COND ((QSGREATERP |j| |n|) #4#))
                 (SEQ
                  (EXIT
                   (SPADCALL B |i| |j|
                             (SPADCALL (SPADCALL A |i| |j| (QREFELT $ 19))
                                       (QREFELT $ 20))
                             (QREFELT $ 23))))
                 (LETT |j| (QSADD1 |j|) . #3#) #5=(GO G190) G191 (EXIT NIL))
            (EXIT
             (SPADCALL B |i| |i|
                       (SPADCALL (SPADCALL B |i| |i| (QREFELT $ 26)) |alpha|
                                 (QREFELT $ 42))
                       (QREFELT $ 23))))
           (LETT |i| (QSADD1 |i|) . #3#) #5# G191 (EXIT NIL))
      (EXIT
       (PROGN
        (LETT #2# NIL . #3#)
        (SEQ (LETT |v| NIL . #3#) (LETT #1# (SPADCALL B (QREFELT $ 44)) . #3#)
             G190
             (COND
              ((OR (ATOM #1#) (PROGN (LETT |v| (CAR #1#) . #3#) NIL)) #4#))
             (SEQ
              (EXIT (LETT #2# (CONS (SPADCALL |v| (QREFELT $ 46)) #2#) . #3#)))
             (LETT #1# (CDR #1#) . #3#) #5# G191 (EXIT (NREVERSE0 #2#))))))))) 

(DEFUN |REP;radicalEigenvectors;ML;6| (A $)
  (PROG (|sln| |nsl| #1=#:G711 |ep| #2=#:G710 #3=#:G709 |alg| |lval| |xx| |sym|
         #4=#:G692 #5=#:G691 |veclist| |i| |m| #6=#:G708 |ll| #7=#:G707 |eig|
         |n| |leig|)
    (RETURN
     (SEQ
      (LETT |leig| (SPADCALL A (QREFELT $ 52))
            . #8=(|REP;radicalEigenvectors;ML;6|))
      (LETT |n| (SPADCALL A (QREFELT $ 9)) . #8#) (LETT |sln| NIL . #8#)
      (SEQ (LETT |eig| NIL . #8#) (LETT #7# |leig| . #8#) G190
           (COND
            ((OR (ATOM #7#) (PROGN (LETT |eig| (CAR #7#) . #8#) NIL))
             #9=(GO G191)))
           (SEQ
            (EXIT
             (COND
              ((QEQCAR (QVELT |eig| 0) 0)
               (SEQ (LETT |veclist| NIL . #8#)
                    (SEQ (LETT |ll| NIL . #8#) (LETT #6# (QVELT |eig| 2) . #8#)
                         G190
                         (COND
                          ((OR (ATOM #6#)
                               (PROGN (LETT |ll| (CAR #6#) . #8#) NIL))
                           #9#))
                         (SEQ (LETT |m| (SPADCALL |n| 1 (QREFELT $ 16)) . #8#)
                              (SEQ (LETT |i| 1 . #8#) G190
                                   (COND ((QSGREATERP |i| |n|) #9#))
                                   (SEQ
                                    (EXIT
                                     (SPADCALL |m| |i| 1
                                               (SPADCALL
                                                (SPADCALL |ll| |i| 1
                                                          (QREFELT $ 19))
                                                (QREFELT $ 20))
                                               (QREFELT $ 23))))
                                   (LETT |i| (QSADD1 |i|) . #8#) #10=(GO G190)
                                   G191 (EXIT NIL))
                              (EXIT
                               (LETT |veclist| (CONS |m| |veclist|) . #8#)))
                         (LETT #6# (CDR #6#) . #8#) #10# G191 (EXIT NIL))
                    (EXIT
                     (LETT |sln|
                           (CONS
                            (VECTOR
                             (SPADCALL
                              (PROG2
                                  (LETT #5# (QVELT |eig| 0) . #8#)
                                  (QCDR #5#)
                                (|check-union| (QEQCAR #5# 0)
                                               (|Fraction|
                                                (|Polynomial| (|Integer|)))
                                               #5#))
                              (QREFELT $ 20))
                             (QVELT |eig| 1) |veclist|)
                            |sln|)
                           . #8#))))
              ('T
               (SEQ
                (LETT |sym|
                      (PROG2
                          (LETT #4# (QVELT |eig| 0) . #8#)
                          (QCDR #4#)
                        (|check-union| (QEQCAR #4# 1)
                                       (|SuchThat| (|Symbol|)
                                                   (|Polynomial| (|Integer|)))
                                       #4#))
                      . #8#)
                (LETT |xx| (SPADCALL |sym| (QREFELT $ 54)) . #8#)
                (LETT |lval|
                      (SPADCALL
                       (SPADCALL (SPADCALL |sym| (QREFELT $ 55))
                                 (QREFELT $ 38))
                       |xx| (QREFELT $ 40))
                      . #8#)
                (EXIT
                 (SEQ (LETT |alg| NIL . #8#) (LETT #3# |lval| . #8#) G190
                      (COND
                       ((OR (ATOM #3#)
                            (PROGN (LETT |alg| (CAR #3#) . #8#) NIL))
                        #9#))
                      (SEQ
                       (LETT |nsl|
                             (VECTOR |alg| (QVELT |eig| 1)
                                     (PROGN
                                      (LETT #2# NIL . #8#)
                                      (SEQ (LETT |ep| NIL . #8#)
                                           (LETT #1# (QVELT |eig| 2) . #8#)
                                           G190
                                           (COND
                                            ((OR (ATOM #1#)
                                                 (PROGN
                                                  (LETT |ep| (CAR #1#) . #8#)
                                                  NIL))
                                             #9#))
                                           (SEQ
                                            (EXIT
                                             (LETT #2#
                                                   (CONS
                                                    (|REP;evalvect| |ep| |alg|
                                                     |xx| $)
                                                    #2#)
                                                   . #8#)))
                                           (LETT #1# (CDR #1#) . #8#) #10# G191
                                           (EXIT (NREVERSE0 #2#)))))
                             . #8#)
                       (EXIT (LETT |sln| (CONS |nsl| |sln|) . #8#)))
                      (LETT #3# (CDR #3#) . #8#) #10# G191 (EXIT NIL))))))))
           (LETT #7# (CDR #7#) . #8#) #10# G191 (EXIT NIL))
      (EXIT |sln|))))) 

(DEFUN |REP;gramschmidt;2L;7| (|lvect| $)
  (PROG (|orth| |pol| #1=#:G717 #2=#:G716 #3=#:G718 #4=#:G724 |w| #5=#:G723 |v|
         RMR #6=#:G712 |n|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |lvect| NIL (QREFELT $ 59)) NIL)
            ('T
             (SEQ
              (LETT |v| (|SPADfirst| |lvect|) . #7=(|REP;gramschmidt;2L;7|))
              (LETT |n| (SPADCALL |v| (QREFELT $ 60)) . #7#)
              (LETT RMR
                    (|RectangularMatrix|
                     (PROG1 (LETT #6# |n| . #7#)
                       (|check-subtype| (> #6# 0) '(|PositiveInteger|) #6#))
                     1 (|Expression| (|Integer|)))
                    . #7#)
              (LETT |orth| (LIST (SPADCALL |v| (QREFELT $ 33))) . #7#)
              (SEQ (LETT |v| NIL . #7#) (LETT #5# (CDR |lvect|) . #7#) G190
                   (COND
                    ((OR (ATOM #5#) (PROGN (LETT |v| (CAR #5#) . #7#) NIL))
                     #8=(GO G191)))
                   (SEQ
                    (LETT |pol|
                          (SPADCALL
                           (SPADCALL |v|
                                     (PROGN
                                      (LETT #1# NIL . #7#)
                                      (SEQ (LETT |w| NIL . #7#)
                                           (LETT #4# |orth| . #7#) G190
                                           (COND
                                            ((OR (ATOM #4#)
                                                 (PROGN
                                                  (LETT |w| (CAR #4#) . #7#)
                                                  NIL))
                                             #8#))
                                           (SEQ
                                            (EXIT
                                             (PROGN
                                              (LETT #3#
                                                    (SPADCALL
                                                     (|REP;innerprod| |w| |v|
                                                      $)
                                                     |w| (QREFELT $ 32))
                                                    . #7#)
                                              (COND
                                               (#1#
                                                (LETT #2#
                                                      (SPADCALL #2# #3#
                                                                (|compiledLookupCheck|
                                                                 '+
                                                                 (LIST '$ '$
                                                                       '$)
                                                                 RMR))
                                                      . #7#))
                                               ('T
                                                (PROGN
                                                 (LETT #2# #3# . #7#)
                                                 (LETT #1# 'T . #7#)))))))
                                           (LETT #4# (CDR #4#) . #7#)
                                           #9=(GO G190) G191 (EXIT NIL))
                                      (COND (#1# #2#)
                                            ('T
                                             (SPADCALL
                                              (|compiledLookupCheck| '|Zero|
                                                                     (LIST '$)
                                                                     RMR)))))
                                     (|compiledLookupCheck| '- (LIST '$ '$ '$)
                                                            RMR))
                           (|compiledLookupCheck| '|coerce|
                                                  (LIST
                                                   (LIST '|Matrix|
                                                         (LIST '|Expression|
                                                               (LIST
                                                                '|Integer|)))
                                                   '$)
                                                  RMR))
                          . #7#)
                    (EXIT
                     (LETT |orth| (CONS (SPADCALL |pol| (QREFELT $ 33)) |orth|)
                           . #7#)))
                   (LETT #5# (CDR #5#) . #7#) #9# G191 (EXIT NIL))
              (EXIT |orth|)))))))) 

(DEFUN |REP;eigenMatrix;MU;8| (A $)
  (PROG (|d| #1=#:G740 |v| |n| |lef| #2=#:G730 #3=#:G729 #4=#:G731 #5=#:G739
         |eiv|)
    (RETURN
     (SEQ
      (LETT |lef|
            (PROGN
             (LETT #2# NIL . #6=(|REP;eigenMatrix;MU;8|))
             (SEQ (LETT |eiv| NIL . #6#)
                  (LETT #5# (SPADCALL A (QREFELT $ 58)) . #6#) G190
                  (COND
                   ((OR (ATOM #5#) (PROGN (LETT |eiv| (CAR #5#) . #6#) NIL))
                    #7=(GO G191)))
                  (SEQ
                   (EXIT
                    (PROGN
                     (LETT #4# (QVELT |eiv| 2) . #6#)
                     (COND (#2# (LETT #3# (APPEND #3# #4#) . #6#))
                           ('T
                            (PROGN
                             (LETT #3# #4# . #6#)
                             (LETT #2# 'T . #6#)))))))
                  (LETT #5# (CDR #5#) . #6#) #8=(GO G190) G191 (EXIT NIL))
             (COND (#2# #3#) (#9='T NIL)))
            . #6#)
      (LETT |n| (SPADCALL A (QREFELT $ 9)) . #6#)
      (EXIT
       (COND ((< (LENGTH |lef|) |n|) (CONS 1 "failed"))
             (#9#
              (SEQ
               (LETT |d| (SPADCALL (|SPADfirst| |lef|) (QREFELT $ 62)) . #6#)
               (SEQ (LETT |v| NIL . #6#) (LETT #1# (CDR |lef|) . #6#) G190
                    (COND
                     ((OR (ATOM #1#) (PROGN (LETT |v| (CAR #1#) . #6#) NIL))
                      #7#))
                    (SEQ
                     (EXIT (LETT |d| (SPADCALL |d| |v| (QREFELT $ 63)) . #6#)))
                    (LETT #1# (CDR #1#) . #6#) #8# G191 (EXIT NIL))
               (EXIT (CONS 0 |d|)))))))))) 

(DEFUN |REP;orthonormalBasis;ML;9| (A $)
  (PROG (|basis| |lvec| #1=#:G749 |alterm| |n| |alglist|)
    (RETURN
     (SEQ
      (COND
       ((NULL (SPADCALL A (QREFELT $ 66)))
        (|error| "the matrix is not symmetric"))
       ('T
        (SEQ (LETT |basis| NIL . #2=(|REP;orthonormalBasis;ML;9|))
             (LETT |lvec| NIL . #2#)
             (LETT |alglist| (SPADCALL A (QREFELT $ 58)) . #2#)
             (LETT |n| (SPADCALL A (QREFELT $ 9)) . #2#)
             (SEQ (LETT |alterm| NIL . #2#) (LETT #1# |alglist| . #2#) G190
                  (COND
                   ((OR (ATOM #1#) (PROGN (LETT |alterm| (CAR #1#) . #2#) NIL))
                    (GO G191)))
                  (SEQ
                   (SEQ (LETT |lvec| (QVELT |alterm| 2) . #2#)
                        (EXIT
                         (COND
                          ((SPADCALL |lvec| NIL (QREFELT $ 59))
                           (|error| "sorry ")))))
                   (EXIT
                    (COND
                     ((< 1 (LENGTH |lvec|))
                      (SEQ (LETT |lvec| (SPADCALL |lvec| (QREFELT $ 61)) . #2#)
                           (EXIT
                            (LETT |basis| (APPEND |lvec| |basis|) . #2#))))
                     ('T
                      (LETT |basis|
                            (CONS
                             (SPADCALL (|SPADfirst| |lvec|) (QREFELT $ 33))
                             |basis|)
                            . #2#)))))
                  (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
             (EXIT |basis|)))))))) 

(DEFUN |RadicalEigenPackage| #1=()
  (PROG #1#
    (RETURN
     (PROG (#2=#:G751)
       (RETURN
        (COND
         ((LETT #2# (HGET |$ConstructorCache| '|RadicalEigenPackage|)
                . #3=(|RadicalEigenPackage|))
          (|CDRwithIncrement| (CDAR #2#)))
         ('T
          (UNWIND-PROTECT
              (PROG1
                  (CDDAR
                   (HPUT |$ConstructorCache| '|RadicalEigenPackage|
                         (LIST (CONS NIL (CONS 1 (|RadicalEigenPackage;|))))))
                (LETT #2# T . #3#))
            (COND
             ((NOT #2#)
              (HREM |$ConstructorCache| '|RadicalEigenPackage|))))))))))) 

(DEFUN |RadicalEigenPackage;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
     (PROGN
      (LETT |dv$| '(|RadicalEigenPackage|) . #1=(|RadicalEigenPackage|))
      (LETT $ (GETREFV 68) . #1#)
      (QSETREFV $ 0 |dv$|)
      (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #1#))
      (|haddProp| |$ConstructorCache| '|RadicalEigenPackage| NIL (CONS 1 $))
      (|stuffDomainSlots| $)
      (QSETREFV $ 6 (|RadicalSolvePackage| (|Integer|)))
      $)))) 

(MAKEPROP '|RadicalEigenPackage| '|infovec|
          (LIST
           '#(NIL NIL NIL NIL NIL NIL 'RSP (|NonNegativeInteger|) (|Matrix| 17)
              (0 . |nrows|) (|Symbol|) (|Kernel| 13) (5 . |kernel|)
              (|Expression| 18) (10 . |One|) (|Matrix| 13) (14 . |zero|)
              (|Fraction| 35) (|Integer|) (20 . |elt|) (27 . |coerce|)
              (|Kernel| $) (32 . |eval|) (39 . |setelt|) (47 . |transpose|)
              (52 . *) (58 . |elt|) (65 . |sqrt|) (70 . |Zero|) (|Boolean|)
              (74 . =) (80 . /) (86 . *) |REP;normalise;2M;3| (92 . |new|)
              (|Polynomial| 18) (|EigenPackage| 18)
              (96 . |characteristicPolynomial|) (102 . |coerce|) (|List| 13)
              (107 . |radicalRoots|) |REP;radicalEigenvalues;ML;4| (113 . -)
              (|List| 45) (119 . |nullSpace|) (|Vector| 13) (124 . |coerce|)
              (|List| 15) |REP;radicalEigenvector;EML;5| (|Union| 17 53)
              (|Record| (|:| |eigval| 49) (|:| |eigmult| 7)
                        (|:| |eigvec| (|List| 8)))
              (|List| 50) (129 . |eigenvectors|) (|SuchThat| 10 35)
              (134 . |lhs|) (139 . |rhs|)
              (|Record| (|:| |radval| 13) (|:| |radmult| 18)
                        (|:| |radvect| 47))
              (|List| 56) |REP;radicalEigenvectors;ML;6| (144 . =)
              (150 . |nrows|) |REP;gramschmidt;2L;7| (155 . |copy|)
              (160 . |horizConcat|) (|Union| 15 '"failed")
              |REP;eigenMatrix;MU;8| (166 . |symmetric?|)
              |REP;orthonormalBasis;ML;9|)
           '#(|radicalEigenvectors| 171 |radicalEigenvector| 176
              |radicalEigenvalues| 182 |orthonormalBasis| 187 |normalise| 192
              |gramschmidt| 197 |eigenMatrix| 202)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 67
                                                 '(1 8 7 0 9 1 11 0 10 12 0 13
                                                   0 14 2 15 0 7 7 16 3 8 17 0
                                                   18 18 19 1 13 0 17 20 3 13 0
                                                   0 21 0 22 4 15 13 0 18 18 13
                                                   23 1 15 0 0 24 2 15 0 0 0 25
                                                   3 15 13 0 18 18 26 1 13 0 0
                                                   27 0 13 0 28 2 13 29 0 0 30
                                                   2 13 0 0 0 31 2 15 0 13 0 32
                                                   0 10 0 34 2 36 35 8 10 37 1
                                                   17 0 35 38 2 6 39 17 10 40 2
                                                   13 0 0 0 42 1 15 43 0 44 1
                                                   15 0 45 46 1 36 51 8 52 1 53
                                                   10 0 54 1 53 35 0 55 2 47 29
                                                   0 0 59 1 15 7 0 60 1 15 0 0
                                                   62 2 15 0 0 0 63 1 8 29 0 66
                                                   1 0 57 8 58 2 0 47 13 8 48 1
                                                   0 39 8 41 1 0 47 8 67 1 0 15
                                                   15 33 1 0 47 47 61 1 0 64 8
                                                   65)))))
           '|lookupComplete|)) 

(MAKEPROP '|RadicalEigenPackage| 'NILADIC T) 
