
(/VERSIONCHECK 2) 

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

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

(DEFUN |REP;normalise;2M;3| (|v| $)
  (PROG (|normv|)
    (RETURN
     (SEQ
      (LETT |normv| (SPADCALL (|REP;innerprod| |v| |v| $) (QREFELT $ 26))
            |REP;normalise;2M;3|)
      (EXIT
       (COND ((SPADCALL |normv| (|spadConstant| $ 27) (QREFELT $ 29)) |v|)
             ('T
              (SPADCALL (SPADCALL (|spadConstant| $ 11) |normv| (QREFELT $ 32))
                        |v| (QREFELT $ 33))))))))) 

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

(DEFUN |REP;radicalEigenvector;EML;5| (|alpha| A $)
  (PROG (#1=#:G1829 |v| #2=#:G1828 |j| |i| B |n|)
    (RETURN
     (SEQ (LETT |n| (QVSIZE A) . #3=(|REP;radicalEigenvector;EML;5|))
          (LETT B (SPADCALL |n| |n| (QREFELT $ 14)) . #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 $ 18))
                                           (QREFELT $ 19))
                                 (QREFELT $ 22))))
                     (LETT |j| (QSADD1 |j|) . #3#) #5=(GO G190) G191
                     (EXIT NIL))
                (EXIT
                 (SPADCALL B |i| |i|
                           (SPADCALL (SPADCALL B |i| |i| (QREFELT $ 25))
                                     |alpha| (QREFELT $ 43))
                           (QREFELT $ 22))))
               (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 $ 45)) . #3#) G190
                 (COND
                  ((OR (ATOM #1#) (PROGN (LETT |v| (CAR #1#) . #3#) NIL)) #4#))
                 (SEQ
                  (EXIT
                   (LETT #2# (CONS (SPADCALL |v| (QREFELT $ 47)) #2#) . #3#)))
                 (LETT #1# (CDR #1#) . #3#) #5# G191
                 (EXIT (NREVERSE0 #2#))))))))) 

(DEFUN |REP;radicalEigenvectors;ML;6| (A $)
  (PROG (|sln| |nsl| #1=#:G1862 |ep| #2=#:G1861 #3=#:G1860 |alg| |lval| |xx|
         |sym| #4=#:G1843 #5=#:G1842 |veclist| |i| |m| #6=#:G1859 |ll|
         #7=#:G1858 |eig| |n| |leig|)
    (RETURN
     (SEQ
      (LETT |leig| (SPADCALL A (QREFELT $ 53))
            . #8=(|REP;radicalEigenvectors;ML;6|))
      (LETT |n| (QVSIZE A) . #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 $ 14)) . #8#)
                              (SEQ (LETT |i| 1 . #8#) G190
                                   (COND ((QSGREATERP |i| |n|) #9#))
                                   (SEQ
                                    (EXIT
                                     (SPADCALL |m| |i| 1
                                               (SPADCALL
                                                (SPADCALL |ll| |i| 1
                                                          (QREFELT $ 18))
                                                (QREFELT $ 19))
                                               (QREFELT $ 22))))
                                   (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 $ 19))
                             (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 $ 55)) . #8#)
                (LETT |lval|
                      (SPADCALL
                       (SPADCALL (SPADCALL |sym| (QREFELT $ 56))
                                 (QREFELT $ 39))
                       |xx| (QREFELT $ 41))
                      . #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=#:G1868 #2=#:G1867 #3=#:G1869 #4=#:G1875 |w|
         #5=#:G1874 |v| RMR #6=#:G1863 |n|)
    (RETURN
     (SEQ
      (COND ((SPADCALL |lvect| NIL (QREFELT $ 60)) NIL)
            ('T
             (SEQ
              (LETT |v| (|SPADfirst| |lvect|) . #7=(|REP;gramschmidt;2L;7|))
              (LETT |n| (QVSIZE |v|) . #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 $ 34))) . #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 $ 33))
                                                    . #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 $ 34)) |orth|)
                           . #7#)))
                   (LETT #5# (CDR #5#) . #7#) #9# G191 (EXIT NIL))
              (EXIT |orth|)))))))) 

(DEFUN |REP;eigenMatrix;MU;8| (A $)
  (PROG (|d| #1=#:G1891 |v| |n| |lef| #2=#:G1881 #3=#:G1880 #4=#:G1882
         #5=#:G1890 |eiv|)
    (RETURN
     (SEQ
      (LETT |lef|
            (PROGN
             (LETT #2# NIL . #6=(|REP;eigenMatrix;MU;8|))
             (SEQ (LETT |eiv| NIL . #6#)
                  (LETT #5# (SPADCALL A (QREFELT $ 59)) . #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| (QVSIZE A) . #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=#:G1900 |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 $ 59)) . #2#)
             (LETT |n| (QVSIZE A) . #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 $ 60))
                           (|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 $ 34))
                             |basis|)
                            . #2#)))))
                  (LETT #1# (CDR #1#) . #2#) (GO G190) G191 (EXIT NIL))
             (EXIT |basis|)))))))) 

(DEFUN |RadicalEigenPackage| #1=()
  (PROG #1#
    (RETURN
     (PROG (#2=#:G1902)
       (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 (|Symbol|) (|Kernel| 10)
              (0 . |kernel|) (|Expression| 16) (5 . |One|)
              (|NonNegativeInteger|) (|Matrix| 10) (9 . |zero|) (|Fraction| 36)
              (|Integer|) (|Matrix| 15) (15 . |elt|) (22 . |coerce|)
              (|Kernel| $) (27 . |eval|) (34 . |setelt|) (42 . |transpose|)
              (47 . *) (53 . |elt|) (60 . |sqrt|) (65 . |Zero|) (|Boolean|)
              (69 . =) (|SparseMultivariatePolynomial| 16 8) (75 . |One|)
              (79 . /) (85 . *) |REP;normalise;2M;3| (91 . |new|)
              (|Polynomial| 16) (|EigenPackage| 16)
              (95 . |characteristicPolynomial|) (101 . |coerce|) (|List| 10)
              (106 . |radicalRoots|) |REP;radicalEigenvalues;ML;4| (112 . -)
              (|List| 46) (118 . |nullSpace|) (|Vector| 10) (123 . |coerce|)
              (|List| 13) |REP;radicalEigenvector;EML;5| (|Union| 15 54)
              (|Record| (|:| |eigval| 50) (|:| |eigmult| 12)
                        (|:| |eigvec| (|List| 17)))
              (|List| 51) (128 . |eigenvectors|) (|SuchThat| 7 36)
              (133 . |lhs|) (138 . |rhs|)
              (|Record| (|:| |radval| 10) (|:| |radmult| 16)
                        (|:| |radvect| 48))
              (|List| 57) |REP;radicalEigenvectors;ML;6| (143 . =)
              |REP;gramschmidt;2L;7| (149 . |copy|) (154 . |horizConcat|)
              (|Union| 13 '"failed") |REP;eigenMatrix;MU;8|
              (160 . |symmetric?|) |REP;orthonormalBasis;ML;9|)
           '#(|radicalEigenvectors| 165 |radicalEigenvector| 170
              |radicalEigenvalues| 176 |orthonormalBasis| 181 |normalise| 186
              |gramschmidt| 191 |eigenMatrix| 196)
           'NIL
           (CONS (|makeByteWordVec2| 1 'NIL)
                 (CONS '#()
                       (CONS '#()
                             (|makeByteWordVec2| 67
                                                 '(1 8 0 7 9 0 10 0 11 2 13 0
                                                   12 12 14 3 17 15 0 16 16 18
                                                   1 10 0 15 19 3 10 0 0 20 0
                                                   21 4 13 10 0 16 16 10 22 1
                                                   13 0 0 23 2 13 0 0 0 24 3 13
                                                   10 0 16 16 25 1 10 0 0 26 0
                                                   10 0 27 2 10 28 0 0 29 0 30
                                                   0 31 2 10 0 0 0 32 2 13 0 10
                                                   0 33 0 7 0 35 2 37 36 17 7
                                                   38 1 15 0 36 39 2 6 40 15 7
                                                   41 2 10 0 0 0 43 1 13 44 0
                                                   45 1 13 0 46 47 1 37 52 17
                                                   53 1 54 7 0 55 1 54 36 0 56
                                                   2 48 28 0 0 60 1 13 0 0 62 2
                                                   13 0 0 0 63 1 17 28 0 66 1 0
                                                   58 17 59 2 0 48 10 17 49 1 0
                                                   40 17 42 1 0 48 17 67 1 0 13
                                                   13 34 1 0 48 48 61 1 0 64 17
                                                   65)))))
           '|lookupComplete|)) 

(MAKEPROP '|RadicalEigenPackage| 'NILADIC T) 
