Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib10-09 - 43,50466/evev.doc
There are 2 other files named evev.doc in the archive. Click here to see a list.
```
WESTERN MICHIGAN UNIVERSITY
COMPUTER CENTER

LIBRARY PROGRAM #2.4.1

CALLING NAME:  EVEV
PREPARED BY:  BILL GRANET

PROGRAMMED BY: *
APPROVED BY:  JACK R. MEAGHER
DATE:  AUGUST, 1972 (VERSION 2)

EIGENVALUES AND EIGENVECTORS

1.0 PURPOSE

THIS PROGRAM USES THE QR ALGORITHM TO CALCULATE THE EIGENVALUES AND
EIGENVECTORS OF ARBITRARY N BY N COMPLEX MATRICES.  EIGENVALUES AND
EIGENVECTORS ARE NUMBERS (L) AND VECTORS (X) WHICH SATISFY  AX=LX
WHERE A IS AN ARBITRARY N BY N COMPLEX MATRIX.

2.0 LIMITATIONS

I)  THE ORDER OF A MAY BE UP TO 35 BY 35.
II)  THE EIGENVALUES OF A ARE NOT NECESSARILY CALCULATED IN
ANY ABSOLUTE ALGEBRAIC ORDER.
III)  EXAMPLES EXIST FOR WHICH THIS PROGRAM FAILS TO CALCULATE
EIGENVALUES.  THIS PROGRAM, FOR EACH MATRIX A, PRINTS AN
INTEGER REPRESENTING THE NUMBER OF EIGENVALUES CALCULATED.
THE DIFFERENCE BETWEEN THIS INTEGER  AND N, THE ORDER OF
THE MATRIX A, IS THE NUMBER OF EIGENVALUES OF A FOR WHICH
FAILURE  OCCURRED.

IN CASE OF FAILURE, CONSULT THE REFERENCE AT THE END OF THE
WRITE-UP OR THE COMPUTER CENTER.

IV)  AT MOST SIX (6) LINES CAN BE USED FOR ENTERING A FORMAT.
V)  AT MOST TEN (10) MATRIX ELEMENTS CAN BE ENTERED PER LINE.

3.0 SPECIAL SYMBOLS

I)  <CR> SIGNIFIES THE ENTERING OF A CARRIAGE RETURN BY THE USER
IN A TERMINAL.
II)  ^C IS OBTAINED AT THE TERMINAL BY PRESSING THE C BUTTON WHILE
HOLDING DOWN THE CTRL BUTTON.

*  THIS PROGRAM IS A COMBINATION OF ONE GIVEN BY WAYNE STATE UNIVERSITY
WITH REVISIONAL AND ADDITIONAL PROGRAMMING BY BILL GRANET AND BERENICE HOUCHARD.
THE ALGORITHM FOR CALCULATION OF EIGENVALUES AND EIGENVECTORS COMES FROM
REFERENCE INDICATED ON THE LAST PAGE.

4.0 METHOD OF USE

THE FOLLOWING EXAMPLE OF PROGRAM OPERATION IS BASED ON THE CONVER-
SATIONAL MODE OF OPERATION WHICH OCCURS FROM A TERMINAL.  IN THE
CONVERSAIONAL MODE WHEN A PARAMETER, PROCESSING OPTION, OR BLOCK OF DATA IS
REQUIRED THE COMPUTER TYPES A QUESTION  ASKING FOR THE DATA  AND THE USER
OUTPUT (IF REQUIRED), AND THEN TYPES THE NEXT QUESTION.

THE LINE NUMBERS AT THE LEFT MARGIN ARE USED FOR REFERENCE ONLY AND ARE
PART OF THE ACTUAL PROGRAM INPUT OR OUTPUT.  THE PROSE DESCRIPTION FOLLOWING
THE EXAMPLE EXPLAINS IN DETAIL THE POSSIBLE USER RESPONSES AT EACH LINE.

FROM THE TERMINAL INPUT ALWAYS STARTS WHEREVER THE CARRIAGE IS POSTIONED
AND IS MADE COMPATIBLE WITH 80 COLUMN CARD INPUT BY ACCEPTANCE OF 80
CHARACTORS FROM TERMINAL AS ONE "LINE" EVEN THOUGH THE TERMINAL
CARRIAGE HAS TO LINE FEED SOMEWHERE WITHIN THE 80 CHARACTERS TO  CONTIUNE
PRINTING.

IF YOU START TO INPUT NEAR POSITION ONE AND THE LINE IS NOT VERY LONG, THE
WHOLE "LINE" WILL FIT WITHOUT AN AUTOMATIC CARRIAGE RETURN AND LINE FEED
FROM THE COMPUTER.  BUT IF YOU START FAR ENOUGH DOWN THE CARRIAGE AND
THE LINE IS LONG ENOUGH YOU MAY GET AN AUTOMATIC CARRIAGE RETURN
AND LINE FEED WHILE TRYING TO INPUT THE LINE.  IN THIS CASE CONTINUE INPUT
ON THE NEXT LINE AND TYPE A CARRIAGE RETURN AT THE END OF YOUR INPUT.  WHEN
USING THIS PROCEDURE YOU MUST COUNT THE CHARACTERS AND NEVER EXCEED 80
CHARACTERS PER INPUT "LINE". FOR INPUT LINES FROM THE TERMINAL EACH LINE IS
TERMINATED BY A CARRIAGE RETURN, MARKED IN THE EXAMPLES AS <CR>.

5.0 EXAMPLE OF PROGRAM OPERATION

<CR> AND ALL INFORMATION ON THE SAME LINE WITH AND PRECEEDING <CR>
ARE ENTERED BY USER EXCEPT FOR PROMPTINGS.
LINE NUMBERS ARE USED FOR IDENTIFICATION PURPOSES AND ARE NOT
ENTERED AT THE TERMINAL.  "<CR>"  SIGNIFICATIES THE ENTERING OF RETURN
THE 3X3 MATRIX USED IN LINES 13-15 COMES FROM PAGE 360 PROBLEM 26.92 OF
"THEORY AND PROBLEMS OF NUMERICAL ANALYSIS" BY F. SCHEID. THIS WAS PUBLISHED
BY MCGRAW HILL BOOK CO, 1968 (SCHAUMS OUTLINE SERIES).
2.  R EVEV<CR>
3.  OUTPUT?(TYPE HELP IF NEEDED)--<CR>
4.  INPUT?(TYPE HELP IF NEEDED)--<CR>
5.  ENTER OUTPUT IDENTIFICATION
6.  TEST EVEV<CR>
7.  ENTER ORDER OF MATRIX.
8.  3<CR>
9.  FORMAT
10.  STD<CR>
11.  ENTER DATA, REAL PART FIRST THEN IMIAGINARY
12.  (AT MOST 10 SETS PER LINE)
13.  8,,,-5,3,-2<CR>
14.  ,5,3,,,<CR>
15.  3,2,,,2,<CR>
16.  [OUTPUT]
17.  INPUT?FINISH<CR>
18.  [EXIT INFORMATION]
19.  [LOG OFF]

6.0 EXPLANATIONS FOR SECTION 5.0

LINE 1.    WHAT IS MARKED ON THE EXAMPLE AS LINE 1 IS IN REALITY SEVERAL LINES
OF INPUT WHICH CONSTITUTE THE STANDARD LOGIN PROCEDURE.

TO EXECUTE THIS PROGRAM YOU MUST BE LOGGED IN.  (FOR LOGIN PROCEDURE SEE THE
COMPUTER CENTER USERS GUIDE #1.)  IF YOU ARE ALREADY LOGGED IN AND ARE IN
MONITOR COMMAND YOU MAY PROCEED DIRECLTY TO LINE 2.  (THE USUAL METHOD OF GETTING
INTO MONITOR COMMAND MODE IS TO ENTER  ^C)

LINE 2.   THIS INITIATES EXECUTION OF THIS PROGRAM.

LINES 3-4.   COMPLETE EXPLANATION FOR THESE TWO LINES FOLLOWS IN SECTION 7.0.
THE ENTERING OF "<CR>" IN RESPONSE TO OUTPUT? WILL CAUSE ANSWERS TO BE PRINTED
AT THE TERMINAL AND THE ENTERING OF "<CR>" IN RESPONSE TO INPUT? SIGNIFIES
TO THIS PROGRAM THAT INPUT DATA IS TO BE ENTERED AT THE TERMINAL.  (THIS
APPLIES WHEN YOU AT TERMINAL.  IN BATCH A DIFFERENT RULE APPLIES.)

LINES 5-6.    THE USER MAY IDENTIFY HIS OUTPUT FROM THIS PROGRAM BY UP TO 80
CHARACTERS BY ENTERING THEM ON LINE 6.  IF NO OUTPUT IDENTIFICATION IS WANTED,
THE ENTERING OF RETURN ON LINE 6 WILL CAUSE THE COMPUTER TO SKIP TO LINE 7.

LINES 7-8.  MATRIX SIZES UP TO 35X35 ARE ALLOWED.  ENTER ON LINE 8 AN INTEGER
REPRESENTING THE SIZE ON THE MATRIX.

LINES 9-12.  IF YOU ENTER STD ON LINE 10, THEN LINES 11-12 WILL PRINT.  FOLLOWING
THESE TWO LINES YOU MUST ENTER THE MATRIX ELEMENTS IN SUCH A WAY  THAT THE
REAL AND IMAGINARY PARTS ARE SEPARATED BY COMMAS AND THE ELEMENTS ARE
SEPARTED BY COMMAS.

IF YOU WANT TO SPECIFY YOUR OWN FORMAT FOR THE MATRIX ELEMENTS, THEN YOU MUST
FOLLOW THE RULES OF FORTRAN FORMATING.
IF YOU WANT TO PROCESS A SECOND DATA SET WITH THE SAME FORMAT USED ON THE
FIRST DATA SET, THEN ENTER SAME ON THE LINE FOLLOWING FORMAT.  AT MOST 6
LINES CAN BE USED FOR ENTERING A FORMAT.  IN THIS PROGRAM G FORMAT IS USED.

LINES 13-15.  NO MORE THAN 10 MATRIX ELEMENTS MAY BE TYPED PER LINE.  IF THE
MATRIX IS MORE THAM 10, THEN THE ROWS OF THE MATRIX ARE TO BE ENTERED AT
THE RATE OF 10 PER LINE.  A NEW ROW OF THE MATRIX MUST START ON A  NEW LINE.

THIS IS A 3X3 MATRIX CONTAINING COMPLEX ELEMENTS.  ZEROS AT THE END OF A ROW
DO NOT HAVE TO BE ENTERED.  ZEROS BETWEEN NON-ZERO ELEMENTS ARE ENTERED WITH A
COMMA FOLLOWED BY ANOTHER COMMA.

THE INPUT DATA SHOWN ON LINES 13-15 CORRESPOND TO THE FOLLOWING MATRIX:

8,-5I,3-2I
5I, 3,   0
3+2I, 0, 2

LINE 16.  THE EXPLANATIONS FOR LINES 3-4 AND THE INFORMATION IN SECTION 7.0
APPLY HERE.

LINES 17-19.  THE ENTERING OF FINISH<CR> CAUSES THIS PROGRAM TO PROVIDE EXIT
INFORMATION AND FINALLY TO PRINT A PERIOD SO THAT THE USER MAY LOG OFF OR
PERFORM ANOTHER JOB.

7.0 EXPLANATIONS FOR LINES 3-4 AND 16-17 IN SECTION 5.0

THE RESPONCES TO INPUT? AND OUTPUT? IN SECTION 5.0 DEFINE WHERE THE USER
INTENDS TO WRITE HIS OUTPUT FILE (LINE 3) AND FROM WHERE THE USER EXPECTS TO
READ HIS INPUT DATA (LINE 4).  SEE NOTE (2) BELOW FOR OTHER INPUT OPTIONS.

THE PROPER RESPONSE TO EACH OF THESE QUESTIONS CONSISTS OF THREE BASIC PARTS:
A DEVICE, A FILENAME, AND A PROJECT-PROGRAMMER NUMBER.

THE GENERAL FORMAT FOR THESE THREE PARTS IS AS FOLLOWS:

DEV:FILE.EXT[PROJ,PROG]

1) DEV: ANY OF THE FOLLOWING DEVICES ARE APPROPRAITE WHERE INDICATED:

DEVICE LIST	DEFINITION		STATEMENT USE

TTY:		TERMINAL		INPUT OR OUTPUT
DSK:		DISK			INPUT OR OUTPUT
LPT:		LINE PRINTER		OUTPUT ONLY
DTA0:	DECTAPE 0		INPUT OR OUTPUT
DTA1:	DECTAPE 1		INPUT OR OUTPUT
DTA2		DECTAPE 2		INPUT OR OUTPUT
DTA3:	DECTAPE 3		INPUT OR OUTPUT
DTA4:	DECTAPE 4		INPUT OR OUTPUT
DTA5:	DECTAPE 5		INPUT OR OUTPUT
DTA6:	DECTAPE 6		INPUT OR OUTPUT
DTA7:	DECTAPE 7		INPUT OR OUTPUT
MTA0:	MAGNETIC TAPE 0		INPUT OR OUTPUT
MTA1:	MAGNETIC TAPE 1		INPUT OR OUTPUT

INPUT MAY NOT BE DONE FROM THE LINE PRINTER NOR MAY OUTPUT GO TO THE

2) FILE.EXT IS THE NAME AND EXTESSION OF THE FILE TO BE USED.  THIS PART OF
THE SPECIFICATION IS USED ONLY IF DISK OR DECKTAPE IS USED.

3)  [PROJ,PROG]  IF A DISK IS USED AND THE USER WISHES TO READ A FILE
IN ANOTHER PERSON'S DIRECTORY, HE MAY DO SO BY SPECIFYING PROJECT-PROGRAMMER
NUMBER OF THE DIRECTORY FROM WHICH HE WISHES TO READ  THE PROJECT NUMBER AND
THE PROGRAMMER NUMBER MUST BE SEPARATED BY COMMA AND ENCLOSED IN BRACKETS.
OUTPUT MUST GO TO YOUR OWN AREA.

EXAMPLE:
OUTPUT?  LPT:/2
INPUT?   DSK:DATA.DAT[71171,71026]

IN THE EXAMPLE, TWO COPIES OF THE OUTPUT ARE TO BE PRINTED BY  THE
HIGH SPEED PRINTER.  THE INPUT DATA IS A DISK FILE OF NAME DATA.DAT IN USER
DIRECTORY [71171,71026].

DEFAULTS:

1) IF NO DEVICE IS SPECIFIED BUT A FILENAME IS SPECIFIED THE DEFAULT DEVICE
WILL BE DSK:

2) IF NO FILENAME IS SPECIFIED AND A DISK OR DECTAPE IS USED THE DEFAULT ON
INPUT WILL BE FROM INPUT.DAT; ON OUTPUT IT WILL BE OUTPUT.DAT.

3)  IF THE PROGRAM IS RUN FROM THE TERMINAL AND NO SPECIFICATIONS IS GIVEN
(JUST A CARRIAGE RETURN) BOTH INPUT AND OUTPUT DEVICES WILL BE THE TERMINAL.

4)  IF THE PROGRAM IS RUN THROUGH BATCH AND NO SPECIFICATION IS GIVEN, (A BLANK
CARD) THE INPUT DEVICE WILL BE CDR:  AND THE OUTPUT WILL BE THE LPT:

5)  IF NO PROJECT-PROGRAMMER NUMBER IS GIVEN, THE USERS'S OUN NUMBER WILL BE
ASSUMED.

NOTE:	(1) IF LPT: IS USED AS AN OUTPUT DEVICE MULITIPLE COPIES MAY BE OBTAINED
BY SPECIFYING LPT:/N WHERE N REFERS TO THE NUMBER  OF COPIES 	DESIRED.

(2)  THE FOLLOWING TWO OPTIONS ARE NOT APPLICABLE FOR THE FIRST DATA
SET, I.E. IT IS APPLICABLE ONLY WHEN THE PROGRAM BRANCHES BACK TO
LINE 4 UPON FIRST COMPLETION OF LINES 5-16.

(A)  SAME OPTION

UPON RETURNING FROM LINE 16 IN SECTION 5.0 IF THE SAME DATA FILE
IS TO BE USED AGAIN, SIMPLY ENTER "SAME<CR>". OTHERWISE
EITHER USE THE FINISH OPTION OR ENTER ANOTHER FILE NAME ETC.

(B)	FINISH OPTION

THE USER MUST ENTER "FINISH<CR>" TO BRANCH OUT OF THIS PROGRAM.
FAILUR TO DO SO MIGHT RESULT IN LOSING THE ENTER OUTPUT FILE.

8.0 SAMPLE TERMINAL RUN

.R EVEV<CR>

WMU EIGENVALUE AND EIGENVECTORS

OUTPUT? (TYPE HELP IF NEEDED)--TTY:<CR>
INPUT? (TYPE HELP IF NEEDED)--TTY:<CR>

ENTER OUTPUT IDENTIFICATION
TEST EVEV<CR>

ENTER ORDER OF MATRIX.
3<CR>

FORMAT
STD<CR>

ENTER DATA,REAL PART FIRST THEN THE IMAGINARY;
(AT MOST 10 SETS PER LINE)
NOTE: USE COMMA(,) INSTEAD OF SEMICOLON(;) TO SEPARATE PAIRS
OF COMPLEX NUMBERS
8,,,-5,3,-2<CR>
,5,3,,,<CR>
3,2,,,2,<CR>

EST EVEV

NUMBER OF EIGENVALUES CALCULATED IS          3

EIGENVALUES         REAL          IMAGINARY

2.376856      0.3490088E-09
-1.431015     -0.2268915E-09
12.05416     -0.4995174E-11

COMPLEX EIGENVECTORS-NORMALIZED TO LENGTH =1.

EIGENVECTOR  1
0.6427619E-01 -0.4734262E-01 -0.3798688     -0.5157408
0.7629284     -0.3575760E-01

EIGENVECTOR  2
-0.2154075E-01  0.5436920      0.6135073      0.2430679E-01
0.3357625     -0.4628352

EIGENVECTOR  3
0.8351907     -0.4338821E-02  0.2396038E-02  0.4612193
0.2500706      0.1648437

ROW WITH THE MAX. RELATIVE ERROR =    1
ROW WITH THE MAX. REL. ERROR HAS AX =  0.15277526     -0.11252654
ROW WITH THE MAX. REL. ERROR HAS LX=  0.15277523     -0.11252656
ROW WITH THE MAX. REL. ERROR HAS AX-LX=  0.26077032E-07  0.26077032E-07
THE MAXIMUM RELATIVE ERROR =  0.19435997E-06
EUCL. NORM OF (AX-LX)/EUCL. NORM OF AX =  0.35639273E-07

ROW WITH THE MAX. RELATIVE ERROR =    3
ROW WITH THE MAX. REL. ERROR HAS AX = -0.48048117      0.66232405
ROW WITH THE MAX. REL. ERROR HAS LX= -0.48048120      0.66232410
ROW WITH THE MAX. REL. ERROR HAS AX-LX=  0.29802322E-07 -0.52154064E-07
THE MAXIMUM RELATIVE ERROR =  0.73410816E-07
EUCL. NORM OF (AX-LX)/EUCL. NORM OF AX =  0.45157677E-07

ROW WITH THE MAX. RELATIVE ERROR =    1
ROW WITH THE MAX. REL. ERROR HAS AX =   10.067521     -0.52300853E-01
ROW WITH THE MAX. REL. ERROR HAS LX=   10.067521     -0.52300843E-01
ROW WITH THE MAX. REL. ERROR HAS AX-LX= -0.11920929E-06 -0.93132257E-08
THE MAXIMUM RELATIVE ERROR =  0.11876898E-07
EUCL. NORM OF (AX-LX)/EUCL. NORM OF AX =  0.10297542E-07

INPUT? (TYPE HELP IF NEEDED)--FINISH<CR>
CPU TIME: 1:13 ELAPSED TIME 10:11.00
NO EXECUTION ERRORS DETECTED

EXIT

.

9.0  SAMPLE BATCH INPUT DECK

\$JOB [PROJ#,PROG#]/TIME:0:01:00/PAGES:20
\$DATA
8		-5		 3	-2
5	 3	00	00	00
3	2	00	00	 2	00
\$EOD
R EVEV
LTP:
CDR:
TEST RUN
3
(G2.0,1X,G2.0,2X,G2.0,1X,G2.0,2X,G2.0,1X,G2.0)
FINISH
(EOF)

THE USER SHOULD KNOW THAT TOO LARGE A VALUE FOR TIME OR PAGES ON THE FIRST LINE
MIGHT RESULT IN HIS PROGRAM BEING DELAYED BY THE MONITOR WHICH FAVORS PROGRAMS
WITH SMALLER ESTIMATED TIMES AND NUMBER OF PAGES.  HOWEVER, IF YOU ESTIAMTE A
NUMBER TOO LOW, YOUR PROGRAM MAY BE INTERRUPTED BEFOR YOUR JOB WAS FINISHED.
IT IS RECOMMENDED THAT PREVIOUS RUNS BE UESED AS GUIDES FOR TIME AND NUMBER
OF PAGES ESTIMATE.

THE NNNNNN ON THE SECOND CARD IS TO REPLACED BY USER'S PASSWORD.

IF THE USER HAD PREVIOUSLY STORED HIS INPUT DATA ON DISK WITH A NAME, SAY DATAEV,
THEN ALL THE CARDS BETWEEN \$DATA AND \$EOD INCLUSIVE WOULD BE LEFT OUT AND CRD:
WOULD BE REPLACED BY DATAEV.

EACH LINE ABOVE REPRESENTS ONE CARD.  FOR EACH WORD, KEYPUNCHING STARTS IN
COLUMN 1.  FOR ALL THE CARD BETWEEN R EVEV AND FINSIH INCLUSIVE SEE SECTION  6.0
FOR EXPLANATIONS.  NOTE ALSO THAT THE INPUT MATRIX BETWEEN \$DATA AND \$EOD IS
THE SAME ONE USED IN SECIONS 5.0 AND 6.0.  HOWEVER, HERE OBJECT TIME FORMAT IS
USED INSTEAD OF "STD: I.E. STANDARD FORMAT.

REFERENCE:
1.  "THE PROGRAMES'S HANDBOOK" BY R.E. FUNDERLIC, PGS. 225-235
(PUBLISHER IS AMERICAN DATA PROCESSING, DEC. 1967).

```