;;; -*- Mode: Lisp; Package: Macsyma -*-
;;; Translated code for LMIVAX::MAX$DISK:[SHARE1]KACH.MC;3
;;; Written on 9/12/1984 03:37:56, from MACSYMA 302
;;; Translated for LPH

;;; TRANSL-AUTOLOAD version NIL
;;; TRANSS version 87 TRANSL version 1157 TRUTIL version 27
;;; TRANS1 version 108 TRANS2 version 39 TRANS3 version 50
;;; TRANS4 version 29 TRANS5 version 26 TRANSF version NIL
;;; TROPER version 15 TRPRED version 6 MTAGS version NIL
;;; MDEFUN version 58 TRANSQ version 88 FCALL version 40
;;; ACALL version 70 TRDATA version 68 MCOMPI version 146
;;; TRMODE version 73 TRHOOK version NIL
(eval-when (compile eval)
      (setq *infile-name-key*
	          (namestring (truename '#.standard-input))))

(eval-when (compile)
   (setq $tr_semicompile 'NIL)
   (setq forms-to-compile-queue ()))

(comment "MAX$DISK:[SHARE1]KACH.MC;3")

;;; General declarations required for translated MACSYMA code.

(DECLARE (SPECIAL $LAST%ROW $SHOW%ALL $Z))

(DECLARE (SPECIAL $SHOW%ALL))

(DECLARE (SPECIAL $LAST%ROW))

(DEF-MTRVAR $Z '$Z 1)

(DEFMTRFUN-EXTERNAL ($HACH $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($ACCELERATE $BOOLEAN MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($CRITERION $BOOLEAN MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($CHECK $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($GETL $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($LOG2 $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($ITERATE $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($FX $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($FH $ANY MDEFINE NIL NIL))

(DEFMTRFUN-EXTERNAL ($FQ $ANY MDEFINE NIL NIL))


(MEVAL* '(($DECLARE) $Z $SPECIAL))

(MEVAL* '(($MODEDECLARE) $SHOW%ALL $BOOLEAN))

(MEVAL* '(($DECLARE) $SHOW%ALL $SPECIAL))

(DEFPROP $SHOW%ALL ASSIGN-MODE-CHECK ASSIGN)

(DEF-MTRVAR $SHOW%ALL NIL)

(MEVAL* '(($MODEDECLARE) $LAST%ROW $ANY))

(MEVAL* '(($DECLARE) $LAST%ROW $SPECIAL))

(DEF-MTRVAR $LAST%ROW 0)

(DEFPROP $HACH T TRANSLATED)

(ADD2LNC '$HACH $PROPS)

(DEFMTRFUN
 ($HACH $ANY MDEFINE NIL NIL) ($A $B $N $M $L) NIL
 ((LAMBDA ($X $I $K $H $Q $LAST%ROW)
    NIL
    (SETQ $LAST%ROW 0)
    (SETQ
      $H
      (SIMPLIFY (MFUNCTION-CALL
		  $BFLOAT (MUL* (POWER 2 (MUL* 2 $L))
				(SIMPLIFY (MFUNCTION-CALL $IDENT $N))))))
    (SETQ
      $X
      (SIMPLIFY (MFUNCTION-CALL $GENMATRIX (TRD-MSYMEVAL $Z '$Z) $N 1)))
    (DO (($K 0 (+ $K 1))) (NIL '$DONE)
      (COND
	((LIKE (SETQ $I (SIMPLIFY (MFUNCTION-CALL $CHECK $A $B $X $M))) 0)
	   (RETURN (LIST '(MLIST) '|&win| $K '|&iterations| $X)))
	(T
	  (COND ((TRD-MSYMEVAL $SHOW%ALL NIL)
		   (SIMPLIFY (MFUNCTION-CALL $PRINT $K $X))
		   (SIMPLIFY (MFUNCTION-CALL $PRINT '|& |))))
	  (COND
	    ((NOT (MFUNCTION-CALL $CRITERION $A $B $X $N $M $L $K))
	       (SIMPLIFY (MFUNCTION-CALL $ITERATE $X $A $H $Q $I $N)))
	    (T (MFUNCTION-CALL $ACCELERATE $A $B $X $N $M $L $K)
	       (SIMPLIFY (MFUNCTION-CALL $ITERATE $X $A $H $Q $I $N))))))))
  '$X '$I '$K '$H '$Q '$LAST%ROW))

(DEFPROP $ACCELERATE T TRANSLATED)

(ADD2LNC '$ACCELERATE $PROPS)

(DEFMTRFUN
  ($ACCELERATE $BOOLEAN MDEFINE NIL NIL) ($A $B $X $N $M $L $K) NIL NIL)

(DEFPROP $CRITERION T TRANSLATED)

(ADD2LNC '$CRITERION $PROPS)

(DEFMTRFUN
  ($CRITERION $BOOLEAN MDEFINE NIL NIL) ($A $B $X $N $M $L $K) NIL T)

(DEFPROP $CHECK T TRANSLATED)

(ADD2LNC '$CHECK $PROPS)

(DEFMTRFUN
 ($CHECK $ANY MDEFINE NIL NIL) ($A $B $X $M) NIL
 ((LAMBDA ($Y $J $J1)
   NIL
   (PROG ()
      (SETQ $J1 0)
      (SETQ $Y (NCMUL2 $A $X))
      (COND
	((MFUNCTION-CALL $NUMBERP (TRD-MSYMEVAL $LAST%ROW '$LAST%ROW))
	   (COND
	     ((NOT (LIKE (TRD-MSYMEVAL $LAST%ROW '$LAST%ROW) 0))
		(COND
		  ((NOT
		     (IS-BOOLE-CHECK
		       (MLSP (MARRAYREF
			       $Y (TRD-MSYMEVAL $LAST%ROW '$LAST%ROW) 1)
			     (MARRAYREF
			       $B (TRD-MSYMEVAL $LAST%ROW '$LAST%ROW) 1))))
		     (SETQ $J1 (TRD-MSYMEVAL $LAST%ROW '$LAST%ROW))))))))
      (COND ((NOT (LIKE $J1 0)) (RETURN $J1)))
      (DO (($J 1 (+ 1 $J))) ((IS-BOOLE-CHECK (MGRP $J $M)) '$DONE)
	(COND ((NOT (IS-BOOLE-CHECK
		      (MLSP (MARRAYREF $Y $J 1) (MARRAYREF $B $J 1))))
		 (SETQ $J1 $J))))
      (RETURN $J1)))
  '$Y '$J '$J1))

(DEFPROP $GETL T TRANSLATED)

(ADD2LNC '$GETL $PROPS)

(DEFMTRFUN
 ($GETL $ANY MDEFINE NIL NIL) ($A $B $N $M) NIL
 ((LAMBDA ($I $J $L)
    NIL
    (SETQ
      $L
      (DOSUM
	(FUNGEN&ENV-FOR-MEVALSUMARG
	  ($B $M) ($I)
	  (MUL* (ADD* (SIMPLIFY (LIST '(MABS) (MARRAYREF $B $I 1))) 1)
		(DOSUM
		  (FUNGEN&ENV-FOR-MEVALSUMARG
		    ($I $A) ($J)
		    (ADD* (SIMPLIFY (LIST '(MABS) (MARRAYREF $A $J $I))) 1)
		    ((MPLUS) ((MABS) (($A ARRAY) $J $I)) 1))
		  '$J 1 $M NIL))
	  ((MTIMES) ((MPLUS) ((MABS) (($B ARRAY) $I 1)) 1)
	   (($PRODUCT) ((MPLUS) ((MABS) (($A ARRAY) $J $I)) 1) $J 1 $M)))
	'$I 1 $N NIL))
    (SETQ $L (ADD* 1 (SIMPLIFY (MFUNCTION-CALL $LOG2 (MUL* $N $M $L))))))
  '$I '$J '$L))

(DEFPROP $LOG2 T TRANSLATED)

(ADD2LNC '$LOG2 $PROPS)

(DEFMTRFUN
  ($LOG2 $ANY MDEFINE NIL NIL) ($X) NIL
  (SIMPLIFY
    (MFUNCTION-CALL
      $BFLOAT
      (DIV (SIMPLIFY (LIST '(%LOG) $X)) (SIMPLIFY (LIST '(%LOG) 2))))))

(DEFPROP $Z T TRANSLATED)

(ADD2LNC '$Z $PROPS)

(DEFMTRFUN ($Z $FIXNUM MDEFINE NIL T) ($I $J) NIL 0)

(DEFPROP $ITERATE T TRANSLATED)

(ADD2LNC '$ITERATE $PROPS)

(DEFMTRFUN
  ($ITERATE $ANY MDEFINE NIL NIL) ($X $A $H $Q $I $N) NIL
  (PROGN (SETQ $Q (SIMPLIFY (MFUNCTION-CALL $FQ $A $H $I $N)))
	 (SETQ $X (SIMPLIFY (MFUNCTION-CALL $FX $X $A $H $Q $I $N)))
	 (SETQ $H (SIMPLIFY (MFUNCTION-CALL $FH $A $H $Q $I $N)))))

(DEFPROP $FX T TRANSLATED)

(ADD2LNC '$FX $PROPS)

(DEFMTRFUN
  ($FX $ANY MDEFINE NIL NIL) ($X $A $H $Q $I $N) NIL
  (ADD*
    $X
    (*MMINUS
      (MUL*
	(POWER (ADD* $N 1) -1) (POWER $Q (RREMAINDER -1 2))
	(NCMUL2
	  $H (SIMPLIFY
	       (MFUNCTION-CALL
		 $TRANSPOSE (SIMPLIFY (MFUNCTION-CALL $ROW $A $I)))))))))

(DEFPROP $FH T TRANSLATED)

(ADD2LNC '$FH $PROPS)

(DEFMTRFUN
 ($FH $ANY MDEFINE NIL NIL) ($A $H $Q $I $N) NIL
 (MUL*
  (DIV (POWER $N 2) (ADD* (POWER $N 2) -1))
  (ADD*
    $H
    (*MMINUS
      (MUL*
	(DIV 2 (ADD* $N 1)) (POWER $Q -1)
	(NCMUL2
	  $H
	  (NCMUL2
	    (SIMPLIFY (MFUNCTION-CALL
			$TRANSPOSE (SIMPLIFY (MFUNCTION-CALL $ROW $A $I))))
	    (NCMUL2 (SIMPLIFY (MFUNCTION-CALL $ROW $A $I))
		    (SIMPLIFY (MFUNCTION-CALL $TRANSPOSE $H))))))))))

(DEFPROP $FQ T TRANSLATED)

(ADD2LNC '$FQ $PROPS)

(DEFMTRFUN
  ($FQ $ANY MDEFINE NIL NIL) ($A $H $I $N) NIL
  (NCMUL2
    (SIMPLIFY (MFUNCTION-CALL $ROW $A $I))
    (NCMUL2
      $H (SIMPLIFY (MFUNCTION-CALL
		     $TRANSPOSE (SIMPLIFY (MFUNCTION-CALL $ROW $A $I)))))))

(compile-forms-to-compile-queue)

