Lecture Notes ~n Computer Science Edited by G. Goos and J. Hartmanis
51 B. S. Garbow J. M. Boyle J. J. Dongarra C. B. M...
13 downloads
452 Views
11MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
Lecture Notes ~n Computer Science Edited by G. Goos and J. Hartmanis
51 B. S. Garbow J. M. Boyle J. J. Dongarra C. B. Moler
Matrix Eigensystem Routines EISPACK Guide [~ension
Editorial Board P. Brinch Hansen, O. Gries, C. Moter, G. SeegmfJtter, J. Stoer, N. Wirth
Author Burton S. G a r b o w Applied Mathematics Division A r g o n n e National Laboratory 9 7 0 0 South C a s s A v e n u e Argonne, Illinois 6 0 4 3 9 U S A
Library of Congress Cataloging in Publication Da~a
Main entry under title: Matrix eigensystem routines. (Lecture notes i_n computer science ~ 51) Supplements the 2d. ed of Matrix eigeneystem routines : EISPACK guide. i. EZSPACK (Computer program) I. Garbow~ B. S.~ 1930II. Series. QAI9~.M38 001.6'425 77-2802
AMS Subject Classifications (1970): 15A18, 65F15 CR Subject Classifications (1974): 5.14 ISBN 3-540-08254-9 Springer-Verlag Berlin • Heidelberg • New York ISBN 0-387-08254-9 Springer-Verlag New York • Heidelberg • Berlin This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically those of translation, reprinting, re-use of illustrations, broadcasting, reproduction by photocopying machine or similar means, and storage in data banks. Under § 54 of the German Copyright Law where copies are made for other than private use, a fee is payable to the publisher, the amount of the fee to be determined by agreement with the publisher. © by Springer-Vertag Berlin - Heidelberg 1977 Printed in Germany Printina and bindina: Beltz Offsetdruck, Hemsbach/Bergstr.
PREFACE
This volume supplements the earlier Volume 6 in this series [i0]; together they provide guidance for the complete second release of the EISPACK Eigensystem Package. classes:
The stress in this book is on four additional problem
the sylmnetric band eigenproblem, the generalized symmetric elgen-
problem, the generalized real eigenproblem, and the singular value decomposition of a rectangular matrix and solution of an associated linear least squares problem. The organization of material in this volume follows closely that of [i0].
Several of the newer problems transform to problems covered earlier
in [i0]; reference should be made there for details that apply after the problem has been transformed.
Towards achieving a certain degree of self-
sufficiency, however, the documentation for seven earlier subroutines that recur here in the various recommended paths of Section 2 has been recopied in Section 7.1 of this volume. The EISPAC control program, available with the IBM version of EISPACK, extends to each of the newer problem classes except Singular Value Decomposition; the discussion of its usage, where applicable, is integrated into the various sections of this volume.
Its documentation, earlier provided
in [I0], has been recopied in Section 7.2 of this volume. EISPACK is a product of the NATS (N__ationalActivity to ~est ~oftware) Project ([3],[4],[5]) which has been guided by the principle that the effort to produce high quality mathematical software is justified by the wide use of that software in the scientific community.
EISPACK has been
distributed to several hundred computer centers throughout the world since the package was first released in May, 1972, and now the second release is available as described in Section 5.
Building a systematized collection of mathematical software is necessarily a collaborative undertaking demanding the interplay of a variety of skills; we wish to acknowledge a few whose roles were especially crucial during the preparation of the second release.
J. Wilkinson persisted in his encourage-
ment of the project and his counsel was often sought during his frequent visits to North Americas J. Pool.
Organization and direction came from W. Cowell and
B. Smith and V. Klema provided highly valued consultation.
The
field testing was carried out at the installations listed in Section 5 through the sustained efforts of M. Berg, A. Cline, D. Dodson, B. Einarsson, S. Eisenstat, I. Farkas, P. Fox, F. Fritsch, C. Frymann, G. Haigler, H. Happ, L. Harding, M. Havens, H. Hull, D. Kincaid, P. Messina, M. Overton, R. Raffenetti, J. Stein, J. Walsh, and J. Wang.
Additional assistance in providing the timing informa-
tion for the tables of Section 4 was given by T. Pinter.
Appreciation is also
expressed for the very important feedback received from users not formally associated with the testing effort.
Finally, we acknowledge the skill and
cooperation of our typist, J. Beumer.
Work performed under the auspices of the United States Energy Research and Development Administration and the National Science Foundation.
iV
TABLE OF CONTENTS
SECTION i INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i.
Organization
of the guide . . . . . . . . . . . . . . . . . . . . .
2.
Accuracy of the EISPACK subroutines
................
SECTION 2 HOW TO USE EISPACK . . . . . . . . . . . . . . . . . . . . . . . . . . .
i.
Recommended basic paths in EISPACK . . . . . . . . . . . . . . . . . i.I
13 15
1.2
All eigenvalues of a real symmetric hand matrix
1.3
Some eigenvalues and corresponding eigenvectors of a real symmetric band matrix . . . . . . . . . . . . . . .
17
1.4
Some eigenvalues
20
1.5
All eigenvalues and corresponding eigenvectors of a generalized real symmetric matrix system . . . . . . . .
22
All eigenvalues of a generalized real symmetric matrix system . . . . . . . . . . . . . . . . .
24
Some eigenvalues and corresponding eigenvectors of a generalized real symmetric matrix system . . . . . . . .
26
Some eigenvalues of a generalized real symmetric matrix system . . . . . . . . . . . . . . . . .
28
All eigenvalues and corresponding eigenvectors of a generalized real matrix system . . . . . . . . . . . . .
30
All eigenvalues
32
1.6
1.7
1.8
1.9
1.10
2.
All eigenvalues and corresponding eigenvectors of a real symmetric band matrix . . . . . . . . . . . . . . .
Variations
.......
of a real symmetric band matrix . . . . . . .
of a generalized
real matrix system . . . . .
of the recommended EISPACK paths
............
2.1
The QR algorithm for real symmetric band matrices
2.2
Variants of the real symmetric generalized
V
34
......
eigenproblem
35 . . .
37
3.
. . . . . . . . . . . . . . . .
40
The representation of the eigenvalues of a generalized real matrix system . . . . . . . . . . . . .
41
Unpacking the eigenvectors of a generalized real matrix system . . . . . . . . . . . . . . . .
43
3.3
The EPSI parameter . . . . . . . . . . . . . . . . . . . . . .
45
3.4
Possible ill-condition of the generalized real symmetric eigenproblem paths . . . . . . . . . . . . . .
48
3.5
Higher degree eigenvalue problems
49
3.6
The use of BANDV in solving band systems of linear equations . . . . . . . . . . . . . . . . . . . . .
51
3.7
Additional facilities of the EISPAC control program . . . . .
52
3.8
Non-zero values of IERR . . . . . . . . . . . . . . . . . . .
58
3.9
Examples illustrating the use of the EISPACK subroutines and the control program . . . . . . . . . . . . .
60
Singular Value Decomposition with EISPACK . . . . . . . . . . . . .
69
4.1
The Singular Value Decomposition and rank estimation . . . . .
70
4,2
Subroutines SVD and MINFIT . . . . . . . . . . . . . . . . . .
72
4.3
The pseudo-inverse of a rectangular matrix . . . . . . . . . .
74
4.4
Least squares solutions of minimal norm . . . . . . . . . . .
75
4.5
Homogeneous linear equations . . . . . . . . . . . . . . . . .
76
Additional information and examples 3.1
3.2
4.
. . . . . . . . . . . . . .
SECTION 3 VALIDATION OF EISPACK . . . . . . . . . . . . . . . . . . . . . . . . .
77
SECTION 4 EXECUTION TIMES FOR EISPACK . . . . . . . . . . . . . . . . . . . . . .
80
!.
Tables of execution times . . . . . . . . . . . . . . . . . . . . .
81
2.
Repeatability and reliability of the measured execution times , . .
121
3.
Dependence of the execution times upon the matrix system . . . . . .
122
VI
4.
E x t r a p o l a t i o n of timing results to other m a c h i n e s and compilers
5.
Timing c o n s i d e r a t i o n s for band p r o b l e m s and singular value decomposition . . . . . . . . . . . . . . . . . . . .
126
The sample m a t r i c e s for the timing results . . . . . . . . . . . . .
129
6.
. .
124
SECTION 5 C E R T I F I C A T I O N A N D A V A I L A B I L I T Y OF E I S P A C K . . . . . . . . . . . . . . .
131
SECTION 6 D I F F E R E N C E S B E T W E E N THE E I S P A C K SUBROUTINES A N D THE H A N D B O O K A L G O L P R O C E D U R E S . . . . . . . . . . . . . . . . . . .
133
SECTION 7 D O C U M E N T A T I O N AND SOURCE L I S T I N G S
. . . . . . . . . . . . . . . . . . .
135
i.
EISPACK subroutines
. . . . . . . . . . . . . . . . . . . . . . . .
137
2.
EISPAC control p r o g r a m . . . . . . . . . . . . . . . . . . . . . . .
314
Vii
L I S T OF TABLES i.
S e c t i o n s d e s c r i b i n g the r e c o m m e n d e d b a s i c paths in E I S P A C K o . .
12
2.
ISUBNO v a l u e s and p a r a m e t e r names for s u b r o u t i n e calls f r o m EISPAC . . . . . . . . . . . . . . . . . .
56
3.
Summary of v a l u e s of IERR . . . . . . . . . . . . . . . . . . . .
59
4-5.
E x e c u t i o n times o n the I B M 370/195 at Argonne National Laboratory . . . . . . . . . . . . . . . . . . .
84
6-7.
E x e c u t i o n times on the IBM 360/75 at U n i v e r s i t y of Illinois,
8-9.
E x e c u t i o n times o n the I B M 360/65 at A m e s L a b o r a t o r y
. .
86 88
......
I0-ii.
E x e c u t i o n times on the I B M 370/165 at The U n i v e r s i t y of Toronto.
90
12-13.
E x e c u t i o n times on the IBM 370/168 M o d 3 at Stanford University.
92
14-15.
E x e c u t i o n times on the B u r r o u g h s 6700 at U n i v e r s i t y of C a l i f o r n i a , San D i e g o . . . . . . . . . . . . . . .
94
16-17.
E x e c u t i o n times o n the CDC 6600 at K i r t l a n d A i r F o r c e B a s e . . .
96
18-19.
E x e c u t i o n times on the CDC C Y B E R 175 at N A S A L a n g l e y R e s e a r c h Center . . . . . . . . . . . . . . . . . .
98
20-21.
E x e c u t i o n times on the CDC 7600 at N a t i o n a l C e n t e r for A t m o s p h e r i c R e s e a r c h
100
. . . . . . . . . . . .
22-23.
E x e c u t i o n times on the CDC 7600 at Lawrence Livermore Laboratory . . . . . . . . . . . . . . . . . .
102
24-25.
E x e c u t i o n times o n the CDC 6400 at N o r t h w e s t e r n U n i v e r s i t y
104
26-27.
E x e c u t i o n times o n the CDC 6 4 0 0 / 6 5 0 0 at P u r d u e U n i v e r s i t y . . . .
28-29.
E x e c u t i o n times on the CDC 6 6 0 0 / 6 4 0 0 at T h e U n i v e r s i t y of Texas.
30-31.
E x e c u t i o n times on the H o n e y w e l l 6070 at Bell L a b o r a t o r i e s
32-33.
E x e c u t i o n times on the U n i v a c IIi0 at The University of Wisconsin . . . . . . . . . . . . . . . . . . .
34-35.
E x e c u t i o n times o n the DEC K A - P D P - 1 0 at Y a l e U n i v e r s i t y . . . . .
36-37.
E x e c u t i o n times on the A m d a h l 470V/6 at U n i v e r s i t y of M i c h i g a n
. . .
106
. . .
108 110
112 114 .
116
38.
E x e c u t i o n times for the E I S P A C K d r i v e r subroutines, SVD and M I N F I T over v a r i o u s c o m p u t e r systems . . . . . . . . . .
118
39.
E x e c u t i o n times for the E I S P A C control p r o g r a m on the IBM 370/195 at A r g o n n e N a t i o n a l L a b o r a t o r y . . . . . . . . . . .
120
VIII
1.0-i
Section i INTRODUCTION
The subset of the EISPACK package of Fortran IV programs included within this volume is a systematized collection of subroutines which compute the eigenvalues and/or eigenvectors for three special classes of matrix problems and the singular value decomposition of an arbitrary matrix.
The three
problem classes are real symmetric band, generalized real symmetric, and generalized real.
The singular value decomposition, in turn, enables the
solution of certain linear least squares problems.
The subroutines are
based mainly upon Algol procedures published in the Handbook series of Springer-Verlag by Wilkinson and Reinsch [i] and the QZ algorithm of Moler and Stewart [8] as extended by Ward [9]. They have been adapted and thoroughly tested on several different machines, and have been certified and are supported by the NATS project [3,4,5].
The machines for which they are
certified include IBM 360-370, CDC 6000-7000, Univac iii0, Honeywell 6070, DEC PDP-10, and Burroughs 6700. This manual is a user guide to these newer capabilities of EISPACK (complementing [i0]) and to a control program EISPAC available with the IBM version of the package.
It contains program segments which illustrate
each of the basic computations with EISPACK and discusses variants of these that provide mild tradeoffs of efficiency, storage, and accuracy. Other sections of the guide discuss the validation procedures used for testing EISPACK, report execution times of the EISPACK subroutines on several machines, advertise the certified status and availability of EISPACK, and describe the major differences between the published Algol procedures in [i] and their Fortran counterparts.
The final section includes detailed
documentation with Fortran listings of each EISPACK subroutine referenced herein and the document for the control program.
I.i-i
Section i.I ORGANIZATION OF THE GUIDE
This guide is organized for the convenience,
hopefully, of the user.
Material most pertinent to the basic uses of the package and the control program appears in the early sections and references the more detailed and specific information in later sections.
Here follows a brief description
of the organization of the guide. The remaining subsection of this introduction is a general statement with regard to the expected accuracy of the results from EISPACK.
This
statement is based upon the careful and detailed analyses of Wilkinson and others.
Only a brief overview is provided in this subsection and the
interested reader is directed to [I] and [2] for more detailed statements of accuracy. Section 2 is divided into a prologue and four major subsections.
The
prologue introduces the concept of an EISPACK path, discusses the economies that can be realized with the use of the control program if available, instructs on the selection among the I0 basic paths of this volume. first subsection establishes several conventions fying the discussions of the paths.
and
The
that are useful in clari-
It then details the i0 basic paths
and associated control program calls in the form of program segments.
Each
program segment is introduced by a brief description of the problem it solves and any specific considerations needed for the path, and is followed by a summary of array storage requirements for the path and sample execution times on the IBM 370/195 computer.
The next subsection describes possible
variants of the i0 basic paths, focusing on those conditions for which the variants are to be preferred.
The third subsection provides further infor-
mation about specific details of EISPACK and the control program and
i.i-2
suggests several additional applications of the package.
Complete sample
programs illustrating the use of EISPACK and EISPAC to solve a specified eigenproblem appear at the end of this subsection.
The last subsection
describes the EISPACK capabilities to compute the singular value decomposition of a matrix and to solve an associated linear least squares problem. Section 3 outlines the validation procedures for EISPACK that led to the certification of the package.
Section 4 reports sample execution
times of the individual subroutines and of several of the program segments of Section 2 and also discusses such considerations as the dependence of the execution times upon the matrix and the computer.
The statement of
certification for EISPACK, the machines and operating systems on which it has been certified, and its availability appear in Section 5.
Section 6
itemizes the principal differences between the referenced Fortran subroutines and their Algol antecedents published in [i]. Finally, the documentation and Fortran listing for each subroutine appear in edited form in Section 7.
1.2-1
Section
1.2
ACCURACY OF THE EISPACK SUBROUTINES
The most useful statement of the EISPACK subroutines numerically
stable;
that can be made with regard to the accuracy
is that they are based on algorithms which are
that is, for every computed eigenpair
(%,z) associated
with a matrix A, there exists a matrix E with norm small compared of A for which % and z are an exact eigenpair problems,
the corresponding
the accuracy of the subroutines
properties
of the problem which,
approach also applies, For these problems
is necessitated
in general,
preclude
by the inherent
the more familiar
for real syrmnetric band matrices
and indeed is a consequence
the eigenvalues
also with
This backward or inverse approach in
describing
However,
For generalized
claim can be made after associating
B a matrix of small relative norm.
forward approach.
of A+E.
to that
the forward
of the backward analysis.
computed by EISPACK must be close to the
exact ones, but a similar claim for the eigenvectors
is not possible.
What
is true in this case is that the computed eigenvectors will be closely orthogonal if the subroutines
that accumulate
The size of E, of course, accuracy,
is crucial
the transformations to a meaningful
are used.
statement of
and the reader is referred to the detailed error analyses
Wilkinson and others
([i],[2]).
In our many tests of EISPACK,
of
we have sel-
dom observed an E with norm larger than a small multiple of the product of the order of the matrix or system, an appropriate norm, and the precision of the machine.
2.0-1
Section 2 HOW TO USE EISPACK
This section is designed to provide, in readily accessible form, the basic information you need to correctly use subroutines from EISPACK to solve an eigenproblem.
The way in which this information is presented
is influenced by the design of the eigensystem package; hence we will first consider briefly the global structure of EISPACK. EISPACK is capable of performing 32 different basic computations (22 of them described in [I0]), plus several variations of them.
If each of
these computations (and variations) were performed completely within a single EiSPACK subroutine, the package would be unwieldy indeed.
It also would
be highly redundant, since the same steps appear in many of the computations. To avoid these problems, the subroutines in EISPACK are designed so that each performs a basic step which appears in one or more of the computations. (See [7] for an introduction to the modularization of EISPACK.)
Consequently,
the redundancy (hence the size) of the package is minimized. Another consequence is that, in general, more than one subroutine from EISPACK is required to perform a given computation.
These subroutines must
of course be called in the correct order and with the proper parameters; in addition, some computations also require certain auxiliary actions, e.g., initializing parameters and testing for errors.
Throughout the re-
mainder of this book such an ordered set of subroutine calls and associated auxiliary actions will be called an EISPACK
path.
As a result of this structure the documentation for the use of EISPACK comprises two main parts:
a description of the basic paths and their var-
iations, and a description of the individual subroutines in EISPACK. information about the paths constitutes the remainder of this section
The
2.0-2
while the subroutine documentation The path descriptions
is collected
in Section 7.
are divided into three parts.
Section 2.1
describes
the i0 basic paths and includes a table to facilitate
to them.
Section 2.2 describes
suggests when such variations tain additional
some of the variations
might be useful.
zero error indicators
and the descriptions
it in Section 2.3.
Section 7.
Section 2.3 contains cer-
of the basic paths and their variants
have omitted much of the detailed information
may be obtained
of these paths and
information about and examples of the use of EISPACK.
keep the descriptions
collected
Detailed
will be sufficient
basic eigenproblems
simple, we
(e.g., the meanings
of certain parameters)
for the individual
that the information
to permit you to correctly
The detail of path information
is a driver subroutine
solve most eigenproblems.
is limited
driver sub-
only are desired.
There
for each class of problems handled by the package; to six of the i0 basic paths are
of the paths in this section.
further reduction in the detail of path information
you must know to solve an eigenprob!em, achieved by use of a control program,
with wider applicability,
[6].
this control program on those computing
quately support execution-time straightforward
that
can be
called EISPAC, which is available
with the IBM version of the eigensystem package
relatively
Applica-
to those problems where all
or all eigenvalues
given as part of the discussion
to implement
in
that you must know to solve certain
driver subroutine calls corresponding
Substantial
and
given in this section
routine to build the desired path from other EISPACK members.
and eigenvectors
of non-
subroutines
can be reduced by using an appropriate
bility of the driver subroutines
To
information about each subroutine
from the documentation
We hope, however,
eigenvalues
reference
(It is only practical systems which ade-
loading of subroutines.)
problem description
EISPAC accepts a
stated in terms of the
2.0-3
properties
of the input matrix or system and the kinds of results required.
It checks this description for consistency,
automatically
selects and
executes the appropriate path, and then returns the results to your program.
Thus EISPAC not only simplifies the use of the eigensystem package,
but also enhances
its robustness by eliminating
errors in transcribing
the possibility
of making
a path.
To use EISPAC, you call it with a set of parameters which describes the problem you wish to solve, and which enables EISPAC to choose the appropriate
path.
EISPAC calls corresponding
most of their variations)
to the i0 basic paths
(and
are given as a further part of the discussion
of the paths in this section.
Note that in order to use EISPAC, you must
provide system control cards defining the file from which the EISPACK subroutines
are to be loaded;
this and other detailed information on the
use of EISPAC can be found in its subroutine document in Section 7.2.
2.1-1
Section 2.1 RECOMMENDED
BASIC PATHS IN EISPACK
This section describes how to use EISPACK to compute some or all of the eigenvalues,
or some or all of the eigenvalues
ing eigenvectors,
for the three classes of problems mentioned
The paths recommended eigenproblems variations
and their correspond-
here provide accurate
using a minimum of storage.
of these paths
(using different
solutions
in Section I.
for their respective
Under some circumstances, subroutines)
slightly more accurate or speedier solutions;
may provide
these variations
are dis-
cussed in Section 2.2. To determine problem,
the recommended
path to solve your particular
consult Table 1 at the end of this section.
eigen-
First, decide to
which of the three classes listed across the top of the table your problem belongs.
In general,
the computation will be more accurate and efficient
if you use any known special properties it in the most specialized which is real symmetric is better classified the other hand,
of the matrix or system to place
applicable class.
Thus a generalized
(both A and B symmetric
problem
and B positive definite)
so, than as just real (but see Section 2.3.4).
some special properties
cannot be utilized;
On
for example,
advantage cannot be taken of the band form of a matrix unless it is symmetric as well. Next, determine which of the problem classifications left side of Table I most closely matches eigenvectors
you wish to find.
the subsection which describes variations
of the path exist,
listed down the
the subset of eigenvalues
The table entry so determined
and
indicates
the recormnended path for your problem.
(If
the subsection will refer you to Section
2.2 for them or to the corresponding
section of [i0].)
For example,
if
2.1-2
you have a real symmetric band matrix and you wish to find all its eigenvalues and their corresponding
eigenvectors,
the table directs you to Section 2.1.1.
Each subsection to which the table refers provides just the information you need to use the described path correctly. ment of the problem and an identification variables.
It begins with a state-
of the main input and result
The subroutine calls and auxiliary statements
the path are given and are followed by the corresponding call, if applicable, tional parameters the disposition
and the EISPAC call.
of addi-
(if any) appearing in the path and a brief summary of
for the arrays appearing of array s t o r a g e u s e d
4.)
driver subroutine
Next is a description
of the results of the computation.
timing results.
consttuting
Dimension
information
in the path and a summary of the total amount
is then given.
These are followed by indicative
(Timing considerations
are discussed more fully in Section
The subsection concludes with references
to applicable
subsections
of
Section 2.2 (or to !i0]). We have employed a few conventions the presentation parameters.
of information.
All parameters
in these subsections
One of these concerns the types of the
have their Fortran implied type:
ginning with I, J, K, L, M, or N are type INTEGER, will be called
working precision,
to streamline
those be-
and the others are what
which denotes either type REAL or type
DOUBLE PRECISION depending on the version of EISPACK being used. A second convention concerns certain parameters which are used only to pass intermediate
results from one subroutine to another.
of these parameters are not described in the subsections,
since only their
type and dimension need be known to execute a path correctly. tate recognition
of these parameters,
employing a systematic nomenclature.
The roles
To facili-
they are written in lower case, Their names are composed of f or i
2.1-3
to indicate type (working precision or integer), dimensionality
(scalar, vector,
or matrix),
is used for the first working precision
s, v, or m to indicate
and a serial number.
Thus
fvl
temporary vector to appear in a
given path. A third convention is used to indicate how the array parameters path are dimensioned. must be replaced stants.
It employs
three "variables"
in array declarator
to array declarator
statements
mb.
the values of these
It is of utmost importance
that whenever a path otherwise un-
errors will occur.
An example may help clarify using the path described
W(~),
the use of ~w and ~ .
in Section 2.1.7.
A, B, W, and Z, the dimension B(~,~),
there-
M M set to that used for ~ ,
is executed, N and, if used, M, satisfy N ~r~n and M i n ; predictable
mb, which
in the EISPACK subroutines;
fore NM must be set to the constant used for ~ , and MB to that used for
and
statements by Fortran integer con-
The parameters NM, Mi~, and MB communicate
constants
r~n, ~ ,
in a
and Z ( ~ , ~ ) .
information
Considering
Suppose you are only the parameters
is stated there as A ( ~ , ~ ) ,
If the largest system for which you intend
to use this path is of order 50, and if you do not expect to compute more than I0 eigenvalues
and eigenvectors,
you might use the array declarator
statement
DIMENSION A(50,50),B(50,50),W(10),Z(50,10)
together with
NM=
50
MM=
!0
You would,
of course,
set N to the actual order of the system for each
execution of the path; it must satisfy N ~ 50.
10
Similarly,
M will be set
2.1-4
(by the path)
to the number of eigenvalues
determined;
it must satisfy
M < i0. The surmnary of the total amount of array storage used by a path is given in terms of the order parameters N and M, rather than in terms of and ~ °
Thus it represents
the minimum array storage required to
execute the path for a given order matrix or system, achieved when r~ is equal to N and
mm
is equal to M.
Note that when using the EISPAC control
program you need not dimension any parameters which do not appear in the call to EISPAC
(i.e., those named according
since it allocates
them for you.
to the second convention above)
This does not, however,
reduce the minimum
storage required, which remains as indicated in the surmnary. A fourth convention eigenveetor
relates to the calls to subroutines
option, when eigenvalues
the formal parameter corresponding required,
is not referenced
only are computed.
that have an
In such a case
to the eigenvector matrix Z, although
in the subroutine;
appear instead at the corresponding
the variable name DUMMY will
position in the calling statement.
A final convention concerns the handling of execution errors in a path.
Certain EISPACK subroutines may fail to satisfactorily
their step of the computation;
in this case an error parameter,
sally denoted by IERR, is set to a non-zero value indicating error which occurred.
perform univer-
the type of
In many cases the execution of a path must not be
allowed to continue after such an error; hence a conditional branch to statement number 99999 is inserted in each path after each subroutine call which may set the parameter IERR. might be to print IERR and stop.
Appropriate
action at statement 99999
Each distinct error that can occur in
EISPACK produces one of a unique set of values for IERR. values of IERR and their meanings,
The possible
together with an indication of whether
or not any partial results have been correctly computed,
11
are summarized
in
2.1-5
Section 2.3.8; more detailed information on IERR can be obtained by consulting the documents for the individual subroutines.
If you are using EISPAC,
it will print a message describing any errors which occur and terminate execution, unless you elect to examine IERR as discussed in Section 2.3.7 and in the EISPAC document. In summary, to select the recommended EISPACK path to solve your eigenproblem, consult Table I and then read the subsection to which it refers in light of the above conventions.
Note that in order to ensure correct
execution of the path, you must, in addition to providing input data and result storage, do the following:
provide arrays for storage of inter-
mediate or temporary results, call the subroutines in the path in the correct order, pass parameters from one call to the next exactly as described, and perform certain auxiliary actions.
Alternatively,
if the
control program EISPAC is included in your version of EISPACK, you may simply call it and let it perform these tasks for you.
TABLE 1 SECTIONS DESCRIBING THE RECOMMENDED BASIC PATHS IN EISPACK
Class of Matrix or em
All Eigenvalues & Corresponding Eisenvectors All Eigenvalues Some Eigenvalues & Corresponding Eigenvectors Some Eigenvalues
Real Symmetric Band
Real Real Symmetric Generalized Generalized
2.1.1
2.1.5
2.1.9
2.1.2
2.1.6
2.1.10
2.1.3
2.1.7
--
2.1.4
2.1.8
--
12
2.1-6
Section 2.1.1 ALL EIGENVALUES AND CORRESPONDING EIGENVECTORS OF A REAL SYMMETRIC BAND MATRIX
A real symmetric band matrix of order N and (half) band width MB can be presented to EISPACK as an MB-column array, with the lowest subdiagonal stored in the last N+I-MB positions of the first column, the next higher subdiagonal in the last N+2-MB positions of the second column, further subdiagonals similarly, and finally the principal diagonal in the last column.
Contents of storage locations not part of the matrix are arbitrary.
For example, when N = 5 and MB = 3, the array (designated A) should contain
*
*
A(I,I)
*
A(2,1)
A(2,2)
A(3,1)
A(3,2)
A(3,3)
A(4,2)
A(4,3)
A(4,4)
A(5,3)
A(5,4)
A(5,5)
where the subscripts for each element refer to the row and column of the element in the standard two-dimensional representation, and '*' denotes an arbitrary value. To determine all the eigenvalues W and their corresponding eigenvectors Z of a real symmetric band matrix A of order N and (half) band width MB, the recommended EISPACK path is:
CALL
BANDR(NM,N,MB,A,W,fvT,fvT,.TRUE.,Z)
CALL TQL2(NM,N,W,fvI,Z,IERR) IF (IERR .NE. O) GO TO 99999
or, using driver subroutine RSB:
CALL RSB (N-M,N,MB,A,W, I, Z,fvl ,fvl, IERR) IF (IERR .NE. O) GO TO 99999 13
2.1-7
or, using EISPAC:
CALL EISPAC(NM, N,MATRIX('REAL',A,'SYMMETRIC'),BAND(MB),VALUES(W),VECTOR(Z))
This path returns the eigenvalues in ascending order and a set of orthonormal eigenvectors; A is destroyed except for its last two columns which retain a copy of the tridiagonal matrix produced in the initial reduction. Note that if the hand matrix is already tridiagonal (MB = 2), EISPAC selects the more specialized tridiagonal path and may return slightly different eigenvalues and eigenvectors than the EISPACK path or driver subroutine RSB. Suitable dimensions for the arrays are:
A(r~n,mb), W(nm), Z(nm,~n), and
fvl (~). The array storage required to execute this path is N 2 + N(MB+2) working precision words. Indicative execution times for this path (run on an IBM 370/195) are .006, .033, .22, and 1.5 seconds for sample matrices of order and (half) band width (10,3), (20,6), (40,12), and (80,24) respectively.
Extrapolation
of these execution times for matrices of different (half) band widths is discussed in Section 4.5. A variant of this path substitutes the implicit for the explicit QL shift; see Section 2.2.3 of [i0].
14
2.1-8
Section 2.1.2 ALL EIGENVALUES OF A REAL SYMMETRIC BAND MATRIX
A real symmetric band matrix of order N and (half) band width MB can be presented to EISPACK as an MB-column array, with the lowest subdiagonal stored in the last N+I-MB positions of the first column, the next higher subdiagonal in the last N+2-MB positions of the second column, further subdiagonals similarly, and finally the principal diagonal in the last column.
Contents of storage locations not part of the matrix are arbitrary.
For example, when N = 5 and MB = 3, the array (designated A) should contain m
*
A(I,I)
*
*
A(2,1)
A(2,2)
A(3,1)
A(3,2)
A(3,3)
A(4,2)
A(4,3)
A(4,4)
A(5,3)
A(5,4)
A(5,5)
where the subscripts for each element refer to the row and column of the element in the standard two-dimensional representation, and '*' denotes an arbitrary value. To determine all the eigenvalues W of a real symmetric band matrix A of order N and (half) band width MB, the recommended EISPACK path is:
CALL BANDR(NM,N,MB,A,W,fVl,fv2,.FALSE. ,DUMMY) CALL TQLRAT(N,W,fv2,1ERR) IF (IERR .NE. 0) GO TO 99999
or, using driver subroutine RSB:
CALL RSB (NM,N ,MB ,A,W ,O ,DUMMY ,fv l ,fv 2 ,1ERR ) IF (IERR .NE. O) GO TO 99999
15
2. i-9
or, using EISPAC:
CALL EISPAC(NM,N,MATRIX('REAL',A,'SYMMETRIC'),BAND(MB),VALUES(W))
This path returns the eigenvalues in ascending order; A is destroyed except for its last two columns which retain a copy of the tridiagonal matrix produced in the initial reduction. Note that if the band matrix is already tridiagonal (MB = 2), EISPAC selects the more specialized tridiagonal path and may return slightly different eigenvalues than the EISPACK path or driver subroutine RSB. Suitable dimensions for the arrays are: and
A(nm,mb), W(nm),
fv1(nm),
fv2(~). The array storage required to execute this path is N(MB+3) working
precision words. Indicative execution times for this path (run on an IBM 370/195) are .002, o011, .061, and .38 seconds for sample matrices of order and (half) band width (10,3), (20,6), (40,12), and (80,24) respectively.
Extrapolation
of these execution times for matrices of different (half) band widths is discussed in Section 4.5. Variants of this path substitute the explicit or implicit for the rational QL shift; see Section 2.2.3 of [i0].
16
2. I-I0
Section 2.1.3 SOME EIGENVALUES AND CORRESPONDING EIGENVECTORS OF A REAL SYMMETRIC BAND MATRIX
A real symmetric band matrix of order N and (half) band width MB can be presented to EISPACK as an MB-column array, with the lowest subdiagonal stored in the last N+I-MB positions of the first column, the next higher subdiagonal in the last N+2-MB positions of the second column, further subdiagonals similarly, and finally the principal diagonal in the last column.
Contents of storage locations not part of the matrix are arbitrary.
For example, when N = 5 and MB = 3, the array (designated A) should contain
*
*
A(I,I)
*
A(2,1)
A(2,2)
A(3,1)
A(3,2)
A(3,3)
A(4,2)
A(4,3)
A(4,4)
A(5,3)
A(5,4)
A(5,5)
where the subscripts for each element refer to the row and column of the element in the standard two-dimensional representation, and '*' denotes an arbitrary value. To determine the eigenvalues W in an interval ~xtending from P~LB to RUB, together with their corresponding eigenvectors Z, of a real symmetric band matrix A of order N and (half) band width MB, the recommended EISPACK path is:
17
2.1-11
DO I00 J = I, MB DO 50 1 = i, N fm2(l,J) 50
= A(I,J)
CONTINUE
I00 CONTIh~UE CALL
BANDR(NM,N,MB,A,fvl,fv2,fv3,.FALSE.,DUMMY)
EPSI = 0.0 CALL
BISECT(N,EPSI,fvl,fv2,fv3,RLB,RUB,MM,M,W, ivl,IEP~,~4,fv5)
IF (IERR .NE. 0) GO TO 99999 CALL
BANDV(NM,N,MB,fmI,0.O,M,W,Z,IERR,NV,fv6,fv5)
IF (IERR .NE. 0) GO TO 99999
or, using EISPAC:
CALL EISPAC(hrM, N,MATRIX(~REAL',A,'SYMMETRIC'), BAND(~),VALUES(W,MM,M,RLB,RUB),VECTOR(Z))
NV communicates
the dimension of the scratch array
fv6
and must be at
least N(2M~-I). The parameter computation.
EPSI is used to control
the accuracy of the eigenvalue
Setting it to zero or calling EISPAC without
the use of a default value suitable for most matrices.
supplying
it causes
Further information
about the use of EPSI can be found in Section 2.3.3 and in the BISECT and EISPAC documents. eigenvalues vided M ! M M ,
Upon completion
determined
to lie in the interval defined by RLB and RUB and, pro-
the eigenvalues
ing orthonormal
of the path~ M is set to the number of
eigenvectors
are in ascending
order in W and their correspond-
are in the first M columns of Z.
Note that,
should the computed M be greater than MM, BISECT sets IERR non-zero and does not compute any eigenvalues.
This path destroys A except for its last two
18
2.1-12 columns which retain a copy of the tridiagonal matrix produced in the initial reduction. Note that if the band matrix is already tridiagonal (MB = 2), EISPAC selects the more specialized tridiagonal path and may return slightly different eigenvalues and eigenvectors than the EISPACK path. Suitable dimensions for the arrays are:
fm1(~,mb),
fvT(~),
A(nm,mb), W ( ~ ) ,
Z(~,~),
fv2(~), fv3(~), fv4(~), fv5(~), fv6(nv),
and iv1(~).
The array storage required to execute this path is 4N(MB+I) + M(N+I) working precision words and M integer words. could be saved by transmitting
fv6
(N working precision words
to BISECT in place of
fv4.)
Indicative execution times for this path (run on an IBM 370/195), when computing all N eigenvalues and eigenvectors~ are .025, .13, 1.1, and ii seconds for sample matrices of order and (half) band width (10,3), (20,6), (40,12), and (80,24) respectively.
Extrapolation of these execution times
for cases where M is less than N or for matrices of different (half) band widths is discussed in Sections 4.1 and 4.5. A variant of this path substitutes the band symmetric QR algorithm for the tridiagonalization and bisection steps of BANDR and BISECT; see Section 2.2.1.
Other variants substitute the rational QR method for the bisection
process or allow the specification of boundary eigenvalue indices instead of an interval to the bisection process; see Sections 2.2.4 and 2.2.8 of
[10].
19
2.1-13
Section 2.1.4 SOME EIGENVALUES
OF A REAL SYMMETRIC BAND MATRIX
A real symmetric band matrix of order N and (half) band width MB can be presented
to EISPACK as an MB-column array, with the lowest subdiagonal
stored in the last N+I-MB positions subdiagonal subdiagonals column.
of the first column,
in the last N+2-MB positions similarly,
the next higher
of the second column,
and finally the principal
further
diagonal in the last
Contents of storage locations not part of the matrix are arbitrary.
For example~ when N = 5 and MB = 3, the array (designated A) should contain
where the subscripts
*
*
A(I,I)
*
A(2,1)
A(2,2)
A(3,1)
A(3,2)
A(3,3)
A(4,2)
A(4,3)
A(4,4)
A(5,3)
A(5,4)
A(5,5)
for each element refer to the row and column of the
element in the standard two-dimensional
representation,
and '*' denotes an
arbitrary value. To determine
the eigenvalues W in an interval extending
from RLB to
RUB of a real symmetric band matrix A of order N and (half) band width MB, the recommended
CALL
EISPACK path is:
BAI~DR(NM,N,MB,A,fvl,fv2,fv3,.FALSE.,DUMMY)
EPSI = 0°0 CALL
BISECT(N,EPSI,fvl,fv2,fv3,RLB,RUB,MM,M,W,ivi,IERR,fv4,fv5)
IF (IERR .NE. 0) GO TO 99999
or, using EISPAC:
20
2.1-14
CALL EISPAC(NM,N,MATRIX('REAL',A,'SYMMETRIC'), BAND (MB), VALUES (W,MM, M, RLB, RUB ))
The parameter EPSI is used to control the accuracy of the eigenvalue computation.
Setting it to zero or calling EISPAC without supplying it
causes the use of a default value suitable for most matrices.
Further infor-
mation about the use of EPSI can be found in Section 2.3.3 and in the BISECT and EISPAC documents.
Upon completion of the path, M is set to the number
of eigenvalues determined to lie in the interval defined by RLB and RUB and, provided M ! M M ,
the eigenvalues are in ascending order in W.
Note that,
should the computed M be greater than MM, BISECT sets IERR non-zero and does not compute any eigenvalues.
This path destroys A except for its last
two columns which retain a copy of the tridiagonal matrix produced in the initial reduction. Suitable dimensions for the arrays are:
fv2(nm), fv3(nm), fv4(nm), fv5(nm),
and
A(~,mb), W ( ~ ) , f v l ( ~ ) ,
ivl(rr~).
The array storage required to execute this path is N(MB+5) + M working precision words and M integer words. Indicative execution times for this path (run on an IBM 370/195), when computing all N eigenvalues, are .017, .061, .25, and 1.0 seconds for sample matrices of order and (half) hand width (10,3), (20,6), (40,12), and (80,24) respectively.
Extrapolation of these execution times for cases
where M is less than N or for matrices of different (half) band widths is discussed in Sections 4.1 and 4.5. A variant of this path substitutes the band symmetric QR algorithm for the tridiagonalization and bisection steps of BANDR and BISECT; see Section 2.2.1.
Other variants substitute the rational QR method for the bisection
process or allow the specification of boundary eigenvalue indices instead of an interval to the bisection process; see Sections 2.2.4 and 2.2.8 of [i0].
21
2.1-15
Section 2.1.5 ALL EIGENVALUES AND CORRESPONDING EIGENVECTORS OF A GENERALIZED REAL SYMMETRIC MATRIX SYSTEM
The real generalized eigenproblem Az = lBz is further characterized as symmetric if both A and B are symmetric and B is positive definite (all positive eigenvalues).
To determine all the eigenvalues W and their corres-
ponding eigenvectors Z for the real symmetric generalized eigenproblem Az = hBz of order N, the recommended EISPACK path is:
CALL
REDUC(NM,N,A,B,fV2,1ERR)
IF (IERR °NE. 0) GO TO 99999 CALL
TRED2(NM,N,A,W,fvl,Z)
CALL
TQL2(NM,N,W,fvl,Z,IERR)
IF (IERR .NE. 0) GO TO 99999 CALL
REBAK(NM,N,B,fv2,N,Z)
or, using driver subroutine RSG:
CALL
RSG(NM, N,A,B,W,I,Z,2~I,fv2,1ERR)
IF (IERR ~NE. 0) GO TO 99999
or, using EISPAC:
CALL EISPAC(NM,N,MATA('REAL',A,'SYMMETRIC'),MATB('REAL',B,'SYMMETRIC', 'POSITIVE DEFINITE'),VALUES(W),VECTOR(Z))
This path returns the eigenvalues in ascending order and a set of eigenvectors normalized so that zTBz = I; it preserves the full upper triangle of B and the strict upper triangle of A. Suitable dimensions for the arrays are: Z(~,~),
fvl(nm),
and
fv2(r~).
22
A(~,~),
B(~,r~), W(~),
2.1-16
The array storage required to execute this path is 3N 2 + 3N working precision words.
However, for this particular path the eigenvectors can
overwrite the A matrix if the same array parameter is used for both A and Z, thereby reducing the storage required to 2N 2 + 3N working precision words. Indicative execution times for this path (run on an IBM 370/195) are .009, .049, .30, and 2.0 seconds for sample systems of order I0, 20, 40, and 80 respectively. A variant of this path substitutes the implicit for the explicit QL shift; see Section 2.2.3 of [I0]. Variants of the problem itself are discussed in Section 2.2.2 of this volume.
23
2.1-17
Section 2.1~6 ALL EIGENVALUES OF A GENEP~IIZED REAL SYMMETRIC MATRIX SYSTEM
The real generalized eigenproblem Az = hBz is further characterized as symmetric if both A and B are symmetric and B is positive definite (all positive eigenvalues).
To determine all the eigenvalues W for the real
symmetric generalized eigenproblem Az = hBz of order N, the recommended EISPACK path is:
CALL
REDUC(NM,N,A,B,fv2,1ERR)
IF (IERR .NE. 0) GO TO 99999 CALL
TREDI(NM,N,A,W,fVl,fv2)
CALL TQLRAT(N,W,fV2,1ERR) IF (IERR .NE. 0) GO TO 99999
or, using driver subroutine RSG:
CALL
RSG(NM,N,A,B,W,O,DUMMY,fvf,fv2,1ERR)
IF (IERR .NE. 0) GO TO 99999
or, using EISPAC:
CALL EISPAC(NM,N,MATA('REAL',A,'SYMMETRIC'),MATB('REAL',B,'SYMMETRIC ' , 'POSITIVE DEFINITE'),VALUES(W))
This path returns the eigenvalues in ascending order; it preserves the full upper triangle of B and the strict upper triangle of A. Suitable dimensions for the arrays are:
fvl(~),
and
A(~,r~n), B ( ~ , ~ ) ,
W(~),
fv2(~).
The array storage required to execute this path is 2N 2 + 3N working precision words.
24
2.1-18
Indicative execution times for this path (run on an IBM 370/195) are .004, .019, .Ii, and .64 seconds for sample systems of order i0, 20, 40, and 80 respectively. Variants of this path substitute the explicit or implicit for the rational QL shift; see Section 2.2.3 of [i0]. Variants of the problem itself are discussed in Section 2.2.2 of this volume.
25
2.1-19
Section 2.1.7 SOME EIGENVALUES AND CORRESPONDING SYMMETRIC MATRIX SYSTEM
The real generalized symmetric
EIGENVECTORS
To determine
and B is positive definite
for the real syn~netrie generalized
CALL
as
(all
the eigenvalues W in an interval ex-
tending from F~B to RUB, together with their corresponding
recommended
REAL
eigenproblem Az = %Bz is further characterized
if both A and B are symmetric
positive eigenvalues).
OF A GENERALIZED
eigenvectors
Z,
eigenproblem Az = %Bz of order N, the
EISPACK path is:
REDUC(NM,N,A,B,fNg,IERR)
IF (IERR .NE. 0) GO TO 99999 CALL
TREDI(NM,N,A,fvl,fv2,fv3)
EPSI = 0.0 CALL
BISECT(N,EPSI,fvl,fv2,fV3,RLB,RUB,MM,M,W,iVI,IERR,fv4,fv5)
IF (IERR .NE. 0) GO TO 99999 CALL
TiNVIT(NM,N,fVT,fv2,fV3,M,W,ivl,Z,IERR,fv4,fv5,fv6,fvT,fv8)
IF (IERR .NE. 0) GO TO 99999 CALL
TRBAKI(NM,N,A,fv2,M,Z)
CALL
REBAK(NM,N,B,fv9,M,Z)
or, using EISPAC:
CALL EISPAC(NM,N,MATA('REAL',A,'SYMMETRIC'),MATB('REAL',B,'SYMMETRIC', 'POSITIVE DEFINITE'),VALUES(W,MM,M,RLB,RUB),VECTOR(Z))
The parameter computation.
EPSI is used to control
the accuracy of the eigenvalue
Setting it to zero or calling EISPAC without supplying
causes the use of a default value suitable for most matrices.
it
Further in-
formation about the use of EPSI can be found in Section 2.3.3 and in the BISECT and EISPAC documents.
Upon completion of the path, M is set to the
26
2.1-20
number of eigenvalues determined to lie in the interval defined by RLB and RUB and, provided M ! M M ,
the eigenvalues are in ascending order in W and
their corresponding eigenvectors, normalized so that zTBz = 1.0, are in the first M columns of Z.
Note that, should the computed M be greater than MM,
BISECT sets IERRnon-zero and does not compute any eigenvalues.
This path
preserves the full upper triangle of B and the strict upper triangle of A. Suitable dimensions for the arrays are: Z(nm,mm),
f~,8(mn),
A(nm,~), B(n~t,nm), W(mm),
fvl(rbm), fv2(nm), fv3(ro~), fv4(~), fv5(r~m), fv6(row), fvT(rom), fvg(nm), and
ivl(mm).
The array storage required to execute this path is 2N 2 + 9N + M(N+I) working precision words and M integer words. Indicative execution times for this path (run on an IBM 370/195), when computing all N eigenvalues and eigenvectors, are .023, .088, .41, and 2.1 seconds for sample systems of order I0, 20, 40, ~nd 80 respectively. Extrapolation of these execution times for cases where M is less than N is discussed in Section 4.1. Variants of this path substitute the rational QR method or the implicit QL method for the bisection process, allow the specification of boundary eigenvalue indices instead of an interval to the bisection process, or combine the determination of the eigenvalues and eigenvectors of the tridiagonal form into a single subroutine; see Sections 2.2.4, 2.2.7, 2.2.8, and 2.2.5 of [i0]. Variants of the problem itself are discussed in Section 2.2.2 of this volume.
27
2.1-21
Section 2.1.8 SOME EIGENVALUES
OF A GENERALIZED REAL SYMMETRIC MATRIX SYSTEM
The real generalized as symmetric
eigenproblemAz
= hBz is further characterized
if both A and B are symmetric and B is positive definite
positive eigenvalues).
To determine
(all
the eigenvalues W in an interval ex-
tending from RLB to RUB for the real symmetric generalized
eigenproblem
Az = hBz of order N, the recommended EISPACK path is:
CALL
REDUC(NM,N,A,B,fV2,1ERR)
IF (IERR ~NE. 0) GO TO 99999 CALL
TREDI(NM,N,A,fvf,fv2,fv3)
EPSI = 0.0 CALL
BISECT(N,EPSI,fvl,fv2,fV3,RLB,RUB,~,M,W,ivI,IERR,fv4,fvS)
IF (IERR .NE. 0) GO TO 99999
or, using EISPAC:
CALL EISPAC(NM,N,MATA('REAL',A,'SYMMETRIC'),MATB('REAL',B,'SYMMETRIC', 'POSITIVE DEFINITE'),VALUES(W,MM,M,RLB,RUB))
The parameter EPSI is used to control the accuracy of the eigenvalue computation.
Setting it to zero or calling EISPAC without supplying
causes the use of a default value suitable for most matrices. information
it
Further
about the use of EPSI can be found in Section 2.3.3 and in the
BISECT and EISPAC documents. number of eigenvalues
Upon completion
determined
RUB and, provided M ! M M ,
of the path, M is set to the
to lie in the interval defined by RLB and
the eigenvalues
are in ascending order in W.
Note that~ should the computed M be greater than MM, BISECT sets IERR non-zero and does not compute any eigenvalues.
This path preserves
full upper triangle of B and the strict upper triangle of A.
28
the
2.1-22
Suitable dimensions for the arrays are:
fvl(nm), fv2(nm), fv3(nm), fv4(r~), fvS(n~),
A(nm,nm), B(nm,nm), W(mm), and
ivl(m~).
The array storage required to execute this path is 2N 2 + 5N + M working precision words and M integer words. Indicative execution times for this path (run on an IBM 370/195), when computing all N eigenvalues, are .019, .069, .29, and 1.3 seconds for sample systems of order I0, 20, 40, and 80 respectively.
Extrapolation of
these execution times for cases where M is less than N is discussed in Section 4.1. Variants of this path substitute the rational QR method for the bisection process or allow the specification of boundary eigenvalue indices instead of an interval to the bisection process; see Sections 2.2.4 and 2.2.8 of [i0]. Variants of the problem itself are discussed in Section 2.2.2 of this volume.
29
2.1-23
Section 2.1.9 ALL EIGENVALUES AND CORRESPONDING EIGENVECTORS OF A GENERALIZED REAL MATRIX SYSTEM
To determine all the eigenvalues (ALFR,ALFI,BETA) and their corresponding eigenvectors Z for the real generalized eigenproblem Az = %Bz of order N, the r e c o ~ e n d e d EISPACK path is:
CALL QZHES(NM,N,A,B, oTRUE.,Z) CALL QZIT(NM,N,A,B,EPSi,oTRUE.,Z,IERR) CALL QZVAL(NM,N,A,B,ALFR,ALFI,BETA,.TRUE.,Z) IF (IERR .NE. 0) GO TO 99999 CALL QZVEC(NM, N,A,B,ALFR,ALFI,BETA, Z)
or, using driver subroutine RGG:
CALL RGG(NM,N,A,B,ALFR,ALFI,BETA, I,Z,IERR) IF (IERR .NE. 0) GO TO 99999
or, using EISPAC:
CALL EISPAC(NM,N,MATA(~REAL',A),MATB('REAL',B), VALUES(ALFR,ALFI,BETA),VECTOR(Z))
BETA is always non-negative~
The triplet (ALFR,ALFI,BETA) returned by
the path can be transformed to the eigenvalue itself by two divisions, ALFR/BETA to produce the real part and ALFI/BETA to produce the imaginary part.
The divisions are not performed within the programs because of the
possible loss of information content in those situations where B or both A and B are nearly singular or even singular (see Section 2~3.1). The parameter EPSI is used to control the accuracy of the eigenvalue computation.
Setting it to zero or calling EISPAC without supplying it
30
2.1-24
causes the use of a default value suitable for most systems.
Further
information about the use of EPSI can be found in Section 2.3.3 and in the QZIT and EISPAC documents. Pairs of complex eigenvalues are stored in consecutive elements of (ALFR,ALFI,BETA) with that member of the pair with positive imaginary part first.
The corresponding columns of Z contain the real and imaginary parts,
respectively, of the eigenvector associated with the eigenvalue of positive imaginary part.
See Section 2.3.2 for a discussion of the eigenvector
packing into Z. Each eigenvector of Z is normalized so that the modulus of its largest component is 1.0.
This path destroys A and B.
Suitable dimensions for the arrays are:
A(~,~),
B(~,r~), ALFR(~n),
ALFI(~), BETA(r~w), and Z(~,r~). The array storage required to execute this path is 3N 2 + 3N working precision words. Indicative execution times for this path (run on an IBM 370/195) are .026, .17, 1.0, and 7.0 seconds for sample systems of order i0, 20, 40, and 80 respectively.
31
2.1-25
Section 2.1.10 ALL EIGENVALUES
OF A GENERALIZED REAL MATRIX SYSTEM
To determine generalized
all the eigenvalues
(ALFR,ALFI,BETA)
for the real
eigenproblem Az = %Bz of order N, the recommended
EISPACK path
is:
CALL QZHES(NM,N,A,B,.FALSE.,DUMMY) CALL QZIT(NM,N,A,B,EPSI,.FALSE.,DUMMY,IERR) CALL QZVAL(NrM,N,A,B,ALFR,ALFI,BETA,.FALSE.,DUM~) IF (!ERR .NE. 0) C~ TO 99999
or, using driver subroutine RGG:
CALL RGG(NM,N,A,B~ALFR,ALFI,BETA,O,DUMMY,IERR) IF (IERR .NE. O) GO TO 99999
or, using EISPAC:
CALL EISPAC(NM,N,MATA('REAL',A),MATB('REAL',B),VALUES(ALFR,ALFI,BETA))
BETA is always non-negative. by the path can be transformed ALFR/BETA part~
(ALFR,ALFI,BETA)
returned
to the eigenvalue
itself by two divisions,
to produce the real part and ALFI/BETA
to produce the imaginary
The divisions
possible
The triplet
are not performed within the programs because of the
loss of information
content in those situations where B or both A
and B are nearly singular or even singular
(see Section 2.3.1).
The parameter EPSI is used to control the accuracy of the eigenvalue computation.
Setting it to zero or calling EISPAC without
supplying
causes the use of a default value suitable for most systems.
it
Further in-
formation about the use of EPSI can be found in Section 2.3.3 and in the QZIT and EISPAC documents.
32
2.1-26
Pairs of complex eigenvalues are stored in consecutive elements of (ALFR, ALFI,BETA) with that member of the pair with positive imaginary part first. This path destroys A and B. Suitable dimensions for the arrays are:
A(~,r~),
B(~,~),
ALFR(~),
ALFI(r~), and BETA(n). The array storage required to execute this path is 2N 2 + 3N working precision words. Indicative execution times for this path (run on an IBM 370/195) are .020, .II, .63, and 4.2 seconds for sample systems of order I0, 20, 40, and 80 respectively.
33
2.2-1
Section 2.2 VARIATIONS OF THE RECOMMENDED EISPACK PATHS
This section describes variants of the recommended paths given in Section 2.1,
These variants are obtained by modifying one or more of the
call or ancillary statements in the reco~nended paths; they provide some additional or alternate capability.
The variant paths are related to:
the
use of the QR algorithm for finding a few eigenvalues of real sy~mnetric band matrices; and the capacity for solving alternate representations of the real symmetric generalized eigenproblem.
The variant paths are described
in terms of modifications to the recommended paths; to illustrate the modifications,
examples of each of the variant paths are given,
34
2.2-2
Section 2.2.1 THE QR ALGORITHM FOR REAL SYMMETRIC BAND MATRICES
The recommended paths of Sections 2.1.1-2.1.4 for real symmetric band matrices all employ subroutine BANDR to first reduce the matrix to tridiagonal form, followed by an iterative step to determine the eigenvalues.
When the
problem requires only the determination of the eigenvalue nearest to a prescribed number and possibly a few neighbors, it may be advantageous to use subroutine BQR which applies the QR algorithm directly to the input matrix, thus telescoping the otherwise separate reduction and iterative steps. Subroutine BQR determines exactly one eigenvalue when called, but in so doing deflates the problem such that a further call can easily be made to determine another value.
In fact, the only action that the user needs to
take after storing the returned eigenvalue is to decrement the parameter specifying the order of the matrix and call BQR again. BQRwill matrix.
usually find the eigenvalue of smallest modulus of the input
If, more generally, the eigenvalue nearest to a prescribed number
T is desired, BQR can be presented an input matrix derived from the original matrix by shifting (diminishing) the diagonal elements by T; when T is added back to the eigenvalue of smallest modulus of the shifted matrix, one obtains the eigenvalue of the original matrix nearest to T.
In the execution of BQR,
further shifting is done, with accumulation of the shift into T, until the resultant matrix has a zero eigenvalue -- indeed has a zero final row and column, thus simultaneously isolating an eigenvalue and deflating to next lower order. As an example of the use of BQR, to find the two eigenvalues W(1) and W(2) nearest to 4.0 of a real symmetric band matrix A of order N and (half) band width MB, the following program segment might be used:
35
2.2-3
T=4.0 DO i00 i = i, N i00 A(I,I)
= A(I,Z) - T
R=0.O CALL
BQR(NM,N,MB,A,T,R, IERR,NV,fvl)
W(1) = T CALL BQR(NM,N-I ,MB ,A, T, R, IERR, NV, fvT) W(2) = T
R is used to decide when the last row and column of the current formed band matrix can be regarded
as negligible.
trans-
It should be set to zero
for the initial call and is reset in BQR to a value suitable for the subsequent call~ NV communicates
the dimension of the temporary array
at least 2 ~ 2 + 4 ~
fvl
which must be
- 3.
Suitable dimensions
for the arrays are A(~zn,mb)
The array storage required
and f v 7 ( 2 ~ 2 + 4 ~ - 3 ) .
to execute this path is MB(N+2MB+4)
- 3 work-
ing precision words. Indicative when computing are ~011, band width
~055,
execution
times for this subroutine
the single eigenvalue
(run on an IBM 370/195),
of a random matrix nearest
.30, and 2.0 seconds for sample matrices
(10,3),
of these execution
(20,6),
of order and (half)
(40,12), and (80,24) respectively.
times for matrices
of different
to T = 0.0
Extrapolation
(half) band widths is dis-
cussed in Section 4.5. If eigenvectors
corresponding
to the computed
eigenvalues
subroutine BANDV can be called exactly as in the recommended Section 2.1~3.
are desired,
path of
Here also the input matrix would have to be saved initially,
since BQR destroys
it.
The control program EISPAC does not use BQR. 36
2.2-4
Section 2.2.2 VARIANTS OF THE REAL SYMMETRIC GENERALIZED EIGENPROBLEM
The real symmetric generalized
eigenproblem Az = IBz, for which the
recommended basic paths of Sections 2.1.5-2.1.8 that can be solved with EISPACK;
namely,
apply, has two variants
the problems ABz = Iz and BAz = Iz.
Indeed, only two additional EISPACK members are invoked as can be seen from the following discussion. Since B is symmetric and positive definite, B = LL T exists, then transformed
enabling the problem Az = IBz to be rewritten Az = ILLTz and to an equivalent
A 1 = L-IAL -T and y = LTz. problem, tines, for z.
its Cholesky factorization
the generalized
standard symmetric problem AlY = ly with
Thus, given the capacity to solve the standard problem can be solved with two additional
subrou-
one to determine and compose L-IAL -T and the other to solve LTz = y In EISPACK these subroutines
employed in the paths of Sections
are REDUC and REBAK, respectively,
2.1.5-2.1.8.
If the problem arises instead in the form ABz = Iz, then again proceeding from the Cholesky factorization
of B, it can be transformed
to the
standard problem A2Y = ly with A 2 = LTAL and y, although different, to z by y = LTz as before. LTAL and thus, with REBAK, Finally,
related
The additional EISPACK subroutine REDUC2 forms enables the solution of this variant problem.
the problem BAz = Iz can be transformed
to the standard problem
A2x = Ix with A 2 = LTAL as for the variant ABz = Iz, and x = L-iz.
The one
further EISPACK subroutine REBAKB forms z = Lx and thus, with REDUC2,
enables
the solution of this variant problem. Corresponding
to each of the paths of Sections
explicit subroutine,
driver subroutine
calls for these variant problems.
(RSGAB and RSGBA),
For example,
37
2.1.5-2.1.8,
there are
and control program
to determine
all the eigenvalues
2.2-5
W and their corresponding eigenvectors Z for the real symmetric generalized eigenproblem ABz = hz of order N, the recommended EISPACK path is (cf. Section 2.1.5):
CALL REDUC2(NM,N,A,B,fV2,1EIIR) IF (IERR oNE. O) GO TO 99999 CALL
TRED2(NM,N,A,W,fvl,Z)
CALL
TQL2(NM,N,W,fvl,Z,IERR)
IF (IERR .NE. 0) GO TO 99999 CALL
REBAK(NM,N,B,fv2,N,Z)
or, using driver subroutine RSGAB:
CALL
RSGAB(NM,N,A,B,W,I,Z,fvl,fv~,IERR)
IF (IERR ~NE. 0) GO TO 99999
or, using EISPAC:
CALL EISPAC(NM, N,MATA('REAL',A,'SYMMETRIC'),MATB('REAL',B,'SYMMETRIC', 'POSITIVE DEFINITE','ABX=LX'),VALUES(W),VECTOR(Z))
The eigenvectors here, as in the path of Section 2.1.5, are normalized so that zTBz = I. As a second example, to determine the eigenvalues W in an interval extending from RLB to RUB, together with their corresponding eigenvectors Z, for the real symmetric generalized eigenproblem BAz = hz of order N, the recommended EISPACK path is (cf. Section 2.1.7):
38
2.2-6
CALL
REDUC2(NM, N,A,B,fv9,1ERR)
IF (IERR .NE. O) GO TO 99999 CALL
TREDI(NM, N,A,fvl,fv2,fv3)
EPSI = 0.0 CALL
BISECT(N,EPSI,fvl,fv2,fv3,RLB,RUB,MM,M,W,ivl,IERR,fv4,fv5)
IF (IERR .NE. 0) GO TO 99999 CALL TINVIT(NM,N,fVl
,fv2,fv3,M,W,ivl ,Z, IERR,fv4,fv5,fv6,fvT,fvS)
IF (IERR .NE. 0) GO TO 99999 CALL
TRBAKI(NM,N,A,fV2,M,Z)
CALL
REBAKB(NM,N,B,fv9,M,Z)
or, using EISPAC:
CALL EISPAC(NM,N,MATA(' REAL' ,A, 'SYMMETRIC') ,MATB ('REAL' ,B, 'SYMMETRIC', 'POSITIVE DEFINITE','BAX=LX'),VALUES(W,MM,M,RLB,RUB),VECTOR(Z))
The eigenvectors here are normalized so that zTB-iz = 1.0. The paths for the variant problems share the characteristics of the corresponding paths of Sections 2.1.5-2.1.8 with respect to extent of input array preservation, suitable array dimensions, and required array storage.
The indicative execution times of Sections 2.1.5-2.1.8 extend
to the paths for the variant problems as well; more precise timing information is provided in Section 4.
39
2.3-1
Section 2.3 ADDITIONAL INFORMATION AND EXAMPLES
This section contains additional information about and examples of the use of EISPACK and the control program which are either too detailed to be included in the discussion of a particular path, or which apply to more than one path.
The specific topics covered include the representation of
the eigenvalues of generalized real matrix systems; the packing of the eigenvectors of generalized real matrix systems; considerations regarding the user-supplied error tolerance in the computation of the eigenvalues; possible ill-condition of the generalized real symmetric eigenproblem paths; higher degree eigenvalue problems; the solution of band systems of linear equations; the examination of the IERR parameter and intermediate results when using the control program EISPAC; and a s u m a r y of the possible values of IERR and their meanings.
The section concludes with two complete example
driver programs illustrating the use of EISPACK and the control program EISPAC.
40
2.3-2
Section 2.3.1 THE REPRESENTATION
OF THE EIGENVALUES
OF A GENERALIZED REAL MATRIX SYSTEM
The EISPACK routines which compute the eigenvalues
for the generalized
real matrix problem Az = %Bz do not return the %'s directly; singularity
or near singularity
of the eigenvalues
possible
of A and B dictate a different representation
that maximizes
their informational
content.
No special problems are posed when A is singular with B non-singular; the eigenvalues
are all finite with some of them zero.
singular with A non-singular, infinite.
But when B is
some of the eigenvalues must be thought of as
And finally, when both A and B are singular there may again be
infinite eigenvalues,
and in some extreme situations,
for example when A and
B have a common null space (non-zero vectors z for which Az = 0 and Bz = 0), the matrix A - %B will be singular for any choice of %. In practice with inexact data and imprecise arithmetic, to avoid making decisions about exact singularity. is reformulated
it is desirable
Consequently
the problem
to find pairs of scalars ~ and B for which
BAz = aBz .
The algorithm used in EISPACK determines
two unitary matrices Q and Z such
that QAZ and QBZ are both upper triangular.
Then the desired ~.j and Bj are
simply the diagonal elements of the two triangular matrices,
and it is
these quantities which are returned by the subroutine. Because the algorithm uses only unitary transformations, information %j = e./B.. JJ
there is more
in the individual ~. and B. than there is in the ratios ] 3 The errors in aj and $. are all about the same absolute size, J
namely the size of the errors in the input data (or of roundoff errors in the computation).
Consequently,
if an ~j or Bj is obtained which is about
41
2.3-3
the same size as the original matrix elements, determined by the data and the computation.
it can be regarded as accurately
If, however, it is smaller
than the input data, it must be regarded as having a correspondingly higher relative error. For example, about 1.0.
suppose the general size of the elements in A and B is
If ~. = 1,0 and 8. = 2.0, then %. = 0.5 to about the accuracy J J J
of the data; if instead ~.j = 1.0~i0 -6 and ~j = 2.0o10 -6 , then again %. = 0.5 but this time to six fewer figures of accuracy. J
In the extreme
case where e. and 8. are both about the size of the errors in the data or J ] of roundoff errors in the computation, singular to working accuracy.
then any value of % makes A - %B
If $, is very small but ~. is not, then %, J J J
should be regarded as infinite. These statements about accuracy are further complicated in the presence of multiple eigenvalues.
If %. is a zero of det(A-%B) J
of multiplicity m or
if it is an element of a cluster of m nearly equal zeros, and if c is the relative accuracy of the data, the order of c I/m."
then e. and 8. may have relative errors on J J
For example,
if %. is a double eigenvalue, J
then pertur-
bations on the order of 10 -6 in the data may cause perturbations on the order of 10 -3 in the corresponding ~. and B.. J J
42
2.3-4
Section 2.3.2 UNPACKING THE EIGENVECTORS OF A GENERALIZED REAL MATRIX SYSTEM
Since for a generalized real matrix system the complex eigenvalues and their corresponding eigenvectors occur as conjugate pairs and therefore both members of such a pair are determined once the real and imaginary parts of one member are known, only N 2 real numbers are required to recover all the eigenvectors of such a system.
The EISPACK routines which compute the eigen-
vectors of generalized real matrix systems take advantage of this fact (and so save storage) by packing both real and complex eigenvectors into one N by N matrix. In order to determine whether a given column of the matrix of eigenvectors represents a real eigenvector~ the real part of a complex eigenvector, or the imaginary part of a complex eigenvector, the imaginary part of the corresponding eigenvalue must be examined.
Perhaps the clearest way to describe
how this packing is done is to present a program segment which unpacks the matrix of eigenvectors into two separate matrices representing the real and imaginary parts of the eigenvectors. First, suppose that you have computed all the eigenvalues and eigenvectors of a generalized real matrix system according to Section 2.1.9.
The following
program segment unpacks the matrix Z of eigenvectors into matrices ZR and ZI, dimensioned ZR(~,r~) and Z I ( ~ , ~ ) .
Note that this program segment
utilizes the property of the EISPACK programs that for generalized real matrix systems the eigenvalues of each complex conjugate pair are ordered so that the eigenvalue of positive imaginary part appears first in (ALFR,ALFI, BETA).
43
2.3-5
DO 150 K = I, N IF (ALF!(K)
.hE. 0.0) GO TO ii0
DO I00 J = i, N
i00
ZR(J,K)
= Z(J,K)
ZI(J,K)
= 0.0
CONTINUE GO TO 150
ii0
IF (ALFI(K)
.LT. 0.0) GO TO 130
DO 120 J = i, N
120
ZR(J,K)
= Z(J,K)
ZI(J,K)
= Z(J,K+i)
CONTINUE GO TO 150
130
140
DO 140 J = I, N ZR(J,K)
= ZR(J,K-I)
ZI(J,K)
= -ZI(J,K-I)
CONTINUE
150 CONTINUE
Note
that this p r o g r a m segment has been designed
the same matrix;
if they are,
so that Z and ZR can be
then the fourth and tenth statements
be omitted.
44
can
2.3-6
Section 2.3.3 THE EPSI PARAMETER
As discussed in Section i, the various versions of the subroutines in EISPACK are designed to provide the best accuracy possible given the working precisions of the particular machines for which they are available.
For
most of the subroutines, accuracy is controlled by an internal variable, MACHEP ("machine epsilon"), whose value reflects the precision of the machine arithmetic and should not be altered.
However, user control of accuracy
is possible with subroutines BISECT and QZIT.
This accuracy control is
provided by the parameter EPSI, which principally affects the precision of the eigenvalues, and thus the eigenvectors as well, but which also has some effect on computation time.
Some of the considerations helpful in choosing
EPSI are discussed briefly below; further information can be found in the respective documents for the subroutines and in the Handbook ([i], pp. 249-256). In subroutine BISECT, the computation of an eigenvalue is considered to have converged when the refined interval [XU,X0] known to contain the eigenvalue satisfies the condition:
X0 - XU ~ 2 x MACHEP ×
(Ix01 + IxuI) +
EPSI
This condition has the character of a relative accuracy test for eigenvalues whose magnitudes are large with respect to EPSI/MACHEP, and that of an absolute accuracy test for eigenvalues of small magnitude.
EPSI is thus
an absolute error tolerance. When the input value of EPSI is zero (or negative) as in the recommended paths, BISECT automatically resets it to an appropriate default value for each submatrix; this default value is MACHEP times the larger (in magnitude)
45
2.3-7
Gerschgorin
bound for the eigenvalues
the above termination criterion
of that submatrix.
from requiring
in the eigenvalues which are near zero.
This value prevents
"unreasonably"
high accuracy
(In the implementation
of BISECT,
EPSI is actually set negative when the default value is requested. serves as a flag to cause the recomputation submatrix;
This
of the default value for each
the returned value of EPSI is this negative default value for
the final submatrix.) A positive positive
input value for EPSI will not be reset in BISECT.
input value of EPSI exceeds
is less stringent for eigenvalues tends to be reduced.
the default value,
the convergence
test
of smaller magnitude,
and computation
time
If EPSI is smaller than its default value,
gence test becomes more stringent and computation Care should be taken, however, the small eigenvalues input matrix;
though computation relationship
the additional
time tends to increase.
to perturbations
in the
precision will be meaningless.
Al-
time tends to increase with decreasing EPSI, the exact
is highly dependent
When eigenvectors
on the particular matrix.
are computed by the method of inverse iteration,
success of the computation puted eigenvalues.
the conver-
not to specify a smaller value for EPSI unless
are known to be insensitive
otherwise
When the
the
depends critically on the accuracy of the com-
Thus, when TINVIT follows BISECT, use of an EPSI larger
than the default value may result in failure of the eigenvector
calculation
to converge. In subroutine QZIT, an element of either A or B is considered
negligi-
ble if it is smaller than the product of EPSI and the respective matrix norm.
In particular,
an eigenvalue has converged when the lowest subdiagonal
element of A becomes negligible. EPSI requests
the default;
As with BISECT,
in QZIT, however,
46
a zero or negative value of
EPSI itself is not reset.
2.3-8
To use a value of EPSI other than the default,
the statement
EPSI = 0.0
in the paths should be replaced by a statement setting EPSI to the desired value.
When using the control program EISPAC, EPSI can be supplied for the
recommended
paths only by adding EPSI as the last subparameter
parameter.
Thus the VALUES parameter becomes:
...VALUES(W,MM,M,RLB,RUB,EPSI),...
as appropriate.
With EISPAC,
to the VALUES
or ...VALUES(ALFR,ALFI,BETA,EPSI),...
the input value of EPSI is not altered,
though the default value may be used in the computation.
47
even
2.3-9
Section 2.3.4 POSSIBLE
ILL-CONDITION
OF THE GENERALIZED
The solution of the generalized by the paths of Sections 2.1.5-2ol.8 definite and proceeds
REAL SYMMETRIC EIGENPROBLEM PATHS
real symmetric
eigenproblem Az = %Bz
demands that the matrix B be positive
from the Cholesky factorization
B = LL T.
The problem
is then reduced to the standard symmetric problem AiY = %y, where A I = L-IAL -T and y = LTz. is measured
The computed eigenvalues relative
to the size of the elements of A I.
and hence A 1 have large elements, tive errors~
are obtained with an accuracy which
the small eigenvalues
Consequently
if L -I
may have high rela-
This occurs when B is close to an indefinite matrix and is
indicated by the presence of eigenvalues
~ which are much larger than the
elements of A and B. The alternative
approach
in this situation is to ignore the symmetry and
simply use the paths of Sections 2.1.9-2.1.10 problem.
In addition to increased costs,
which are normalized non-zero
this approach produces
real eigeneigenvectors
in a different way and may produce eigenvalnes with
imaginary parts.
more accurate
for the generalized
However,
than those produced
the small eigenvalues will usually be
in the sy~m~etric
paths.
Furthermore,
the
size of the ~. and B~ give some indication of the accuracy obtained. 3 3 It is difficult to give precise guidelines for the choice among these two approaches.
The symmetric path is certainly preferable
if B is well conditioned
with respect to inversion and hence there are no large eigenvalues. badly conditioned,
or its properties
since it always produces programming,
are unknown,
accurate eigenva!ues.
but the increase in execution
duce eigenvalues
with non-zero
If B is
then the real path is safer
It requires little additional
time and the fact that it may pro-
imaginary parts means that it should probably be
used only for small problems or as a check on the accuracy of the symmetric path.
48
2.3-10
Section 2.3.5 HIGHER DEGREE EIGENVALUE PROBLEMS
EISPACK can be used to solve problems of the form
(lrc 0 + lr-ic I +...+ lCr_ 1 + Cr)X = 0
where C0,...,C r are given real matrices of order m. the scalars %j which make the matrix in parentheses to find the corresponding
null vectors x.. J
It is desired to find singular and possibly
In general,
the approach to this
problem involves forming two matrices A and B of order n = m-r, illustrated for the case r = 3, by
Iic2i -C I
A =
-C 3
0
I
Co B=
° I 0
The original problem is then equivalent
to the generalized
real eigenproblem
Az = ~Bz where
This can be solved using the paths of Sections
2.1.9-2.1.10.
there will be n values of ~, counting multiplicities. singular,
some of these values will be infinite
49
In general,
However,
if C O is
(see Section 2.3.1).
2,3-II
In particular,
if C O is the identity matrix,
then the problem is equi-
valent to the standard problem
Az = %z
which can be solved using the EISPACK subroutines Sections
2.!~8-2.1.I0
of [i0].
50
and paths described
in
2.9-12
Section 2.3.6 THE USE OF BANDV IN SOLVING BAND SYSTEMS OF LINEAR EQUATIONS Subroutine BANDV has appeared earlier in the recommended path of Section 2.1.3 that determines
some eigenvalues
and corresponding
eigenvectors
of a real symmetric band matrix.
BANDV can also be used to solve systems of
linear equations in band f o r m - -
in this usage the coefficient matrix may be
either symmetric or non-symmetric. of BANDV for determining non-symmetric
The extendibility an awareness
eigenvectors
band matrices
EISPACK for determining
is not fundamental;
towards the use
no allowance
the corresponding
eigenvalues.)
of BANDV to systems of linear equations derives from of an eigenvector associated with a speci-
itself depends on the solution of a linear system,
case a homogeneous
system.
where % is an approximate of an eigenvector,
for
is made simply because no capability exists in
that the determination
fied eigenvalue
(The symmetry requirement
in this
That is, BANDV solves the linear system (A-~l)x = b, eigenvalue and b the zero vector in the determination
and where % is a parameter
(commonly zero) and b a pre-
scribed constant vector in the solution of a system of linear equations. To signal the usage of BANDV to solve band systems of linear equations, set parameter E21 to 1.0 if the matrix is symmetric and to -I.0 if not (for eigenvectors, matrix~
E21 is set to 0.0 or 2.0), and transmit the band coefficient
the constant matrix, and parameters
tion for BANDV in Section 7.1. matrix;
that near singularity
in the documenta-
The solution matrix overwrites
the input band matrix is unaltered.
indicates
~ as described
The error parameter,
if set,
of the input matrix has been detected.
Execution time for BANDV in solving systems of linear equations approximate
the constant
the time for its use in eigenvector
Section 4.
51
determination,
should closely reported in
2.3-13
Section 2.3.7 ADDITIONAL
FACILITIES OF THE EISPAC CONTROL PROGRAM
The EISPAC control program has two facilities which increase its flexibility and range of application.
The first provides
the opportunity
to
examine the IERR parameter values returned by the EISPACK subroutines; second provides computation
the opportunity
proceeds,
to examine intermediate
the
results as the
much as can be done when the EISPACK subroutines
are
called explicitly. The facility integer variable,
to examine the value of IERR is invoked by setting an say IERROR,
to zero and supplying
it as the subparameter
of the keyword parameter ERROR in the call to EISPAC.
For example,
the path
of Section 2.1.10 becomes
IERROR = 0 CALL EISPAC(NM, N,MATA('REAL',A),MATB('REAL',B), VALUES(ALFR,ALFI,BETA) ,ERROR(IERROR))
To understand
the effect of supplying
of EISPAC when it is not supplied.
the ERROR keyword,
consider
When one of the subroutines
non-zero value of IERR, EISPAC prints a message describing terminates
execution of your program.
EISPAC behaves returns
instead as follows:
When ERROR(IERROR)
the behavior
returns a
the error and is supplied,
If no execution errors occur, EISPAC
to your program after execution of the path, and IERROR is still
equal to zero.
If one of the routines returns a positive value of IERR
(a "fatal error),
EISPAC terminates
(unless suppressed by initializing described
the path, prints the error message IERROR to a machine dependent value as
in Section 7.2), and then returns
equal to IERR.
Finally,
of IERR (a "non-fatal"
to your program with IERROR
if one of the routines returns a negative value
error), EISPAC completes
52
execution of the path in
2.3-14
order to produce some useful results, prints the error message, to your program with IERROR equal to IERR. IERR examination
and returns
Thus the principal use of the
facility is to enable you to retrieve useful partial
results when a non-fatal
error occurs; which results are useful is des-
cribed in the discussion of the particular path in Section 2.1 or 2.2 and is summarized in Table 3 of Section 2.3.8. The EISPAC facility to examine intermediate mode of operation
results is provided by a
in which EISPAC calls a user-supplied
subroutine just
before execution of the path begins,
and again after execution of each sub-
routine and auxiliary action in it.
You are free to choose the name of the
subroutine, correspond
say USUB, but the parameter list and declaration
statements must
to:
SUBROUTINE USUB(ISUBNO,NM,N,AR,AI,WR,WI,ZR,
ZI,MM,M,RLB,RUB,EPSI,
X
SELECT,IDEF,TYPE,IERR,LOW,IGH,BND,D,E,E2,1ND,INT,ORTR,SCALE,
X
TAU,ORTI,MII,NV,MB,BR,DL,ALFR,ALFI,BETA) REAL*8 AR(NM,NM),AI(NM,NM),WR(NM),WI(NM),ZR(NM,NM),ZI(NM,NM),
X
RLB,RUB,EPSI,BND(N),D(N),E(N),E2(N),ORTR(N),SCALE(N),
X
TAU(2,N),ORTI(N),BR(NM,NM),DL(N),ALFR(NM),ALFI(NM),BETA(NM) INTEGER ISUBNO,NM,N,MM,M,IDEF,IERR,LOW,IGN,IND(N),INT(N),MII,NV,MB LOGICAL SELECT(NM),TYPE
In order to avoid Fortran errors it is important dimensioned
as indicated
(except that M M m a y
of WR and of ZR and ZI, where appropriate),
that the array parameters be
be used for the last dimension even though some arrays might
not appear relevant to a particular path. You inform EISPAC that you wish to use the intermediate tion facility by inserting
the keyword parameter
53
result examina-
SUBR with subparameter
USUB
2.3-15
in the EISPAC call.
Note that the statement EXTERNAL USUB must also appear
in your calling program. When USUB is called by EISPAC,
the value of the integer parameter
ISUBNO is set to indicate which EISPACK subroutine
call or auxiliary action
has just been completed.
It is zero when USUB is called just before execu-
tion of the path begins.
IS~NO
the preceding
values in the range 100-299 signify that
action allocated or freed temporary storage,
range 300-499 indicate auxiliary actions for example)~
(initializing
and those beyond 500 correspond
routines as indicated
in Table 2.
those in the
or copying arrays,
to calls to the EISPACK sub-
Thus the value of ISUBNO indicates where
in the execution of a path USUB has been called, mine what action USUB is to take in examining
and can be used to deter-
the intermediate
results.
Table 2 also indicates which of the parameters passed to USUB appeared in the just-completed
call to the E!SPACK subroutine.
As an example of the use of this facility,
suppose you wish to inter-
rupt the path of Section 2.1.2 and use a subroutine TRDIAG to print the tridiagonal matrix produced eigenvalues
from the first step in the determination
of a real symmetric band matrix.
of the
Your driver program must con-
tain the statements
EXTERNAL TRDIAG o
'SYMMETRIC'),BAND(MB),VALUES(W),SUBR(TRDIAG))
CALL EISPAC(NM,N,MATRIX(VREAL',A,
To determine how to write TRDIAG,
consult the definition of the path in
Section 2.1.2 in conjunction with Table 2. from BANDR and is overwritten
The tridiagonal matrix is returned
in the subsequent
execution of TQLRAT,
interruption must be made immediately after the call to BANDR. cates that this call in this path has an associated
54
so the
Table 2 indi-
ISUBNO of 545, and
2.3-16
inspection of the parameters in the BANDR call (see BANDR documentation in Section 7) shows that the diagonal elements are in WR and the subdiagonal elements are in E.
Hence the subroutine might be written as follows:
SUBROUTINE TRDIAG (ISUBNO, NM, N, AR, AI,WR,WI, ZR, ZI, MM, M, RLB, RUB, EPS 1, X
SELECT, IDEF, TYPE, IERR,LOW, IGH, BND,D,E, E2, IND, INT, ORTR, SCALE,
X
TAU, ORTI ,MI 1 ,NV,MB, BR, DL,ALFR, ALFI, BETA) REAL*8 AR(NM,NM) ,AI(NM,NM) ,WR(NM) ,WI (NM) ,ZR(NM,NM) ,ZI(NM,NM),
X
RLB,RUB,EPSI ,BND (N) ,D(N) ,E(N) ,E2 (N) ,ORTR(N) ,SCALE(N),
X
TAU(2 ,N) ,ORTI (N) ,BR(NM,NM) ,DL (N) ,ALFR(NM) ,ALFI (NM) ,BETA (NM) INTEGER ISUBNO, NM, N,MM, M, IDEF, IERR, LOW, IGH, IND (N), INT (N) ,MI i, NV,MB LOGICAL SELECT (NM), TYPE IF (ISUBNO .RE. 545) RETURN WRITE(6, i000) (WR(1) ,E(1),I=I,N)
i000 FORMAT (19HITRIDIAGONAL MATRIX//(1X, IP2DI6.8) ) RETURN END TRDIAG immediately returns after every call from EISPAC except when ISUBNO is 545 (after BANDR); then it writes out the diagonal and subdiagonal elements of the reduced tridiagonal matrix from BANDR.
55
2.3-17
TABLE 2 ISUBNO VALUES AND PARAMETER NAMES FOR SUBROUTINE CALLS FROM EISPAC
Subroutine Call*
ISUBNO Value
544
BANDR (NM,N ,MB, AR,WR, E ,E,. TRUE. ,ZR) in path for all values and vectors
545
BANDR (NM,N,MB,AR,WR,E,E2, .FALSE. ,-) in path for all values, no vectors
546
(2.1.i)
(2.1.2)
BANJOR (NM,N,MB,AR,D,E,E2, .FALSE. ,-) in paths for some values (2.1.3, 2.1.4)
547
BANDV (NM,N,MB,-,E2(1) ,M,WR,ZR,IERR,NV,-,-)
526
BISECT (N ,EPS 1, D, E ,E2, RLB ,RUB ,MM,M,WR, IND, IERR,-, BND)
(not used)
BQR
(not used)
MINFIT
568
QZHES (NM,N,AR,BR, .TRUE. ,ZR) in path for all values and vectors (2.1.9)
572
QZHES (NM,N,AR,BR, .FALSE. ,-) in path for all values, no vectors (2.1.10)
569
QZIT (NM,N,AR,BR,EPSI, .TRUE. ,ZR,IERR) in path for all values and vectors
573
(2.1.9)
QZIT (NM,N,AR,BR,EPSI,oFALSE. ,-,IERR) in path for all values, no vectors (2.1.10)
570
QZVAL (NM,N,AR,BR,ALFR,ALFI,BETA, .TRUE. ,ZR) •n path for all values and vectors (2.1.9)
574
QZVAL (NM,N,AR,BR,ALFR,ALFI,BETA, .FALSE. ,-) in path for all values, no vectors (2.1.10)
571
QZVEC (NM,N,AR,BR,ALFR,ALFI, BETA, ZR)
551
REBAK (NM,N,BR,DL ,M,ZR)
550
~BAF~
548
REDUC (NM,N,AR,BR,DL, IERR)
(NM,N, BR,DL,M, ZR)
56
2.3-18
TABLE 2 (Contd.) ISUBNO VALUES AND PARAMETER NAMES FOR SUBROUTINE CALLS FROM EISPAC
ISUBNO Value 549 (not used)
Subroutine Call* REDUC2 (NM,N,AR,BR,DL, IERR) SVD
528
TINVIT (NM,N,D, E, E2 ,M,WR, IND, ZR, IERR,- ,- ,- ,-, BND)
543
TQLRAT (N,WR,E2,IERR)
542
TQL2 (NM,N,WR,E, ZR,IERR)
536
TRBAKI (NM,N,AR,E,M, ZR)
534
TREDI (NM,N,AR,WR,E ,E2) in path for all values, no vectors (2.1.6)
535
TREDI (NM,N,AR,D,E,E2) in paths for some values (2.1.7, 2.1.8)
533
TRED2 (NM,N,AR,WR,E, ZR)
A dash at some position in a parameter list indicates a temporary storage array which is not passed to the user subroutine by EISPAC.
57
2.3-19
Section 2.3.8 NON-ZERO VALUES OF IERR
This section summarizes
the non-zero values of the error parameter
IERR that can be returned by the EISPACK subroutines,
either directly or
via the control program (see Section 2.3.7), when an execution error is detected.
Such execution errors are classified
path-terminating
errors,
into two categories:
indicated by positive values of IERR and signifying
that although some possibly useful results have been obtained, execution of the path is meaningless;
second, non-terminating
cated by negative values of IERR and signifying already occurred,
some further meaningful
remaining part of the path is executed. in EISPACK corresponds
first,
continued errors,
indi-
that although errors have
results may be obtained Each distinct
if the
error that can occur
to one of a unique set of values for IERR, that one
being a function of the order of the matrix. The non-zero values of IERR are summarized this section.
To determine
the significance
in Table 3 at the end of
of a particular value of IERR,
scan the column headed IERR for the expression with the value of your particular
error.
The name of the subroutine
that set the error parameter
is included in the list to the right; also given is the EISPAC error message number and a brief description
of the significance
of the error.
tailed information may be obtained from the documentation subroutine
in Section 7.
58
More de-
for the particular
2.3-20
TABLE 3 SUMMARY OF VALUES OF IERR EISPAC MESSAGE
IERR
SUBROUTINES
i, l~
MINFIT,QZIT, RGG,RSB,RSG, RSGAB,RSGBA, SVD,TQLRAT, TQL2
N
BQR
3N+I
BISECT
03
The parameter MM specified insufficient storage to hold all the eigenvalues in the interval (RLB, RUB). The only useful result is M, which is set to the number of eigenvalues in this interval.
7N+ i
REDUC,REDUC2, RSG,RSGAB, RSGBA
07
The matrix BR is not positive definite as required in the real symmetric generalized paths. No useful results are produced.
-i, l~i~N
BANDV,TINVIT
50
The calculation of one or more of the eigenvectors including the i~h vector failed to converge; these vectors are set to zero. These failures may be caused by insufficient accuracy of the corresponding eigenvalues. All non-zero eigenvectors and their corresponding eigenvalues should be correct.
10N
RGG,RSB,RSG, RSGAB,RSGBA
The parameter N specifying the order of the input matrix or system exceeds the dimension parameter NM. No results are produced.
12N
RSB
Either the parameter MB specifying the (half) band width is nonpositive or it exceeds the matrix order N. No results are produced.
00
SIGNIFICANCE OF THE ERROR The calculation of the i th eigenvalue or singular value failed to converge. If MINFIT, QZIT (with QZVAL), RGG, or SVD was being used, the eigenvalues or singular values i+l,i+2,...,N should be correct; otherwise, the eigenvalues 1,2,...,i-i should be correct. In neither case are any eigenvectors correct. The calculation of the eigenvalue failed to converge.
59
2.3-21
Section 2.3.9 EXAMPLES
ILLUSTRATING
We illustrate
THE USE OF THE EISPACK SUBROUTINES AND THE CONTROL PROGRAM
the use of Section 2 in preparing
the same eigenprob!ems,
two programs
to solve
one program calling the EISPACK subroutines
and the other using the control program EISPAC.
The problems
are to find the
eigenvalues
in the interval
generalized
real symmetric matrix systems of orders 3 and 4, chosen to exhibit,
respectively,
normal and abnormal path termination.
these problems
is to illustrate
a somewhat complicated is probably
(0,3) and the corresponding
directly
path;
in practice,
put statements; program listing. are available
are complete
of two
The purpose of choosing
the use of this publication
in following
for such low order systems,
easier to use the paths that compute
The two sample programs
eigenvectors
it
the complete eigensystem.
in that they contain input and out-
the data for each case and the computed results accompany For both programs,
it is assumed that the EISPACK subroutines
in compiled form and that appropriate
Note that the EISPAC sample program also assumes EISPAC is available,
the
and may require additional
control cards are provided.
that the compiled form of control statements
that point
to EISPAC and the EISPACK subroutines. The EISPACK sample program is written in standard single precision Fortran IV, while the EISPAC sample program is written in IBM's long precision Fortran IV.
Both programs use Fortran logical unit 5 for input and Fortran
logical unit 6 for output. For these sample programs,
we assume more generally
that the order of
the input system will not exceed 20 and that the number of eigenvalues interval
(0~3) will not exceed 3.
in the
Thus the integer constants r~ and n~m dis-
cussed in Section 2.1 have the values 20 and 3 respectively.
60
2.3-22
Given the above eigenproblems, 2.1.7.
There,
are displayed. depend upon ~
the appropriate Dimensions
we are directed by Table i to Section
calls to the EISPACK subroutines
for the array variables
and to EISPAC
in the sample programs
and m m and hence from the above discussion,
the declaration
statements must be
working precision
A(20,20),B(20,20),W(3),Z(20,3)
working precision
FVI(20),FV2(20),FV3(20),FV4(20),FV5(20),FV6(20), FV7(20),FV8(20),FV9(20)
IV1(3)
INTEGER
To communicate
these dimensions
to the EISPACK subroutines
parameters NM and M M are set to 20 and 3 respectively. RLB and RUB are set to 0.0 and 3.0 respectively,
and to EISPAC,
the
Finally, variables
specifying
the interval
to
be searched for the eigenvalues. The matrices of the system are read row-wise from unit 5 and printed row-wise on unit 6.
The first sample system has one eigenvalue
(0,3), which with its corresponding
in the interval
eigenvector are printed on unit 6.
second sample system has more than three eigenvalues
in (0,3) and the path
is terminated after BISECT with IERR set to 13 = 3N+I. the EISPACK sample program distinguishes
The
For this system,
this error at statement
99999 from
other possible errors, prints the appropriate message on unit 6 and continues execution
(until a system of order zero is specified on unit 5).
sample program also distinguishes
The EISPAC
this error value from other possible error
values, prints a message numbered 03 on unit 6 and terminates execution. (See Section 2.3.7 for use of the ERROR keyword parameter tion. )
61
to continue execu-
2.3-23
LISTING OF THE EISPACK SAMPLE PROGRAM
C C C C C C C C C C C
SAMPLE PROGRAM ILLUSTRATING THE USE OF THE EISPACK SUBROUTINES. THIS PROGRAM READS REAL SYMMETRIC MATRICES A AND B FROM FORTRAN LOGICAL UNIT 5 AND COMPUTES EIGENVALUES W IN THE INTERVAL (0,3) AND THE ASSOCIATED EIGENVECTORS Z FOR THE GENERALIZED PROBLEM AZ = WBZ. SEE SECTION 2.1.7. REAL SYMMETRIC MATRICES A AND B, NO LARGER THAN ORDER REAL EIGENVALUES W, AT MOST 3 OF THEM. EIGENVECTORS Z, AT MOST 3 OF THEM. REAL REAL
C C C
20.
A(20, 20), B(20, 20), W(3), Z(20, 3) RLB, RUB, EPS I
TEMPORARY STORAGE ARRAYS. REAL +
C C C
FVI(20), FV2(20), FV3(20), FV4(20), FV5(20), FV6(20), FV7 (20), FV8(20), FV9(20) INTEGER IV1(3)
ROW AND COLUMN DIMENSION PARAMETERS ASSIGNED. ~M=20 MM=3
C C
READ IN THE REAL SYMMETRIC MATRICES OF ORDER
N
ROW-WISE.
C 10 READ(5,20) N 20 FORMAT(14) IF (N .LE. 0) STOP C DO 40 I = 1, N READ(5, 30) (A(I, J), J=l, N) 30 FORMAT(4EI6.8) 40 CONTINUE C DO 45 I = 1, N READ(5, 30) (B(I, J), J=1, N) 45 CONTINUE C WRITE(6, 50) N 50 FORMAT(///23H ORDER OF THE SYSTEM IS, 14//16H MATRIX ELEMENTS) C DO 70 I = I, N
WRITE(6,60) (A(I, J),J=I,N) 60 FORMAT( 1X, 1P4E16.8) 70 CONTINUE C WRITE(6, 60) C DO 75 I = 1, N
WRITE(6,60) (B(I,J), J=I,N) 75 CONTINUE
62
2.3-24
LISTING OF THE EISPACK SAMPLE PROGRAM (CONTD.)
INITIALIZE THE INTERVAL (RLB, RUB). RLB = 0.0 RUB = 3.0 THE FOLLOWING PATH IS COPIED FROM SECTION 2.1.7. CALL REDUC(NM, N,A,B, FV9, IERR) IF (IERR .NE. 0) GO TO 99999 CALL TREDI(NM, N,A, FV1, FV2, FV3) EPS1 = 0.0 CALL BISECT(N, EPS1, FV1,FV2, FV3, RLB, RUB, MM, M,W, IVI, IERR, FV4, FV5) IF (IERR .NE. 0) GO TO 99999 CALL TINVIT(NM, N, FV1,FV2, FV3,M,W, IV1,Z, IERR, FV4, FV5, FV6, FV7, FV8) IF (IERR .NE. 0) GO TO 99999 CALL TRBAKI(B~M,N,A, FV2,M,Z) CALL REBAK(NM, N,B, FVg,M,Z) PRINT THE
M
EIGENVALUES AND CORRESPONDING EIGENVECTORS.
IF (M .EQ. 0) GO TO 88888 WRITE(6,90) M 9O FORMAT(/47H NUMBER OF EIGENVALUES IN THE INTERVAL (0,3) IS, 14) DO 110 I = 1, M WRITE(6,100) W(1),(Z(J,I),J=I,N) 100 FORMAT(/IIH EIGENVALUE/1X, IPE16.8//14H CORRESPONDING, + 12H EIGENVECTOR/(1X, 3E16.8)) 110 CONTINUE GO TO 10 C THERE ARE NO EIGENVALUES IN (0,3). C C 88888 ~ITE(6,88100) 88100 FORMAT(48HONO EIGENVALUES OF SYSTEM IN THE INTERVAL (0,3).) GO TO I0 C C HANDLING OF IERR PARAMETER C 99999 IF (IERR .GT. 0) GO TO 99200 IERR = -IERR WRITE(6,99100) IERR 99100 FORMAT(52HOAT LEAST ONE EIGENVECTOR FAILED TO CONVERGE, NAMELY, 15) GO TO i0 C 99200 IF (IERR .EQ. 7"N+1) WRITE(6,99250) 99250 FORMAT(/35M MATRIX B IS NOT POSITIVE DEFINITE.) IF (IERR .EQ. 3"N+I) ~ITE(6,99300) M 99300 FORMAT(/35H NOT ENOUGH SPACE ALLOCATED FOR THE, 14, + 35H EIGENVALUES IN THE INTERVAL (0,3).) GO TO 10 END 68
2.3-25
LISTING OF THE EISPAC SAMPLE PROGRAM
SAMPLE PROGRAM ILLUSTRATING THE USE OF THE CONTROL PROGRAM EISPAC. THIS PROGRAM READS REAL SYMMETRIC MATRICES A AND B FROM FORTRAN LOGICAL UNIT 5 AND COMPUTES EIGENVALUES W IN THE INTERVAL (0,3) AND THE ASSOCIATED EIGENVECTORS Z FOR THE GENERALIZED PROBLEM AZ = WBZ. SEE SECTION 2.1.7. REAL SYMMETRIC MATRICES A AND B, NO LARGER THAN ORDER REAL EIGENVALUES Wp AT MOST 3 OF THEM. EIGENVECTORS Z, AT MOST 3 OF THEM. REAL*8 REAL*8
20.
A(20, 20), B(20, 20), W(3), Z(20, 3) RLB, RUB, EPS 1
ROW AND COLUMN DIMENSION PARAMETERS ASSIGNED. ~M=
20
MM=3 READ IN THE REAL SYMMETRIC MATRICES OF ORDER
N
ROW-WISE.
i0 READ(5,20) N 20 FORMAT(14) !F (N oLE. 0) STOP DO 40 1 = i, N READ(5,30) (A(I,J),J=I,N) 30 FORMAT(4D16.8) 40 CONTINUE DO 45 1 = 1, N READ(5,30) (B(I,J),J=I,N) 45 CONTINUE WRITE(6,50) N 50 FORMAT(///23H ORDER OF THE SYSTEM IS, 14//16H MATRIX ELEMENTS) DO 70 1 = 1, N
WRITE(6,60) (A(I,J),J=I,N) 60 FORMAT(IX, IP4D16.8) 70 CONTINUE WRITE(6,60)
DO 75 1 : 1, N WRITE(6, 60) (B(I, J),d:l, N) 75 CONT INUE
64
2.3-26
LISTING OF THE EISPAG SAMPLE PROGRAM (CONTD,)
INITIALIZE THE INTERVAL (RLB, RUB). RLB = 0.0D0 RUB = 3.0D0 THE FOLLOWING CALL IS COPIED FROM SECTION 2.1.7.
+ +
CALL EISPAC(NM, N, MATA('REAL',A,'SY~ETRIC'), MATB('REAL',B,'SYMMETRIC','POSITIVE DEFINITE'), VALUES(W, MM, M, RLB, RUB),VECTOR(Z)) PRINT THE
M
EIGENVALUES AND CORRESPONDING EIGENVECTORS.
ARE THERE ANY EIGENVALUES IN (0,3)? IF (M .NE. 0) GO TO 90 NO. WRITE(6, 80) 80 FORMAT(48HONO EIGENVALUES OF SYSTEM IN THE INTERVAL (0,3).) GO TO 10 YES. 90 WRITE(6,100) M 100 FORMAT(/47H NUMBER OF EIGENVALUES IN THE INTERVAL (0,3) IS, I4) DO 120 I = 1, M
WRITE(6,110) W(1),(Z(J,I),J=I,N) FORMAT(/11H EIGENVALUE/IX, 1PD16.8//14H CORRESPONDING, + 12H EIGENVECTOR/(1X,3D16.8)) 120 CONTINUE 110
GO TO 10 END
65
L~
P~
0
Y
2.3-28
OUTPUT FROM THE EISPACK SAMPLE PROGRAM PRINTED ON UNIT 6
ORDER OF THE SYSTEM IS
3
MATRIX ELEMENTS -I.00000000E 00 1.00000000E 00 -1.00000000E 00 1.00000000E 00 1.00000000E O0 -1.00000000E 00 -1.00000000E 00 -1.00000000E 00 1.00000000E 00 2.00000000E 00 1.00000000E 00 0.0
1.00000000E 00 2.00000000E 00 1.00000000E 00
0.0 1.00000000E 00 2.00000000E 00
NUMBER OF EIGENVALUES IN THE INTERVAL (0,3) IS
I
EIGENVALUE 1.99999905E 00 CORRESPONDING EIGENVECTOR 4.21468599E-07 7.07105637E-01 -7.07107246E-01
ORDER OF THE SYSTEM IS
4
MATRIX ELEMENTS 1.87500000E 00 -5.00000000E-01 3.75000000E-01 -2.50000000E-01 -5.00000000E-01 2.25000000E 00 -2.50000000E-01 -3.75000000E-01 3.75000000E-01 -2.50000000E-01 2.12500000E 00 -1.25000000E~01 -2.50000000E-01 -3.75000000E-01 -1.25000000E-01 2.12500000E O0 6.00000000E 00 3.00000000E 00 0.0 0.0
3.00000000E 00 6.00000000E 00 3.00000000E 00 0.0
NOT ENOUGH SPACE ALLOCATED FOR THE
0.0 3.00000000E 00 6.00000000E 00 3.00000000E 00
0.0 0.0 3.00000000E 00 6.00000000E 00
4 EIGENVALUES IN THE INTERVAL (0,3).
67
2.3-29
OUTPUT FROM THE EISPAC SAMPLE PROGRAM PRINTED ON UNIT 6
ORDER OF THE SYSTEM iS
3
MATRIX ELEMENTS -I.0O000000D 00 1.00000000D 00 -1.00000000D 00 1.00000000D 00 1.00000000D 00 -1.00000000D 00 -1.00000000D 00 -I.00000000D 00 1.00000000D 00 2.00000000D 00 1.00000000D 00 0.0
1.00000000D 00 2.00000000D 00 1.00000000D 00
0.0 1.00000000D 00 2.00000000D 00
NUMBER OF EIGENVALUES IN THE INTERVAL (0,3) IS EIGENVALUE 2.00000000D 00 CORRESPONDING EIGENVECTOR 2.94392336D-17 7.07106781D-01 -7.07106781D-01
ORDER OF THE SYSTEM IS
4
MATRIX ELEMENTS 1.87500000D 00 -5.00000000D-01 3.75000000D-01 -2.50000000D-01 -5.00000000D-01 2.25000000D 00 -2.50000000D-01 -3.75000000D-01 3.75000000D-01 -2.50000000D-01 2.12500000D 00 -1.25000000D-01 -2.50000000D-01 -3.75000000D-01 -1.25000000D-01 2.12500000D 00 6.00000000D 00 3.00000000D 00 0.0 0.0
3.00000000D 00 6.00000000D 00 3.00000000D 00 0.0
0.0 3.00000000D 00 6.00000000D 00 3.00000000D 0O
0.0 0.0 3.00000000D 00 6.00000000D 00
EISPAC EXECUTION PHASE ERROR(S)... 03 IF PARAMETER MM WAS USED, MM SPECIFIED INSUFFICIENT STORAGE TO HOLD ALL EIGENVALUES IN THE INTERVAL RLB TO RUB. IF PARAMETER Mll WAS USED, MULTIPLE EIGENVALUES AT INDEX Mll MAKE UNIQUE SELECTION IMPOSSIBLE. EXECUTION TERMI~TED.
68
2.4-1
Section 2.4 SINGULAR VALUE DECOMPOSITION WITH EISPACK
This section discusses the Singular Value Decomposition, a matrix factorization that involves eigenvalues but which has applications to many problems that do not explicitly refer to eigenvalues.
Two subroutines, SVD
and MINFIT, provide the EISPACK capability for singular value decomposition. The two subroutines overlap to a certain extent, but in their respective principal applications they complement each other in much the same way as matrix inversion and linear equation solving subroutines do. The first subsection of this section defines the singular value decomposition and describes how it provides information for estimating the rank of a matrix.
The next subsection describes the use of subroutines SVD and MINFIT
in computing selected elements of the decomposition.
The final three sub-
sections identify the related applications of the decompositions from SVD and MINFIT to the determination of the pseudo-inverse of a rectangular matrix and to the minimal norm least squares solution of an associated set of linear equations, respectively, and their joint applicability to the solution of homogeneous systems of equations.
2.4-2
Section 2.4.1 THE SINGULAR VALUE DECOMPOSITION AND RANK ESTIMATION
The Singular Value Decomposition proceeds from a real rectangular matrix A with M rows and N columns.
M and N are not constrained but the primary
applications of the decomposition have M ~ N.
The decomposition is commonly
written
A=UEV
T
where E is an N by N diagonal matrix with non-negative entries oj, J=I,o..,N, and U and V are matrices with orthonormal columns of dimensions M by N and N by N, respectively.
Note that U has the same dimensions as A and that V
has as many columns as A but is square.
The elements o. of E are denoted J
the singular values of A, and the columns of U and V are the left and right singular vectors, respectively. Theoretically,
the singular value decomposition can be characterized by
the fact that the singular values are the square roots of the eigenvalues of ATA, the columns of V are the corresponding eigenvectors, and the columns of U are a certain subset of the eigenvectors of AA T.
However, this is not a
satisfactory basis for computation because roundoff errors in the formation of ATA often destroy pertinent information. Most applications of the singular value decomposition require the specification of a tolerance or zero threshold ~o
In problems involving experi-
mental or other inexact data, this tolerance should reflect the absolute accuracy of the matrix elements.
Thus if &ij are the errors in aij , then
an appropriate value for T satisfies
T ~max.. IAij I 1,j
70
2.4-3
In problems where the matrix elements are known exactly or are contaminated only by roundoff error, an appropriate
T > ~.e.max --
T is
o. j
J
where g is the relative accuracy of the floating point arithmetic MACHEP in the EISPACK subroutines). its exact value is not critical;
Although this tolerance
in many situations
effect of using several different values. describe applications
(called
is important,
it is useful to test the
In particular,
of the singular value decomposition
Sections 2.4.3-2.4.5 each of which can
be affected by the choice of T. One fundamental application determination
of the singular value decomposition
is the
of the effective or numerical rank of a matrix whose elements
are not known exactly.
Roughly,
the effective rank is the largest number
of columns of the matrix which are linearly independent transformations
to within the
threshold T.
Since the orthogonal
of U and V preserve linear
independence,
the ranks of A and Z are the same, and the effective rank can
be precisely defined to be the number of singular values which are greater than ~.
A matrix with M > N is said to have "full rank" if its effective
rank is N.
71
2.4-4
Section 2.4.2 SUBROUTINES
SVD AND MINFIT
Subroutine
SVD computes the singular value decomposition
an arbitrary rectangular matrix A (see Section 2.4.1);
A = U ~ V T of
it stores the diagonal
matrix E as a vector W, and optionally accumulates
the orthogonal
tions into U and/or V.
the singular values W and
the transformation decomposition
To determine,
for example,
transforma-
matrices U and V associated with the singular value
of the M by N matrix A, the call to SVD is:
CALL SVD(NM, M,N,A,W,.TRUEo,U,.TRUE.,V,IERR,fvT)
To avoid accumulating
U or V, replace
.TRUE. by .FALSE.
sequence position ahead of the corresponding V array is not referenced be provided
array identifier;
note that the
if preceded by .FALSE. hut that the U array must
for use as intermediate
not accumulated.
in the calling
SVD returns
storage even when the transformations
the singular values unordered;
are
it leaves A
unaltered. Suitable dimensions V(r~w,~),
and
fvl(~).
for the arrays are: (Note that N ! ~
The array storage required words,
reducible
to 2N(M+I)
A(~,~),
W(~),
U(r~n,~m),
and M ! r~ must both be satisfied.)
for SVD is 2N + max(M,N)-3N working precision
if V is not requested.
Furthermore,
either U or
V may overwrite A, thereby reducing storage correspondingly. SVD executes properly when either M > N or M < N; it is generally more efficient, transpose
however, when a matrix is proposed with M < N to present its instead to SVD and interchange
Indicative .065,
execution
the roles of U and V.
times for SVD (run on an IBM 370/195)
are o011,
.43, and 3.0 seconds for sample problems with M = N of order i0, 20,
40, and 80 respectively,
where both U and V are requested.
72
Extrapolation
of
2.4-5
these execution times for cases where M differs from N is discussed in Section 4.5. Subroutine MINFIT computes the elements E and V of the singular value decomposition of A, but instead of U forms uTB where B is a prescribed matrix with the same number of rows as A (anticipating the application described in Section 2.4.4).
It stores the diagonal matrix ~ as a vector W,
and overwrites A with V and B with uTB.
To determine the singular values
W and the transformation matrix V associated with the singular value decomposition of the M by N matrix A and to form uTB atop the M by IP matrix B, the call to MINFIT is:
CALL MINFIT (NM,M,N,A, W, IP ,B, IERR, fv l )
IP can be 0 in which case B is not referenced.
MINFIT returns the
singular values unordered (exactly as from SVD); as described above, A is overwritten by V and B by uTB. Suitable dimensions for the arrays are:
fvT(n~).
(Note that N ! n m
and M ! n m
A(nm,nm), W(nm), B(nm,ip), and
must both be satisfied.)
The array storage required for MINFIT is 2N +max(M,N)-(N+IP)
working
precision words. Indicative execution times for MINFIT (run on an IBM 370/195) are .009, .047, .29, and 2.0 seconds for sample problems with M = N and IP = I of order i0, 20, 40, and 80 respectively.
Extrapolation of these execution times for
cases where M differs from N and IP is other than i is discussed in Section 4.5.
The control program EISPAC does not use SVD and MINFIT.
For more infor-
mation on SVD and MINFIT, consult their respective subroutine documents in Section 7.
73
2.4-6
Section 2.4.3 THE PSEUDO-INVERSE
OF A RECTANGULAR MATRIX
If A is an M by N matrix and ~ is a threshold
chosen as described
in
Section 2.4.1, then the N by M matrix A + is defined to be the effective pseudo-inverse
of A if it has the following properties:
i)
AA + is symmetric
2)
A+A is symmetric
3) A + S : A
+
4)
II ( AA+A - A)[I < T
5)
il(A+)ll
<
where the norm in 4) and 5) is the Euclidean matrix norm. than all the non-zero pseudo-inverse;
singular values of A, then A + becomes
if A is square and non-singular
singular values,
If % is smaller the Moore-Penrose
and Y is smaller than all its
then A + = A -I.
If A = U Z V T, then A + = V Z+ U T where Z+ is the diagonal matrix with elements
f +
il/J. if ~. > T 3 3 --
~"3 = ~0
otherwise.
Since V, Z, and U are all available required
to compute A + is to determine
from subroutine
Z+ based on the selected T and combine
the matrix operands
into the required product.
product
in the document
is provided
Sample coding for this matrix
for SVD in Section 7.
74
SVD, what is further
2.4-7
Section 2.4.4 LEAST SQUARES SOLUTIONS OF MINIMAL NORM
If A is an M by N matrix and b is a given column vector with M components,
then the N-component
vector x is defined to be the least squares
solution of the linear system Ax = b if it minimizes the residual vector b - Ax.
the Euclidean norm of
If r is a threshold chosen as described
in
Section 2.4.1, and if A is of full rank relative to T, then the solution x is unique.
If A is not of full rank, then the solution is not unique;
the absence of other criteria,
it is common to specify that from all vectors
x for which Ilb - Axll is within T of the minimum, ~xll is to be chosen.
in
the one which minimizes
This is known as the minimal norm least squares solu-
tion of Ax = b. If A = U E V T, then the desired solution x can be written x = V E + uTb where E+ (as in the pseudo-inverse
determination
of Section 2.4.3)
is the
diagonal matrix with elements
aj =
rl/o. if ~. > T J J otherwise.
Since V, ~, and uTb are all available from subroutine MINFIT, what is further required to compute x is to determine ~+ based on the selected T and combine the matrix operands into the required product. for this matrix product is provided in the document
Sample coding
for MINFIT in Section 7.
The minimal norm solution x depends upon the choice of r. increased to a value which causes one or more additional be neglected,
If r is
singular values to
then lib - Axll will be increased and IIxll will be decreased.
MINFIT admits more generally of a B matrix with IP columns in which case the solution matrix X also has IP columns. vector,
then IP should be set to I.
7S
If b is a single column
2.4-8
Section 2.4.5 HOMOGENEOUS
LINEAR EQUATIONS
In Section 2.4.1,
the determination
matrix A for a threshold then the dependencies
of the effective rank of the M by N
T was described.
If the effective rank is not N,
of the columns can be expressed as non-trivial
mate solutions of the homogeneous
system of equations Az = 0.
If A = U E V T,
then Av. = a.u., and therefore for those columns v. which correspond J ~J J singular values oj less than the threshold
T, llAvjll < T.
nation of these v_ with otherwise arbitrary J
coefficients
E ~ ] -< i be designated
z, then IIAzl! < T.
lution of Az = 0 to within the threshold.
approxi-
to
If a linear combi~. except that ]
Any such z can be regarded as a soFurthermore,
any such z can be
added to the minimal norm least squares solution x of Section 2.4.4 without increasing
Ilb - Axll by more than T.
Either SVD or MINFIT can be used for this application with equal efficiency.
With SVD, U need not be accumulated,
IP = 0.
76
while MINFIT can be called with
3.0-1
Section 3 VALIDATION OF EISPACK
As part of its original development, testing designed
to thoroughly
EISPACK was subjected
exercise each subroutine
Before a version of EISPACK is declared certified, be validated
in the package.
however,
it must also
at one or more test sites not involved in the adaptation.
This validation has two important goals.
One is to insure that the
adaptation has been carried out successfully anticipated
to careful
on that computer system.
in the development
of EISPACK;
and that EISPACK performs
as
The second has been of major importance
it is to provide feedback on the ease of use
of EISPACK and its documentation.
The procedures
ophy behind this validation are discussed
included in and the philos-
in further detail in ([3],[5]).
Thus, validation at test sites includes two kinds of testing.
The
first employs test drivers and a collection of 156 matrices supplied with EISPACK;
its purpose is to verify that the subroutines have been adapted to
the machine and system properly,
and to obtain data which can later be used
as a check at other locations having the same computer system.
These test
drivers and matrices are included on the tape from the distribution as described
in Section 5.
The second kind of testing is the more informal; EISPACK in actual scientific
computations
routines and their documentation. informal
center
it seeks to employ
to measure the ease of use of the
By its very nature, of course,
this
testing is not repeatable.
In order to simplify the communication
of the results of the formal
testing, a measure of performance
for EISPACK, based on the backward
analysis of Wilkinson and Reinsch
([1],[2]), was defined.
variously,
depending on the problem class, as:
77
error
It is computed
3.0-2
liAz i - %izill
= max
10"N'~'IIAII'IIz. II
l~i~N
i
IIAz i - %iBzi[l ]i = max l~i~N 10"N's'IIAII'Ilzil
for standard (full or band) eigenproblems,
for the real symmetric generalized eigenproblem Az = ~Bz,
IIABz i - lizil I = max IsisN 10"N's'IIAII'IIBII'Ilzill
for the real s3nTmaetric generalized eigenproblem ABz = %z,
IIBAz i - liziII - = max 10"N-~-fIBrF'IfAIl'IIz II l~i~N
for the real symmetric generalized eigenproblem BAz = ~z,
- -
I[BiAz i - ~iBziI[
for the real generalized
=max 10.N.s.(~i. liAi1+1~ii.IiB~j).~jzil I eigenproblem SAz = eBz l~isN (see Section 2.3.1),
liar i - q.u.1 ill + 'IIATui - qivill =l_
llAxi - bill = max l~i~M N's'IIAII'IIxill
for the singular value decomposition A = UEV T,
for the band linear system Ax = b (with M column vectors b.), 1
where A and B are matrices of order N (A is M by N for singular value decomposition)~ and where s is the precision of arithmetic on the test machine (called MACHEP in the subroutines). The factor i0 in the formulas for ~ was chosen empirically to obtain the following criterion for the performance of EISPACK: If ~ is less than I, EISPACK has performed satisfactorily (as well as can be expected according to the backward error analysis for the particular precision of arithmetic).
If ~ is greater than I00, the performance is
78
3.0-3
deemed poor.
Finally,
gressively marginal,
if D is between I and I00, the performance
is pro-
and further investigation might be in order to verify
that no error has occurred. This measure of performance installation
of EISPACK;
tions in the eigenvalues
is also useful as a check on the correct
the residuals are very sensitive to small perturbaor singular values,
and hence so is ~.
~ may thus
reflect small changes in the performance of EISPACK caused either by changes in the subroutines
themselves or by the hardware,
or library with which they are used. check" of the correct installation
operating
system, compiler,
Hence it provides an excellent "quick
of EISPACK on a hardware-software
system.
If the values of ~ obtained from the test cases are similar to those obtained at the test site, it is virtually certain that EISPACK has been correctly installed.
If, however,
some values of ~ are distinctly
have occurred in the transmission or implementation hardware-software instances
larger,
of EISPACK,
or the
system may differ from that on which it was tested;
such
should probably be investigated.
The collection of 156 test matrices has been accumulated sources and provides logical.
an error may
from various
a wide spectrum of test cases from trivial to patho-
Most values of the performance
index ~ for these test cases were
less than 1 for the systems on which EISPACK has been certified.
79
4.0-1
Section 4 EXECUTION TIMES FOR EISPACK
In this section we display approximate execution times of the individual subroutines and various paths in EISPACK covered in this volume, measured with sample matrices on many of the computer systems for which the subroutines have been certified.
The elements of the sample matrices are random
numbers sampled from uniform distributions.
Tables of execution times appear
in the first subsection, and considerations regarding the reliability of the timing measurements~ their dependence upon the elements of the matrices, and the extrapolation of these results to other machines are discussed in later subsections.
A further subsection discusses timing considerations for band
problems and singular value decomposition with coefficient matrices of different shapes.
The section concludes with listings of the program segments that
generate the sample matrices~
80
4.1-I
Section 4.1 TABLES OF EXECUTION TIMES
For each of 17 computer execution
times respectively
systems there follow two tables displaying
for real symmetric band matrices and generalized
real symmetric matrix systems jointly, and singular value decomposition the performance
sample
and for generalized
jointly.
real matrix systems
A further table follows comparing
of the computer systems with each other.
Finally,
one addi-
tional table is included reporting path timings on the IBM 370/195 when the control program EISPAC is used. For timing of band matrices over the various machines,
the (half) band
width MB has been chosen uniformly as MB = 3N/IO where N is the order of the matrix.
For singular value decomposition
with one constant vector
the matrices are square (M = N)
(IP = I) furnished to MINFIT.
See Section 4.5 for
a discussion of the effects of matrix shape on timing for these problem classes. The tables report execution times both for the individual for the recommended
paths of Section 2.1.
subroutines
and
Each column of a table reports
times for a matrix or matrix system of different order.
The entries in any
column are expressed as multiples of the time unit that appears at the head of the column.
The time unit chosen is the absolute time for subroutine
TREDI in one table and for subroutine ELMHES in the other. does not appear in a path, but normalizing enables more convenient that appeared
to the time for ELMHES
(and TREDI)
comparison of the tables in this volume with those
earlier in [i0].)
senting an execution
(ELMHES itself
A dash appears in place of an entry repre-
time too small to be measured within the resolution of
the clock.
81
4. I-2
For those subroutines
that compute some eigenva!ues
tabulated time for BISECT or TINVIT represents to compute all eigenvalues one eigenva!ue
or eigenvectors,
or eigenvector.
while that for BQR or BANDV is for
The times for the eigenvector
routines BISECT and BQR respectively; longer if less accurate eigenvalue
subroutines
are provided by the sub-
these times could be significantly
subroutines were substituted.
of the BANDV times is approximately
of requested vectors~
the
that required for the subroutine
TINVIT and BANDV are measured when the eigenvalues
Extrapolation
or eigenvectors,
linear with the number
BQR times are not easy to extrapolate
owing to the
iterative nature of the algorithm with its speed dependent at each call on the closeness
of an eigenvalue
tion of extrapolation
to the input parameter
here is pretty much academic;
T.
Actually
the ques-
it appears rare that BQR
can compete with the combination of BANDR and BISECT if more than one eigenvalue is desired,
or even for a single eigenvalue unless a close approximation
is known. In several of the eigensystem tions is an option° times,
subroutines
For these subroutines
the accumulation
of transforma-
the tables report both possible
the subroutine name being followed by '(Z)' in the case where the
transformations accumulate
are accumulated.
the U matrix,
V matrix,
With subroutine or both.
SVD there exist options
Three of the four different
times have been measured -- those identified as SVD(U), The time for SVD(U,V) For the paths,
can be approximated
SVD(V),
to SVD
and SVD.
as [SVD(U) + SVD(V) - SVI)].
the entries are built by summing the times for the separate
subroutines.
The entries for those paths that compute partial eigensystems
are expressed
as the sum of two terms:
the first term is the base time for
the path and the second term is that part which depends upon the number of eigenvalues
and eigenvectors
computed.
82
This latter term is either the product
4.1-3
of the estimated time to compute one eigenvalue-eigenvector pair and M, the number of pairs computed, or the product of the estimated time to compute one eigenvalue and M, the number of eigenvalues computed.
Program segments
that generate the sample matrices and matrix systems are listed in Section 4.6.
83
4.1-4
TABLE 4 S U M M A R Y O F E X E C U T I O N TIMES FOR THE E I S P A C K S U B R O U T I N E S I N C L U D E D IN THE PATHS F O R REAL SYMMETRIC BAND MATRICES AND G E N E R A L I Z E D R E A L SYMMETRIC M A T R I X SYSTEMS MACHINE: I B M 370/195, F o r t r a n H, OPT=2 ARCq3N~ NATIONAL LABORATORY ORDER OF MATRIX OR SYSTEM SUBROUTINE T i m e Unit
(Sec)
TRED I TRED2 TRBAKI
N=I0
N=20
N=40
N=60
N=80
.001
.007
.042
.12
.27
i 1°7 1.2
1 1.9 1.4
i 2.0 1.6
i 2.1 1.7
i 2.2 1.8
1.9 1.1
2.1 1.2
2.3 i. 2
BANDR(Z) BANDR
°87 o52
1.4 .86
BQR BANDV
8 .64
8 .52
7 .48
8 ~46
6 .48
REDUC REDUC2 REBAK REBAKB
1.2 1.2 .66 .68
i.i I.i .71 .78
i°i I.i .73 .89
1.2 i.i .76 .96
1.2 i.i . 76 1.0
TQL2 TQLRAT
3.4 1 .3
3.4 .72
3.3 .36
3.2 .25
3.2 .17
BISECT TINVIT
12 .97
8 .1 .66
4 .9 .40
3.5 .32
2 .8 .31
4.3
4.9
5.2
5.4
5.4
i. 8
i. 6
I. 4
i. 4
i. 4
PATHS RSB
(BANDR(Z),TQL2)
RSB (BANDR,TQLRAT) BANDR,BISECT,BANDV
o52+1.9M
.86+.92M
I.I+.60M
1.2+.52M
1.2+~51M
BANDR,BISECT
.52+1.2M
.86+.40M
I.I+.I2M
1.2+.06M
1.2+.03M
RSG ( R E D U C , T R E D 2 , T Q L 2 , R E B A K )
6.9
7.1
7.1
7.3
7.3
RSG
3.4
2.8
2.5
2.4
2.3
2.1+.54M
2.1+.19M
2.2+,IIM
2.2+.07M
2.1+.40M
2.1+.12M
2.2+.06M
2.2+.03M
(REDUC ~TRED I, TQLRAT)
REDUC,TREDI,BISECT~TINVIT, 2.2+1.5M T R B A K 1, R E B A K REDUC,TREDI,BISECT 2.2+1.2M
84
4.1-5
TABLE 5 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE: IBM 370/195, Fortran H, OPT=2 ARGONNE NATIONAL LABORATORY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (Sec)
.001
.006
.048
.16
.36
ELMHES
1
1
1
1
1
QZHES(Z) QZHES
6.5 5.7
5.9 5.1
5.6 4.7
5.5 4.6
5.6 4.7
QZIT(Z) QZIT
20 16
18 12
14 8.5
13 7.1
13 7.0
QZVAL (Z) QZVAL
.55 .54
.18 .17
.05 .05
.02 .02
.01 .01
QZVEC
2.6
1.9
1.5
1.4
1.3
SVD(U) SVD(V) SVD
ii ii 7.5
7.6 7.8 4.4
5.8 5.9 2.9
5.4 5.6 2.4
5.2 5.2 2.2
MINFIT
II
7.6
5.9
5.4
5.2
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
29
26
21
20
19
RGG (QZHES,QZIT,QZVAL)
22
17
13
12
12
PATHS
85
4. I-6
TABLE 6 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES ~ D GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE:
IBM 360/75, Fortran H, OPT=2 UNIVERSITY OF ILLINOIS ORDER OF MATRIX OR SYSTEM
SUBROUTINE
N=20
N=40
Time Unit (Sec)
.077
.46
N=60
N=80
1.5
3.5
TREDI TRED2 TRBAKI
1 1.7 1.3
1 2.1 1.5
1 2.0 1.5
i 2.1 1.6
BANDR(Z) BANDR
1.3 .73
1.8 .89
1.8 .87
2.0 .93
BQR BANDV
5 o31
4 .30
4 .28
5 .29
REDUC REDUC2 REBAK REBAKB
.96 .99 ~62 .64
i.i i.i .75 .79
1.0 1.0 .72 .76
I.I i.I .71 .80
TQL2 TQLRAT
4.6 .51
5.3 .33
4.8 .20
5.0 .15
BISECT TINVlT
4.7 ~47
2.9 .33
1.8 .25
1.4 .26
RSB (~ANDR(Z), TQL2)
5.9
7.1
6.6
7.0
RSB (BANDR,TQLRAT)
i~2
1.2
i.I
i.i
PATHS
BANDR,BISECT,BANDV
.73+°54M
.89+.37M
.87+.31M
.93+.31M
BANrOR,BISECT
° 73+. 23M
.89+. 07M
.87+. 03M
.93+. 02M
RSG (REDUC,TRED2,TQL2,REBAK)
7.9
9.2
8.5
8.9
RSG (REDUC,TREDI,TQLRAT)
2.5
2.4
2.2
2.2
2.0+.35M
2.1+.14M
2.0+.07M
2.1+.05M
2.0+.23M
2.1+.07M
2.0+.03M
2.1+.02M
REDUC,TREDI,BISECT,TINVIT~ TRBAKI,REBAK REDUC,TREDI,BISECT
86
4.1-7
TABLE 7 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
IBM 360/75, Fortran H, OPT=2 UNIVERSITY OF ILLINOIS
ORDER OF MATRIX OR SYSTEM N=20
N=40
.07
.50
i
QZRES(Z) QZHES QZIT(Z) QZIT
SUBROUTINE Time Unit (Sec) ELMHES
QZVAL (Z)
N=60
N=80
1.7
4.1
1
1
1
7.0 6.0
7.3 6.1
7.0 5.8
6.8 5.8
21 13
18 i0
17 8.8
15 7.2
.23 .23
QZVAL
.06 .05
.01 .02
.01 .01
QZVEC
1.6
1.5
1.4
1.3
(u) SVD(V)
SVD
8.1 8.2 3.7
7.1 7.2 2.7
6.5 6.6 2.3
6.1 6.2 2.0
MINFIT
8.7
7.4
6.7
6.3
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
29
27
26
23
RGG (QZNES,QZIT,QZVAL)
20
16
15
13
sw
PATHS
87
4.1-8 TABLE 8 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE:
IBM 360/65, Fortran H, OPT=2 AMES LABORATORY ORDER OF MATRIX OR SYSTF~
SUBROUTINE
N=I0
N=20
N=40
Time Unit (Sec)
.017
.12
.86
TRED I TRED 2 TRBAKI BA~mR(Z) BANDR
N=80
2.5
5.9
i 2 1
1 1.8 1.4
1 1.8 1.5
1 2.0 1.6
1 2.0 1.5
1
1.4 .76
1.7 .84
1.9 .94
1.9 .91
5 .31
4 .30
4 .29
4 .30
-
7
BQR BANDY
N=60
-
REDUC REDUC 2 REBAK REBAKB
2 i 1 1
1.0 .98 .62 .71
.91 1.0 .65 .67
1.0 .98 .70 .75
1.0 .96 .69 ,75
TQL2
TQLRAT
6 2
5.4 .71
5.2 .35
5.3 .23
5.0 .17
BISECT TINVIT
I! 1
5.6 .61
3.2 .31
2.1 .26
1.6 .26
PATHS RSB (BANDR(Z), TQL2)
7
6.8
6.9
7.2
6.9
RSB (BANDR, TQLRAT)
2
i. 5
i. 2
i. 2
i. i
BANDR,BISECT,BANDV
1.5M
.76+.59M
.84+.38M
.94+.32M
.91+.32M
BAN-DR,BISECT
I.IM
.76+. 28M
.84+.08M
.94+.03M
.91+.02M
RSG (REDUC, TRED2, TQL2, REBAK) i0
8.8
8,6
9.0
8.7
RSG (REDUC, TREDI, TQLRAT)
2.7
2.3
2.3
2.2
~+I.4M
2.0+.41M
1.9+.14M
2.0+.08M
2.0+.05M
3+I.IM
2.0+.28M
1.9+.08M
2.0+.03M
2.0+.02M
REDUC,TREDI,BISECT,TINVIT, TRBAK 1,REBAK REDUC,TREDI,BISECT
4
88
4.1-9
TABLE 9 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN TffE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
IBM 360/65, Fortran H, 0PT=2 AMES LABORATORY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
Time Unit (Sec)
.015
N=20
N=40
.Ii
.89
N=60
N=80
3.1
7.2
ELMBES
1
1
1
i
1
QZHES (Z) QZHES
7 7
7.3 6.3
7.4 6.0
6.9 5.7
6.9 5.7
22 14
18 9.7
16 8.6
15 7.3
QZIT (Z) QZIT
24 18
QZVAL(Z)
-
.17 .13
QZVAL QZVEC
.03 .03
.02 .02
.01
°01
2
1.7
1.4
1.2
1.2
SVD
ii ii 6
8.6 8.4 3.9
6.9 7.0 2.6
6.3 6.1 2.1
6.0 6.0 2.0
MINFIT
12
8.6
7.0
6.2
6.0
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
34
31
27
24
23
RGG (QZHES,QZIT,QZVAL)
25
20
16
14
13
sw(u) SVD (V)
PATHS
89
4.1-10 TABLE i0 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SY~4ETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE:
IBM 370/165, Fortran H Extended, OPT=2 THE UNIVERSITY OF TORONTO ORDER OF MATRIX OR SYSTEM
SUBROUTINE Time Unit (Sec)
N=I0
N=20
N=40
N=60
N=80
~002
.020
.12
.41
.93
TRED 1 TRED2 TRBAKI
i 3 I
i 1.7 1.4
i 1.7 1.5
I 1.8 1.7
i 2.0 1.6
BANDR(Z) BANDR
1 1
1.4 .85
2.1 .95
2.0 .89
2.2 .94
BQR BANDV
I0 i
6 .41
4 .39
4 °37
5 .43
REDUC REDUC2 REBAK REBAKB
2 1 1 I
i.i 1.0 .68 °64
I.i .99 .82 .69
i.i 1.0 .80 .75
i.i I,i .79 .84
TQL2 TQLRAT
6 2
4.2 .73
4.7 .39
4.4 .27
4.3 .19
BISECT TINVIT
14 2
6.2 ~64
3.6 .41
2.6 .33
1.9 .28
PATHS RSB (BANDR(Z) ,TQL2)
8
5.6
6.9
6.5
6.6
RSB (BANDR, TQLRAT)
3
1.6
1.3
i~2
i.i
BANDR,BISECT,BANDV
I+2.1M
.85+.72M
o95+.48M
.89+.41M
.94+.45M
BANDR,BISECT
I+I.4M
.8~,31M
.9~.09M
.89+,04M
.9~.02M
RSG (REDUC,TRED2,TQL2,REBAK) ii
7.7
8.4
8.2
8.2
RSG (REDUC,TRED!,TQLRAT)
2,8
2.5
2.4
2.3
REDUC, TRED i, BISECT, TINVIT, TRBAK I, REBAK REDUC, TRED i,BISECT
4 3+I. 8M
2.1+.44M
2.1+.16M
2.!+.09M
2.1+.06M
3+1.4M
2.1+.31M
2.~.09M
2.~.04M
2.~.0~
90
4.1-11
TABLE ii SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
IBM 370/165, Fortran H Extended, OPT=2 THE UNIVERSITY OF TORONTO
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=IO
N=20
N=40
N=60
Time Unit (Sec)
•003
.015
.13
.46
N=80 1.2
ELMIIES
1
1
1
1
1
QZHES (Z) QZHES
6 5
7.6 6.7
7.2 5.9
7.1 5.9
6.4 5.1
19 15
24 15
18 9.6
17 8.6
13 6.3
QZIT(Z) QZIT
QZVAL(Z)
-
QZVAL
-
QZVEC
2
2.0
1.5
1.5
1.3
SVD(H) SVD(V) SVD
9 I0 7
9.6 9.7 4.8
7.1 7.2 2.8
6.2 6.4 2.3
5.2 5.4 2.1
MINFIT
i0
9.4
7.2
6.5
5.4
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
28
33
27
26
21
RGG (QZHES,QZIT,QZVAL)
21
22
16
14
Ii
.20 .24
.06 .06
.03 .02
.01
.01
PATHS
91
4.1-12 T A B L E 12 SUMMARY O F E X E C U T I O N TIMES F O R THE E I S P A C K S U B R O U T I N E S I N C L U D E D IN THE P A T H S F O R R E A L S Y M M E T R I C BAND M A T R I C E S AND G E N E R A L I Z E D REAL S Y M M E T R I C M A T R I X SYSTEMS MACHINE:
IBM 370/168 M o d 3, F o r t r a n H Extended, O P T = 2 STANFORD UNIVERSITY ORDER OF MATRIX OR SYSTEM
SUBROUTINE Time Unit
(Sec)
N=I0
N=20
N=40
N=60
N=80
.003
.015
.097
.31
.71
TRED 1 TRED2 TRBAKI
i 2 I
i 1.8 i. 5
I 1,9 i, 6
I 2.0 i. 7
I 2,0 i. 7
B A N D R (Z) BANDR
i i
1.4 .78
1,9 ,91
2.0 .95
2.1 .95
BQR BANDV
5
6 .38
4 .33
4 .31
4 .30
REDUC REDUC2 REBAK REBAKB
1 1 i 1
I. 2 i. 1 ,72 .69
1 .1 i. 1 .77 .77
i. 2 I. 1 ,80 °83
i. 1 i. 1 .79 .85
TQL2 TQLRAT
4 1
4.8 .88
4.9 .45
4.7 .29
4.6 .21
BISECT TINVIT
i0 1
7 .0 .64
4 .I .38
2 .9 .29
2 .i .28
5
6.2
6.8
6.8
6.7
RSB (BANDR,TQLRAT)
2
i. 7
i. 4
i. 2
i. 2
BANDR,BISECT,BANDV
I+I°4M
.78+. 73M
.91+. 43M
.95+. 36M
.95+. 33M
BANDR,BISECT
I+I.0M
.78+.35M
.91+.IOM
.95+.05M
.95+.03M
PATHS RSB
(BANDR(Z) ,TQL2)
RSG (REDUC, TRED2, TQL2, REBAK)
8
8.4
8.8
8.7
8.5
RSG
4
3.0
2.6
2.4
2.3
(REDUC, TRED 1, TQLRAT)
REDUC,TI~EDI,BISECT,TINVIT, T R B A K 1, R E B A K REDUC,TREDI,BISECT
2+1.2M
2°2+.49M
2.1+.17M
2°I+.09M
2.1+.06M
2+I.0M
2.2+.35M
2.1+.IOM
2.1+.05M
2.1+.03M
92
4.1-13
TABLE 13 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
IBM 370/168 Mod 3, Fortran H Extended, OPT=2 STANFORD UNIVERSITY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (Sec)
•002
.013
.i0
.34
.83
ELMHES
1
1
1
1
1
QZHES (Z) QZHES
7 6
7,5 6.5
7.4 6.1
7.2 5.9
7.0 5.8
22 15
18 9.9
17 8.8
14 7.2
QZIT(Z) QZIT
22 17
QZVAL (Z) QZVAL
1 1
QZVEC
2
1.9
1.6
1.5
1.4
SVD
ii ii 8
8.9 9.0 4.7
7.2 7.2 3.1
6.6 6.6 2.6
6.2 6.2 2.3
MINFIT
12
9.2
7.3
6.7
6.3
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
32
32
27
25
23
RGG (QZHES,QZIT,QZVAL)
24
21
16
15
13
s w (u) SVD(V)
.23 .21
.06 .06
.02 .02
.02 .02
PATHS
93
4.1-14 TABLE 14 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE: Burroughs 6700, Fortran IV (2.6) UNIVERSITY OF CALIFORNIA, SAN DIEGO ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=IO
N=20
Time Unit (Sec)
.078
.53
N=40
N=60
4.1
14
TREDI TRED2 TRBAKI
1 1.8 1.3
1 2.0 1.5
1 2.2 1.7
1 2.1 1.7
BAN-DR(Z) BANDR
i.i .43
2.0 .67
2.5 o81
2.5 .79
5 .40
5 .36
4 .36
4 .36
REDUC REDUC2 REBAK REBAKB
i.i i.i .76
i.i 1.2 .82
1.2 1.2 .85
I.i 1.2 .85
.72
.77
.85
.93
TQL2 TQLRAT
4.5 .75
4.9 .36
4.8 .17
4.7 .ii
BISECT TINVIT
4.2
2.2
i.I
BQR BANDV
•81
,45
025
.76 .19
PATHS RSB (BANDR(Z) ,TQL2)
5.7
6.9
RSB (BANDR,TQLRAT)
1.2
1.0
7.3 °98
7.3 .90
BANDR,BISECT,BANDV
.43+.82M
.67+.47M
.81+.39M
.79+.37M
BANDR,BISECT
~43+.42M
.67+.!IM
.8~.03M
.79+.01M
RSG (REDUC,TRED2,TQL2,REBAK)
8.2
8,9
9.0
8,8
RSG (REDUC, TREDI, TQLRAT)
2.9
2.5
2,3
2.3
2.~.IOM
2.~.06M
2.1+.03M
2.~.01M
REDUC, TRED 1, BISECT, TINVIT ~ 2..I+.7014 2.1+.25M TRBAKI, REBAK REDUC ~TRED 1, BISECT 2. i+. 42M 2 . ~ . I I M
94
4.i-i5 TABLE 15 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE: Burroughs 6700, Fortran IV (2.6) UNIVERSITY OF CALIFORNIA, SAN DIEGO
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=IO
N=20
Time Unit (Sec)
.087
.75
ELMHES
N=40
N=60
6.5
20
i
i
i
i
QZHES (Z) QZHES
6.6 5.6
6.1 5.2
6.2 5.0
6.2 5.2
QZIT(Z)
16 ii
14 8.5
ii 5.5
ii 5.7
QZIT QzvAL(z) QZVAL
.20 •20
.06 .05
.01 .01
.01 .01
QZVEC
1.5
1.2
1,0
SVD(U) SVD(V) SVD
6.5 6.4 3.2
5.3 5.3 2.2
4.8 4.7 1.7
4.7 4.7 1.7
MINFIT
6.4
5.4
4.8
4.5
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
24
22
19
18
RGG (QZHES,QZIT,QZVAL)
16
14
ii
ii
.99
PATHS
95
4.1-16
T A B L E 16 SUMMARY O F E X E C U T I O N TIMES F O R THE E I S P A C K S U B R O U T I N E S I N C L U D E D IN THE P A T H S F O R REAL SYMMETRIC BAND M A T R I C E S AND G E N E R A L I Z E D REAL S Y M M E T R I C M A T R I X SYSTEMS MACHINE:
CDC 6600, F T N E x t e n d e d V e r s i o n 4 C o m p i l e r K I R T L A N D A I R F O R C E BASE ORDER OF MATRIX OR SYSTEM
SUBROUTINE
N= I 0
N= 20
N=40
N=60
T i m e U n i t (See)
°007
.033
.20
.62
i 1.5 i.I
i 1.9 1.4
i 2.0 1.7
i 2.1 1.7
I 2.2 1.7
TEED I TRED2 TRBAKI
N=80 1.4
BANDR(Z) BANDR
.81 o60
i. 3 .75
i. 7 .75
I. 8 .81
i. 8 .79
BQR BANDV
6 .60
6 .49
5 .43
6 ~40
5 .39
REDUC REDUC2 REBAK REBAKB
i~4 1.2 .78 .77
1o3 1.3 .86 .81
1.3 1.3 .96 .85
1.3 i. 3 .94 .87
1.3 1.3 .98 o89
TQL2 TQLRAT
3.0 .99
3.6 .64
3.7 .34
3.8 .24
3.8 .18
BISECT TINVIT
12 •97
9.0 .70
5.6 .43
4.0 .34
3.1 .41
R S B (BANDR(Z),TQL2)
3.8
4.9
5.4
5.6
5.6
RSB (BANDR, TQLRAT)
i. 6
i. 4
i. 1
i. 1
PATHS
°97
BANDR,BISECT,BANDV
.60+1.8M
.75+.94M
.75+.57M
.81+.47M
.79+.43M
BANDR,BISECT
.60+1.2M
.75+.45M
.75+.14M
.81+.07M
.79+.04M
RSG
(REDUC, TRED2, TQL2, REBAK)
6.7
7.6
8.0
8.1
8.2
RSG
(REDUC, TREDI, TQLRAT)
3.3
2.9
2.7
2.5
2.4
REDUC,TREDI,BISECT,TINVIT, 2.4+1.5M T R B A K 1, R E B A K REDUC,TREDI)BISECT 2.4+1.2M
2.3+.60M
2.3+.22M
2.3+.12M
2.3+.08M
2.3+o45M
2.3+.14M
2.3+.07M
2.3+.04M
96
4.1-17
TABLE 17 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLIJ-DED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGD'LAR VALUE DECOMPOSITION MACHINE:
CDC 6600, FTN Extended Version 4 Compiler KIRTLAND AIR FORCE BASE
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
Time Unit (Sec)
•006
.037
.27
•85
ELMHES
N=80 2.0
1
i
i
I
I
QZHES (Z) QZHES
5.6 5.3
6.2 5.3
6.2 5.2
6.5 5.4
6.3 5.2
QZIT(Z) QZIT
14 9.9
14 8•7
II 6.0
II 5.6
i0 4.7
QZVAL (Z ) QZVAL
•48
•13
.03
• 01
• 01
•55
.14
•04
.02
.01
QZVEC
1.9
1.5
i.i
i.I
1.0
SVD (U) SVD(V) SVD
6.7 6.7 4.3
5.6 5.5 3.0
5.0 4.9 2.2
4.7 4.8 2.0
4.6 4.5 1.9
MINFIT
7.0
5.8
5.0
4.9
4.6
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
22
22
19
19
17
RGG (QZHES,QZIT,QZVAL)
16
14
Ii
ii
9•9
PATHS
97
4.1-18 TABLE 18 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE:
CDC CYBER 175, FTN 4.6+420 Compiler, OPT=2 NASA LANGLEY RESEARCH CENTER ORDER OF MATRIX OR SYSTEM
SUBROUTINE
N=IO
N=20
N=40
N=60
N=80
Time Unit (See)
.002
.008
.051
.16
.37
TRED i TRED2 TRBAK 1
I 2 1
1 2.0 1.3
I 2.1 1.6
i 2.1 1.6
1 2.2 1.7
BANDR(Z) BANDR
1 1
1.6 .92
1.9 .84
1.9 .77
2.0 .76
BQR BANDV
6 1
6 ~55
4 .54
5 .51
4 .56
REDUC REDUC 2 REBAK REBAKB
1 1 i i
1.4 1.4 .83 .82
1.3 1.3 .86 .84
1.2 1.2 .85 .85
1.2 1.2 .87 .85
TQL2 TQLRAT
4 1
5.1 .53
5.3 .27
5.0 .18
5.1 .12
BISECT TINVIT
13 1
9.7 .66
5.5 .43
3.8 .31
2.9 .36
6.9
7.1
PATHS RSB ( B ~ R ( Z ) ,TQL2)
5
6.7
7.2
RSB (BANDR,TQLRAT)
2
1.5
I.i
BANDR,BISECT,BANDV
I+2.0M
.92+I.0M
.8~.68M
.77+.57M
.76+.60M
BANDR,BISECT
I+I.3M
.92+.49M
.84+.14M
.77+.06M
.7~.04M
.95
.88
RSG (REDUC,TRED2,TQL2,REBAK)
7
9.3
9.5
9.2
9.4
RSG (REDUC,TREDI,TQLRAT)
3
2.9
2.6
2.4
2.3
REDUC,TREDI,BISECT,TINVIT, TRBAKI,REBAK REDUC,TREDI,BISECT
2+1.6M
2.4+.63M
2.~.21M
2.2+.IIM
2.2+.07M
2+1.3M
2.4+.49M
2.~.!4M
2.2+.0~
2.2+.04M
g8
4o1-19
TABLE 19 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
CDC CYBER 175, FTN 4.6+420 Compiler, OPT=2 NASA LANGLEY RESEARCH CENTER
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (Sec)
.001
.010
.076
.25
.57
ELMHES
1
1
1
1
1
QZHES (Z) QZHES
8 6
6.4 5.3
6.4 5.2
6.3 5.1
6.4 5.1
18 ii
15 8.0
14 7.1
13 6.5
QZIT(Z) QZIT
22 16
QZVAL (Z) QZVAL
-
QZVEC
2
1.4
i.I
SVD (u) SVD(V) SVD
9 9 6
5.6 5.6 3.1
4.7 4.7 2.3
4.3 4.3 1.9
4.2 4.2 1.8
MINFIT
9
5.6
4.8
4.4
4.2
.12 .i0
.04 .04
.02 .02
.01 .01
.98
.91
PATHS RGG (QZHES(E),QZIT(Z), QZVAL(Z),QZVEC)
32
26
22
21
20
RGG (QZHES,QZIT,QZVAL)
23
17
13
12
12
99
4.1-20 TABLE 20 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SI~MMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE: CDC 7600, Local Compiler NATIONAL CENTER FOR ATMOSPHERIC RESEARCH ORDER OF MATRIX OR SYSTEM SUBROUTINE Time Unit
(Sec)
N= iO
N=20
N=40
N=60
N=80
.001
.007
.041
.13
.28
TRED 1 TRED2 TRBAKI
1 2 2
1 1.8 1.3
1 1.9 1.5
1 2.0 1,5
1 2.0 1,6
BANDR(Z) BANDR
1 1
1.5 .88
2.1 i. 1
2.3 i. 2
2.4 i. 3
BQR BANDV
9 1
7 .60
6 .89
6 .94
7 i. 0
REDUC REDUC2 REBAK REBAKB
2 2 1 1
1 .2 1.2 .84 ~74
i. 2 1.2 .87 .77
i. 1 1.2 .87 .77
i. 1 1.2 .87 .77
TQL2 TQLRAT
4 2
3.4 .71
3.6 .43
3.5 .29
3.5 .21
BISECT TINVIT
22 1
ii .68
7.0 .39
5.0 .32
3.9 .31
PATHS RSB (BANDR(Z) ,TQL2)
5
5.0
5.7
5.8
5.9
RSB (BANDR,TQLRAT)
2
i. 6
!. 6
i° 5
1.5
BANDR,BISECT,BANDV
1+3.0M
.88+1.2M
i. i+i. IM
i. 2+1.0M
i. 3+1. IM
BANDR,BISECT
I+2.2M
.88+.56M
I.I+.I7M
1.2+,08M
1.3+.05M
RSG (REDUC, TRED2, TQL2, REBAK)
9
7.2
7.5
7.5
7.5
RSG (REDUC, TRED i, TQLI~T)
5
2.9
2.6
2.4
2.3
REDUC,TREDI,BISECT,TINVIT, TRBAKI, REBAK REDUC,TREDI,BISECT
3+2.5M
2.2+.70M
2.1+.24M
2.1+.13M
2.1+.08M
3÷2.2M
2.2+.56M
2.1+.17M
2.1+.08M
2.1+.05M
100
4.1-21
TABLE 21 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE: CDC 7600, Local Compiler NATIONAL CENTER FOR ATMOSPHERIC RESEARCH
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (Sec)
•001
.007
.050
.16
.38
ELMHES
i
i
I
i
i
QZHES(Z) QZHES
6 6
6.5 5.5
6.5 5.4
6.5 5.4
6.4 5.3
16 ii
13 7.3
13 6.6
Ii 5.5
QZIT(Z)
QZIT
17 13
QZVAL(Z) QZVAL
-
.12
.03
. Ol
.01
-
. 12
. 04
. 01
. 01
QZVEC
2
1.5
1.2
I.i
I.i
SVD (U) SVD (v) SVD
8 7 5
5.8 5.6 3.4
4.8 4.8 2.4
4.5 4.4 2.1
4.3 4.2 1.9
MINFIT
8
5.8
4.8
4.5
4.2
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
26
24
21
20
19
RGG (QZHES,QZIT,QZVAL)
19
16
13
12
ii
PATHS
101
4.1-22 TABLE 22 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE: CDC 7600, CHAT Compiler, Optimized LAWRENCE LIVERMORE LABORATORY ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (See)
.002
.011
.074
.24
.54
1 1.5 .95
1 1.5 1.0
1 1.5 1.0
1 1.5 1.0
1 1.5 1.0
TRED 1 TRED2 TRBAKI BANDR(Z) BAND R
.72 .40
i.! .59
1.2 .66
1.3 .67
1.3 .68
BQR BANDV
5 .56
5 .50
4 .47
5 .47
5 .47
REDUC REDUC2 REBAK REBAKB
1.2 i.i .58 .61
1.2 .96 .51 .58
1.2 .90 .45 .54
1.2 .86 .42 .52
1.2 .85 .41 .52
TQL2 TQLRAT
2°9 .77
3.4 .42
4.8 .21
4.9 .13
5.1 .i0
BISECT TINVIT
12 .83
7.5 .50
4.1 .28
2.8 .21
2.1 .21
RSB (BANDR(Z) ,TQL2)
3.6
4.4
6.0
6.1
6.4
RSB (BANDR,TQLRAT)
i. 2
1.0
PATHS
.87
.80
.78
BANDR, BISECT, BANDV
.40+1.8M
.59+.87M
.66+.57M
.67+.52M
.68+.5~
BANDR, BISECT
.40+1.2M
.59+.37M
.66+.i~
.67+.05M
.68+.03M
RSG (REDUC,TRED2,TQL2,REBAK) 6.1
6.6
8,0
8.0
8.3
RSG (REDUC, TRED 1, TQLRAT)
2.6
2.4
2.4
2.3
3.0
REDUC, TRED 1,BISECT, TINVIT, 2.2+1.5M TRBAKI, REBAK REDUC, TRED 1,BISECT 2.2+1.2M
2.2+.48M
2.2+.15M
2.2+.07M
2.2+.05M
2.2+.37M
2.2+.IOM
2.2+.05M
2.2+.03M
102
4.1-23
TABLE 23 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE: CDC 7600, CHAT Compiler, Optimized LAWRENCE LIVERMORE LABORATORY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (See)
.001
.010
.077
.26
.61
ELMHES
1
i
i
i
i
QZHES (Z) QZHES
5.8 5.0
5.6 4.7
5.6 4.6
5.5 4.5
5.5 4.5
QZIT(Z)
17 12
16 i0
13 7.6
12 6.5
ii 5.7
QZIT
QZVAL(Z) QZVAL
.28 .26
.08 .08
.02 .02
.01 .01
.01 o01
.98
.89
.85
QZVEC
1.7
1.2
SVD(U) SVD(V) SVD
6.7 6.6 4.1
5.2 5.2 2.8
5.2 4.4 2.1
5.4 5.4 2.0
5.3 5.3 1.9
MINFIT
6.7
5.1
5.0
5.4
5.3
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
24
23
20
18
18
RGG (QZHES,QZIT,QZVAL)
17
15
12
ii
i0
PATHS
103
4.1-24 T A B L E 24 SUI~LARY O F E X E C U T I O N TIMES F O R THE E I S P A C K S U B R O U T I N E S I N C L U D E D IN THE P A T H S F O R REAL S Y M M E T R I C BAND M A T R I C E S A N D G E N E R A L I Z E D REAL S Y M M E T R I C M A T R I X SYSTEMS MACHINE:
CDC 6400, FTN 3.0 Compiler, OPT=2 NORTHWESTERN UNIVERSITY ORDER OF MATRIX OR SYSTEM
SUBROUTINE T i m e Unit
(Sec)
N=I0
N=20
N=40
.017
.I0
.68
N=60
N=80
2.1
4.9
TRED 1 T~D2 TRBAKI
1 1.9 1.2
1 1.8 1,3
1 1.9 1.5
1 2.0 1.5
1 2.0 1,5
BANDR(Z) BANDR
1.2 .65
1.6 .97
2.0 i.i
2.2 1.2
2.3 1.2
8 .65
6 .39
6 .37
3 .36
7 ,36
REDUC REDUC2 REBAK REBAKB
!.5 1.4 1 .0 .94
io2 1.3 .83 ,84
1.2 1.2 .82 .82
I.i 1.2 .81 ,81
i.i i.I .81 .81
TQL2 TQLRAT
4.1 !. 4
4.3 .73
4.6 .36
4.6 .25
4.7 .17
BISECT TINVIT
ii i. 2
6.2 .64
3.5 .36
2.5 .29
1.9 . 30
5.3
5.9
6.6
6.7
6,9
2.1
1.7
1.5
1.4
1.4
BQR BAh~V
PATHS RSB
(BANDR(Z) ,TQL2)
RSB (BANDR, TQLRAT) BANDR,BISECT,BANDV
.65+1,8M
.97+.70M
I.I+.46M
1.2+.40M
1.2+.38M
BANDR,BISECT
.65+I.IM
.97+o31M
I.I+.09M
1.2+.04M
1.2+.02M
RSG
(REDUC,TRED2,TQL2,REBAK)
R S G (REDUC, TREDI, TQLRAT)
8.5
8.2
8.5
8.5
8.6
3.9
2 •9
2.5
2.4
2 •3
REDUC,TREDI,BISECT,TINVIT, 2.5+1.5M TRBAKI, R E B A K REDUC, TRED 1, B I S E C T 2.5+1. I M
2.2+.45M
2.2+.15M
2.1+.08M
2.1+.06M
2.2+. 31M
2.2+. 09M
2. I+. 0 4 M
2. i+. 02M
104
4.1-25
TABLE 25 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
CDC 6400, FTN 3.0 Compiler, OPT=2 NORTHWESTERN UNIVERSITY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
Time Unit (Sec)
.015
.ii
°80
I
I
QZHES (Z) QZHES
7,3 6.9
QZIT(Z) QZIT
24 17
ELMHE S
Q ZVAL (Z) QzVAL
N=60
N=80
2.7
6.3
I
I
i
7.0 6.0
7.2 6.1
7.0 5.9
7.0 5.8
16 9.6
18 9.7
15 7.7
14 6.9
•53
.12
.05
.02
.01
.47
.13
.05
.02
.01
QZVEC
2.3
1.6
1.5
1.3
1.2
SVD(U) SVD(V) SVD
9.5 9.3 5.4
7.0 6.9 3.3
6.5 6.4 2.5
5.8 5.8 2.1
5.7 5.6 2,0
MINFIT
i0
7.4
7.1
6.3
6.2
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
34
24
26
23
22
RGG (QZHES,QZIT,QZVAL)
25
16
16
14
13
PATHS
105
4.1-26
T A B L E 26 SUMMARY OF E X E C U T I O N TIMES F O R THE E I S P A C K S U B R O U T I N E S I N C L U D E D IN THE PATHS F O R REAL S Y M M E T R I C B A N D M A T R I C E S A N D G E N E R A L I Z E D R E A L SYMMETRIC M A T R I X SYSTEMS MACHINE:
CDC 6400/6500, FUN C o m p i l e r PURDUE UNIVERSITY ORDER OF MATRIX OR SYSTEM
SUBROUTINE Time Unit
(Sec)
TRED i TRED2 TRBAKI
N=I0
N=20
N=40
.024
.13
.83
i 1.6 i.i
N=60
N=80
2.5
5.6
i 1.8 1.3
i 1.9 1.5
i 2.0 1.6
i 2.0 1.6
2.0 i. 3
2.8 i. 8
3.2 2.0
3.4 2.2
BANDR(Z) BANDR
.96 .60
BQR BANDV
6 °49
6 .43
5 .41
5 .40
5 .40
REDUC REDUC2 REBAK REBAKB
i.i i.i .72 .75
i.i i.I .75 .80
I.i i.i .74 .82
i.i i.I .75 .83
i.i I.i .74 .83
TQL2 TQLRAT
3.6 o87
4.2 .53
4.5 .29
4,5 ,20
4.5 .15
BISECT TINVIT
9.1 .98
6.0 .67
3.6 .43
2.6 .34
1.9 .34
4.6
6.2
7.4
7.7
7.9
i. 5
i. 8
2.1
2.2
2.3
PATHS RSB
(BANDR(Z),TQL2)
RSB (BANDR~ TQLRAT) BANDR,BISECT,BANDV
.60+1.4M
1.3+.73M
1.8+.50M
2.0+.44M
2.2+.42M
BANDR,BISECT
~60+.91M
1.3+.30M
1.8+.09M
2.0+,04M
2,2+.02M
RSG (REDUC,TRED2,TQL2,REBAK)
7.1
7.8
8.3
8.4
8.4
R S G (REDUC ~T R E D 1, TQLRAT)
3.0
2.7
2.4
2.3
2.3
REDUC,TREDI,BISECT,TINVIT, 2.1+1.2M TRBAKI ~R E B A K REDUC,TREDI~BISECT 2.1+.91M
2.1+.43M
2,1+.16M
2.1+.09M
2.1+.06M
2.1+.30M
2.1+.09M
2.1+.04M
2.1+.02M
106
4.1-27
TABLE 27 SI/MMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
CDC 6400/6500, FUN Compiler PURDUE UNIVERSITY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
Time Unit (Sec)
.017
.12
.92
i
I
QZHES (Z) QZHES
7.5 6.7
QZIT(Z) QZIT
21 15
ELMHES
QZVAL(Z) QZVAL
N=60
N=80
3.0
6.9
I
I
I
7.3 6.3
7.2 6.1
7.3 6.1
7.3 6.1
20 12
17 9.0
16 8.0
15 7.2
.39 .38
.12 .12
.03 .03
.01 .02
.01 .01
QZVEC
2.4
1.8
1.5
1.4
1.4
s~m(u) SVD(V) SVD
9.7 9.5 5.4
7.7 7.7 3.4
6.7 6.7 2.5
6.5 6.5 2.2
6.4 6.4 2.1
MINFIT
9.7
7.4
6.3
6.1
6.0
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
31
29
26
25
23
RGG (QZHES,QZIT,QZVAL)
22
19
15
14
13
PATHS
107
4.1-28 TABLE 28 SIIMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE: CDC 6600/6400, RUN Compiler THE UNIVERSITY OF TEXAS ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
Time Unit (Sec)
.016
.048
.22
.65
TREDI TRED2 TRBAKI
1 i.I i.i
1 i~7 1.4
1 2.0 1.7
! 2.1 1.8
1 2.1 1.9
BANDR(Z) BANDR
i.! i.I
2.0 1.4
3.6 2.4
4.3 2.8
4.7 3.0
BQR BANDV
4 1.0
6 ,66
6 ,58
8 .57
7 .56
REDUC REDUC2 REBAK REBAKB
i.I !.0 I.i 1.0
1.3 i.i .70 .98
1.3 i.I .72 1.0
1.3 1.0 .66 1.0
1.3 1.0 .65 1.0
TQL2 TQLRAT
2.1 1.0
3.1 .70
4.1 .44
4.1 .30
4.2 .22
BISECT TINVIT
7.2 1.0
8.2 1,0
6.4 .66
4.8 .49
3.8 .47
RSB (BANDR(Z),TQL2)
3.1
5.1
7.7
8.3
8.9
RSB (BANDR,TQLRAT)
2.1
2.1
2.8
3.1
3.3
BANDR,BISECT,BANDV
I.I+I.7M
1.4+I.IM
2.4+.74M
2.8+.65M
3.0+.61M
BANDR,BISECT
I.I+.72M
1.4+.41M
2.4+.16M
2.8+.08M
3.0+.05M
RSG (REDUC,TRED2,TQL2,REBAK) 5.4
6.8
8.1
8.1
8.3
RSG (REDUC,TREDI,TQLRAT)
3.0
2.7
2.6
2.5
N=80 1.4
PATHS
3.1
REDUC,TREDI,BISECT,TINVIT, 2.1+I.0M TRBAKI,REBAK REDUC,TREDI,BISECT 2.1+.72M
2.3+.56M
2.3+.24M
2.3+.13M
2.3+.09M
2.3+.41M
2.3+.16M
2.3+,08M
2.3+.05M
108
4,1-29
TABLE 29 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE: CDC 6600/6400, RUN Compiler THE UNIVERSITY OF TEXAS
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=IO
N=20
N=40
N=60
Time Unit (Sec)
.016
.048
.25
.78
N=80
1.8
1
1
1
1
1
QZHES (Z) QZHES
2.9 2.8
5.5 4.8
7.3 6.1
7.5 6.2
7.6 6.2
QZIT(Z) QZIT
7.2 5.5
15 9.7
16 9.2
16 8.4
15 7.6
ELMHES
QZVAL(Z) QZVAL
.99 .99
QZVEC
.97
.33 .34
.06 .07
.02 .03
.02 .02
1.7
1.8
1.7
1.6
SVD
3.9 3.9 2.2
6.4 6.3 3.1
7.5 7.4 2.8
7.4 7.3 2.6
7.3 7.3 2.4
MINFIT
3.8
5.7
6.3
6.1
6.0
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
12
22
26
25
24
RGG (QZHES,QZIT,QZVAL)
9.3
15
15
15
14
SVD (u) SVD(V)
PATHS
109
4.1-30 TABLE 30 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED PEAL SYMMETRIC MATRIX SYSTEMS MACHINE:
Honeywell 6070 Fortran-Y(SR-H) BELL LABORATORIES
Optimized
ORDER OF MATRIX OR SYSTEM SUBROUTINE Time Unit
(Sec)
TRED 1 TRED2 TRBAK i
BANDR(Z)
N=I0
N=20
N=40
N=60
N=80
.012
.072
.49
1.6
3.6
1 1.6 •94
1 1.8 1.2
1 1.9 1.3
i 2.0 1.4
i 2.0 1.4
2.3 1.0
2.5 i.i
2.6 i.i
BAN-DR
•97 •53
1.8 .84
BQR BANDV
6 .51
5 .45
4 .42
5 .42
4 .42
REDUC REDUC2 REBAK REBAKB
i.i i.i .81 .69
I.i 1.0 .84 .72
i.i 1.0 .85 .75
i.I I.i .86 .76
i.i i.i .87 .78
TQL2 TQLRAT
4.1 i.i
4.4 .62
4.4 .32
4.2 .21
4.2 .15
BISECT TINVIT
5.3 i.i
3.1 .71
1.6 .40
i.I .30
.81 .29
RSB (BANDR(Z) ,TQL2)
5.0
6.2
6.7
6.7
6.8
RSB (BANDR,TQLRAT)
i. 7
1.5
1.3
1.3
1.3
BANDR, BISECT, BANDV
.53+1.0M
.84+.6~
I.~.4~
I.I+.44M
I.I+.43M
BANDR, BISECT
.53+. 53M
.8~.15M
I.~.04M
I.I+.02M
IoI+.OIM
PATHS
RSG (REDUC, TRED2, TQL2, REBAK)
7.5
8.1
8.3
8.1
8.2
RSG (REDUC, TRED 1, TQLRAT)
3.2
2.7
2.4
2.3
2.3
2.1+.29M
2.1+.IOM
2.1+.06M
2.1+.04M
2.1+.15M
2.1+.04M
2.1+.02M
2.1+.OIM
REDUC, TRED 1, BISECT, T INVlT, 2. i+. 82M TRBAK 1, REBAK REDUC, TRED 1, BISECT 2. i+. 53M
110
4.1-31
TABLE 31 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
Honeywell 6070 Fortran-Y(SR-H) Optimized BELL LABORATORIES
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
Time Unit (See)
.009
.069
.54
ELMHES
N=60
N=80
1.8
4.2
1
1
1
1
1
QZHES (Z) QZHES
7.4 6.4
7.2 6.1
7.1 5.8
7.0 5.7
7.0 5.7
QZIT(Z) QZIT
17 13
16 i0
Ii 6.4
ii 5.6
9.9 4.9
QZVAL(Z) QZVAL
• 56
• 16
• 04
• 02
•56
.16
.04
.02
• Ol .Of
QZVEC
2.1
1.7
1.4
1.3
1.3
SVD(U) SVD(V) SVD
9.1 9.0 5.4
7.5 7.4 3.5
6.2 6.2 2.5
5.9 5.9 2.2
5.7 5.6 2.0
MINFIT
9.4
7.6
6.2
5.9
5[7
RGG (QZ~ES(Z),QZIT(Z), QZVAL(Z),QZVEC)
27
25
20
19
18
RGG (QZHES,QZIT,QZVAL)
20
17
12
ii
ii
PATHS
111
4.1-32 T A B L E 32 S U M M A R Y OF E X E C U T I O N TIMES F O R THE E I S P A C K S U B R O U T I N E S I N C L U D E D IN THE P A T H S F O R REAL SYMMETRIC BAND M A T R I C E S A N D G E N E R A L I Z E D R E A L SYMMETRIC M A T R I X SYSTEMS MACHINE:
U n i v a c Iii0, F o r t r a n V(9) C o m p i l e r THE U N I V E R S I T Y O F W I S C O N S I N ORDER OF MATRIX OR SYSTEM
SUBROUTINE
N=IO
N=20
N=40
.012
.065
.40
I 1.6 .82
i 1.7 I.i
BANDR(Z) BANDR
.96 .57
i. 9 i.i
BQR BANDV
9 .76
i0 . 73
9 .74
8 .76
I0 .77
REDUC REDUC2 REBAK REBAKB
1.2 1.2 °82 .72
i.i 1.2 .84 .76
I.! i.i .84 °79
i.I I.i ~85 .81
I.i I.i .85 .81
TQL2 TQLRAT
3.3 i. 0
3.8 .66
4.1 .38
4.0 .26
4.2 .20
BISECT TINVIT
6.4 i. 2
3.9 .82
2.2 .51
1.5 .39
1.2 .37
RSB (BANDR(Z),TQL2)
4.2
5.7
6.7
6.9
7.2
RSB
1.6
1.7
1.8
1.8
1.8
Time Unit
(Sec)
TRED 1 TRED2 TRBAKI
N=60
N=80
1.2
2.8
i 1.8 1.3
I 1.9 1.4
i 2.0 1.5
2.6 1.4
2 °9 1.5
3. I 1.6
PATHS
(BANDR, TQLRAT)
BANDR,BISECT,BANDV
.57+1.4M
I.I+.93M
1.4+.80M
1.5+.79M
1.6+.78M
BANDR, B ! S E C T
~57+.64M
I.I+.20M
1.4+.06M
I.5+.03M
1.6+.OIM
RSG (REDUC,TRED2,TQL2,REBAK)
6.8
7.4
7.9
7.9
8.1
R S G (REDUC, T R E D I, TQLRAT)
3.2
2.8
2.5
2.4
2.3
REDUC,TREDI,BISECT~TINVlT, 2.2+.92M T R B A K i, R E B A K REDUC,TREDI,B!SECT 2.2+.64M
2.1+.33M
2.1+.12M
2.1+.07M
2.1+.05M
2.1+.20M
2.1+.06M
2.1+.03M
2.1+.OIM
112
4.1-33
TABLE 33 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN TEE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
Univac iii0, Fortran V(9) Compiler THE UNIVERSITY OF WISCONSIN
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
Time Unit (Sec)
.009
.062
.45
ELMHES
N=60
N=80
1.5
3.4
i
I
i
I
i
QZHES (Z) QZHES
6.6 5.8
7.0 5.9
7.3 6.0
7.4 6.1
7.5 6.1
QZIT(Z) QZIT
17 13
16 ii
12 7.0
12 6.5
ii 5.5
QZVAL(Z) QZVAL
.38 .39
.12 .12
.04 .04
.02 .02
.01 .01
QZVEC
1.9
1.5
1.3
1.2
1.2
SVD(U) SVD(V) SVD
7.8 7.8 4.7
6.6 6.6 3.2
5.8 5.8 2.4
5°7 5.7 2.1
5.6 5.6 2.0
MINFIT
8.0
6.7
5.9
5.8
5.6
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
26
25
21
21
20
RGG (QZHES,QZIT,QZVAL)
19
17
13
13
12
PATHS
113
4.1-34 TABLE 34 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE:
DEC KA-PDP-IO, F40 Compiler YALE UNIVERSITY ORDER OF MATRIX OR SYSTEM
SUBHOUT INE
N=I0
N=20
Time Unit (Sec)
.092
~62
N=30
N=40
1.9
4.4
TRED 1 TRED2 TRBAK 1
1 1.8 1.3
1 2.0 1.5
1 2.0 i.6
i 2.1 1.7
BANDR(Z) Bm~mR
1.2 .47
2.0 .75
2.4 .85
2.5 .90
5 .53
4 .42
3 .40
4 .38
REDUC REDUC 2 REBAK REBAKB
1.2 I.i .80 .76
1.2 1.2 ,86 .82
1.2 1.2 ,89 .86
1.2 1.2 .91 .87
TQL2 TQLRAT
3.6 .80
3.8 .42
3.8 .28
3.7 .21
BISECT TINVIT
4.1 1.2
2.1 .69
1.4 .50
1.0 .40
RSB (BANDR(Z),TQL2)
4.8
5.8
6,1
6.2
RSB (BANDR,TQLRAT)
1.3
1.2
i.i
i,i
BQR BANDV
PATHS
BANDR,BISECT~BANDV
.47+.94M
.75+.52M
.85+.45M
.90+.41M
BANDR,BISECT
.47+.41M
•75+. I O M
.85+. 0 5 M
,90+. 03M
RSG (REDUC,TRED2,TQL2,REBAK) 7.4
7.8
7.9
7.9
RSG (REDUC,TRED!,TQLRAT)
2,6
2.5
2,4
3.0
REDUC,TREDI,BISECT,TINVIT, 2.2+.74M TRBAKI,REBAK REDUC,TREDI,BISECT 2.2+.41M
2.2+.26M
2.2+.15M
2.2+.IOM
2.2+.IOM
2.2+,05M
2.2+,03M
114
4.1-35
TABLE 35 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED REAL MATRIX SYSTEMS AND SINGLrLAR VALUE DECOMPOSITION MACHINE:
DEC KA-PDP-10, F40 Compiler YALE UN!I~RSITY
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
Time Unit (Sec)
.089
.77
ELMHES
N=30
N=40
2.5
6.0
i
i
1
1
QZHES (Z) QZHES
7.0 6.0
6.5 5.4
6.7 5.5
6.7 5.6
QZIT(Z) QZIT
15 Ii
14 8.2
12 6.7
ii 6.0
QZVAL(Z) QZVAL
.25 .27
.06 .06
.03 .02
.02 .O1
QZVEC
1.7
1.3
1.2
1.2
SVD(U) SVD(V) SVD
6.6 6.6 3.2
5.3 5.3 2.2
5.0 5.1 1.9
4.9 4.9 1.8
MINFIT
6.7
5.3
5.0
4.9
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
24
22
20
19
RGG (QZHES,QZIT,QZVAL)
17
14
12
12
PATHS
115
4.1-36 TABLE 36 SUMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR REAL SYMMETRIC BAND MATRICES AND GENERALIZED REAL SYMMETRIC MATRIX SYSTEMS MACHINE:
Amdahl 470V/6, Fortran H, OPT=2 ~{IVERSITY OF MICHIGAN ORDER OF MATRIX OR SYSTEM
SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (Sec)
.002
.014
.092
.30
.71
1 1.6 1.2
1 1.8 1.4
1 2.0 1.6
1 2.0 1.6
1 2.0 1.6
TREDI TI~ED2 TRBAKI BANDR(Z) BANDR
.88 .52
1.5 .74
1.9 ~83
2.0 .84
2.0 .83
BQR BANDV
6 .43
5 .35
4 .33
4 .32
4 .32
EEDUC REDUC2 REBAK REBAKB
I.i .98 .61 .55
1.0 .98 .67 .63
1.0 .98 .70 .70
1.0 .99 .72 .74
i.i .98 .70 .74
TQL2 TQLRAT
4,8 1.5
5.2 .85
5.2 .42
4.9 .27
4.6 .19
BISECT TINVIT
ii i.i
6.9 .68
3.8 .39
2.6 .29
1.9 .29
RSB (BANDR(Z) ,TQL2)
5.7
6.7
7.1
6.9
6.6
RSB (BANDR, TQLRAT)
2.0
1.6
1.3
i.i
1.0
PATHS
BANDR,BISECT,BANDV
.52+1.5M
.74+.69M
.83+.42M
o84+.36M
.83+.34M
BANDR,BISECT
.52+1.1M
.74+.34M
.83+.09M
.84+.04M
.83+.02M
RSG (REDUC,TILED2,TQL2,REBAK)
8.1
8.7
8.9
8.7
8.4
RSG (REDUC, TRED [, TQLRAT)
3.5
2.9
2.5
2.3
2.2
REDUC,TREDI,BISECT,TINVIT, 2.1+1.4M TP~BAK1, REBAK REDUC,TREDI,BISECT 2.1+I.IM
2.0+.48M
2.0+.16M
2.0+.09M
2.0+.06M
2.0+.34M
2.0+.09M
2.0+.04M
2.0+.02M
t16
4.1-37
TABLE 37 SLrMMARY OF EXECUTION TIMES FOR THE EISPACK SUBROUTINES INCLUDED IN THE PATHS FOR GENERALIZED P~AL MATRIX SYSTEMS AND SINGULAR VALUE DECOMPOSITION MACHINE:
Amdahl 470V/6, Fortran H, OPT=2 UNIVERSITY OF MICHIGAN
ORDER OF MATRIX OR SYSTEM SUBROUTINE
N=I0
N=20
N=40
N=60
N=80
Time Unit (See)
.002
.014
.12
.40
.99
1
I
I
I
!
QZHES(Z) QZHES
7.7 6.8
7.1 6.1
6.8 5.7
6.4 5.4
6.1 5.1
QZIT(Z) QZIT
24 18
21 13
16 9,0
15 7.7
13 6.3
ELMHES
QZVAL(Z) QZVAL
.58 .57
.17 .16
.04 .04
.02 .02
.01 .01
QZVEC
2.2
1.6
1.3
1.2
i.i
SVD(U) SVD(V) SVD
II ii 6.7
8.3 8.2 3.9
6.6 6,6 2.5
5.9 5.8 2.0
5.5 5.4 1.8
MINFIT
12
8.5
6.7
6.0
5.6
RGG (QZHES(Z),QZIT(Z), QZVAL(Z),QZVEC)
34
30
25
23
20
RGG (QZHES,QZIT,QZVAL)
25
20
15
13
ii
PATHS
117
4.1-38
TABLE 38 EXECUTION TIMES FOR SELECTED EISPACK DRIVER SUBROUTINES, SVD AND MINFIT OVER VARIOUS COMPUTER SYSTEMS MEASURED ON PROBLEMS OF ORDER 40 BOTH WITH EIGENVECTORS COMPUTED (i) AND WITHOUT (0) MACHINE Time Unit (Sec) IBM 370/195 (ARGONNE NATIONAL LABORATORY)
RSB(1) RSB(0) RSG(1) RSG(O)RGG(1) ~22
.061
.30
.ii
1
1
1
1
RGG(Q)
SVD
MINFIT
.63
.14
.28
1
1
i
I
1.0
IBM 360/75 (UNIVERSITY OF ILLINOIS)
15
9.2
14
ii
13
13
9.7
13
IBM 360/65 (AMES LABORATORY)
27
17
24
18
24
22
17
22
IBM 370/165 (THE UNIVERSITY OF TORONTO)
3.9
2.7
3.4
2.9
3.5
3.2
2.6
3.4
IBM 370/168 Mod 3 (STANFORD UNIVERSITY)
3.0
2.2
2.8
2.4
2.7
2.6
2.3
2.7
BURROUGHS 6700 138 (UNIVERSITY OF CALIFORNIA, SAN DIEGO) CDC 6600 (KIRTLAND AIR FORS~ BASE)
5.0
CDC CYBER 175 (NASA LANGLEY RESEARCH CENTER)
1.7
67
3.6
.94
123
91
119
108
82
ii0
5.4
5.1
4.9
4.8
4.4
4.8
1.6
1.2
1.7
1.6
1.2
1.3
I.i CDC 7600 (NATIONAL CENTER FOR ATMOSPHERIC RESEARCH)
1.0
1.0
i°0
1.0
1.0
CDC 7600 (LAWRENCE L IVERMORE LABORATORY)
2.1
i.i
2.0
1.7
1.5
1.5
1.2
1.4
CDC 6400 (NORTHWESTERN UNIVERSITY)
21
17
19
16
21
20
15
20
CDC 6400/6500 (PURDUE UNIVERSITY)
28
29
23
19
23
22
17
21
118
.87
.86
4.1-39
TABLE 38 (Cont'd) EXECUTION TIMES FOR SELECTED EISPACK DRIVER SUBROUTINES, SVD AND MINFIT OVER VARIOUS COMPUTER SYSTEMS MEASURED ON PROBLEMS OF ORDER 40 BOTH WITH EIGENVECTORS COMPUTED (i) AND WITHOUT (0) MACHINE Time Unit (Sac)
RSB(1) RSB(0) RSC
.061
.30
.ii
1
1
1
1
CDC 6600/6400 (THE UNIVERSITY OF TEXAS)
7.9
i0
6.0
HONEYWELL 6070 (BELL LABORATORIES)
15
Ii
UNIVAC iii0 (THE UNIVERSITY OF WISCONSIN)
12
126
IBM 370/195 (ARGONNE NATIONAL LABORATORY)
DEC KA-PDP-10 (YALE UNIVERSITY) AMDAHL 470V/6 (UNIVERSITY OF MICHIGAN)
3.0
MINFIT
.63
.14
.28
1
1
1
1
5.8
6.3
6.1
5.2
5.7
13
ii
ii
i0
9.6
12
12
ii
9.5
9.3
9.3
7.7
9.5
92
109
1.9
2.7
119
125
2.2
1.0
SVD
114
2.8
109
2.7
79
2.1
104
2.8
4.1-40
TABLE 39 SUMMARY OF EXECUTION TIMES FOR SELECTED PROBLEMS USING THE EISPAC CONTROL PROGRAM MACHINE: IBM 370/195, Fortran H, OPT=2 ARGONNE NATIONAL LABORATORY
Time Unit:
1 second ORDER OF MATRIX OR SYSTEM
PROBLEM CLASS
EIGENVALUES
EIGENVECTORS
GUIDE SECTION
N=I0
N=20
N=40
N=60
RSB
All
All
2.1.1
.012
.041
.23
.70
RSB
All
None
2.1.2
°008
.016
.066
.18
RSB
Some(M=N)
Some(M=N)
2.1.3
o031
.13
RSB
Some(M=N)
None
2.1.4
.023
.068
.26
.61
i.i
RSG
All
All
2.1.5
,019
.058
.31
.93
2.0
RSG
All
None
2.1.6
.014
.028
.ii
.31
RSG
Some(M=N)
2.1.7
.034
.i0
.43
RSG
Some(M=N)
None
2.1.8
.029
,080
.31
RGG
All
All
2.1.9
.031
.16
RGG
All
None
2.1.10
.024
.II
Some(M=N)
120
1.0
i.i .66
4.1
i.i .75
N=80
1.6 .39 12
.68 2.2 1.4
3.1
6.8
1.9
4.0
4.2-1
Section 4.2 REPEATABILITY
AND RELIABILITY OF THE MEASURED EXECUTION TIMES
In the multi-program difficult variations
environment of modern computers,
to reliably measure the execution
it is often very
time of a program.
Significant
can occur depending on the load on the machine and the amount of
I/0 interference.
For the EISPACK subroutines
to be made also for the dependence of execution
in particular,
allowance has
times upon the matrix or
matrix system (see Section 4.3). Towards improving the usefulness of the timing information various machines,
each subroutine was run a number of times on different
matrices and the average time reported. structured
for the
Also, the timing programs were
to perform no output until all the timings had been collected.
For the most part, the timing routines used to measure execution out external interrupts which may occur. although not to be interpreted
The reported times,
as absolute bounds,
121
therefore,
should be useful in giving
a feeling for the execution time required by the individual paths.
time factor
subroutines
or
4.3-1
Section 4.3 DEPENDENCE
OF THE EXECUTION TIMES UPON THE MATRIX OR MATRIX SYSTEM
To characterize
the dependence
of the execution
subroutines
upon the matrix or matrix system,
subroutines
into two main categories:
and back transformation eigenvalue-eigenvector
subroutines;
it is helpful to divide the
first, the non-iterative and second,
reduction
the iterative reduced-form
subroutines.
For the first category of subroutines, sparse matrices
times of the EISPACK
the execution
times for all non-
and matrix systems of a given order are approximately
close to those given in the tables of Section 4.1. of the reduction
transformations
consume less time to manipulate special sparse matrices,
For sparse matrices)
may be skipped and the arithmetic the many zero operands;
the decrease in execution
constant)
however,
some
unit may
except for
time of these subroutines
is marginal. For the second category of subroutines,
their execution
greatly upon the structure of the input matrix or matrices dominant,
blocked,
sparse),
the closeness
tiveness
of the matrix or system.
370/195,
random matrices
subroutines,
times depend
(e.go, diagonally
of the eigenvalues)
Based upon our experiments
and the defecon the IBM
tend to produce slower execution of category two
and therefore the execution
times given in the tables of
Section 4ol appear to be near the maximum for these subroutines. Subroutines have components to bi-diagonal
SVD and MINFIT,
each of which is completely
in both categories
distinguished
form is non-iterative,
values from the bi-diagonal tines BISECT, TINVIT,
the reduction step
while the determination
form is iterativeo
and BANDV,
above;
self-contained,
of the singular
On the other hand, subrou-
although seemingly second category candidates
122
4.3-2
by their roles, are better placed into the first category -- BISECT because it employs a fixed number of bisections, and TINVIT and BANDV because, although formally iterative, they almost always converge on the first iteration.
t23
4.4-i
Section 4.4 EXTRAPOLATION
OF TIMING RESULTS TO OTHER MACHINES AND COMPILERS
The extrapolation
of timing results to other machines
may appear straightforward
but can be grossly inaccurate
of the particular machines
and compilers
illustrate
and compilers
if characteristics
are not carefully considered.
this point, we make two comparisons:
first,
of EISPACK on an IBM 360/75 and 370/195, and second,
To
the execution
the execution
times
times of
EISPACK compiled with the CDC 6600 Fortran RUN and FTN compilers. The eigensystems using identical
of several random matrices
object modules
of order 80 were determined
on the IBM 360/75 and 370/195.
the IBM 360/75 times to the 370/195 times show large variations tine to subroutine are between
(compare Tables 4-5 with Tables 6-7).
!I and 14, but at opposite
BANDV are 6.7 and 7.8, respectively, These large variations routines namely,
are attributable
whereas for TQL2,
to the special architecture
the buffered or two-level memory,
able to take advantage
from subrou-
Many of the ratios
extremes the ratios for BISECT and
in the ratios of execution
metic units~ and the instruction
The ratios of
stack.
19.4. times among the subof the IBM 370/195;
the pipe line or parallel arithSome of the EISPACK subroutines
are
of these special features of the 370/195 better than
others. The compiler can also affect the relative efficiencies routines.
On two comparable
CDC 6600 computers,
compiler and the other the FTN compiler,
1.4 for BANDV,
one employing
the RUN
the ratios of the execution
for the EISPACK subroutines were determined Tables 28-29).
of EISPACK sub-
(compare Tables
times
16-17 with
Many of the ratios are close to I, but extremes as large as 2.6 for BANDR with accumulation,
124
and 3.8 for BANDR without
4.4-2
accumulation of transformations obtain for real symmetric band matrices of order 80° It is clear from these examples that the relative efficiency of an algorithm can be very machine and compiler dependent, and hence that the extrapolation of our timing results to other systems must necessarily include these considerations.
125
4.5-1
Section 4.5 TIMING CONSIDERATIONS
FOR BAND PROBLEMS AND SINGULAR VALUE DECOMPOSITION
The tables of Section 4.1 limit themselves,
in the timings for real
symmetric band problems and singular value decomposition, shape each -- for band problems to be 3/10 of the order
the (half) band width
to a single matrix
(MB) is always chosen
(N), while for singular value decomposition
the
coefficient matrix is always chosen to be square (M = N) with one constant vector
(IP = i) transmitted
useful towards attempting
to MINFIT.
to estimate
The following information may be the corresponding
times in other prob-
lem situations. Let two symmetric band matrices be described as similar if the ratio of (half) band width to order is the same for each. matrices will be described dimension
Analogously,
two rectangular
as similar if the ratio of row dimension
is the same for each.
to column
Thus, all band matrices used in the timings
of Section 4.1 are similar with common ratio 3/10, and all rectangular matrices used in the timings of SVD and MINFIT are similar with common ratio i. the ratios of execution band matrices
times for the EISPACK subroutines
are approximately
the ratios of execution lar matrices
on a pair of similar
the same as the corresponding
another pair of similar band matrices of the same orders.
Then,
ratios for
And, analogously,
times for SVD or MINFIT on a pair of similar rectangu-
are approximately
the same as the corresponding
ratios for
another pair of similar rectangular matrices with the same larger dimensions. The following charts report the IBM 370/195 timings for BANDR, BANDV on band matrices of order 80 with differing SVD and MINFIT on several rectangular times are in seconds.
These charts,
4.1~ should be useful in estimating
BQR, and
(half) band widths,
matrices with larger dimension
and for 80.
The
in combination with the tables of Section execution
rectangular matrices of different dimensions
126
times for band matrices and on a specific machine.
4.5--2
SUBROUTINE
(N,MB)= (80,4)
(N,MB)= (80,8)
(N,MB)= (80,12)
(N,MB)= (80,16,)
(N,MB)= (80,20)
(N,I{B)= (80,24)
BANDR(Z)
.27
.39
.47
.52
.57
.61
BANDR
.066
.14
.20
.25
.29
.33
BQR
,15
.35
.68
BANDV
.009
.024
.046
I.i
1.6
.072
1.7
.i0
.13
SUBROUTINE
(M,N)=(80,20)
(M~N)y(8Q,40)
(M~N)=(40,80)
(M,N)=(80~80)
Sl~(U)
.16
.58
.50
1.9
SVD(V)
.i0
.42
.82
1.9
SVD
.08
.26
.27
MINFIT
.i0
.42
.79
.78 1.9
For example, to estimate the execution time T(60,12) on the IBM 370/195 for BAN-DR(Z) on a band matrix of order 60 and (half) band width 12, proceed from the proportion T(60,12)/T(g0,16) = T(60,18)/T(80,24) and substitute, using the chart above and Table 4, to obtain T(60,12)/.52 = .25/.61, from which T(60,12) is estimated as .21 seconds.
To convert this estimate to
one for a different machine, multiply by the ratio of speeds of the two machines for this subroutine, which can be estimated from corresponding entries in the tables of Section 4.1. The entries for MINFIT in the tables of Section 4.1 and in the chart above are obtained from problems where the constant matrix is a single (column) vector (IP = i).
The additional time required when the constant
matrix has more columns is generally small and varies approximately linearly with the number of columns. The following chart reports the IBM 370/195 timings (in seconds) for MINFIT when it is called successively with no constant matrix (IP = 0),
127
4.5-3
one column vector
SUBROUTINE
(IP = i)~ and two column v e c t o r s
(IP = 2).
_~,N)=(80,20)
(M,N)=(80,40)
(M,N)=(40,80)
(M~N)=(80,80)
MINFIT(IP
= 0)
.09
.41
.78
1.9
MINFIT(IP
= i)
.!0
.42
.79
1.9
MINFIT(IP = 2)
.10
.43
.80
2.0
128
4.6-1
Section 4.6 THE SAMPLE MATRICES FOR THE TIMING RESULTS
In this section, Fortran listings of the program segments which generate the sample matrices for the timing results are provided.
The matrix elements
are pseudo-random integers sampled from a uniform distribution on the interval (-215,+215).
A listing of the auxiliary subroutine RANDOM which generates
the random integers is also provided.
REAL GENERAL MATRIX
C C
10 20
DO 20 I = 1,N DO 10 J = 1,N CALL RANDOM (INIT, A(I,J)) CONTINUE CONTINUE
REAL SYMMETRIC BAND MATRIX
1O 20
MB = ( 3 * N ) / 10 DO 20 I = I , N DO 10 J = 1,MB CALL RANDOM (INIT, A(I,J)) CONTINUE CONTINUE
GENERALIZED REAL SYMMETRIC MATRIX SYSTEM
I0
20 30
DO 30 1 = 1, N SUM = 0.0 DO 10 J = I,N CALL RANDOM ( I N I T , A ( I , J ) ] A(J, I) = A(I,J) CALL RANDOM (INIT, B(I,J)) ,B(J,I) = B(I,J) CONTI NUE DO 20 J = IpN SUM = SUM + A B S ( B ( I , J ) ) CONTINUE B(I,I) = SUM CONT INUE
129
4.6-2
GENERALIZED REAL MATRIX SYSTEM
i0 20
DO 20 I = I,N DO 10 J = I,N CALL R A N D ~ (INIT, A(I,J)) CALL RANDOM (INIT, B(I,J)) CONTINUE CONTINUE
Subroutine RANDOM:
SUBROUTINE RANDOM (INIT, X) REAL X INIT = MOD(3125*INIT, 65536) X = INIT - 32768 RETURN END
Subroutine RANDOM produces pseudo-random integer elements X between -215 and 215 from a starting integer INIT.
It was designed so that it
could be implemented in Fortran and would produce the same set of pseudorandom numbers on different machines.
As a result it has some shortcomings
as a random number generator, including a rather short period of 214 numbers.
130
5.0-i
Section 5 CERTIFICATION AND AVAILABILITY OF EISPACK Under the auspices of the NATS Project, the subroutines constituting Release 2 of EISPACK have been tested on and are certified for the following computer systems and working precisions (test site names are indicated in parentheses): MACHINE
OPERATING SYSTEM
COMPILER
WORKING PRECISION
IBM 370/195
OS/360 (21.7) FTN IV G,H(21.7),WATFIV (ARGONNE NATIONAL LABORATORY)
LONG
IBM 360/75
OS/360 (21.7) FTN IV H(21.7) (UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN)
LONG
IBM 370/168
MTS FTN IV G,H (UNIVERSITY OF MICHIGAN)
LONG
IBM 360/75
0S/360 (21.7) FTN IV H EXTENDED(2.1) (STOCKHOLM DATA CENTER)
LONG
IBM 370/165
OS/360 (21.7) FTN IV H EXTENDED(2.1) (THE UNIVERSITY OF TORONTO)
LONG
BURROUGHS 6700
MCP 2.6 FORTRAN IV(2.6) (UNIVERSITY OF CALIFORNIA, SAN DIEGO)
SINGLE
CDC 6600
SCOPE 3.4.2 FTN(4.2) (KIR~ AIR FORCE BASE/AFWL)
SINGLE
CDC 6600
KRONOS 2.1 RUN(2.3) (ICASE/NASA LANGLEY RESEARCH CENTER)
SINGLE
CDC 7600
(LOCAL) (LOCAL) (NATIONAL CENTER FOR ATMOSPHERIC RESEARCH)
SINGLE
CDC 6400
SCOPE 3.3 RUN(2.3),FTN(3.0) (NORTHWESTERN UNIVERSITY)
SINGLE
CDC 6400/6500
(LOCAL) FUN (PURDUE UNIVERSITY)
SINGLE
UT2D-85 RUN(60.2),MNF,RLrNW ( T H E UNIVERSITY OF TEXAS AT AUSTIN)
SINGLE
HONEYWELL 6070
GECOS SR-F FORTRAN-Y(SR-F) (BELL LABORATORIES AT MURRAY HILL)
SINGLE
UNIVAC iii0
EXEC-8(31.244) FORTRAN V(9) (THE UNIVERSITY OF WISCONSIN)
SINGLE
DEC PDP-IO
TOPS-IO(506B) FORTRAN F40 (YALE UNIVERSITY)
SINGLE
CDC 6600/6400
131
5.0-2
The control program EISPAC has been tested on and is certified for the IBM systems at Argonne, Illinois, Stockholm, and Toronto listed above. Additional testing of EISPACK was carried out at Stanford University, Harvard University, and on the Amdahl 470V/6 machine at University of Michigan. Certification implies the full support of the NATS project in the sense that reports of poor or incorrect performance on at least the computer systems listed above will be examined and any necessary corrections made. This support holds only when the software is obtained through the channels indicated below and has not been modified; it will continue to hold throughout the useful life of EISPACK or until, in the estimation of the developers, the package is superseded or incorporated into other supported, widelyavailable program libraries.
The following individual serves as a contact
for information about EISPACK, accepting reports from users concerning performance: Burton S. Garbow Applied Mathematics Division Argonne National Laboratory Argonne, Illinois 60439 U.S.A. Phone: 312-739-7711 x4342 EISPACK is distributed from the Argonne Code Center.
Versions exist
for IBM 360-370, CDC 6000-7000, Univac iii0, Honeywell 6070, DEC PDP-10, and Burroughs 6700 machines.
Requesters interested in obtaining EISPACK
(Fortran source decks, documentation, and testing aids) should write to the following address for complete information on the acquisition procedures: Argonne Code Center Building 221 Argonne National Laboratory Argonne, Illinois 60439 U.S.A.
132
6.0-I
Section 6 DIFFERENCES BETWEEN THE EISPACK SUBROUTINES AND THE HANDBOOK ALGOL PROCEDURES
This section describes, subroutine by subroutine, the major differences between the EISPACK subroutines covered in this volume and their Algol antecedents in the Handbook [i].
These differences fall into four categories:
i) correction of several errors, 2) minor algorithmic improvements, 3) changes based on consideration of Fortran language efficiency, and finally, 4) changes to better unify the individual programs into a package. Specific changes to individual members of EISPACK are as follows.
BANDR
-
The lower triangle of the matrix is stored rather than the upper triangle, thus placing, in particular, the main diagonal elements in the last column.
The Algol column range of 0 to M has been
translated to I to M by redefining M to include the main diagonal.
-
The Givens reduction transformations are formulated in square-root free form.
BQR
-
Storage organization, column labeling, and definition of M as for BANDR.
The orthogonality threshold parameter TOL has been replaced by the scaling technique discussed in the "Organisational and Notational Details" section of the Handbook, Contribution 11/2, p. 221.
MINFIT -
Separate storage entities are provided for the coefficient and constant matrices rather than maintaining a single augmented array.
The parameter T0L has been replaced as in BQR.
133
6.0-2
An error parameter has been introduced that is set in instances of non-convergence.
A test has been inserted to avoid a possible divide exception.
REBAK
-
Instead of back transforming eigenvectors MI through M2 as is done in the Handbook, REBAK transforms eigenvectors
i through M.
REBAKB -
As for REBAK.
SVD
The replacement of TOL, the introduction of an error parameter, the insertion of a test to avoid a possible divide exception are done as in MINFITo
It is not required that the matrix be presented with at least as many rows as columns;
it is r e c o ~ e n d e d ~
efficiency~
134
however,
for greater
and
7,0-i
Section 7 DOCUMENTATION AND SOURCE LISTINGS
This section contains the documentation and source listings for the EISPACK subroutines covered in this volume and the documentation for the control program EISPAC.
The subroutines appear in alphabetical order in
Section 7.1 with the source listing for each subroutine following its document.
Section 7.2 contains the document for EISPAC, but because of its
size and machine dependencies the listing is not included. Both the subroutine documents and source listings have been systematically edited for this publication to eliminate duplicate text; they therefore differ from the material distributed to requesters of EISPACK.
The statement
of certification of item 6 has been removed from the individual documents and appears here in Section 5.
The reference to this publication which appears
in item 4 and the brief discussion of testing that appears in items 5.A and 5.C of the distributed documents have been removed; the latter has been replaced by a pointer to the more extensive discussion of testing here in Section 3. Two modifications have been made to the subroutine listings published here.
First, they have been shortened by eliminating comments related to
usage, calling sequence, and error exits which basically duplicate text in the documents.
Second, statements initializing the machine-dependent
variable MACHEP, which in each distributed version of EISPACK are completed to contain its appropriate numerical value, appear here as
MACHEP = ?
(The correct value for MACHEP is the smallest positive working precision floating point number which, when added to 1.0 using the working precision addition operation on your machine, gives a number larger than 1.0.)
135
7,0-2
Appropriate values of MACHEP for several machines are summarized in the following table.
MACHINE
MACHEP
Burroughs 6700
2.**(-37)
CDC 6000 and 7000 Series
2.**(-47)
DEC PDP-IO
2.**(-26)
Honeywell 6070
2.**(-26)
Univac iii0
2.**(-26)
IBM 360-370 Double precision
16.D0"*(-13)
Single precision
16.**(-5)
Except for the statements initializing MACHEP, the published listings are ANSI Fortran.
The double precision version certified for IBM equipment
employs non-standard Fortran to the extent of using F~AL*8 declarations.
136
7.1-i
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F226
PACKAGE
(EISPACK)
BANDR
A F o r t r a n IV S u b r o u t i n e to R e d u c e a R e a l S y m m e t r i c B a n d M a t r i x to a S y m m e t r i c T r i d i a g o n a l M a t r i x U s i n g and O p t i o n a l l y Accumulating Orthogonal Transformations.
July,
1975
I. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e BANDR reduces a real symmetric b a n d m a t r i x to a s y m m e t r i c t r i d i a g o n a l m a t r i x u s i n g and optionally accumulating orthogonal similarity transformations. This r e d u c e d f o r m is u s e d by o t h e r s u b r o u t i n e s to find the e i g e n v a l u e s a n d / o r e i g e n v e c t o r s of the o r i g i n a l m a t r i x . See s e c t i o n 2C for the s p e c i f i c routines.
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
BANDR(NM,N,MB,A,D,E,E2,MATZ,Z)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l array A (and Z if MATZ is true) as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t for A (and Z) in the c a l l i n g p r o g r a m . is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x A. g r e a t e r than NM.
137
set e q u a l to N m u s t be not
7.1-2
MB
is an integer input v a r i a b l e set equal to the (half) band width of the m a t r i x A, defined as the number of adjacent diagonals, i n c l u d i n g the p r i n c i p a l diagonal, required to specify the non-zero portion of the lower triangle of the matrix. MB must be not greater than N.
A
is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least MB. On input, A contains the lower triangle of the symmetric band m a t r i x of order N and (half) band width MB to be reduced to tridiagonal form. Its lowest s u b d i a g o n a l is stored in the last N+I-MB p o s i t i o n s of the first column, its next s u b d i a g o n a l in the last N+2-MB p o s i t i o n s of the second column, further s u b d i a g o n a l s similarly, and finally its p r i n c i p a l diagonal in the N positions of the last column. Contents of storage locations not part of the m a t r i x are arbitrary. For example, when N=5 and MB=3, A should contain ( * ( * (A(3,1) (A(4,2) (A(5,3)
* A(2,1) A(3,2) A(4,3) A(5,4)
A(I,I) A(2,2) A(3,3) A(4,4) A(5,5)
) ) ) ) )
where the subscripts for each element refer to the row and column of the element in the standard t w o - d i m e n s i o n a l r e p r e s e n t a t i o n , and (*) denotes an a r b i t r a r y value. On output, A has been destroyed, except for its last two columns which contain a copy of the tridiagonal matrix. is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N c o n t a i n i n g the d i a g o n a l elements of the tridiagonal matrix. is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N containing, in its last N-I positions, the s u b d i a g o n a l elements of the t r i d i a g o n a l matrix. The element E(1) is set to zero.
138
7.1-3
E2
is a w o r k i n g p r e c i s i o n r e a l o u t p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g , in its last N-I positions, the s q u a r e s of the s u b d i a g o n a l e l e m e n t s of the t r i d i a g o n a l m a t r i x . The element E2(1) is set to zero. E2 n e e d not be d i s t i n c t from E (non-standard usage acceptable with at l e a s t t h o s e c o m p i l e r s i n c l u d e d in the c e r t i f i c a t i o n s t a t e m e n t ) , in w h i c h c a s e no s q u a r e s are r e t u r n e d .
MATZ
is a l o g i c a l i n p u t v a r i a b l e set true if the t r a n s f o r m a t i o n m a t r i x is to b e a c c u m u l a t e d and set f a l s e o t h e r w i s e . is, if MATZ is true, a w o r k i n g p r e c i s i o n real o u t p u t t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at least N. It c o n t a i n s the o r t h o g o n a l t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the r e d u c t i o n to the t r i d i a g o n a l form. If MATZ is f a l s e , Z is not r e f e r e n c e d and can be a dummy (working precision) variable.
B.
Error
Conditions
and R e t u r n s .
None.
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
If all the e i g e n v a l u e s of the o r i g i n a l m a t r i x are d e s i r e d , this s u b r o u t i n e s h o u l d be f o l l o w e d by TQLI (F289), I M T Q L I (F291), or T Q L R A T (F235). If all the e i g e n v a l u e s and e i g e n v e c t o r s of the o r i g i n a l m a t r i x are d e s i r e d , this s u b r o u t i n e s h o u l d be f o l l o w e d by TQL2 (F290) or I M T Q L 2 (F292), i d e n t i f y i n g the output Z m a t r i x a b o v e w i t h the i n p u t Z m a t r i x to TQL2 or IMTQL2. If some of the e i g e n v a l u e s of the o r i g i n a l m a t r i x are d e s i r e d , this s u b r o u t i n e s h o u l d be f o l l o w e d by BISECT (F294) or T R I D I B (F237). If some of the e i g e n v a l u e s and e i g e n v e c t o r s of the o r i g i n a l m a t r i x are d e s i r e d , this s u b r o u t i n e s h o u l d be f o l l o w e d by B I S E C T (F294) or T R I D I B (F237) and then by B A N D V (F227). N o t e , h o w e v e r , that the i n p u t m a t r i x A m u s t be s a v e d b e f o r e BANDR for the l a t e r use b y BANDV, s i n c e BANDR d e s t r o y s it.
139
7.1-4
3. D I S C U S S I O N
OF METHOD
AND ALGORITHM.
The t r i d i a g o n a l r e d u c t i o n is p e r f o r m e d in the f o l l o w i n g way. Starting w i t h J=l, the elements in the J-th column w i t h i n the band and below the p r i n c i p a l s u b d i a g o n a l are eliminated successively, starting from the lowermost element, by fast Givens t r a n s f o r m a t i o n s (2). Each such t r a n s f o r m a t i o n p r e s e r v e s symmetry but introduces a new element outside of the band. To m a i n t a i n the band form, these elements are e l i m i n a t e d by a sequence of a d d i t i o n a l t r a n s f o r m a t i o n s with the effect of shifting them downwards and finally b e y o n d the border of the matrix. By a c c u m u l a t i n g the t r a n s f o r m a t i o n s in Z, full i n f o r m a t i o n is saved for later use in the d e t e r m i n a t i o n of the eigenvectors. The above steps are repeated on further columns of the transformed A until A is reduced to t r i d i a g o n a l form; that is, repeated for J = 2,3,...,N-2. Finally, the elements of the t r i d i a g o n a l form are copied into D and E and the squares of the s u b d i a g o n a l elements stored in E2. This subroutine BANDRD written
is a t r a n s l a t i o n of the Algol p r o c e d u r e and d i s c u s s e d in detail by Schwarz (i).
4. REFERENCES.
l)
Schwarz, H.R.~ T r i d i a g o n a l i z a t i o n of a Symmetric Band Matrix, Num. Math. 12,231-241 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c C o m p u t a t i o n , Volume II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/8, 273-283, S p r i n g e r - V e r l a g , 1971.)
2)
Gentleman, W.M., Least Squares C o m p u t a t i o n s T r a n s f o r m a t i o n s W i t h o u t Square Roots, J. Inst. Maths Applic 12,329-336 (1973).
by Givens
5. CHECKOUT. A. Test
Cases~
See the section d i s c u s s i n g testing real symmetric band matrices.
140
of the codes
for
7.1-5
B. Accuracy. The accuracy of BANDR can best be described in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real symmetric band matrices. In these paths~ this subroutine is n u m e r i c a l l y stable (1,2). This stability contributes to the property of these paths that the computed e i g e n v a l u e s are the exact eigenvalues of a m a t r i x close to the original m a t r i x and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e l g e n v e c t o r s of that matrix.
141
7.1-6 SUBROUTINE
BANDR(NM,N,MB,A,D,E~E2,MATZ,Z)
C I N T E G E R J, K, L ~ N, R, Ii, I2, J1, J2 ~ K R , M B , M R , M I ~ R E A L A ( N M , M B ) ~D (N), E (N) ,E2 (N), Z ( N M , N ) R E A L G , U , BI, B 2 , C 2 ~F 1 ,F2, S 2 , D M I N , D M I N R T REAL SQRT INTEGER MAX0,MIN0,MOD LOGICAL MATZ
NM, N2 ,R 1 , U G L , M A X L ~ M A X R
C
C 30
DMIN = 2.0**(-64) DMINRT = 2.0**(-32) ********** INITIALIZE DO 30 J = i, N D(J) = 1.0
DIAGONAL
IF
(.NOT.
MATZ)
TO
60
DO
50
I~
800,
70
SCALING
MATRIX
**********
C GO
C J =
N
C D O 40 K = I, Z(J,K) = 0.0
40
N
C 50
Z(J,J) CONTINUE
=
1.0
C 60 M 1 IF 70 N2
= MB - 1 (MI - I) 9 0 0 , = N - 2
C DO C
7 0 0 K = i, N2 MAXR = MIN0(MI,N-K) ********** FOR R=MAXR S T E P -I DO 6 0 0 RI = 2, M A X R R -- M A X R + 2 - R1 KR = K + R MR = M B R G = A(KR,MR) A(KR-I,I) = A(KR-I,MR+I) UGL = K
UNTIL
C DO
5 0 0 J = KR, N~ MI Jl = J - ! J2 = Jl - 1 IF (G .EQ. 0 . 0 ) G O TO 6 0 0 BI = A ( J I , I ) / G B2 = BI * D ( J I ) / D ( J ) $2 = 1.0 / (i.0 + B1 * B2) IF ($2 .GE. 0 . 5 ) G O TO 4 5 0 BI = G / A ( J I , I ) B2 = BI * D ( J ) / D ( J I ) C2 = 1.0 - $2 D ( J I ) = C2 * D ( J I ) D(J) = C2 * D(J) F1 = 2 . 0 * A ( J ~ M I )
142
2 DO
--
**********
7.1-7 F 2 = BI A(J,MI) A(JI,MB) A(J,MB)
* A(JI,MB) = - B 2 * (BI * A ( J , M I ) - A(J,MB)) - F2 = B2 * (B2 * A(J,MB) + FI) + A(JI,MB) = B1 * (F2 - FI) + A(J,MB)
A(J,MI)
DO
200
200 L = UGL, J2 12 = MB - J + L U = A(JI,12+I) + B2 * A(J,12) A(J,12) = -El * A(JI,12+I) + A(JI,12+I) = U CONTINUE
+
UGL = J A(JI,I) = A(JI,I) + IF (J .EQ. N) G O T O MAXL = MIN0(MI,N-JI)
A(J,12)
B2 * G 350
DO
300
3 0 0 L = 2, M A X L II = J l + L 12 = MB - L U = A(II,12) + B2 * A(II,12+I) A(II,12+I) = -BI * A(II,!2) + A(II,12) = U CONTINUE
350
Ii = J + M 1 I F (II .GT. N) G O T O 3 5 0 G = B2 * A(II,I) IF (.NOT. MATZ) GO TO 500
A(II,12+I)
DO
400
4 0 0 L -- I, N U = Z(L,JI) + B2 * E(L,J) Z(L,J) = -BI * Z(L,JI) + Z(L,J) Z(L,JI) = U CONTINUE GO
450
U
TO =
500
D(JI)
D(JI) = $2 * D(J) D ( J ) = S2 * U FI = 2.0 * A(J,MI) F2 = B1 * A(J,MB) U = BI * (F2 - FI) + A(JI,MB) A(J,MI) = B 2 * (BI * A ( J , M I ) - A(JI,MB)) + F2 A(JI,MB) = B2 * (B2 * A(JI,MB) + FI) + A(J,MB) A(J,MB) = U DO
460
460 L = UGL, J2 12 = MB - J + L U = B2 * A(JI,12+I) + A(J,12) = -A(JI,12+I) A(JI,12+I) = U CONTINUE
143
A(J,12) + BI * A(J,12)
- A(J,MI)
7.1-8
UGL = J A(JI,I) = B2 * A ( J I , I ) + G IF (J .EQ. N) G O TO 4 8 0 MAXL = MIN0(MI,N-JI) DO
470
4 7 0 L = 2, M A X L II = J l + L 12 = M B - L U = B2 * A ( I I , 1 2 ) + A(II,12+I) A(II,I2+I) = -A(II,I2) + BI * A ( I I , I 2 + I ) A(II,I2) = U CONTINUE
480
Ii = J + M 1 IF (Ii °GT. N) GO T O 4 8 0 G = A(II,I) A(II,I) = BI * A ( I I , I ) IF ( . N O T . M A T Z ) G O TO 5 0 0 DO
4 9 0 L = i, N U = B2 * Z ( L , J I ) + Z(L,J) Z(L,J) = -Z(L,JI) + BI * Z ( L , J ) Z(L,JI) = U CONTINUE
490 500 600
CONTINUE CONTINUE IF ( M O D ( K , 6 4 ) .NE. 0) GO TO 7 0 0 ********** RESCALE TO AVOID UNDERFLOW DO 6 5 0 J = K, N IF ( D ( J > .GE. D M I N ) G O TO 6 5 0 MAXL = MAXO(I,MB+I-J)
610
DO 6 1 0 A(J,L)
L = MAXL, M1 = DMINRT * A(J,L)
IF (J .EQ. N) GO TO MAXL = MINO(MI,N-J)
630
DO
620
6 2 0 L = I, M A X L Ii = J + L 12 = M B - L A(II,12) = DMINRT CONTINUE
630
IF
640
DO 640 Z(L,J)
(.NOT.
MATZ)
GO
TO
* A(II,12)
645
L = I, N = DMINRT * Z(L,J)
144
OR
OVERFLOW
*********~
7.1-9
A(J,MB) = DMIN * A(J,MB) D(J) = D(J) / DMIN CONTINUE
645 650 700 800 810
CONTINUE ********** FORM SQUARE DO 8 1 0 J = 2, N E(J) = SQRT(D(J)) IF
(.NOT.
DO
830
J =
DO 820 Z(J,K)
820 830
CONTINUE
840
U =
MATZ) i, K
=
GO
TO
ROOT
840
N 2,
= E(K)
N
* Z(J,E)
1.0
DO
850
8 5 0 J = 2, N A(J,MI) = U * E(J) * A(J,MI) U = E(J) E2(J) = A(J,MI) ** 2 A(J,MB) = D(J) * A(J,MB) D(J) = A(J,MB) E(J) = A(J,MI) CONTINUE D(1) = A(I,MB) E(1) = 0.0 E2(1) = 0.0 GO T O i 0 0 1
900
950 i001
OF
DO
9 5 0 J = I, N D(J) = A(J,MB) E(J) = 0.0 E2(J) = 0.0 CONTINUE
RETURN END
145
SCALING
MATRIX
**********
7.1-I0
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F227
PACKAGE
(EiSPACK)
BANDV
A F o r t r a n IV S u b r o u t i n e to D e t e r m i n e S o m e E i g e n v e c t o r s of a R e a l S y m m e t r i c B a n d M a t r i x or S o l v e B a n d E q u a t i o n s .
July,
1975
I. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e BANDV determines those e i g e n v e c t o r s of a real s y m m e t r i c b a n d m a t r i x c o r r e s p o n d i n g to a set of o r d e r e d a p p r o x i m a t e e i g e n v a l u e s , u s i n g i n v e r s e iteration. It c a n a l s o be u s e d to s o l v e a s y s t e m of l i n e a r e q u a t i o n s w i t h a s y m m e t r i c or n o n - s y m m e t r i c b a n d c o e f f i c i e n t m a t r i x , or a s u c c e s s i o n of r e l a t e d s y s t e m s .
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
BANDV(NM,N,MBW,A,E21,M,W,Z, IERR,NV,RV,RV6)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is a n i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and Z in the calling program. is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x A. greater than NM.
MBW
set e q u a l to N m u s t be n o t
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the n u m b e r of c o l u m n s of the a r r a y A used t o s t o r e the b a n d m a t r i x . If the m a t r i x is symmetric, MBW is its (half) b a n d w i d t h ,
146
7.1-11
denoted MB and defined as the number of adjacent diagonals, including the p r i n c i p a l diagonal, required to specify the non-zero portion of the lower triangle of the matrix. If BANDV is being used to solve systems of linear equations and the c o e f f i c i e n t m a t r i x is not symmetric, it must have the same number of adjacent diagonals above the main diagonal as below, and so in this case MBW=2*MB-I. MB
must
be not
greater
than
N.
is a working p r e c i s i o n real input twod i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least MBW . If the band m a t r i x is symmetric, A contains its lower triangle of order N and (half) band width MB. Its lowest s u b d i a g o n a l is stored in the last N+I-MB positions of the first column, its next s u b d i a g o n a l in the last N+2-MB p o s i t i o n s of the second column, further s u b d i a g o n a l s similarly, and finally its principal diagonal in the N positions of the last column. Contents of storage locations not part of the m a t r i x are arbitrary. For example, when N=5 and MB=3, A should contain ( * ( * (A(3,1) (A(4,2)
* A(2,1) A(3,2) A(4,3)
A(I,I) A(2,2) A(3,3) A(4,4)
(A(5,3)
A(5,4)
A(5,5) )
where the subscripts for to the row and column of standard t w o - d i m e n s i o n a l (*) denotes an arbitrary
) ) ) )
each element refer the element in the r e p r e s e n t a t i o n , and value.
If BANDV is being used to solve Systems of linear equations and the c o e f f i c i e n t m a t r i x is not symmetric, A is N by 2*MB-I instead with lower triangle as above and with its first s u p e r d i a g o n a l stored in the first N-I p o s i t i o n s of column MB+I, its second s u p e r d i a g o n a l in the first N-2 positions of column MB+2, further s u p e r d i a g o n a l s similarly, and finally its h i g h e s t s u p e r - d i a g o n a l in the first N+I-MB positions of the last column. In the example above, A would be a u g m e n t e d with two additional columns containing
t47
7.1-12
(A(I,2) (A(2,3) (A(3,4) (A(4,5) ( * E21
A(I,3) A(2,4) A(3,5) * ,
) ) ) ) ).
is a w o r k i n g p r e c i s i o n real input v a r i a b l e s p e c i f y i n g the o r d e r i n g of the e i g e n v a l u e s . E21 should c o n t a i n 0.0 if the e i g e n v a l u e s are in a s c e n d i n g order and 2.0 if the e i g e n v a l u e s are in d e s c e n d i n g order. If BANDV is being used to solve systems of linear e q u a t i o n s , E21 should c o n t a i n 1.0 if the c o e f f i c i e n t m a t r i x is s y m m e t r i c and -i.0 if not. is an i n t e g e r input v a r i a b l e set equal to the n u m b e r of s p e c i f i e d e i g e n v a l u e s for w h i c h the c o r r e s p o n d i n g e i g e n v e c t o r s are to be d e t e r m i n e d . If BANDV is being used to solve systems of linear e q u a t i o n s , M is equal to the n u m b e r of systems.
W
is a w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least M c o n t a i n i n g the M specified eigenvalues of the s y m m e t r i c band matrix. The e i g e n v a l u e s must be in either a s c e n d i n g or d e s c e n d i n g order in W. The o r d e r i n g is r e q u i r e d to insure the d e t e r m i n a t i o n of independent orthogonal eigenvectors a s s o c i a t e d w i t h close e i g e n v a l u e s . If BANDV is being used to solve systems of linear e q u a t i o n s , W contains M p a r a m e t e r s (commonly zero) which, together with A, d e f i n e the c o e f f i c i e n t m a t r i c e s A-W(J)*I, J=I,2,...,M of the s u c c e s s i v e systems, w h e r e I is the i d e n t i t y matrix. is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and column d i m e n s i o n at least M. On output, it contains M o r t h o n o r m a l e i g e n v e c t o r s of the s y m m e t r i c band m a t r i x c o r r e s p o n d i n g to the M e i g e n v a l u e s in W.
148
7.1-13
If BANDV is b e i n g u s e d to s o l v e s y s t e m s of linear equations, t h e n on i n p u t , Z contains the M associated constant vectors of t h e s u c c e s s i v e systems (A-W*I)*X=Z and on o u t p u t , Z contains the corresponding solution vectors X. IERR
B.
Error
is an i n t e g e r o u t p u t v a r i a b l e set equal an error completion code described in s e c t i o n 2B. The normal completion code zero,
to is
NV
is a n i n t e g e r input variable s e t e q u a l to the dimension of t h e a r r a y RV as s p e c i f i e d in t h e D I M E N S I O N statement for RV in the calling program. NV m u s t be n o t l e s s t h a n N* ( 2 * M B - I ) .
RV
is a w o r k i n g precision real temporary array variable of d i m e n s i o n at l e a s t N*(2*MB-I) u s e d to s t o r e t h e u p p e r t r i a n g u l a r matrix produced in t h e i n v e r s e iteration process.
RV6
is a w o r k i n g precision real temporary onedimensional variable of d i m e n s i o n at l e a s t N u s e d to h o l d t h e a p p r o x i m a t e elgenvectors or s o l u t i o n vectors in t h e i n v e r s e i t e r a t i o n process.
Conditions
and
Returns.
If n o n e of t h e i n i t i a l v e c t o r s for the inverse iteration process produces an a c c e p t a b l e approximation to an eigenvector, BANDV terminates the computation for that eigenvector and sets IERR to -R where R is t h e i n d e x of the e i g e n v e c t o r . If t h i s f a i l u r e occurs for more than one eigenvector, the last occurrence is recorded in IERR. T h e c o l u m n s of Z corresponding to failures of the a b o v e s o r t a r e set to z e r o v e c t o r s . If BANDV is b e i n g u s e d to s o l v e s y s t e m s of l i n e a r equations and near singularity of t h e c o e f f i c i e n t matrix is d e t e c t e d , BANDV continues the c o m p u t a t i o n but sets IERR to -R where R is t h e i n d e x of t h e l i n e a r system. If t h i s f a i l u r e o c c u r s f o r m o r e t h a n o n e system, the l a s t o c c u r r e n c e is r e c o r d e d in IERR. If t h e a b o v e e r r o r c o n d i t i o n sets IERR to z e r o .
149
does
not
occur,
BANDV
7.1-14
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
To d e t e r m i n e some of the e i g e n v a l u e s and e i g e n v e c t o r s of a s y m m e t r i c b a n d matrix, BANDV should be p r e c e d e d by B A N D R (F226) to p r o v i d e a s u i t a b l e s y m m e t r i c t r i d i a g o n a l m a t r i x for BISECT (F294) or T R I D ! B (F237) w h i c h can then be used to d e t e r m i n e the e i g e n v a l u e s . If MACHEP d e n o t e s the r e l a t i v e m a c h i n e p r e c i s i o n , then the c o m p u t a t i o n of the e i g e n v e c t o r s by i n v e r s e i t e r a t i o n r e q u i r e s that the p r e c i s i o n of the e i g e n v a l u e s he c o m m e n s u r a t e w i t h small r e l a t i v e p e r t u r b a t i o n s of the order of MACHEP in the m a t r i x elements. For m o s t s y m m e t r i c band m a t r i c e s , it is e n o u g h that the a b s o l u t e error in the e i g e n v a l u e s for which e i g e n v e c t o r s are d e s i r e d be a p p r o x i m a t e l y MACHEP times a n o r m of the matrix. But some m a t r i c e s r e q u i r e a s m a l l e r a b s o l u t e error~ p e r h a p s as small as MACHEP times the e i g e n v a l u e of s m a l l e s t m a g n i t u d e .
3. D I S C U S S I O N
OF M E T H O D
AND A L G O R I T H M .
The e i g e n v e c t o r s of the m a t r i x are c o m p u t e d by inverse iteration. First, the LU d e c o m p o s i t i o n of the m a t r i x with an a p p r o x i m a t e e i g e n v a l u e s u b t r a c t e d from its d i a g o n a l e l e m e n t s is a c h i e v e d by G a u s s i a n e l i m i n a t i o n using p a r t i a l pivoting. The upper t r i a n g u l a r m a t r i x is stored in the t e m p o r a r y array RV. An a p p r o x i m a t e vector, stored in RV6, is c o m p u t e d s t a r t i n g f r o m an i n i t i a l v e c t o r , and the n o r m of the a p p r o x i m a t e v e c t o r is c o m p a r e d w i t h a n o r m of the m a t r i x to d e t e r m i n e w h e t h e r the g r o w t h is s u f f i c i e n t to a c c e p t it as an e i g e n v e c t o r . If this v e c t o r is accepted, its E u c l i d e a n norm is m a d e I. At m o s t N o r t h o g o n a l initial v e c t o r s are tried to o b t a i n the r e q u i r e d growth. If no v e c t o r is accepted, the p a r a m e t e r IERR is set to i n d i c a t e this f a i l u r e and BANDV p r o c e e d s to c o m p u t e the next e i g e n v e c t o r . E i g e n v e c t o r s c o m p u t e d in the above way c o r r e s p o n d i n g to well s e p a r a t e d e i g e n v a l u e s of the m a t r i x will be orthogonal. However, e i g e n v e c t o r s c o r r e s p o n d i n g to close e i g e n v a l u e s of the m a t r i x may not be s a t i s f a c t o r i l y orthogonal, Hence, to insure o r t h o g o n a l e i g e n v e c t o r s , each a p p r o x i m a t e v e c t o r is made o r t h o g o n a l to those p r e v i o u s l y c o m p u t e d e i g e n v e c t o r s w h o s e e i g e n v a l u e s are close to the c u r r e n t eigenvalue. The g r o w t h test is made after the o r t h o g o n a l i z a t i o n process. I d e n t i c a l e i g e n v a l u e s are p e r t u r b e d s l i g h t l y in an a t t e m p t to obtain independent eigenvectors. T h e s e p e r t u r b a t i o n s are not r e c o r d e d in the e i g e n v a l u e array W.
150
7. 1-15
If BANDV is being used to solve systems of linear equations, the p r o c e d u r e described above is followed (omitting the growth test and o r t h o g o n a l i z a t i o n process), choosing as initial vector the a p p r o p r i a t e constant vector. Upon return from BANDV, the d e t e r m i n a n t (up to sign) of A-W(M)*I can be computed, if desired, by forming the product of the first N elements of RV. This subroutine is patterned after the e i g e n v e c t o r d e t e r m i n a t i o n portion of the Fortran subroutine TSTURM (F293), with initial vectors chosen as in INVIT (F288). These latter subroutines are translations of the Algol procedures TRISTURM and INVIT, respectively, w r i t t e n and d i s c u s s e d in detail by Peters and W i l k i n s o n (I).
4. REFERENCES.
i)
Peters, G. and Wilkinson, J.H., The C a l c u l a t i o n of Specified E i g e n v e c t o r s by Inverse Iteration, H a n d b o o k A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/18, 418-439, Springer-Verlag, 1971.
for
5. CHECKOUT. A.
Test Cases. See the section discussing testing real symmetric band matrices.
of the codes
for
B. Accuracy. The accuracy of BANDV can best be described in terms of its role in those paths of EISPACK which find eigenvalues and e i g e n v e c t o r s of real symmetric band matrices. In these paths, this subroutine is n u m e r i c a l l y stable (I). This stability contributes to the property of these paths that the computed e i g e n v a l u e s are the exact eigenvalues of a m a t r i x close to the original m a t r i x and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that matrix.
1,51
7,1-16
SUBROUTINE
BANDV(NM,N~MBW,A,E21,M,W,Z,IERR,NV,RV,RV6)
INTEGER
X
I,J,K,M,N,R,II,IJ,JJ,KJ,MB,MI,NM,NV,IJI,ITS,KJI,MBW,M21, IERR,MAXJ,MAXK,GROUP REAL A(NM,MBW),W(M),Z(NM,M),RV(NV),RV6(N) REAL U,V,UK,XU,X0,XI,E21,EPS2,EPS3,EPS4,NORM,ORDER,MACHEP REAL SQRT,ABS,FLOAT,SIGN INTEGER MIN0 **********
MACHEP
=
MACHEP IS A M A C H I N E DEPENDENT PARAMETER SPECIFYING THE RELATIVE PRECISION OF FLOATING POINT ARITHMETIC.
?
IERR = 0 I F (M . E Q . 0) G O T O i 0 0 1 MB = MBW I F ( E 2 1 .LT. 0 . 0 ) M B = ( M B W + I) / 2 M1 = MB - I M21 = M1 + MB ORDER = 1.0 - ABS(E21) ********** FIND VECTORS BY INVERSE ITERATION D O 9 2 0 R = i, M ITS = I
Xl
= W(R)
I F (R .NE. i) G O T O i 0 0 ********** COMPUTE NORM OF NORM = 0.0 DO
**********
60 JJ KJ IJ
J = Ix M B = MB + 1 = JJ + MI = i
MATRIX
**********
J
DO
40 60
40 1 = JJ, N NORM = NORM + ABS(A(I,J)) IF (E21 .GE. 0.0) GO TO 40 NORM = NORM + ABS(A(IJ,KJ)) IJ = IJ + I CONTINUE
CONTINUE IF (E21 **********
°LT. 0.0) NORM = 0.5 * NORM EPS2 IS T H E C R I T E R I O N FOR GROUPING, EPS3 REPLACES ZERO PIVOTS AND EQUAL ROOTS ARE MODIFIED BY EPS3, EPS4 IS TAKEN VERY SMALL TO AVOID OVERFLOW IF ( N O R M .EQ. 0.0) NORM = 1.0 EPS2 = I.OE-3 * NORM * ABS(ORDER) EPS3 = MACHEP * NORM UK = SQRT(FLOAT(N)) EPS4 = UK * EPS3
152
**********
7.1-17 80 C !00
C C
120
GROUP = 0 GO TO 120 ***~*****~ LOOK FOR CLOSE OR COINCIDENT ROOTS *~******** IF ( A B S ( X I - X O ) .GE. E P S 2 ) G O T O 80 GROUP = GROUP + I I F ( O R D E R * (XI - X O ) .LE. 0 . 0 ) X I = X 0 + O R D E R * E P S 3 *******~** EXPAND MATRIX, SUBTRACT EIGENVALUE, AND INITIALIZE VECTOR ********** D O 2 0 0 1 = i, N IJ = I + M I N 0 ( 0 , I - M I ) * N K J = IJ + M B * N IJl = KJ + M1 * N IF (MI .EQ. 0) G O T O 1 8 0
C DO
125 130
140 150
1 5 0 J = I, M I IF (IJ .GT. M I ) G O T O 125 IF (IJ .GT. 0) G O T O 1 3 0 RV(IJI) = 0.0 IJl = IJl + N GO TO 130 RV(IJ) = A(I,J) IJ = IJ + N II = I + J IF (II .GT. N) G O T O 1 5 0 JJ = MB - J IF ( E 2 1 .GE. 0 . 0 ) G O T O 1 4 0 II = I JJ = M B + J RV(KJ) = A(II,JJ) KJ = KJ + N CONTINUE
C 180
200
RV(IJ) = A(I,MB) - X1 RV6(1) = EPS4 IF ( O R D E R .EQ. 0 . 0 ) R V 6 ( 1 ) CONTINUE
=
Z(I,R)
C IF (MI .EQ. 0) G O T O 6 0 0 ~********* ELIMINATION WITH D O 5 8 0 1 = I, N II = I + I MAXK = MIN0(I+MI-I,N) MAXJ = MIN0(N-I,M21-2)
C
INTERCHANGES
C DO
3 6 0 K = I, M A X K KJI = K J = KJI + N JJ = J + MAXJ
C DO
340
3 4 0 K J = J, J J, N RV(KJI) = RV(KJ) KJI = KJ CONTINUE
153
* N
*******~**
7.1-18
RV(KJI) CONTINUE
360
=
0.0
C IF (I o E Q . N) G O T O 5 8 0 U = 0.0 MAXK = MIN0(I+MI,N) MAXJ = MIN0(N-II,M21-2)
* N
C DO
4 5 0 J = I, M A X K IF (ABS(RV(J)) .LT. u
=
ABS(U))
GO
TO
450
RV(J)
K = J CONTINUE
450 C
J = I + N JJ = J + MAXJ I F (K . E Q . I) KJ = K
GO
TO
520
C DO
500
5 0 0 I J = I, J J , V = R V (I J) RV(IJ) = RV(KJ) RV(KJ) = V KJ = KJ + N CONTINUE
N
520
IF (ORDER .NE. 0.0) GO TO V = R V 6 (I) RV6(1) = RV6(K) R V 6 (K) = V I F (U . E Q . 0 . 0 ) G O T O 5 8 0
C 520
C DO
560 K = II, MAXK V = RV(K) / U KJ = K
C DO
5 4 0 I J = J, J J, KJ = KJ + N RV(KJ) = RV(KJ) CONT-INUE
540
N - V
* RV(IJ)
C IF (ORDER CONTINUE
560
.EQ.
0.0)
RV6(K)
=
RV6(K)
- V
* RV6(1)
C 580 C
CONTINUE ******4***
C
600
DO
BACK SUBSTITUTION FOR I=N STEP -i UNTIL 6 3 0 I I = I, N I = N + i - ii MAXJ = MIN0(II,M21) IF (MAXJ . E Q . i) G O T O 6 2 0 !Jl = I J = IJl + N
t54
I DO
--
**********
7.1-19 JJ
= J +
(MAXJ
-
2)
DO
6 1 0 I J = J, J J , IJl = IJl + 1 RV6(1) = RV6(1) CONTINUE
610 620
625 630
* N N - RV(IJ)
v = RV(I) IF (ABS(V) .GE. EPS3) GO ********** SET ERROR -- NEARLY IF (ORDER .EQ. 0.0) IERR V = SIGN(EPS3,V) RV6(1) = RV6(1) / V CONTINUE
* RV6(IJI)
TO 625 SINGULAR = -R
XU = 1.0 IF ( O R D E R .EQ. 0.0) GO TO 870 ****~***** ORTHOGONAL!ZE WITH RESPECT MEMBERS OF GROUP ********** IF (GROUP . E Q . 0) G O T O 7 0 0 DO
6 8 0 J J = i, G R O U P J = R - GROUP - i + XU = 0.0
640
DO XU
6 4 0 1 = i, N = XU + RV6(I)
660
DO 660 RV6(1)
1
=
i,
TO
JJ
N
= RV6(1)
- XU
CONTINUE
700
NORM
720
D O 7 2 0 1 = i, N NORM = NORM + ABS(RV6(1))
* Z(I,J)
0.0
IF (NORM .GE. 1.0E-I) GO TO 840 ********** IN-LINE PROCEDURE FOR CHOOSING A NEW STARTING VECTOR ********** I F ( I T S .GE. N) G O T O 8 3 0 ITS = ITS + 1 XU = EPS4 / (UK + 1.0) RV6(1) = EPS4
760
DO 760 RV6(1)
1 = 2, = XU
N
RV6(ITS) = RV6(ITS) GO TO 600
- EPS4
155
* UK
SYSTEM
PREVIOUS
* Z(I,J)
680
=
LINEAR
**********
7.1-20 C 830
C C 840
******~*** SET ERROR -!ERR = -R XU = 0.0 GO TO 870 ********** NORMALIZE SO i AND EXPAND U = 0,0
NON-CONVERGED
THAT SUM OF SQUARES IS TO FULL ORDER **********
C 860
D O 8 6 0 1 = I, N U = U + RV6(1)**2
C XU
=
1.0
/
SQRT(U)
C 870 900
DO 900 Z(I,R)
1 = i, N = RV6(1)
* XU
C 920
X0 = XI CONTINUE
C I001
EiGENVECTOR
RETURN END
156
********~*
7.1-21
NATS
PROJECT
EIGENSYSTEM.SUBROUTINE F294-2 A Fortran
PACKAGE BISECT
IV S u b r o u t i n e to D e t e r m i n e of a S y m m e t r i c T r i d i a g o n a l
May, February,
(EISPACK)
Some E i g e n v a l u e s Matrix.
1972 1977
I. P U R P O S E . The F o r t r a n IV s u b r o u t i n e BISECT determines e i g e n v a l u e s of a s y m m e t r i c t r i d i a g o n a l m a t r i x interval using Sturm sequencing.
those in a s p e c i f i e d
2. USAGE. A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
BISECT(N,EPSI,D,E,E2,LB,UB, MM,M,W,!ND,IERR,RV4,RV5)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w a n d the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x . EPSI
set e q u a l
to
is a w o r k i n g p r e c i s i o n r e a l v a r i a b l e . On input, it s p e c i f i e s an a b s o l u t e e r r o r t o l e r a n c e for the c o m p u t e d e i g e n v a l u e s . If the i n p u t EPSI is n o n - p o s i t i v e , it is r e s e t to a d e f a u l t v a l u e d e s c r i b e d in s e c t i o n 2C. is a w o r k i n g p r e c i s i o n r e a l i n p u t oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the d i a g o n a l e l e m e n t s of the symmetric tridiagonal matrix. is a w o r k i n g p r e c i s i o n r e a l i n p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g , in its last N-I positions, the s u b d i a g o n a l e l e m e n t s of the s y m m e t r i c tridiagonal matrix. E(1) is a r b i t r a r y .
157
7.1-22
E2
is a w o r k i n g p r e c i s i o n r e a l o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N. On input, the l a s t N-I p o s i t i o n s in this a r r a y c o n t a i n the s q u a r e s of the s u b d i a g o n a l e l e m e n t s of the s y m m e t r i c t r i d i a g o n a l matrix. E2(1) is a r b i t r a r y . On o u t p u t , E2(1) is set to zero. If a n y of the e l e m e n t s in E are r e g a r d e d as n e g l i g i b l e , the c o r r e s p o n d i n g e l e m e n t s of E2 are set to zero, a n d so the m a t r i x s p l i t s i n t o a d i r e c t s u m of s u b m a t r i c e s .
LB,UB
are working precision real input variables s p e c i f y i n g the l o w e r and u p p e r e n d p o i n t s , r e s p e c t i v e l y , of the i n t e r v a l to be s e a r c h e d for the e i g e n v a l u e s . If LB is n o t less than UB, BISECT c o m p u t e s no e i g e n v a l u e s . See s e c t i o n 2C for f u r t h e r d e t a i l s .
MM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to a n u p p e r b o u n d for the n u m b e r of e i g e n v a l u e s in the i n t e r v a l (LB,UB). is an i n t e g e r o u t p u t v a r i a b l e set e q u a l to the n u m b e r of e i g e n v a l u e s d e t e r m i n e d to lie in the i n t e r v a l (LB,UB). is a w o r k i n g p r e c i s i o n r e a l o u t p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t MM c o n t a i n i n g the M e i g e n v a l u e s of the s y m m e t r i c t r i d i a g o n a l m a t r i x in the i n t e r v a l (LB,UB). T h e e i g e n v a l u e s a r e in a s c e n d i n g o r d e r in W.
IND
is an i n t e g e r o u t p u t o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t MM c o n t a i n i n g the s u b m a t r i x i n d i c e s a s s o c i a t e d w i t h the c o r r e s p o n d i n g M e i g e n v a l u e s in W. E i g e n v a l u e s b e l o n g i n g to the f i r s t submatrix have index I, t h o s e b e l o n g i n g to the s e c o n d s u b m a t r i x h a v e i n d e x 2, etc.
IERR
is a n i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n c o d e d e s c r i b e d in s e c t i o n 2B. The normal completion code zero.
RV4,RV5
to is
are w o r k i n g p r e c i s i o n r e a l t e m p o r a r y oned i m e n s i o n a l v a r i a b l e s of d i m e n s i o n at l e a s t N u s e d to h o l d the l o w e r a n d u p p e r b o u n d s for the e i g e n v a l u e s in the b i s e c t i o n process.
158
7.1-23
B. Error
Conditions
and Returns.
If M exceeds MM~ BISECT terminates with no eigenvalues computed, and IERR is set to 3*N+I. Upon this error exit, M contains the n u m b e r of e i g e n v a l u e s d e t e r m i n e d to lie in (LB,UB). If
M
does not
C. A p p l i c a b i l i t y
exceed
MM,
IERR
is set
to zero.
and Restrictions.
To d e t e r m i n e some of the eigenvalues of a full symmetric matrix, BISECT should be preceded by TREDI (F277) to provide a suitable symmetric tridiagonal m a t r i x for BISECT. To d e t e r m i n e some of the e i g e n v a l u e s of a complex H e r m i t i a n matrix, BISECT should be preceded by HTRIDI (F284) to provide a suitable real symmetric tridiagonal m a t r i x for BISECT. Some of the eigenvalues of certain n o n - s y m m e t r i c tridiagonal matrices can be computed using the c o m b i n a t i o n of FIGI (F280) and BISECT. See F280 for the d e s c r i p t i o n of this special class of matrices. For these matrices, BISECT should be preceded by FIGI to p r o v i d e a suitable symmetric m a t r i x for BISECT. To determine e i g e n v e c t o r s a s s o c i a t e d with the computed eigenvalues, BISECT should be followed by TINVlT (F223) and the a p p r o p r i a t e back t r a n s f o r m a t i o n s u b r o u t i n e -TRBAKI (F279) after TREDI, HTRIBK (F285) after HTRIDI, or BAKVEC (F281) after FIGI. The subroutines TQLI (F289) and IMTQLI (F291) d e t e r m i n e all the eigenvalues of a symmetric tridiagonal m a t r i x faster than BISECT determines 25 percent of them. Hence, if more than 25 p e r c e n t of them are desired, it is r e c o m m e n d e d that TQLI or IMTQLI be used. The interval (LB,UB) is formally half-open, not including the upper endpoint UB. However, because of rounding errors, the true e i g e n v a l u e s very close to the endpoints of the interval may be e r r o n e o u s l y counted or missed. The input interval (LB,UB) may be refined i n t e r n a l l y to a smaller interval known to contain all the eigenvalues in (LB,UB). This insures that BISECT will not p e r f o r m u n n e c e s s a r y b i s e c t i o n steps to d e t e r m i n e the eigenvalues in (LB,UB).
159
7.1-24
T h e p r e c i s i o n of the c o m p u t e d e i g e n v a l u e s is c o n t r o l l e d t h r o u g h the p a r a m e t e r EPS1. To o b t a i n e i g e n v a l u e s a c c u r a t e to w i t h i n a c e r t a i n a b s o l u t e e r r o r , EPSI s h o u l d be set to that e r r o r . In p a r t i c u l a r , if MACHEP d e n o t e s the r e l a t i v e m a c h i n e p r e c i s i o n , then to o b t a i n the e i g e n v a l u e s to a n a c c u r a c y c o m m e n s u r a t e w i t h s m a l l relative perturbations of the o r d e r of MACHEP in the m a t r i x e l e m e n t s , it is e n o u g h for m o s t t r i d i a g o n a l m a t r i c e s that EPSI be a p p r o x i m a t e l y MACHEP times a n o r m of the m a t r i x . But s o m e m a t r i c e s r e q u i r e a s m a l l e r EPSI for this a c c u r a c y , p e r h a p s as s m a l l as MACHEP times the e i g e n v a l u e of s m a l l e s t m a g n i t u d e in (LB,UB). N o t e , h o w e v e r , that if EPSI is s m a l l e r t h a n r e q u i r e d , BISECT w i l l p e r f o r m u n n e c e s s a r y b i s e c t i o n s t e p s to d e t e r m i n e the e i g e n v a l u e s . F o r f u r t h e r d i s c u s s i o n of EPSI, see r e f e r e n c e (i). If the i n p u t EPSI is n o n - p o s i t i v e , BISECT r e s e t s it, for each s u b m a t r i x , to -MACHEP t i m e s the l - n o r m of the s u b m a t r i x and u s e s its m a g n i t u d e . T h i s v a l u e is t e n t a t i v e l y c o n s i d e r e d a d e q u a t e for c o m p u t i n g the e i g e n v a l u e s to an a c c u r a c y c o m m e n s u r a t e w i t h s m a l l relative perturbations of the o r d e r of MACHEP in the matrix elements.
3. D I S C U S S I O N
OF M E T H O D
AND
ALGORITHM.
The eigenvalues are determined a p p l i e d to the S t u r m s e q u e n c e .
by
the m e t h o d
of b i s e c t i o n
T h e c a l c u l a t i o n s p r o c e e d as f o l l o w s . F i r s t , the s u b d i a g o n a l e l e m e n t s are t e s t e d for n e g l i g i b i l i t y . If an e l e m e n t is c o n s i d e r e d n e g l i g i b l e , its s q u a r e is set to zero, and so the m a t r i x s p l i t s into a d i r e c t sum of s u b m a t r i c e s . T h e n , the S t u r m s e q u e n c e for the e n t i r e m a t r i x is e v a l u a t e d at UB and LB g i v i n g the n u m b e r of e i g e n v a l u e s of the m a t r i x less t h a n UB and LB respectively. T h e d i f f e r e n c e is the n u m b e r of e i g e n v a l u e s in (LE,UB). N e x t , a s u b m a t r i x is e x a m i n e d for its e i g e n v a l u e s in the interval (LB,UB). T h e G e r s c h g o r i n i n t e r v a l , k n o w n to c o n t a i n a l l the e i g e n v a l u e s , is d e t e r m i n e d a n d u s e d to r e f i n e the i n p u t i n t e r v a l (LB,UB). If the i n p u t EPSI is n o n p o s i t i v e , it is r e s e t to the d e f a u l t v a l u e d e s c r i b e d in s e c t i o n 2C. T h e n , s u b i n t e r v a l s , e a c h e n c l o s i n g an e i g e n v a l u e in (LB,UB), a r e s h r u n k u s i n g a b i s e c t i o n p r o c e s s u n t i l the e n d p o i n t s of e a c h s u b i n t e r v a l are c l o s e e n o u g h to be a c c e p t e d as an e i g e n v a l u e of the s u b m a t r i x . H e r e the e n d p o i n t s of each s u b i n t e r v a l are c l o s e e n o u g h w h e n they d i f f e r by less than MACHEP t i m e s t w i c e the sum of the m a g n i t u d e s of the e n d p o i n t s p l u s the a b s o l u t e e r r o r t o l e r a n c e EPSI.
160
7.1-25
The submatrix eigenvalues are then merged found e i g e n v a l u e s into an ordered set. The above steps are repeated eigenvalues in the interval
on each (LB,UB)
with
previously
s u b m a t r i x until are computed~
all
the
This s u b r o u t i n e is a subset (except for the section m e r g i n g eigenvalues of submatrices) of the F o r t r a n s u b r o u t i n e TSTURM (F293), which is a t r a n s l a t i o n of the Algol p r o c e d u r e TRISTURM w r i t t e n and d i s c u s s e d in detail by Peters and W i l k i n s o n (2). A similar Algol procedure BISECT is d i s c u s s e d in detail by Barth, Martin, and W i l k i n s o n (i).
4. REFERENCES.
i)
Barth, W., Martin, R.S., and Wilkinson, J.H., of the E i g e n v a l u e s of a Symmetric T r i d i a g o n a l the M e t h o d of Bisection, Num. Math. 9,386-393
2)
Peters, G. and Wilkinson, J.H., The C a l c u l a t i o n of Specified E i g e n v e c t o r s by Inverse Iteration, H a n d b o o k A u t o m a t i c Computation~ Volume II~ Linear Algebra~ J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/18, 418-439, Springer-Verlag, 1971.
Calculation M a t r i x by (1967).
for
5. CHECKOUT. A. Test
Cases.
See the section d i s c u s s i n g testing of the codes for complex Hermitian, real symmetric, real symmetric tridiagonal, and certain real n o n - s y m m e t r i c t r i d i a g o n a l matrices.
B. Accuracy. The subroutine BISECT is n u m e r i c a l l y stable (1,2); that is, the computed eigenvalues are close to those of the original matrix. In addition, they are the exact eigenvalues of a matrix close to the original real symmetric tridiagonal matrix.
t61
7.1-26
SUBROUTINE
BiSECT(N,EPSI,D,E,E2,LB,UB,MM,M,W,
IND,IERR,RV4,RV5)
INTEGER I,J,K,L,M,N,P,Q,R,S,II,MM,MI,M2,TAG,IERR,ISTURM REAL D(N),E(N),E2(N),W(MM),RV4(N),RV5(N) REAL U,V,LB,TI,T2,UB,XU,XO,XI~EPSI,MACHEP REAL ABS,AMAXI,AMINI,FLOAT INTEGER IND(MM) **********
MACHEP IS A THE RELATIVE
MACHINE DEPENDENT PARAMETER SPECIFYING PRECISION OF FLOATING POINT ARITHMETIC.
********** MACHEP
C
20 40 C
C
60
80
C
C i00
=
?
IERR = 0 TAG = 0 T1 = LB T2 = UB ********** LOOK FOR SMALL SUB-DIAGONAL ENTRIES ********** D O 4 0 I = I, N I F (I . E Q . i) G O T O 2 0 IF (ABS(E(1)) .GT. MACHEP * (ABS(D(1)) + ABS(D(I-I)))) X GO TO 40 E2(1) = 0.0 CONTINUE ********** DETERMINE THE NUMBER OF EIGENVALUES IN THE INTERVAL ********** P = 1 Q = N X1 = UB ISTURM = I GO TO 320 M = S X1 = LB ISTURM = 2 GO TO 320 M = M - S I F (M . G T . M M ) G O T O 9 8 0 Q = 0 R = 0 ********** ESTABLISH AND PROCESS NEXT SUBMATRIX, REFINING INTERVAL BY T H E G E R S C H G O R I N BOUNDS ********** I F (R . E Q . M ) G O T O I 0 0 1 TAG = TAG + i P = Q * I XU = D (P) X0 = D(P) U = 0.0
162
7.1-27
DO
it0
120 140
C
180
200
220 C
1 2 0 Q = P, N X1 = U U = 0.0 V = 0.0 I F (Q . E Q . N) G O T O i i 0 U = ABS(E(Q+I)) V = E2 ( q + l ) XU = AMINI(D(Q)-(XI+U) ,XU) X0 = AMAXI(D(Q)+(XI+U) ,X0) I F (V .EQ. 0 . 0 ) G O T O 1 4 0 CONTINUE
XI = AMAXI(ABS(XU),ABS(X0)) * MACHEP IF (EPSI .LE. 0.0) EPSI = -XI I F (P . N E . Q) G O T O 1 8 0 ********** CHECK FOR ISOLATED ROOT WITHIN INTERVAL I F (TI . G T . D ( P ) .OR. D(P) .GE. T2) GO TO 940 MI = P M2 = P RVB(P) = D(P) GO TO 900 XI = XI * FLOAT(Q-P+I) LB = AMAXI(TI,XU-XI) UB = AMINI(T2,X0+XI) X1 = LB ISTURM = 3 GO TO 320 MI = S + I XI = UB ISTURM = 4 GO TO 320 M2 = S IF (MI .GT. M2) GO TO 940 ********** FIND ROOTS BY BISECTION ********~* X0 = UB ISTURM = 5
**********
DO
240
250
260
240 1 = MI, M2 R V 5 (I) -- U B RV4(1) = LB CONTINUE ********** LOOP FOR K-TH EIGENVALUE FOR K=M2 STEP -I UNTIL MI DO -(-DO- NOT USED TO LEGALIZE -COMPUTED GO TO-) K = M2 XU = LB ********** FOR I=K STEP -i UNTIL MI DO -- ********** DO 260 II = MI, K I = M1 + K - II IF (XU .GE. RV4(1)) GO TO 260 XU = RV4(1) GO TO 280 CONTINUE
163
**********
7.1-28
280
IF (X0 .GT. R V 5 ( K ) ) X0 = R V 5 ( K ) ********** NEXT BISECTION STEP ********** 300 X1 = (XU + X0) * 0 . 5 IF ( ( X 0 - XU) .LE. (2.0 * M A C H E P * X (ABS(XU) + ABS(X0)) + ABS(EPSI))) G O TO 420 ********** IN-LINE PROCEDURE FOR STURM SEQUENCE ********** 320 S = P - 1 U=I.0 DO
325 330
u
380
400
420
900
=
D(I)
IF (U CONTINUE
340
360
340 I = P, Q IF (U .NE. 0 . 0 ) GO TO 3 2 5 V = ABS(E(1)) / MACHEP IF ( E 2 ( 1 ) .EQ. 0 . 0 ) V = 0 . 0 GO TO 3 3 0 V = E2(1) / U -
Xl
.LT.
-
0.0)
V
S = S +
I
GO TO ( 6 0 , 8 0 , 2 0 0 , 2 2 0 , 3 6 0 ) , ISTURM ********** REFINE INTERVALS ********** IF (S .GE. K) GO TO 4 0 0 XU = X1 IF (S .GE. M I ) GO TO 3 8 0 RV4(MI) = X1 GO TO 3 0 0 RV4(S+I) = XI IF ( R V 5 ( S ) .GT. XI) R V 5 ( S ) = XI GO TO 3 0 0 X0 = X1 GO TO 3 0 0 ********** K-TH EIGENVALUE FOUND ********** R V 5 ( K ) = XI K = K - 1 IF (K .GE. MI) G O T O 2 5 0 ********** ORDER EIGENVALUES TAGGED WITH THEIR SUBMATRIX ASSOCIATIONS ********** S = R R
=
R
+
M2
-
M1
+
1
J = 1 K = MI DO
9 2 0 L = I, IF (J .GTo IF (K .GT. IF ( R V 5 ( K )
R S) GO TO 9 1 0 M2) GO TO 9 4 0 .GE. W ( L ) ) GO
DO
905
9 0 5 II = J, S I = L + S - !I W(I+1) = W(i) IND(I+I) = IND(1) CONTINUE
164
TO
915
7.1-29
910
915 920 940
W(L) = RVS(K) IND(L) = TAG K = K + 1 GO TO 920 J = J + 1 CONTINUE I F (Q . L T . GO TO i001 **********
980 IERR = I001LB = T1 UB = T2 RETURN END
N)
GO
TO
I00
SET ERROR -- UNDERESTIMATE OF NUMBER EIGENVALUES IN INTERVAL ********** 3 * N + 1
165
OF
7.1-30
NATS
EiGENSYSTEM
PROJECT
SUBROUTINE F236
A Fortran
PACKAGE
(EISPACK)
BQR
IV S u b r o u t i n e to D e t e r m i n e S o m e E i g e n v a l u e s of a R e a l S y m m e t r i c Band M a t r i x .
July,
1975
i. P U R P O S E . The F o r t r a n IV s u b r o u t i n e BQR d e t e r m i n e s s o m e of the e i g e n v a l u e s of a r e a ! s y m m e t r i c b a n d m a t r i x u s i n g the QR a l g o r i t h m w i t h s h i f t s of o r i g i n . It d e t e r m i n e s one e i g e n v a l u e for e a c h call, d e f l a t i n g the m a t r i x b e f o r e returning. T h e s u b r o u t i n e c o u l d be u s e d to d e t e r m i n e all of the e i g e n v a l u e s ; h o w e v e r , m o r e e f f i c i e n t r o u t i n e s e x i s t in this c a s e (see s e c t i o n 2C).
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
BQR(NM,N,MB~A,TjR,IERR,NV,RV)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the row d i m e n s i o n of the t w o - d i m e n s i o n a l array A as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t for A in the c a l l i n g p r o g r a m . is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x A. greater than NM.
MB
set e q u a l to N m u s t be n o t
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the (half) b a n d w i d t h of the m a t r i x A, d e f i n e d as the n u m b e r of a d j a c e n t d i a g o n a l s , i n c l u d i n g the p r i n c i p a l d i a g o n a l , r e q u i r e d to s p e c i f y the n o n - z e r o p o r t i o n of the l o w e r t r i a n g l e of the m a t r i x . ME m u s t be not g r e a t e r than N for the f i r s t c a l l of BQR (see s e c t i o n 2C).
166
7.1-31
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t MB. On i n p u t , A c o n t a i n s the l o w e r t r i a n g l e of the s y m m e t r i c b a n d m a t r i x of o r d e r N a n d (half) b a n d width MB w h i c h w i t h the s h i f t p a r a m e t e r T d e f i n e s the m a t r i x w h o s e e i g e n v a l u e s a r e sought. Its l o w e s t s u b d i a g o n a l is s t o r e d in the l a s t N+I-MB p o s i t i o n s of the f i r s t c o l u m n , its n e x t s u b d i a g o n a l in the l a s t N+2-MB p o s i t i o n s of the s e c o n d c o l u m n , f u r t h e r s u b d i a g o n a l s s i m i l a r l y , and f i n a l l y its p r i n c i p a l d i a g o n a l in the N positions of the last c o l u m n . C o n t e n t s of s t o r a g e l o c a t i o n s n o t p a r t of the m a t r i x are arbitrary. For example, when N=5 and MB=3, A should contain ( * ( * (A(3,1) (A(4,2) (A(5,3)
* A(2,1) A(3,2) A(4,3) A(5,4)
A(I,I) A(2,2) A(3,3) A(4,4) A(5,5)
) ) ) ) )
w h e r e the s u b s c r i p t s for e a c h e l e m e n t r e f e r to the r o w a n d c o l u m n of the e l e m e n t in the s t a n d a r d t w o - d i m e n s i o n a l r e p r e s e n t a t i o n , and (*) d e n o t e s an a r b i t r a r y v a l u e . On o u t p u t , A has the same f o r m as on input, e x c e p t h a v i n g b e e n d e f l a t e d (by a z e r o e d last row) to n e x t l o w e r order. It is thus s u i t a b l e as an i n p u t p a r a m e t e r for a f u r t h e r call of BQR if an a d d i t i o n a l e i g e n v a l u e is s o u g h t . is a w o r k i n g p r e c i s i o n r e a l v a r i a b l e . On input, T s p e c i f i e s the s h i f t a p p l i e d to the d i a g o n a l e l e m e n t s of A; the m a t r i x w h o s e e i g e n v a l u e is to b e d e t e r m i n e d is thus A+TI where I is the i d e n t i t y m a t r i x . The o u t p u t v a l u e of T is s i m u l t a n e o u s l y an e i g e n v a l u e of A + T I ( g e n e r a l l y that one n e a r e s t to the i n p u t T) and the s h i f t a p p l i e d to the d i a g o n a l e l e m e n t s of the output A matrix. It is thus s u i t a b l e as an i n p u t p a r a m e t e r (along w i t h A) for a f u r t h e r c a l l of BQR if an a d d i t i o n a l e i g e n v a l u e is s o u g h t .
167
7.1-32
B.
Error
R
is a w o r k i n g p r e c i s i o n r e a l v a r i a b l e u s e d to d e t e r m i n e w h e n the l a s t r o w (and c o l u m n ) of the current transformed b a n d m a t r i x in A c a n be r e g a r d e d as n e g l i g i b l e . It s h o u l d be set to zero for the f i r s t c a l l of BQR and w i l l be r e s e t by the s u b r o u t i n e at e a c h c a l l to a v a l u e s u i t a b l e as i n p u t for the subsequent c a l l (see s e c t i o n 3).
IERR
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n c o d e d e s c r i b e d in s e c t i o n 2B. The normal completion code zero.
is
NV
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the d i m e n s i o n of the a r r a y RV as s p e c i f i e d in the D I M E N S I O N statement for RV in the calling program. NV m u s t be n o t less t h a n 2*MB**2+4*MB-3.
RV
is a w o r k i n g p r e c i s i o n real temporary array variable of d i m e n s i o n at l e a s t 2*MB**2+4*MB-3. The first 3*MB-2 locations are used for auxiliary storage~ thereby permitting the t r a n s f o r m e d elements of A to be s t o r e d b a c k i n t o A. The next 2*MB-I l o c a t i o n s a r e u s e d to s t o r e the s c a l a r (half) l e n g t h s of the v e c t o r s that d e f i n e the e l e m e n t a r y Hermitians at e a c h s t a g e of t h e u n i t a r y r e d u c t i o n p r o c e s s . The final MB*(2*MB-I) l o c a t i o n s a r e u s e d to store these vectors themselves.
Conditions
and
If m o r e t h a n 30 the e i g e n v a l u e ,
Returns°
iterations are BQR terminates
If the e i g e n v a l u e is d e t e r m i n e d IERR is set to zero.
C.
to
Applicability
and
r e q u i r e d to with IERR within
30
determine set to N. iterations,
Restrictions.
To d e t e r m i n e some of the e i g e n v a l u e s of a b a n d s y m m e t r i c matrix, BQR s h o u l d be c a l l e d s u c c e s s i v e l y for each eigenvalue, transmitting the output parameters f r o m the previous c a l l e x c e p t for r e p l a c e m e n t of N by N-I. N o t e that MB s h o u l d n o t be a l t e r e d e v e n w h e n it e x c e e d s the c u r r e n t N. The eigenvalues determined will u s u a l l y be t h o s e n e a r e s t to the i n p u t v a l u e of T.
168
7.1-33
To d e t e r m i n e a l l the e i g e n v a l u e s of a b a n d s y m m e t r i c matrix, subroutine B A N D R (F226) s h o u l d be u s e d i n s t e a d , f o l l o w e d by TQLI ( F 2 8 9 ) , I M T Q L I (F291), or r Q L R A T (F235) . To d e t e r m i n e e i g e n v e c t o r s a s s o c i a t e d w i t h the c o m p u t e d eigenvalues, BQR s h o u l d be f o l l o w e d by B A N D V (F227). Note, h o w e v e r , that the m a t r i x A+TI d e f i n e d by the original A and T p a r a m e t e r s m u s t be s a v e d b e f o r e BQR for its l a t e r u s e by BANDV. If the m a t r i x has e l e m e n t s of w i d e l y v a r y i n g m a g n i t u d e s , the l a r g e r ones s h o u l d be in the top l e f t - h a n d c o r n e r .
3. D I S C U S S I O N
OF M E T H O D
AND ALGORITHM.
T h e aim of the a l g o r i t h m is to o b t a i n the e i g e n v a l u e of A of s m a l l e s t m a g n i t u d e ; i.e., the e i g e n v a l u e of A+TI nearest to T. T h e e i g e n v a l u e is d e t e r m i n e d by the QR method. The e s s e n c e of this m e t h o d is a p r o c e s s w h e r e b y a s e q u e n c e of s y m m e t r i c b a n d m a t r i c e s , u n i t a r i l y s i m i l a r to the o r i g i n a l s y m m e t r i c b a n d m a t r i x w i t h s h i f t e d o r i g i n is f o r m e d w h i c h c o n v e r g e s to a m a t r i x w i t h a zero last r o w (and c o l u m n ) . The sum of the o r i g i n s h i f t s is t h e n t a k e n as a n e i g e n v a l u e of A, and this n u m b e r a d d e d to the i n p u t T is r e t u r n e d as the d e s i r e d e i g e n v a l u e of A+TI. S h i f t i n g is d e f e r r e d u n t i l the o f f - d l a g o n a l e l e m e n t s of the last row of the t r a n s f o r m e d A b e c o m e s m a l l e n o u g h that t h e i r s u m m e d m a g n i t u d e s does not e x c e e d 1/4 of the tolerance quantity R. S h i f t i n g s o o n e r than this c o u l d l o s e s i g h t of the d e s i r e d e i g e n v a l u e , w h i l e s h i f t i n g too l a t e w o u l d a p p r e c i a b l y s l o w the a l g o r i t h m . R is r e s e t at e a c h call to the m a x i m u m of its c u r r e n t v a l u e a n d the s u m m e d m a g n i t u d e s of the o f f - d i a g o n a l e l e m e n t s of the c u r r e n t last row of A. The s h i f t i n g c r i t e r i o n a d o p t e d is e f f e c t i v e as long as the rows of A are n o t r a p i d l y i n c r e a s i n g f r o m top to b o t t o m . W h e n an o r i g i n s h i f t f i n a l l y takes p l a c e , it is c h o s e n as the e i g e n v a l u e of the l o w e s t 2x2 p r i n c i p a l m i n o r c l o s e r to the s e c o n d d i a g o n a l e l e m e n t of this m i n o r . W h e n the last r o w (and c o l u m n ) of the m a t r i x b e c o m e n e g l i g i b l e , then the s u m of the o r i g i n s h i f t s a d d e d to the i n p u t T is r e t u r n e d in T as the e i g e n v a l u e of A+TI and the m a t r i x is d e f l a t e d by d e l e t i n g (zeroing) its last row (and c o l u m n ) . T h i s s u b r o u t i n e is a t r a n s l a t i o n of the A l g o l p r o c e d u r e w r i t t e n and d i s c u s s e d in d e t a i l by M a r t i n , R e i n s c h , and W i l k i n s o n (i).
169
BQR
7.1-34
4. REFERENCES. I)
Martin, R.S., Reinsch, C., and Wilkinson, J.H., The QR A l g o r i t h m for Band Symmetric M a t r i c e s , Num. Math. 16,85-92 (1970). (Reprinted in H a n d b o o k for A u t o m a t i c C o m p u t a t i o n , V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Relnsch, C o n t r i b u t i o n II/7, 266-272j Springer-Verlag, 1971.)
5. CHECKOUT. A.
Test
Cases.
See the section d i s c u s s i n g testing real symmetric band matrices.
of
the codes
for
B. Accuracy~ The s u b r o u t i n e BQR is n u m e r i c a l l y stable (i); that the computed e i g e n v a l u e s are close to those of the original matrix. In a d d i t i o n s they are the exact e i g e n v a l u e s of a m a t r i x close to the original real symmetric band matrix.
170
is,
7.1-35
SUBROUTINE
B Q R (NM, N , M B , A, T, R, I E R R , NV, RV)
C INTEGER
X
I, J , K , L , M , N, II, IK, JK, JM, KJ, KK, KM, L L , M B , M K , M N , M Z , MI ,M2,M3,M4,NI,NM,NV, ITS,KJI,M2 I,M31, IERR, IMULT R E A L A ( N M , M B ) , R V (NV) R E A L F , G , Q , R , S,T, S C A L E REAL SQRT,ABS, SIGN INTEGER MAX0,MIN0
C
C
IERR = 0 MI = M I N 0 ( M B , N ) M = MI - i M2 = M + M M21 = M2 + 1 M3 = M21 + M M31 = M3 + 1 M4 = M31 + M2 MN = M+ N MZ = MB M I ITS = 0 ********** TEST FOR 40 G = A ( N , M B ) IF (M .EQ. O) G O TO F = 0.0
CONVERGENCE
**********
360
C DO
50
50 K = i, M MK = K + MZ F = F + ABS(A(N,MK)) CONTINUE
C
C
IF (ITS .EQ. 0 .AND. F .GT. R) R = F IF (R + F .LE. R) G O TO 3 6 0 IF (ITS .EQ. 30) GO T O 1 0 0 0 ITS = ITS + 1 ********** FORM SHIFT FROM BOTTOM 2 BY 2 M I N O R IF (F .GT. 0 . 2 5 * R .AND. ITS .LT. 5) GO T O 90 F = A(N,MB-I) IF (F .EQ. 0.0) GO T O 70 Q = (A(N-I,MB) - G) / (2.0 * F) S = SQRT(Q*Q+I.0) G = G F / (Q + S I G N ( S , Q ) ) 70 T = T + G
C 80
D O 80 I = i, N A(I,MB) = A(I,MB)
- G
C 90 i00
DO i00 K = M 3 1 , RV(K) = 0.0
M4
C DO
3 5 0 II = I, M N I = II - M NI = N - II IF (NI .LT. 0)
GO
TO
230
171
**********
7. 1 - 3 6
********** FORM COLUMN n = MAX0(I,2-I)
ii0
D O i i 0 K = I, RV(K) = 0.0
OF
SHIFTED
MATRIX
A-G*I
**********
M3
DO
120
1 2 0 K = L, M 1 KM = K + M MK = K + MZ RV(KM) = A(II,MK) CONTINUE LL IF
= MIN0(M,NI) ( L L . E Q . 0)
GO
TO
DO
130 135
140
1 3 0 K = i, L L KM = K + M21 IK = II + K M K = MB K RV(KM) = A(IK,MK) CONTINUE ********** PRE-MULT!PLY LL = M2 !MULT = 0 ****e***** MULTIPLICATION KJ = M4 - M1
135
DO
1 7 0 J = I~ L L KJ = KJ + M I JM = J + M3 IF (RV(JM) .EQ. F = 0.0
WITH
HOUSEHOLDER
PROCEDURE
0.0)
1 5 0 K = i, M I KJ = KJ + i JK = J + K - I F = F + RV(EJ) CONTINUE
GO
TO
**********
170
DO
150
*
RV(JK)
F = F / RV(JM) KJ = KJ - M I 1 6 0 K = I, M 1 KJ = KJ + 1 JK = J + K - 1 RV(JK) = RV(JK) CONTINUE
DO
160
170
KJ = CONTINUE IF
(IMULT
KJ
-
RV(KJ)
- MI
.NE.
0)
GO
TO
280
172
REFLECTIONS
*
F
**********
7.1-37
C
*********e HOUSEHOLDER F = RV(M21) S = 0.0 RV(M4) = 0.0 SCALE = O. 0
REFLECTION
*~********
C 180
DO 180 K = M21, SCALE = SCALE +
M3 ABS(RV(K))
C IF
(SCALE
.EQ.
0.0)
GO
TO
210
C 190
DO 190 K = M21, M3 S = S + (RV(K)/SCALE)**2
C S = SCALE * SCALE * G = -SIGN(SQRT(S),F) RV(M21) = g RV(M4) = S - F * G KJ = M4 + M2 * M1 + RV(KJ) = F - G
S
i
C DO
200 C 210
220
2 0 0 K = 2, M I KJ = KJ + I KM = K +M2 R V ( K J ) -- R V ( K M ) CONTINUE ********** SAVE COLUMN D O 2 2 0 K = L, M 1 KM = K+M MK = K + MZ A(II,MK) = RV(KM) CONTINUE
OF
TRIANGULAR
FACTOR
R
**********
C 230 C 240
L = MAXO(I,MI+I-I) I F (I . L E o 0) G O T O 3 0 0 ********** PERFORM ADDITIONAL D O 2 4 0 K = i, M 2 1 RV(K) = 0.0
STEPS
**********
C C
250 C
LL = MIN0(MI,NI+MI) ********** GET ROW OF TRIANGULAR FACTOR R D O 2 5 0 K K = i, L L K = KK - i KM = K +MI IK = I + K M K = MB K RV(KM) = A(IK,ME) CONTINUE ********** POST-MULTIPLY WITH HOUSEHOLDER LL = MI IMULT = 1 GO TO 140
173
**********
REFLECTIONS
**********
7.1-38
C 280
290 C 300
********** STORE COLUMN OF NEW A MATRIX ********** D O 2 9 0 K = L, M 1 MK = K + MZ A(I,MK) = RV(K) CONTINUE ********** UPDATE HOUSEHOLDER REFLECTIONS ********** I F (L . G T . i) L = L 1 KJI = M4 + L * M1
C DO
3 2 0 J = L, M 2 JM = J + M3 RV(JM) = RV(JM+I)
C DO
3 2 0 K = I, M I KJI = KJI + I KJ = K J1 - M1 RV(KJ) = RV(KJI) CONTINUE
320 350
CONTINUE
360
GO TO 40 • ********* T = T + G
380
DO 380 A(I,MB)
CONVERGENCE
1 = I, N = A(I,MB)
**********
- G
C DO
400
4 0 0 K = i, M I MK = K + MZ A(N,MK) = 0.0 CONTINUE
C GO TO i001 **********
C C i000 i001
IERR = RETURN END
SET ERROR EIGENVALUE
-- NO CONVERGENCE TO AFTER 30 ITERATIONS
N
174
**********
7.1-39
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F233
PACKAGE
(EISPACK)
MINFIT
A F o r t r a n IV S u b r o u t i n e to C o m p u t e the S i n g u l a r V a l u e D e c o m p o s i t i o n of an A r b i t r a r y R e a l R e c t a n g u l a r M a t r i x and the S o l u t i o n of a R e l a t e d L i n e a r L e a s t S q u a r e s P r o b l e m .
July,
1975
I. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e MINFIT c o m p u t e s the s i n g u l a r v a l u e s and c o m p l e t e o r t h o g o n a l d e c o m p o s i t i o n of the r e a l rectangular coefficient matrix A of the l i n e a r s y s t e m AX = B. A is d e c o m p o s e d into T U * DIAG(S)
* V
T with U itself, minimal are the square
T T U = V V = I. U B is f o r m e d r a t h e r than U e n a b l i n g a d e t e r m i n a t i o n of the s o l u t i o n X of n o r m (see s e c t i o n 2C). The d i a g o n a l e l e m e n t s of s i n g u l a r v a l u e s of A, e q u a l to the n o n - n e g a t i v e T r o o t s of the e i g e n v a l u e s of A A.
2. U S A G E , A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
MINFIT(NM,M,N,A,W,
IP,B,IERR,RVl)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and B as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and B in the calling program. Note that A and B are
175
7,1-40
overwritten by N - r o w e d a r r a y s V T U B; h e n c e , NM m u s t be at l e a s t as the m a x i m u m of M and N. is an i n t e g e r the n u m b e r of A and B. M
and as
large
input variable set e q u a l to r o w s of r e c t a n g u l a r matrices m u s t be n o t g r e a t e r t h a n NM.
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the n u m b e r of c o l u m n s of A a n d the o r d e r of the s q u a r e m a t r i x V which overwrites A. N m u s t be n o t g r e a t e r t h a n NM. is a w o r k i n g p r e c i s i o n real two-dimensional variable with row dimension NM and column dimension at l e a s t N. On input, A contains the rectangular (coefficient) m a t r i x to b e d e c o m p o s e d . On output, A has been overwritten by the o r t h o g o n a l V m a t r i x in the d e c o m p o s i t i o n . W
is a w o r k i n g p r e c i s i o n real output onedimensional v a r i a b l e of d i m e n s i o n at l e a s t N containing the s i n g u l a r v a l u e s of A.
IP
is an i n t e g e r the n u m b e r of zero.
input variable c o l u m n s of B.
set IP
e q u a l to c a n be
is a w o r k i n g p r e c i s i o n real two-dimensional variable with row dimension NM and c o l u m n dimension at l e a s t IP. If IP is not z e r o ~ t h e n on i n p u t , B c o n t a i n s the c o n s t a n t m a t r i x of the s y s t e m . On output, T B has been overwritten by U B. If IP is zero, t h e n B is n o t r e f e r e n c e d and can be a d u m m y ( w o r k i n g p r e c i s i o n ) variable. IERR
RVI
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n code described in s e c t i o n 2B. The normal completion code zero.
to is
is a w o r k i n g p r e c i s i o n real temporary onedimensional variable of d i m e n s i o n at l e a s t N u s e d to h o l d the o f f - d l a g o n a l e l e m e n t s of the b i d i a g o n a l form.
176
7.1-41
B.
Error
Conditions
and
Returns.
If m o r e t h a n 30 i t e r a t i o n s a r e r e q u i r e d to d e t e r m i n e a s i n g u l a r v a l u e , this s u b r o u t i n e terminates with IERR set to the i n d e x of the s i n g u l a r v a l u e for w h i c h the failure occurs. T h e s i n g u l a r v a l u e s in the W array s h o u l d be c o r r e c t f o r i n d i c e s IERR+I,IERR+2,...,N, as w e l l as the c o r r e s p o n d i n g c o l u m n s of V (in A) a n d r o w s T of U B (in B). If a l l the s i n g u l a r v a l u e s a r e d e t e r m i n e d iterations, IERR is set to zero.
C.
Applicability
and
30
Restrictions.
T h e m i n i m a l n o r m s o l u t i o n of AX = B f r o m the d e c o m p o s i t i o n in MINFIT by + V
within
* DIAG(S
c a n be o b t a i n e d forming
T ) * U
B
+ w h e r e e a c h e l e m e n t of S is the r e c i p r o c a l of the corresponding e l e m e n t of S w h e r e n o n - z e r o and z e r o where S is zero. Some zero t h r e s h o l d w o u l d h a v e to be employed (for e x a m p l e , the p r o d u c t of the s q u a r e r o o t of the m a c h i n e p r e c i s i o n a n d a n o r m of the m a t r i x ) . Sample c o d i n g to p e r f o r m this c o m p u t a t i o n m i g h t be: DO
i00
200 300 C
I00 1 = I, N DO I00 J = I, IP X(I,J) = 0.OD0 DO 300 K = I, N IF (W(K) .LT. T H R E S H ) G O TO 300 DO 200 1 = i, N DO 200 J = I, IP X(I,J) = X(I,J)+A(I,K)*B(K,J)/W(K) CONTINUE THE C O L U M N S OF X A R E T H E M I N I M A L N O R M S O L U T I O N S .
S o l u t i o n s of a s y s t e m of h o m o g e n e o u s linear equations with coefficient matrix A can be o b t a i n e d as t h o s e c o l u m n s of V (or l i n e a r c o m b i n a t i o n s of them) w h i c h correspond to zero e l e m e n t s of S.
177
7.1-42
3. D I S C U S S I O N
OF M E T H O D
AND
ALGORITHM.
T The s i n g u l a r v a l u e d e c o m p o s i t i o n A = U * DIAG(S) * V is a c c o m p l i s h e d in two steps. A is f i r s t r e d u c e d to the bidiagonal form J by two s e q u e n c e s of H o u s e h o l d e r transformations, t h o s e on the left r e d u c i n g c o l u m n s of A and B, a n d t h o s e on the r i g h t r e d u c i n g r o w s of A. Because the t r a n s f o r m a t i o n s are o r t h o g o n a l , J has the same s i n g u l a r T v a l u e s as A, that is J = G * DIAG(S) * H F u r t h e r , if the p r o d u c t of the l e f t t r a n s f o r m a t i o n s is d e n o t e d P and the p r o d u c t of the r i g h t t r a n s f o r m a t i o n s Q, so that T J = P * A * Q, t h e n U = PG and V = QH. The bidiagonal form J is t h e n d e c o m p o s e d by a v a r i a n t of the QR m e t h o d a p p l i e d to the s y m m e t r i c t r i d i a g o n a l m a t r i x T J J. (The s i n g u l a r v a l u e s of J are the n o n - n e g a t i v e T s q u a r e r o o t s of the e i g e n v a l u e s of J J.) T h e e s s e n c e of this m e t h o d is a p r o c e s s w h e r e b y a s e q u e n c e of s y m m e t r i c T t r i d i a g o n a ! m a t r i c e s , u n i t a r i l y s i m i l a r to J J~ is f o r m e d w h i c h c o n v e r g e s to a d i a g o n a l m a t r i x . The r a t e of c o n v e r g e n c e of this s e q u e n c e is i m p r o v e d by s h i f t i n g the o r i g i n at e a c h i t e r a t i o n . B e f o r e the i t e r a t i o n s for e a c h e i g e n v a l u e , the s y m m e t r i c t r i d i a g o n a l m a t r i x is c h e c k e d for a p o s s i b l e s p l i t t i n g into s u b m a t r i c e s . If a s p l i t t i n g o c c u r s , o n l y the l o w e r m o s t s u b m a t r i x p a r t i c i p a t e s in the n e x t iteration. T h e left ( t r a n s p o s e d ) and r i g h t t r a n s f o r m a t i o n s T u s e d in e a c h i t e r a t i o n a r e a c c u m u l a t e d in the U B (in B) and V (in A) a r r a y s . T h e o r i g i n s h i f t at e a c h i t e r a t i o n is an e i g e n v a l u e of the current lowermost 2x2 principal minor. W h e n e v e r the lowermost ixl p r i n c i p a l s u b m a t r i x f i n a l l y s p l i t s f r o m the r e s t of the m a t r i x ~ its e l e m e n t is t a k e n to be a n e i g e n v a l u e of t h e o r i g i n a l m a t r i x a n d the a l g o r i t h m p r o c e e d s w i t h the remaining submatrix. T h i s p r o c e s s is c o n t i n u e d u n t i l the m a t r i x has s p l i t c o m p l e t e l y into s u b m a t r i c e s of o r d e r i. T h e t o l e r a n c e s in the s p l i t t i n g t e s t s are p r o p o r t i o n a l to the relative machine precision. This s u b r o u t i n e MINFIT written R e i n s c h (i).
is a t r a n s l a t i o n of the A l g o l p r o c e d u r e and d i s c u s s e d in d e t a i l by G o l u b and
178
7.1-43
4. REFERENCES.
i)
Golub, G.H. and Reinsch, C., Singular Value D e c o m p o s i t i o n and Least Squares Solutions, Num. Math. 14,403-420 (1970). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, Volume II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n I/i0~ 134-151, Springer-Verlag, 1971.)
5. CHECKOUT. A. Test Cases. See the section discussing testing of the codes for singular value decomposition.
B. Accuracy. The subroutine MINFIT is n u m e r i c a l l y stable (I); that is each computed singular value is exact for a m a t r i x close to the original real rectangular matrix.
179
7.1-44
SUBROUTINE
MINFIT(NM,M,N,A,W,!P,B,IERR,RVI)
INTEGER I,J,K,L,M,N,II,IP,II,KK,KI,LL,LI,MI,NM, R E A L A ( N M , N ) , W ( N ) , B (NM, IP) , R V I (N) REAL C,F,G,H~S,X,Y,Z,EPS,SCALE,MACHEP REAL SQRT,AMAXI~ABS,SIGN **********
MACHEP
=
MACHEP IS A M A C H I N E DEPENDENT PARAMETER SPECIFYING THE RELATIVE PRECISION OF F L O A T I N G POINT ARITHMETIC.
?
IERR = 0 ********** HOUSEHOLDER G=0.0 SCALE = 0.0 X=0.0 DO
120
300 1 L = ! + RVI(1) G=0.0 S=O.O SCALE IF (I
= I
I, =
SCALE
= 0.0 .GT. M)
(SCALE
REDUCTION
TO
BIDIAGONAL
N
DO 120 K = I, SCALE = SCALE IF
* G
GO
TO
210
M + ABS(A(K,I))
,EQo
0.0)
GO
TO
210
DO
130
130 K = I, M A(K,!) = A(K,I) / SCALE S = S + A(K,I)**2 CONTINUE F = A(I,I) G = -SlGN(SQRT(S),F) H = F * G - S A(I,I) = F - G IF (I .EQ. N) G O TO DO
!50
J = L,
160
N
S=0.0
140
DO 140 K = I, M S = S + A(K,I) * A(K,J) F
= S
/ H
DO
150
ITS,IERR
150 K = I, M A(K,J) = A(K,J) CONTINUE
+ F
180
* A(K,I)
FORM
**********
7.1-45
160
IF
(IP
.EQ.
DO
180 J = S=O.0
O) I,
GO
TO
190
IP
DO 170 K = I, M S = S + A(K,I) * B(K,J)
170
F=S/H DO
180
180 K = I, M B(K,J) = B(K,J) CONTINUE
190 200
DO 2 0 0 A(K,I)
210
W(1) = SCALE G = 0.0 S = 0.0 SCALE = 0.0 IF (I .GT. M
220
K
=
I,
(SCALE
* A(K,I)
M
= SCALE
* A(K,I)
* G
.OR.
D O 2 2 0 K = L, SCALE = SCALE IF
+ F
I
.EQ.
N)
GO
TO
N + ABS(A(I,K))
.EQ.
0.0)
GO
TO
290
DO
230
2 3 0 K = L, N A(I,K) = A(I,K) / SCALE S = S + A(I,K)**2 CONTINUE
F = A(I,L) g = -SIGN(SQRT(S),F) H = F * G - S A(I,L) = F - G
240
250
DO 2 4 0 RVI(K)
K = L, N = A(I,K)
IF
(I
.EQ.
M)
DO
2 6 0 J = L, S=0.0
GO
/ H TO
270
M
DO 250 K = L, N S = S + A(J,K) * A(I,K) DO
260
260 K = L, N A(J,K) = A(J,K) CONTINUE
+
181
S * RVI(K)
290
7.1-46
270 280
DO 280 A(I,K)
K =
= L~ N SCALE * A(I,K)
C 290 300 C C
X = AMAX!(X,ABS(W(I))+ABS(RVI(I))) CONTINUE ***~****** ACCUMULATION OF RIGHT-HAND F O R I = N S T E P -i U N T I L I DO D O 4 0 0 I I = i, N I = N+ 1 - II I F (I , E Q . N) G O T O 3 9 0 I F (G . E Q , 0 . 0 ) G O T O 3 6 0
TRANSFORMATIONS. -- **********
C C 320
DO 320 ********** A(J,I)
J
= L, N DOUBLE DIVISION AVOIDS = (A(I,J) / A(I,L)) / G
POSSIBLE
UNDERFLOW
**********
C DO
3 5 0 J = L, S = 0.0
N
C DO 3 4 0 K = L , S = S + A(I,K)
340
N *
A(K,J)
C
DO
350
3 5 0 K = L, N A(K,J) = A(K,J) CONTINUE
360
DO
+
S
* A(K,I)
C 3 8 0 J = L, N A(I,J) = 0.0 A(J,I) = 0.0 CONTINUE
380 C 390
A(I,I) G
400
=
=
1.0
RVI(I)
L = I CONTINUE
C IF MI
(M . G E . N = M + i
DO
500
.OR.
IP
.EQ.
0)
GO
TO
510
C I = MI,
N
C DO
500 C 510 C
5 0 0 J = i, I P B(I,J) = 0.0 CONTINUE ********** DIAGONALIZATION EPS = MACHEP * X ********** FOR K=N STEP -I D O 7 0 0 K K = i, N K 1 -- N - K K K = K1 + ! ITS = 0
OF
THE
UNTIL
~82
BIDIAGONAL i DO
--
FORM
**********
**e*******
7.1-47
C C
********** 520
C C 530 C 540
TEST FOR SPLITTING. FOR L=K STEP -I UNTIL 1 DO D O 5 3 0 L L = I, K LI = K - LL L = L1 + i IF (ABS(RVI(L)) .LE. E P S ) G O T O ********** RVI(1) IS A L W A Y S ZERO, SO THROUGH THE BOTTOM OF THE IF (ABS(W(LI)) .LE. E P S ) G O T O CONTINUE ********** CANCELLATION OF RVI(L) IF C = 0.0
--
**********
565 THERE IS NO EXIT LOOP ********** 540 L
GREATER
THAN
1 **********
S=l.O DO
5 6 0 1 = L, K F = S * RVI(1) RVI(1) = C * RVI(1) IF ( A B S ( F ) .LE. E P S ) G = w(I) H = SQRT (F*F+G*G) w(1) -C = g / H S = -F / H I F (IP .EQ. 0) G O T O 5 5 0 J -- i, I P Y = B(LI,J) Z = B(I,J) B(LI,J) = Y * C + B(I,J) = -Y * S + CONTINUE
GO
TO
565
560
DO
550 560
565
Z * S Z * C
CONTINUE ********** TEST FOR CONVERGENCE ********** Z = W(K) I F (L .EQ. K) G O T O 6 5 0 ********** SHIFT FROM BOTTOM 2 BY 2 MINOR IF ( I T S .EQ. 30) G O T O 1 0 0 0 ITS = ITS + 1 X = w(n) Y = W(KI) G = R V I (KI)
**********
= ~ V l (K) = ( ( Y - Z) * (Y + Z) + (G - H) * (G + H ) ) / ( 2 . 0 * H * Y) G = SQRT(F*F+I.0) F = ( ( X - Z) * (X + Z) + H * (Y / (F + S I G N ( G , F ) ) - H)) / X ********** NEXT QR TRANSFORMATION ********** C = 1.0 S = 1.0 H F
183
7.1-48
DO
600 I = G =
Ii = L, II + 1 RVl
Y
= w(i)
H G Z
= = =
S * G C * G SQRT (F*F+H*H)
R v l (If) C
K1
=
F
=
z
/ Z
s = H / z F G H Y
= X * = -X* = Y * = Y *
C
+ G S +G
*
S *
C
S C
C DO
570
5 7 0 J = i, N X = A(J,II) Z = A(J,I) A(J,II) = X * A(J,!) = -X * CONTINUE
C + S +
Z Z
* *
S C
C Z
=
SQRT (F*F+H*H)
w(I1) C
********** IF
= z
ROTATION CAN BE ARBITRARY (Z .EQ. 0 . 0 ) G O T O 5 8 0
IF
Z
IS
C = F / Z s = H / z 580
F = C * G + S * Y X = -S * G + C * Y I F ( I P . E Q . 0) G O T O
600
C DO
590
5 9 0 J = i, I P Y = B(II,J) Z = B(I,J) B(II,J) = Y * B(I,J) = -Y * CONTINUE
C + S +
Z Z
* *
S C
C 600
CONTINUE
C
C 650 C
RVI(L) = 0.0 RVl (K) = F W(K) = X GO TO 520 ********** CONVERGENCE ********** I F (Z . G E . 0 . 0 ) G O T O 7 0 0 ********** W(K) IS MADE NON-NEGATIVE W(K) = -Z
C 690
DO 690 A(J,K)
J =
= I, N -A(J,K)
184
**********
ZERO
**********
7.1-49
C 700
CONTINUE
C GO TO i001 **********
C C I000 I001
S E T E R R O R -- N O C O N V E R G E N C E TO A S I N G U L A R V A L U E A F T E R 30 I T E R A T I O N S
IERR = K RETURN END
185
~*********
7.1-50
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE PACKAGE F238
(EISPACK)
QZHES
A F o r t r a n IV S u b r o u t i n e to S i m u l t a n e o u s l y R e d u c e One of a Pair of Real G e n e r a l M a t r i c e s to U p p e r H e s s e n b e r g F o r m and the Other to Upper T r i a n g u l a r F o r m Using and Optionally Accumulating Orthogonal Transformations.
July,
1975
I. PURPOSE. The F o r t r a n IV s u b r o u t i n e QZHES r e d u c e s the g e n e r a l i z e d real e i g e n p r o b l e m AX = ( L A M B D A ) B X to an e q u i v a l e n t p r o b l e m with A in upper H e s s e n b e r g form and B in upper t r i a n g u l a r form~ using and o p t i o n a l l y a c c u m u l a t i n g o r t h o g o n a l transformations. T h e s e r e d u c e d forms are used by other s u b r o u t i n e s to find the g e n e r a l i z e d e i g e n v a l u e s and/or e i g e n v e c t o r s of the o r i g i n a l m a t r i x system. See s e c t i o n 2C for the s p e c i f i c routines.
2. USAGE. A.
Calling The
Sequence°
SUBROUTINE SUBROUTINE
statement
is
QZHES(NM,N,A,B,MATZ~Z)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is given in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and B (and Z if MATZ is true) as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and B (and Z) in the c a l l i n g program. is an i n t e g e r input v a r i a b l e set equal to the order of the m a t r i c e s A and B. N m u s t be not g r e a t e r than NM.
t86
7.1-51
is a w o r k i n g p r e c i s i o n r e a l t w o - d l m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On i n p u t , A c o n t a i n s one of the r e a l g e n e r a l m a t r i c e s of order N that d e f i n e the e i g e n p r o b l e m AX = (LAMBDA)BX. On o u t p u t , A contains an u p p e r H e s s e n b e r g m a t r i x ; e l e m e n t s b e l o w the s u b d i a g o n a l are set to zero. See s e c t i o n 3 for the d e t a i l s . is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and column d i m e n s i o n at l e a s t N. On input, B c o n t a i n s the o t h e r r e a l g e n e r a l m a t r i x of order N in the s y s t e m . On o u t p u t , B c o n t a i n s an u p p e r t r i a n g u l a r m a t r i x ; e l e m e n t s b e l o w the d i a g o n a l are set to zero. See s e c t i o n 3 for the d e t a i l s . MATZ
is a l o g i c a l i n p u t v a r i a b l e set true if (column) t r a n s f o r m a t i o n m a t r i x is to be a c c u m u l a t e d and set f a l s e o t h e r w i s e .
the
is, if MATZ is true, a w o r k i n g p r e c i s i o n real o u t p u t t w o - d i m e n s i o n a l v a r i a b l e w i t h row dimension NM and c o l u m n d i m e n s i o n at least N. It c o n t a i n s the o r t h o g o n a l (column) t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the r e d u c t i o n s to the H e s s e n b e r g and t r i a n g u l a r f o r m s of A and B. If MATZ is f a l s e , Z is n o t r e f e r e n c e d and can be a dummy (working precision) variable.
B. E r r o r
Conditions
and R e t u r n s .
None.
C, A p p l i c a b i l i t y
and R e s t r i c t i o n s .
If all the e i g e n v a l u e s of the o r i g i n a l m a t r i x s y s t e m d e s i r e d , this s u b r o u t i n e s h o u l d b e f o l l o w e d by QZIT (F239) and Q Z V A L (F240) o If all the e i g e n v a l u e s a n d m a t r i x s y s t e m are d e s i r e d , f o l l o w e d by QZIT (F239), (F241).
187
are
e i g e n v e c t o r s of the o r i g i n a l this s u b r o u t i n e s h o u l d be Q Z V A L (F240), and QZVEC
7.1-52
3.
DISCUSSION
OF M E T H O D
AND
ALGORITHM.
B is f i r s t r e d u c e d to u p p e r t r i a n g u l a r form, one time, by H o u s e h o l d e r r o w t r a n s f o r m a t i o n s . These transformations are s i m u l t a n e o u s l y a p p l i e d to A.
column
at a
A is then r e d u c e d to u p p e r H e s s e n b e r g f o r m by r o w r o t a t i o n s w h i l e m a i n t a i n i n g the t r i a n g u l a r f o r m of B. T h i s is p o s s i b l e if the e l e m e n t s of A are a n n i h i l a t e d in a p r e c i s e o r d e r , c o l u m n w i s e f r o m the b o t t o m , as for e x a m p l e w h e n N=5: (
X
( x ((3) ((2) ((i)
X
X
X
X
)
x x (5) (4)
x x x (6)
x x x x
x x x x
) ) ) ).
E a c h r o t a t i o n a n n i h i l a t i n g an e l e m e n t of A introduces one n o n z e r o e l e m e n t on the s u b d i a g o n a l of B. T h i s e l e m e n t is t h e n a n n i h i l a t e d by a c o l u m n r o t a t i o n w h i c h w h e n a p p l i e d to A d o e s n o t d i s t u r b a n y of the n e w l y i n t r o d u c e d zeros. By a c c u m u l a t i n g t h e s e c o l u m n r o t a t i o n s in Z, f u l l i n f o r m a t i o n is s a v e d for l a t e r u s e in b a c k t r a n s f o r m i n g the e i g e n v e c t o r s of the r e d u c e d s y s t e m into t h o s e of the o r i g i n a l s y s t e m . T h i s s u b r o u t i n e is an i m p l e m e n t a t i o n of the f i r s t step QZ a l g o r i t h m w r i t t e n and d i s c u s s e d in d e t a i l by M o l e r S t e w a r t (i).
4.
of the and
REFERENCES.
i)
M o l e r , C.B~ and S t e w a r t , G.W. ~ An A l g o r i t h m Generalized Matrix Eigenvalue Problems, S l A M J. N u m e r . A n a l . 1 0 , 2 4 1 - 2 5 6 (1973).
for
5. C H E C K O U T . A.
Test
Cases~
See the s e c t i o n d i s c u s s i n g t e s t i n g real generalized matrix systems.
of
the
codes
for
B. A c c u r a c y ° T h e a c c u r a c y of QZHES c a n b e s t be d e s c r i b e d in t e r m s of its r o l e in t h o s e p a t h s of EISPACK which find e i g e n v a ! u e s a n d e i g e n v e c t o r s of r e a l g e n e r a l i z e d m a t r i x systems. In t h e s e p a t h s , this s u b r o u t i n e is n u m e r i c a l l y
188
7.1-53
stable (i). This stability c o n t r i b u t e s to the property of these paths that each computed eigenvalue and its c o r r e s p o n d i n g e i g e n v e c t o r are exact for a system close to the original system.
7.1-54
SUBROUTINE
QZHES(NM,N,A,B,MATZ,Z)
INTEGER !,J,K,L,N,LB,LI,NM,NKI,NMI,NM2 REAL A(NM,N),B(NM,N),Z(NM,N) REAL R,S,T,UI,U2,VI,V2,RHO REAL SQRT,ABS,SIGN LOGICAL MATZ IF
(~NOT.
DO
3 1 =
MATZ) i,
GO
TO
i0
N
DO
2 J = i, N Z(I,J) = 0.0 CONTINUE
Z(l,l) = 1.0 3 CONTINUE ********** REDUCE B TO UPPER i0 IF (N .LE. I) GO TO 170 NMI = N - i
DO
TRIANGULAR
i 0 0 L = i, N M I LI = L + i S = 0~0 DO
20
20 1 = LI, N S = S + ABS(B(I,L)) CONTINUE
IF (S .EQ. 0.0) G O S = S + ABS(B(L,L)) R = 0.0
TO
i00
DO
25
25 1 = L, N B(I,L) = B(I,L) / S R = R + B(I,L)**2 CONTINUE
R = S I G N ( S Q R T (R), B (L, L)) B(L,L) = B(L,L) + R RHO = R * B(L,L) DO
50 J = L I , T = 0.0 DO
30
T 30
N
I = L, =
T
N
+ B(I,L)
* ~(I,J)
CONTINUE T = -T
/ RHO
190
FORM
**********
7.1-55
DO
4 0 1 = L, N B(I,J) = B(I,J) CONTINUE
40 50
+
T
* B(I,L)
CONTINUE DO
80 J = T=0.0
i,
N
DO
6 0 1 = L, N T -- r + B ( I , L ) CONTINUE
60
T
=
-T
/
* A(I,J)
RHO
DO
7 0 1 = L, N A(I,J) = A(I,J) CONTINUE
70 80
+
T
* B(I,L)
CONTINUE B(L,L)
=
-S
* R
DO
90 1 = LI, N B(I,L) = 0.0 CONTINUE
90 I00
CONTINUE ********** I F (N NM2 =
.EQ. N - 2
REDUCE A TO UPPER HESSENBERG FORM, KEEPING B TRIANGULAR ********** 2) G O T O 1 7 0
1 6 0 K = I, N M 2 NKI = NMI - K ********** FOR L=N-I STEP -i UNTIL K+I D O 1 5 0 L B = i, N K I L = N - LB L1 = L + I ********** ZERO A(L+I,K) ********** S = ABS(A(L,K)) + ABS(A(LI,K)) I F (S . E Q . 0 . 0 ) G O T O 1 5 0 UI = A(L,E) / S U2 = A(LI,K) / S R = SIGN(SQRT(UI*UI+U2*U2),UI)
WHILE
DO
vl
=
V2 U2
= -U2 / R = V2 / Vl
-(ul
+ R)
/ R
191
DO
--
**********
7.1-56
DO
i i 0 J = K, N T = A(L,J) + U2 * A(LI,J) A(L,J) = A ( L , J ) + r * VI A(LI,J) = A(LI,J) + r * V2 CONTINUE
ii0
A(L!~K)
=
0.0
DO
120
1 2 0 J = L, N T = B ( L , J ) + U2 * B ( L I , J ) B(L,J) = B(L,J) + T * VI B(LI,J) = B(LI,J) + r * V2 CONTINUE • ********* ZERO B(L+I,L) ********** S = ABS(B(LI,LI)) + ABS(B(LI,L)) IF (S .EQ. 0 . 0 ) GO TO 150 UI = B ( L I , L I ) / S U2 = B ( L I , L ) / S R = SIGN(SQRT(UI*UI+U2*U2),UI) Vl = - ( U I + R) / R V2 = - U 2 / R U2 = V2 / VI DO
130 1 = i, LI T = B(I,LI) + U2 * B ( I , L ) B(I,LI) = B(I,LI) + T * V1 B ( I , L ) = B ( I , L ) + T * V2 CONTINUE
130
B(LI,L)
=
0.0
DO
1 4 0 I = i, N T = A(I,LI) + U2 * A ( I , L ) A(I,LI) = A(!,LI) + T * V1 A(I,L) = A(I,L) + T * V2 CONTINUE
140
IF
(.NOT.
MATZ)
GO
TO
DO
145 1 = i, N T = Z ( I , L I ) + U2 * Z ( I , L ) Z(I,LI) = Z ( I , L I ) + T * V1 Z(I,L) = Z(I,L) + T * V2 CONTINUE
145 150
150
CONTINUE
160
CONTINUE
170
RETURN END
192
7.1-57
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F239-2
PACKAGE
(EISPACK)
QZIT
A Fortran IV Subroutine to Reduce One of a Pair of Real Matrices from Upper H e s s e n b e r g to Q u a s i - U p p e r Triangular Form While M a i n t a i n i n g the Upper Triangular Form of the Other Using and O p t i o n a l l y A c c u m u l a t i n g Orthogonal T r a n s f o r m a t i o n s .
July, January,
1975 1977
i. PURPOSE. The Fortran IV subroutine QZIT reduces the g e n e r a l i z e d real eigenproblem AX = (LAMBDA)BX, where A is in upper H e s s e n b e r g form and B is in upper triangular form, to an equivalent p r o b l e m with A now in q u a s i - u p p e r triangular form and B still in upper triangular form, using and o p t i o n a l l y a c c u m u l a t i n g orthogonal transformations. These reduced forms are used by other subroutines to find the g e n e r a l i z e d eigenvalues and/or e l g e n v e c t o r s of this m a t r i x system or of an original real general m a t r i x system from which this system was itself reduced. See section 2C for the specific routines.
2. USAGE. A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
QZIT(NM,N,A,B,EPSI,MATZ,Z,IERR)
The p a r a m e t e r s are discussed below and the i n t e r p r e t a t i o n of working p r e c i s i o n for various machines is given in the section discussing certification. NM
is an integer input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and B (and Z if MATZ is true) as specified in the D I M E N S I O N statements for A and B (and Z) in the calling program.
193
7.1-58
is an i n t e g e r i n p u t v a r i a b l e set e q u a l the o r d e r of the m a t r i c e s A and B. m u s t b e not g r e a t e r than NM~ A
to N
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and column d i m e n s i o n at least N. On input, A contains a real upper Hessenberg matrix; c o n t e n t s of s t o r a g e l o c a t i o n s b e l o w the s u b d i a g o n a l are a r b i t r a r y . On o u t p u t , A contains a quasi-upper triangular matrix, that is, t r i a n g u l a r e x c e p t for p o s s i b l e 2x2 diagonal blocks~ See s e c t i o n 3 for the details. is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On i n p u t , B c o n t a i n s an u p p e r t r i a n g u l a r m a t r i x ; c o n t e n t s of s t o r a g e l o c a t i o n s b e l o w the d i a g o n a l are a r b i t r a r y . On o u t p u t , B s t i l l c o n t a i n s an u p p e r t r i a n g u l a r m a t r i x a l t h o u g h the e l e m e n t s h a v e c h a n g e d . One additional location, B ( N , I ) , is u s e d to s t o r e the p r o d u c t of EPSI and the n o r m of B for l a t e r use by s u b r o u t i n e s that m a y follow QZiT. See s e c t i o n 3 for the details.
EPSI
is a w o r k i n g p r e c i s i o n r e a l i n p u t v a r i a b l e d e f i n i n g the t o l e r a n c e u s e d to d e t e r m i n e n e g l i g i b l e e l e m e n t s of A and B in the c o u r s e of the a l g o r i t h m . An e l e m e n t of e i t h e r m a t r i x w i l l be c o n s i d e r e d n e g l i g i b l e and r e s e t to zero if it is not l a r g e r than the p r o d u c t of EPSI and the n o r m of the matrix. If EPSI is n o n - p o s i t i v e , then a d e f a u l t v a l u e e q u a l to the r e l a t i v e m a c h i n e p r e c i s i o n w i l l be u s e d i n s t e a d . A positive v a l u e of EPSI m a y r e s u l t in f a s t e r e x e c u t i o n , but less a c c u r a t e r e s u l t s .
MATZ
is a l o g i c a l i n p u t v a r i a b l e set true if (column) t r a n s f o r m a t i o n m a t r i x is to be a c c u m u l a t e d and set f a l s e o t h e r w i s e .
the
is~ if MATZ is true, a w o r k i n g p r e c i s i o n real two-dimensional variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. If A and B are p r i m a r y data, t h e n on input~ Z c o n t a i n s the i d e n t i t y m a t r i x of order N. If A and B are r e d u c e d f r o m a r e a l g e n e r a l m a t r i x s y s t e m , then on input,
7.1-59
Z contains the t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the reduction. On output, Z contains the o r t h o g o n a l (column) t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the r e d u c t i o n s to the q u a s i - t r i a n g u l a r and current t r i a n g u l a r forms of A and B. If MATZ is false, Z is not r e f e r e n c e d and can be a dummy (working p r e c i s i o n ) variable. IERR
is an integer output v a r i a b l e set equal an error c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n code zero.
B. Error C o n d i t i o n s
to is
and Returns.
If m o r e than 50 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e a diagonal Ixl or 2x2 b l o c k of the q u a s i - t r i a n g u l a r form, this s u b r o u t i n e t e r m i n a t e s w i t h IERR set to the index of the row for w h i c h the f a i l u r e occurs. The p r i n c i p a l minor in rows and columns IERR+I,IERR+2,...,N s h o u l d be in s u i t a b l e form for a d e t e r m i n a t i o n of its e i g e n v a l u e s with QZVAL (F240), but no e i g e n v e c t o r s can be computed. If all the d i a g o n a l blocks are d e t e r m i n e d w i t h i n 50 zero.
C. A p p l i c a b i l i t y
of the q u a s i - t r i a n g u l a r form iterations, IERR is set to
and R e s t r i c t i o n s .
To d e t e r m i n e all the e i g e n v a l u e s of a real g e n e r a l m a t r i x system, QZIT should be p r e c e d e d by QZHES (F238) to p r o d u c e s u i t a b l e upper H e s s e n b e r g A and upper t r i a n g u l a r B m a t r i c e s for QZIT. QZIT should always be f o l l o w e d by QZVAL (F240). To d e t e r m i n e all the e i g e n v a l u e s and e i g e n v e c t o r s of a real g e n e r a l m a t r i x system, QZIT should be p r e c e d e d by QZHES (F238). QZIT should always be f o l l o w e d by QZVAL (F240) and QZVEC (F241).
3. D I S C U S S I O N The
QR
OF M E T H O D AND A L G O R I T H M . method
is e f f e c t i v e l y applied to the upper -I Hessenberg matrix C=AB w i t h o u t ever h a v i n g to e x p l i c i t l y form it; u n i t a r y e q u i v a l e n c e s on A and chosen so that at each i t e r a t i o n A remains upper
195
B
are
7. 1-60
Hessenberg, B remains upper triangular, and the product -I AB , if formed, would be exactly the m a t r i x derived o r i g i n a l l y from C by the c o r r e s p o n d i n g i t e r a t i o n of the method.
QR
The essence of the QR m e t h o d is a process w h e r e b y a sequence of upper H e s s e n b e r g matrices, u n i t a r i l y similar to the original H e s s e n b e r g matrix, is formed w h i c h converges to a q u a s i - t r i a n g u l a r matrix, that is, an upper H e s s e n b e r g m a t r i x whose e i g e n v a l u e s are the e i g e n v a l u e s of ixl or 2x2 p r i n c i p a l submatrices. The rate of c o n v e r g e n c e of this sequence is improved by shifting the origin at each iteration. The a r i t h m e t i c t h r o u g h o u t the process is kept real, w h e n c o n v e r g i n g toward 2x2 submatrices with complex e i g e n v a l u e s , by c o m b i n i n g two iterations into one using a pair of complex c o n j u g a t e origin shifts. Before each iteration, the last H e s s e n b e r g form is checked for a possible splitting into submatriees. If a s p l i t t i n g occurs, only the lower s u b m a t r i x p a r t i c i p a t e s in the next iteration. The origin shifts at each i t e r a t i o n are the e i g e n v a l u e s of the lowest 2x2 p r i n c i p a l minor if complex, or that one of them closer to the second d i a g o n a l element of this minor if real. W h e n e v e r a lowest ixl or 2x2 principal submatrix finally splits from the rest of the matrix, the a l g o r i t h m proceeds with the r e m a i n i n g submatrix. This process is c o n t i n u e d until the m a t r i x has split c o m p l e t e l y into s u b m a t r i c e s of order I or 2. The tolerances in the s p l i t t i n g tests are p r o p o r t i o n a l to EPSI. The o p e r a t i o n s d e f i n i n g the e q u i v a l e n c e s on A and B comprise both row and column H o u s e h o l d e r transformations. By a c c u m u l a t i n g the column t r a n s f o r m a t i o n s in Z, full i n f o r m a t i o n is saved for later use in back t r a n s f o r m i n g the e i g e n v e c t o r s of the r e d u c e d system into those of the original system. This s u b r o u t i n e is an i m p l e m e n t a t i o n of the second the QZ a l g o r i t h m w r i t t e n and discussed in detail and Stewart (I) and extended by Ward (2).
step of by Moler
4. REFERENCES. I)
Moler, C.B. and Stewart, G.W., An A l g o r i t h m G e n e r a l i z e d M a t r i x E i g e n v a l u e Problems~ SlAM J. Numer. Anal. i0~241-256 (1973).
2)
Ward, R.C.~ An E x t e n s i o n of the QZ A l g o r i t h m for Solving the G e n e r a l i z e d M a t r i x E i g e n v a l u e Problem, T e c h n i c a l Note NASA TN D-7305 (1973).
196
for
7.1-61
5. CHECKOUT. A.
Test
Cases.
See the section d i s c u s s i n g testing real g e n e r a l i z e d m a t r i x systems.
of the codes
for
B. Accuracy. The a c c u r a c y of QZIT can best b e d e s c r i b e d in terms of its role in those paths of EISPACK which find eigenvalues and e i g e n v e c t o r s of real g e n e r a l i z e d m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (1,2). This s t a b i l i t y c o n t r i b u t e s to the property of these paths that each computed e i g e n v a l u e and its c o r r e s p o n d i n g e i g e n v e c t o r are exact for a system close to the original system.
197
7, t - 6 2
SUBROUTINE
QZIT(NM,N,A,B,EPSI~MATZ,Z,IERR)
C INTEGER
I,J,K,L,N,EN,KI,K2,LD,LL~LI,NA,NM,ISH,ITS~KMI,LMI, ENM2,1ERR,LORI~ENORN REAL A(NM,N),B(NM,N),Z(NM,N) REAL R,S,T,Ai,A2,A3,EP,SH,UI,U2,U3,VI,V2~V3,ANI,AII,AI2, X A21,A22,A33,A34,A43,A44,BNI,BII,BI2,B22,B33,B34, X B44,EPSA,EPSB,EPSI,ANORM,BNORM REAL SQRT,ABS,SIGN INTEGER MAX0,MINO LOGICAL MATZ,NOTLAS X
C IERR = 0 ********** COMPUTE ANORM = 0.0 BNORM = 0.0
C
EPSA,EPSB
**********
C DO
30 1 = !, N ANI = 0.0 IF (I .NE. !) A N I B N I = 0.0
= ABS(A(I,I-I))
C DO
20
20 J = !~ ANI = ANI BNI = BNI CONTINUE
N + ABS(A(I,J)) + ABS(B(I,J))
C
30
IF ( A N I IF ( B N ! CONTINUE
.GT. .GT.
ANORM) BNORM)
ANORM BNORM
= ANI = BN!
C
C 40 50 C C
C 60
70 C
IF ( A N O R M .EQ. 0 . 0 ) A N O R M = 1.0 IF ( B N O R M .EQ. 0 . 0 ) B N O R M = 1.0 EP = EPSI IF (EP .GT. 0 . 0 ) G O TO 50 ********** COMPUTE ROUNDOFF L E V E L IF E P S I IS Z E R O * * * * * * * * * * EP = 1.0 EP = EP / 2 . 0 IF ( I . 0 + EP .GT. 1.0) G O T O 40 E P S A = EP * A N O R M E P S B = EP * B N O R M ********** R E D U C E A TO Q U A S I - T R I A N G U L A R FORM, WHILE KEEPING B TRIANGULAR ********** LORI = 1 ENORN = N EN = N ********** B E G I N QZ S T E P * * * * * * * * * * IF (EN .LE. 2) GO T O I 0 0 1 IF ( . N O T . M A T Z ) E N O R N = E N ITS = 0 N A = EN - i 1 E N M 2 = NA ISN = 2 ********** CHECK FOR CONVERGENCE OR R E D U C I B I L I T Y .
198
7.1-63
FOR L=EN 80 LL = 13 E N L M I = EN - LL L = LMI + 1 IF (n .EQ. i) G O IF ( A B S ( A ( L , L M I ) ) CONTINUE
STEP
-I
UNTIL
1 DO
--
**********
DO
80
TO 95 .LE.
EPSA)
GO
90 A ( L , L M I ) = 0.0 IF (L .LT. NA) G O TO 95 ********** I-BY-I OR 2-BY-2 BLOCK EN = L M I G O TO 60 ********** C H E C K F O R S M A L L T O P OF 95 LD = L i 0 0 L1 = L + 1 Ell = B(L,L) IF ( A B S ( B I I ) .GT. E P S B ) GO TO 120 B(L,L) = 0.0 S = ABS(A(L,L)) + ABS(A(LI,L)) UI = A ( L , L ) / S U2 = A ( L I , L ) / S R = SIGN(SQRT(UI*UI+U2*U2),UI) VI = - ( U l + R) / R V2 = -U2 / R U 2 = V2 / V1 II0 J = L , E N O R N T = A ( L , J ) + U2 * A(L,J) = A(L,J) + A(LI,J) = A(LI,J) T = B ( L , J ) + U2 * B(L,J) = B(L,J) + B(LI,J) = B(LI,J) CONTINUE
TO
90
ISOLATED
**********
B **********
DO
II0
120
A(LI,J) T * V1 + T * V2 B(LI,J) T * V1 + r * V2
IF (L .NE. i) A ( L , L M I ) = -A(L,LMI) LMI = L L = L1 G O TO 90 All = A(L,L) / BII A 2 1 :: A ( L I , L ) / BII IF ( I S H .EQ. I) GO T O 140 ********** ITERATION STRATEGY ********** IF (ITS .EQ. 5 0 ) G O TO I 0 0 0 IF (ITS .EQ. I0) G O T O 155 ********** DETERMINE T Y P E OF S H I F T * * * * * * * * * * B22 = B(LI,LI) IF ( A B S ( B 2 2 ) .LT. E P S B ) B 2 2 = E P S B B33 = B(NA,NA) IF ( A B S ( B 3 3 ) .LT. E P S B ) B 3 3 = E P S B B44 = B(EN,EN) IF ( A B S ( B 4 4 ) .LT. E P S B ) B 4 4 = E P S B A33 = A(NA,NA) / B33
I@@
7.1-64
130
A34 = A(NA,EN) / B44 A43 = A(EN,NA) / B33 A44 = A(EN,EN) / B44 B34 = B(NA,EN) / B44 T = 0.5 * (A43 * B34 - A33 - A44) R = T * T + A34 * A43 - A33 * A44 I F (R . L T . 0 . 0 ) G O T O 1 5 0 • ********* DETERMINE SINGLE SHIFT ZEROTH COLUMN OF A ********** ISH = i R = S Q R T (R) S H = - T + R S = -T - R IF (ABS(S-A44) .LT. ABS(SH-A44)) SH = S • ********* LOOK FOR TWO CONSECUTIVE SMALL SUB-DIAGONAL ELEMENTS OF A. FOR L=EN-2 STEP -i UNTIL LD DO -- ********** DO 130 LL = LD, ENM2 L = ENM2 + LD - LL I F (L . E Q . L D ) G O T O 1 4 0 LMI = L - i LI = L + i T = A(L,L) IF (ABS(B(L,L)) .GT. EPSB) T = T - SH * B(L,L) IF (ABS(A(L,LMI)) .LE. ABS(T/A(LI,L)) * EPSA) GO TO I00 CONTINUE
140
C
C
C
AI = All - SH A2 = A21 I F (L o N E . L D ) A ( L , L M I ) = -A(L,LMI) GO TO 160 ********** DETERMINE DOUBLE SHIFT ZEROTH COLUMN OF A ********** 150 AI2 = A(L,LI) / B22 A22 = A(LI,LI) / B22 BI2 = B(L,LI) / B22 A1 = ((A33 - All) * (A44 - All) - A34 * A43 + A43 * B34 * All) X / A21 + AI2 - All * BI2 A2 = (A22 - All) - A21 * BI2 - (A33 - All) - (A44 - All) X + A43 * B34 A3 = A(LI+I,LI) / B22 GO TO 160 ********** AD HOC SHIFT ********** 155 A1 = 0.0 A2 = 1.0 A3 = 1.1605 160 ITS = ITS + I IF (.NOT. MATZ) LORI = LD ********** MAIN LOOP ********** D O 2 6 0 K = L, N A NOTLAS = K .NE. NA .AND. ISH .EQ. 2 KI = K + i K2 = K + 2 KMI = MAX0(K-I,L) LL = MiNO(EN,KI+ISH) IF (NOTLAS) GO TO 190
200
7.1-65
170
~********~ ZERO A(K+I,K-I) ********~* IF (K .EQ. L) GO TO 170 AI = A(K,KMI) A2 = A ( K I , K M I ) S = ABS(AI) + ABS(A2) IF (S .EQ. 0 . 0 ) GO TO 70 UI = A I / S U2 = A2 / S R = SIGN(SQRT(UI*UI+U2*U2),UI) vl = - ( U l + R) / R V2 = - U 2 / R U 2 = V2 / VI 180 J = K M I , E N O R N T = A ( K , J ) + U2 * A(K,J) = A(K,J) + A(KI,J) = A(KI,J) T = B ( K , J ) + U2 * B(K,J) = B(K,J) + B(KI,J) = B(KI,J) CONTINUE
DO
180
190
200
A(KI,J) T * VI + T * V2 B(KI,J) T * VI + r * V2
IF (K .NE. L) A ( K I , K M I ) = 0.0 GO TO 2 4 0 ******~*** ZERO A(K+I,K-I) AND A(K+2,K-I) IF (K .EQ. L) GO TO 2 0 0 AI = A ( K , K M I ) A2 = A ( K I , K M I ) A3 = A(K2,KMI) S = ABS(AI) + ABS(A2) + ABS(A3) IF (S ,EQ. 0 . 0 ) GO TO 2 6 0 UI = AI / S U2 = A2 / S U3 = A3 / S R = SIGN(SQRT(UI*UI+U2*U2+U3*U3),UI) Vl = - ( U I + R) / R V2 = - U 2 / R V3 = - U 3 / R U2 = V 2 / VI U3 = V3 / Vl DO
210
210 J = KMI, ENORN r = A ( K , J ) + U2 * A(K,J) = A(K,J) + A(KI,J) = A(KI,J) A(K2,J) = A(K2,J) T = B ( K , J ) + U2 * B(K,J) = B(K,J) + B(KI,J) = B(KI,J) B(K2,J) = B(K2,J) CONTINUE
**********
A(KI,J) + U3 r * VI + T * V2 + T * V3 B ( K I , J ) + U3 T * VI + r * V2 + T * V3
201
* A(K2,J)
* B(K2,J)
7. 1 - 6 6
220
IF (K .EQo L) GO TO 2 2 0 A(KI,KM!) = 0.0 A(K2,KMI) = 0.0 ********** ZERO B(K+2,K+I) AND B(K+2,K) ********** S = ABS(B(K2,K2)) + ABS(B(K2,KI)) + ABS(B(K2,K)) IF (S .EQ. 0 . 0 ) G O TO 2 4 0 UI = B ( K 2 , K 2 ) / S U2 = B ( K 2 , K I ) / S U3 = B ( K 2 , K ) / S R = SIGN(SQRT(UI*UI+U2*U2+U3*U3),UI) v l = - ( u 1 + R) / R V2 = - U 2 / R v3 = -u3 / R U2 = V 2 / V I U3 = V 3 / Vl DO
230
2 3 0 1 = L O R I , LL T = A(I,K2) + U2 * A ( I , K I ) A(I,K2) = A(I,K2) + T * VI A(I,KI) = A(I,KI) + T * V2 A(I,K) = A(I,K) + r * V3 r = B ( I , K 2 ) + U2 * B ( I , K I ) B(!,K2) = B(I,K2) + T * VI B(I,KI) = B(I,KI) + T * V2 B ( I , K ) = B ( I , K ) + T * V3 CONTINUE B(K2,K) = 0.0 B(K2,KI) = 0.0 IF ( . N O T . M A T Z )
GO
TO
+ U3
* A(I,K)
+ U3
* B(I,K)
240
DO
235 240
235 I = I, N T = Z(I,K2) + U2 * Z(I,KI) + Z(I,K2) = Z ( I , K 2 ) + T * V1 Z(I,KI) = Z(I,KI) + r * V2 Z(I,K) = Z(I,K) + r * V3 CONTINUE • ********* ZERO B(K+I,K) ****~***** S = ABS(B(KI,KI)) + ABS(B(KI,K)) IF (S .EQ. 0 . 0 ) G O T O 2 6 0 UI = B ( K I , K I ) / S U2 = B(KI,K) / S R = SIGN(SQRT(UI*UI+U2*U2),UI) v l = - ( u 1 + R) / R V2 = - U 2 / R U2 = V 2 / Vl DO
250 I = L O R I , LL T = A(I,KI) + U2 * A ( I , K ) A(i,KI) = A(I,KI) + T * Vl A(I,K) = A(I,K) + T * V2 T = B ( I , K I ) + U2 * B ( I , K ) B(I,KI) = B(I,KI) + T * VI
202
U3
* Z(I,K)
7.1-67
250
B(I,K) CONTINUE
= B(I,K)
B(KI,K) = 0.0 IF ( . N O T . M A T Z )
+ T
GO
TO
* V2
260
DO
255 260
C C i000 C i001
255 1 = i, N T = Z ( l , K l ) + U2 * Z ( I , K ) Z(I,KI) = Z ( I , K I ) + T * VI Z(I,K) = Z(I,K) + T * V2 CONTINUE
CONTINUE ********** GO TO 70 ********** I E R R = EN ********** IF (N .GT. RETURN END
END
QZ
STEP
SET HAS
E R R O R -- N E I T H E R BECOME NEGLIGIBLE
SAVE EPSB i) B ( N , I )
**********
FOR USE = EPSB
203
BY
BOTTOM AFTER QZVAL
SUBDIAGONAL ELEMENT 50 I T E R A T I O N S ********** AND
QZVEC
**********
7.1-68
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F240-2
PACKAGE
(EISPACK)
QZVAL
A F o r t r a n IV Subroutine to Extract the G e n e r a l i z e d E i g e n v a l u e s of a Real M a t r i x System With One M a t r i x in Q u a s i - U p p e r T r i a n g u l a r Form and the Other in Upper T r i a n g u l a r Form Using and Optionally Accumulating Orthogonal Transformations.
July, January,
1975 1977
i. PURPOSE. The Fortran IV s u b r o u t i n e QZVAL reduces the g e n e r a l i z e d real e i g e n p r o b l e m AX = (LAMBDA)BX, where A is in quasiupper t r i a n g u l a r form and B is in upper triangular form, to an e q u i v a l e n t p r o b l e m with A further reduced and B still in upper t r i a n g u l a r form, using and optionally a c c u m u l a t i n g orthogonal transformations. The reduced A is upper triangular except for possible 2x2 diagonal blocks c o r r e s p o n d i n g to pairs of complex eigenvalues. The subroutine returns q u a n t i t i e s whose ratios give the g e n e r a l i z e d eigenvalues. The reduced forms may then be used to find the g e n e r a l i z e d e i g e n v e c t o r s of this m a t r i x system or of an original real general m a t r i x system from which this system was itself reduced. See section 2C.
2. USAGE. A, Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
QZVAL(NM,N,A,B,ALFR,ALFI,BETA,MATZ,Z)
The p a r a m e t e r s are discussed below and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for various m a c h i n e s is given in the section discussing certification. NM
is an integer input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and B (and Z if MATZ is true) as specified in the D I M E N S I O N statements for A and B (and Z) in the calling program.
204
7.1-69
is an integer input v a r i a b l e set equal the order of the matrices A and B. must he not greater than NM, A
to N
is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least N. On input, A contains a q u a s i - u p p e r triangular matrix, that is, triangular except for possible 2x2 diagonal blocks. Contents of storage locations below the s u b d i a g o n a l are arbitrary. On output, A has been reduced further so that any r e m a i n i n g 2x2 blocks correspond to pairs of complex eigenvalues. See section 3 for the details. is a working p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least N. On input, B contains an upper triangular matrix; contents of storage locations below the diagonal are arbitrary, except for location B(N,I) which should contain a number equal to the product of the p r e c i s i o n of c o m p u t a t i o n and the norm of the matrix; this number has been p r e v i o u s l y stored by QZIT (F239), if used. On output, B still contains an upper triangular m a t r i x a l t h o u g h the elements have changed. B(N,I) is unchanged. See section 3 for the details.
ALFR,ALFI are w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l variables of d i m e n s i o n at least N containing the real and imaginary parts, respectively, of the diagonal elements of A that would result if it were reduced completely to triangular form by u n i t a r y t r a n s f o r m a t i o n s that left the diagonal of B real and non-negative. N o n - z e r o values of ALFI occur in pairs, the first m e m b e r positive and the second negative. BETA
is a working p r e c i s i o n real output oned i m e n s i o n a l variable of d i m e n s i o n at least N c o n t a i n i n g the real n o n - n e g a t i v e diagonal elements of B that w o u l d result if A were reduced completely to triangular form. The generalized elgenvalues are then given by the ratios ((ALFR+I*ALFI)/BETA).
205
7.1-70
MATZ
is a l o g i c a l input v a r i a b l e set true if the (column) t r a n s f o r m a t i o n m a t r i x is to be a c c u m u l a t e d and set false otherwise. is~ if MATZ is true, a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e w i t h row dimension NM and c o l u m n d i m e n s i o n at least N. If A and B are p r i m a r y data, then on input, Z c o n t a i n s the i d e n t i t y m a t r i x of order N. If A and B are r e d u c e d from a real g e n e r a l m a t r i x system, then on input, Z c o n t a i n s the t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the reduction. On output, Z c o n t a i n s the o r t h o g o n a ! (column) t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the r e d u c t i o n s to the c u r r e n t q u a s i - t r i a n g u l a r and t r i a n g u l a r forms of A and B. If MATZ is false, Z is not r e f e r e n c e d and can be a d u m m y (working p r e c i s i o n ) variable.
B. Error
Conditions
and Returns.
None.
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
To d e t e r m i n e all the e i g e n v a l u e s of a real g e n e r a l m a t r i x system, QZVAL should be p r e c e d e d by QZHES (F238) and QZIT (F239) to p r o d u c e s u i t a b l e q u a s i upper t r i a n g u l a r A and u p p e r t r i a n g u l a r B matrices for QZVAL. To d e t e r m i n e all the e i g e n v a l u e s and e i g e n v e e t o r s of a real g e n e r a l m a t r i x system, QZVAL should be p r e c e d e d by QZHES (F238) and QZIT (F239). QZVAL should always be f o l l o w e d by QZVEC (F241).
3. D I S C U S S I O N
OF M E T H O D
AND A L G O R I T H M .
For ixl p r o b l e m s , the d i a g o n a l e l e m e n t of A is t r a n s f e r r e d to ALFR and the d i a g o n a l e l e m e n t of B BETA, w i t h signs r e v e r s e d if n e c e s s a r y in order that be n o n - n e g a t i v e .
to
BETA
For 2x2 p r o b l e m s , the d i a g o n a l e l e m e n t s of B are first tested for n e g l i g i b i l i t y . If the first one is n e g l i g i b l e , then a row r o t a t i o n can be c h o s e n to t r i a n g u l a r i z e the 2x2 minor of A, r e d u c i n g the 2x2 p r o b l e m to two Ixl p r o b l e m s ; if the second one is n e g l i g i b l e , then a c o l u m n r o t a t i o n can be chosen.
206
7.1-71
For n o n - s i n g u l a r
2x2 -I
minors
of
B, an a p p r o x i m a t e
e i g e n v a l u e of AB is first determined from the c h a r a c t e r i s t i c equation. Column and row rotations can then be chosen which employ this a p p r o x i m a t i o n to t r i a n g u l a r i z e the minor of A while m a i n t a i n i n g the t r i a n g u l a r i t y of B, in a stable manner. If the rotations are real, they are actually applied. If the rotations are complex, they are used to compute the diagonal elements of A and B that would result, but are not actually applied. In this case, the imaginary parts of the diagonal elements of A are stored in ALFI (after these elements are n o r m a l i z e d in order that BETA can store the m a g n i t u d e of the resulting diagonal element of B~ and possibly also i n t e r c h a n g e d so that the element with p o s i t i v e ALFI appears first); for real eigenvalues, ALFI is set to zero. By a c c u m u l a t i n g the column t r a n s f o r m a t i o n s in Z, full i n f o r m a t i o n is saved for later use in back t r a n s f o r m i n g the e i g e n v e c t o r s of the reduced system into those of the original system. This subroutine is an i m p l e m e n t a t i o n of the third step QZ a l g o r i t h m w r i t t e n and d i s c u s s e d in detail by Moler Stewart (i).
of the and
4. REFERENCES. I)
Moler, C.B. and Stewart, G.W., An A l g o r i t h m G e n e r a l i z e d M a t r i x E i g e n v a l u e Problems, SlAM J. Numer. Anal. 10,241-256 (1973).
for
5. CHECKOUT. A. Test
Cases.
See the section d i s c u s s i n g testing real g e n e r a l i z e d m a t r i x systems.
of the codes
for
B. Accuracy. The accuracy of QZVAL can best be described in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real g e n e r a l i z e d m a t r i x systems. In these paths, this subroutine is n u m e r i c a l l y stable (I). This stability contributes to the p r o p e r t y of these paths that each computed eigenvalue and its c o r r e s p o n d i n g e i g e n v e c t o r are exact for a system close to the original system.
207
7.1-72
SUBROUTINE
QZVAL(NM,N,A,B,ALFR,ALFI,BETA,MATZ,Z)
INTEGER I,J,N~ENjNA,NM,NN,ISW REAL A(NM,N),B(NM,N),ALFR(N),ALFI(N),BETA(N),Z(NM,N) REAL C,D,E,R,S,T,AN,AI,A2,BN~CQ,CZ,DI,DR,EI,TI,TR,UI,U2, X VI,V2,AII,AII,AI2,A21~A21,A22,BII,BI2,B22,SQI,SQR, X SSI,SSR,SZI,SZR,AII!~AIIR,AI21,AI2R,A221,A22R,EPSB REAL SQRT,ABS,SIGN LOGICAL MATZ EPSB = B(N,I) ISW = 1 ********** FIND EIGENVALUES OF Q U A S I - T R I A N G U L A R MATRICES. F O R E N = N S T E P -i U N T I L 1 DO -- * * * * * * * * * * DO 5 1 0 NN = I, N EN = N + i - N N N A = EN - i IF ( I S W .EQ. 2) GO TO 5 0 5 IF (EN .EQ. i) G O T O 4 1 0 IF ( A ( E N , N A ) .NE. 0 . 0 ) GO TO 4 2 0 ********** I-BY-I BLOCK, ONE REAL ROOT ********** 410 ALFR(EN) = A(EN,EN) IF ( B ( E N , E N ) .LT. 0 . 0 ) A L F R ( E N ) = -ALFR(EN) BETA(EN) = ABS(B(EN,EN)) ALFI(EN) = 0.0 GO TO 5 1 0 ********** 2-BY-2 BLOCK ********** 420 IF ( A B S ( B ( N A , N A ) ) .LE. E P S B ) G O TO 4 5 5 IF ( A B S ( B ( E N , E N ) ) .GT. E P S B ) GO TO 4 3 0 AI = A ( E N , E N ) A2 = A ( E N , N A ) BN = 0 . 0 GO TO 4 3 5 430 AN = ABS(A(NA,NA)) + ABS(A(NA,EN)) + ABS(A(EN,NA)) X + ABS(A(EN,EN)) BN = A B S ( B ( N A , N A ) ) + ABS(B(NA,EN)) + ABS(B(EN,EN)) All = A(NA,NA) / AN AI2 = A(NA,EN) / AN A21 = A(EN,NA) / AN A22 = A(EN,EN) / AN BII = B(NA,NA) / BN BI2 = B(NA,EN) / BN B22 = B(EN,EN) / BN E = All / BII E1 = A 2 2 / B 2 2 S = A 2 1 / (BII * B 2 2 ) T = (A22 - E * B22) / B22 IF ( A B S ( E ) .LE. A B S ( E I ) ) GO TO 431 E = E1 T = (All - E * B I I ) / B I I 431 C = 0.5 * (T - S * B I 2 ) D = C * C + S * (AI2 - E * B I 2 ) IF (D .LT. 0 . 0 ) GO TO 4 8 0
208
7.1-73
**********
432
435
TWO REAL ROOTS. ZERO BOTH A(EN,NA) AND B(EN,NA) ********** E = E + (C + S I G N ( S Q R T ( D ) , C ) ) All = All - E * BII AI2 = AI2 - E * BI2 A22 = A22 - E * B22 IF ( A B S ( A I I ) + A B S ( A I 2 ) .LT. ABS(A21) + ABS(A22)) GO TO 432 A1 = A I 2 A2 = All GO TO 435 A1 = A 2 2 A2 = A 2 1 ********** CHOOSE AND APPLY REAL Z ********** S = ABS(AI) + ABS(A2) UI = A1 / S U2 = A2 / S R = SIGN(SQRT(UI*UI+U2*U2),UI) Vl = - ( U l + R) / R V2 = -U2 / R U2 = V2 / VI DO
440
4 4 0 1 = i, EN T = A ( I , E N ) + U2 * A ( I , N A ) A(I,EN) = A ( I , E N ) + T * VI A(I,NA) = A(I,NA) + r * V2 T = B ( I , E N ) + U2 * B ( I , N A ) B ( I , E N ) = B ( I , E N ) + T * VI B(I,NA) = B ( I , N A ) + T * V2 CONTINUE IF
(.NOT.
MATZ)
GO
TO
450
DO
445 450
455
460
445 1 = I, N T = Z ( I , E N ) + U2 * Z ( I , N A ) Z(I,EN) = Z ( I , E N ) + T * VI Z ( I , N A ) = Z ( I , N A ) + T * V2 CONTINUE
IF (BN .EQ. 0 . 0 ) G O TO 475 IF (AN .LT. A B S ( E ) * BN) GO TO 455 AI = B ( N A , N A ) A2 -- B ( E N , N A ) GO TO 4 6 0 A1 = A ( N A , N A ) A2 = A ( E N , N A ) • ********* CHOOSE AND APPLY REAL Q *~******** S = ABS(AI) + ABS(A2) IF (S .EQ. 0 . 0 ) G O TO 475 UI = A1 / S U2 = A2 / S R = SIGN(SQRT(UI*UI+U2*U2),UI) vl -- - ( u l + R) / R V2 = - U 2 / R U2 = V2 / VI
209
7.1-74
DO
470 475
470 J = NA, N T = A(NA,J) + U2 * A(EN,J) A(NA,J) = A(NA,J) + T * V1 A(EN,J) = A(EN,J) + T * V2 T = B(NA,J) + U2 * B(EN,J) B(NA,J) = B(NA,J) + T * V1 B(EN,J) = B(EN,J) + T * V2 CONTINUE
A(EN,NA) B(EN,NA) ALFR(NA)
= 0.0 = 0.0 = A(NA,NA)
ALFR(EN)
=
A(EN,EN)
IF ( B ( N A , N A ) .LT. 0 . 0 ) A L F R ( N A ) = -ALFR(NA) IF ( B ( E N , E N ) .LT. 0 . 0 ) A L F R ( E N ) = -ALFR(EN) BETA(NA) = ABS(B(NA,NA)) BETA(EN) = ABS(B(EN,EN)) A L F I (EN) = 0 , 0 ALFI(NA) = 0.0 GO TO 505 ********** TWO COMPLEX ROOTS ********** E = E + C 480 E1 = SQRT(-D) AIIR = All - E * BII AIII = E1 * BII AI2R = AI2 - E * BI2 AI21 = E1 * BI2 A22R = A22 - E * B22 A221 = E1 * B22 IF ( A B S ( A I I R ) + ABS(AIII) + ABS(AI2R) + ABS(AI21) ABS(A21) + ABS(A22R) + ABS(A221)) GO TO 482 A1 = AI2R All = AI21 A2 = -AIIR A21 = -AIII GO TO 485 AI = A22R 482 All = A221 A2 = -A2! A21 = 0.0 ********** CHOOSE COMPLEX Z ********** CZ = S Q R T ( A I * A I + A I I * A I I ) 485 IF (CZ .EQ. 0 . 0 ) G O T O 4 8 7 S Z R = (AI * A 2 + A I I * A2I) / CZ S Z I = (AI * A 2 I - A I I * A2) / CZ R = SQRT(CZ*CZ+SZR*SZR+SZI*SZI) CZ = CZ / R SZR = SZR / R SZl = SZI / R GO TO 490 SZR = 1.0 487 SZI = 0.0
210
.L3
7,1-75
490
492
495
497
500
502
503
.505
510
IF (AN .LT, (ABS(E) + El) * BN) GO TO 492 AI = CZ * BII + SZR * BI2 All = SZI * BI2 A2 = SZR * B22 A21 = SZI * B22 GO TO 495 AI = CZ * All + SZR * AI2 All = SZI * AI2 A2 = CZ * A21 + SZR * A22 A21 = SZI * A22 • ********* CHOOSE COMPLEX Q ********** CQ = SQRT(AI*AI+AII*AII) IF (CQ .EQ. 0.0) GO TO 497 SQR = (AI * A2 + All * A21) / CQ SQI = (AI * A21 - All * A2) / CQ R = SQRT(CQ*CQ+SQR*SQR+SQI*SQI) CQ = CQ / R SQR = SQR / R SQI = SQI / R GO TO 500 SQR = 1,0 SQI = 0.0 • ********* COMPUTE DIAGONAL ELEMENTS THAT WOULD RESULT IF T R A N S F O R M A T I O N S WERE APPLIED ********** SSR = SQR * SZR + SQI * SZI SSI = SQR * SZI - SQI * SZR I = 1 TR = CQ * CZ * All + CQ * SZR * AI2 + SQR * CZ * A21 X + SSR * A22 TI = CQ * SZI * AI2 - SQI * cz * A21 + SSI * A22 DR = CQ * CZ * Ell + CQ * SZR * BI2 + SSR * B22 DI = CQ * SZI * BI2 + SSI * B22 GO TO 503 I = 2 TR = SSR * All - SQR * CZ * AI2 - CQ * SZR * A21 X + CQ * CZ * A22 TI = -SSI * All - SQI * CZ * AI2 + CQ * SZI * A21 DR = SSR * BII - SQR * CZ * BI2 + CQ * CZ * B22 DI = -SSI * BII - SQI * CZ * BI2 T = TI * DR - TR * DI J = NA I F (T . L T . 0 . 0 ) J = E N R = SQRT(DR*DR+DI*DI) BETA(J) = BN * R ALFR(J) = AN * (TR * DR + TI * DI) / R ALFI(J) = AN * T / R I F (I . E Q . I) G O T O 5 0 2 ISW
=
3
-
TSW
CONTINUE
RETURN END
211
7. 1-76
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F241
PACKAGE
(EISPACK)
QZVEC
A F o r t r a n IV S u b r o u t i n e to D e t e r m i n e the G e n e r a l i z e d E i g e n v e c t o r s of a Real M a t r i x S y s t e m W i t h One M a t r i x in Q u a s i - U p p e r T r i a n g u l a r F o r m and the Other in Upper Triangular Form Using Back Substitution.
July,
1975
i. PURPOSE. The F o r t r a n IV s u b r o u t i n e QZVEC d e t e r m i n e s the e i g e n v e c t o r s c o r r e s p o n d i n g to a set of s p e c i f i e d e i g e n v a l u e s for the g e n e r a l i z e d real e i g e n p r o b l e m AX = (LAMBDA)BX, w h e r e A is in q u a s i - u p p e r t r i a n g u l a r form and B is in u p p e r t r i a n g u l a r form, using b a c k s u b s t i t u t i o n . Q u a s i - t r i a n g u l a r , in this case, m e a n s t r i a n g u l a r e x c e p t for p o s s i b l e 2x2 diagonal blocks c o r r e s p o n d i n g to pairs of c o m p l e x e i g e n v a l u e s . The e i g e n v e c t o r s of a real g e n e r a l m a t r i x s y s t e m can also be c o m p u t e d if QZHES (F238), QZIT (F239), and Q Z V A L (F240) have been used to r e d u c e the m a t r i c e s of the s y s t e m to q u a s i t r i a n g u l a r and t r i a n g u l a r f o r m and to a c c u m u l a t e the transformations.
2.
USAGE. A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
QZVEC(NM,N,A,B,ALFR,ALFI,BETA,Z)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is given in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A, B, and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A~ B, and Z in the c a l l i n g program. is an i n t e g e r input v a r i a b l e set equal to the order of the m a t r i c e s A and B. N m u s t be not g r e a t e r than NM.
212
7.1-77
A
is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l input v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at least N containing a q u a s i - u p p e r t r i a n g u l a r matrix, that is, t r i a n g u l a r e x c e p t for p o s s i b l e 2x2 d i a g o n a l blocks c o r r e s p o n d i n g to pairs of complex eigenvalues. C o n t e n t s of s t o r a g e l o c a t i o n s b e l o w the s u b d i a g o n a l are arbitrary, is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and column d i m e n s i o n at least N. On input, B contains an upper t r i a n g u l a r matrix; contents of storage locations b e l o w the d i a g o n a l are a r b i t r a r y , except for l o c a t i o n B(N,I) w h i c h should c o n t a i n a n u m b e r equal to the p r o d u c t of the p r e c i s i o n of c o m p u t a t i o n and the n o r m of the matrix; this number has been p r e v i o u s l y saved by QZVAL (F240). On output, B has been d e s t r o y e d .
ALFR,ALFI are w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e s of d i m e n s i o n at least N c o n t a i n i n g the real and i m a g i n a r y parts, r e s p e c t i v e l y , of the n u m e r a t o r s of the g e n e r a l i z e d eigenvalues. BETA
is a w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N c o n t a i n i n g the d e n o m i n a t o r s of the g e n e r a l i z e d e i g e n v a l u e s , which are thus given by the ratios ((ALFR+I*ALFI)/BETA). is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and c o l u m n d i m e n s i o n at least N. If A and B are p r i m a r y data, then on input, Z contains the i d e n t i t y m a t r i x of order N, and on output, contains the real and i m a g i n a r y parts of the e i g e n v e c t o r s of this system. If A and B are r e d u c e d from a real g e n e r a l m a t r i x system, then on input, Z contains the t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the r e d u c t i o n , and on output, c o n t a i n s the real and i m a g i n a r y parts of the e i g e n v e c t o r s of the real g e n e r a l m a t r i x system. If the J-th e i g e n v a l u e is real, the J-th column of Z c o n t a i n s its eigenvector. If the J-th and (J+l)-th e i g e n v a l u e s form a c o m p l e x pair, the J-th and (J+l)-th columns of Z c o n t a i n the real and i m a g i n a r y parts of the e i g e n v e c t o r
213
7.1-78
a s s o c i a t e d with the first e i g e n v a l u e of the pair. The c o n j u g a t e of this vector is the e i g e n v e e t o r for the c o n j u g a t e eigenvalue. Each e i g e n v e c t o r is n o r m a l i z e d so that the m o d u l u s of its largest component is 1.0 .
B. Error
Conditions
and Returns°
None.
C.
Applicability
and R e s t r i c t i o n s .
To d e t e r m i n e all the e i g e n v a l u e s and e i g e n v e c t o r s of a real g e n e r a l m a t r i x system, QZVEC should be preceded by QZHES (F238), QZIT (F239), and QZVAL (F240) to d e t e r m i n e the e i g e n v a l u e s and a c c u m u l a t e the transformations.
3. D I S C U S S I O N
OF M E T H O D
AND ALGORITHM.
The e i g e n v e c t o r s of the system are d e t e r m i n e d by a back s u b s t i t u t i o n process, then t r a n s f o r m e d to the e i g e n v e c t o r s of the o r i g i n a l m a t r i x s y s t e m using the i n f o r m a t i o n in Z~ and finally normalized. This s u b r o u t i n e is an i m p l e m e n t a t i o n of the fourth the QZ a l g o r i t h m w r i t t e n and d i s c u s s e d in detail and Stewart (I).
step of by Moler
4, REFERENCES° i)
Moler~ C.B. and Stewart, G.W., An A l g o r i t h m G e n e r a l i z e d M a t r i x E i g e n v a l u e Problems, SlAM J. Numer. Anal. 10,241-256 (1973).
for
5. CHECKOUT. A° Test
Cases.
See the section d i s c u s s i n g testing real g e n e r a l i z e d m a t r i x systems.
214
of the
codes
for
7,1-79
B. A c c u r a c y . T h e a c c u r a c y of QZVEC can b e s t be d e s c r i b e d in t e r m s of its r o l e in t h o s e p a t h s of EISPACK which find e i g e n v a l u e s and e i g e n v e e t o r s of real g e n e r a l i z e d m a t r i x systems. In t h e s e p a t h s , this s u b r o u t i n e is n u m e r i c a l l y s t a b l e (i). This s t a b i l i t y c o n t r i b u t e s to the p r o p e r t y of t h e s e p a t h s that each c o m p u t e d e i g e n v a l u e and its c o r r e s p o n d i n g e i g e n v e c t o r are e x a c t for a s y s t e m c l o s e to the o r i g i n a l s y s t e m .
215
7.1-80
SUBROUTINE
QZVEC(NM,N,A,B,ALFR~ALFI,BETA,
Z)
INTEGER I~J,K,M,N~EN, II,JJ,NA,NM,NN,ISW,ENM2 REAL A(NM,N),B(NM,N),ALFR(N),ALFI(N),BETA(N),Z(NM,N) REAL D,Q,R,S,T~W,X,Y,DI,DR,RA,RR, SA,TI,TR,TI,T2,WI,XI,ZZ,ZI, X ALFM,ALMI,ALMR,BETM,EPSB REAL SQRT,ABS EPSB = B(N,I) ISW = I ********** FOR EN=N STEP -i UNTIL i DO -- ********** D O 8 0 0 N N = I, N EN = N + i - NN NA = EN - I IF ( I S W . E Q . 2) G O T O 7 9 5 IF (ALFI(EN) .NE. 0.0) GO TO 710 ********** REAL VECTOR ********** M = EN B(EN,EN) = 1.0 I F ( N A . E Q . O) G O T O 8 0 0 ALFM = ALFR(M) BETM = BETA(M) ********** FOR I=EN-I STEP -I UNTIL 1 DO -- ********** D O 7 0 0 I I = i, N A I = EN II W = BETM * A(I,I) - ALFM * B(I,I) R=0.0
610
630
640
650 690
DO 610 J = M, R = R + (BETM
EN * A(I,J)
- ALFM
*
B(I,J))
I F (I . E Q . I . O R . I S W . E Q . 2) G O T O 6 3 0 IF (BETM * A(I,I-I) .EQ. 0.0) GO TO 630 ZZ = W S = R GO TO 690 M = I I F ( I S W . E Q . 2) G O T O 6 4 0 ********** REAL I-BY-I BLOCK ********** T = W I F (W .EQ. 0 . 0 ) T = E P S B B(I,EN) = -R / r GO TO 700 ********** REAL 2-BY-2 BLOCK ********** X = BETM * A(I,I+I) - ALFM * B(I,I+I) Y = BETM * A(I+I,I) Q = W* ZZ - X * Y T = (X * S - Z Z * R ) / q B(I,EN) = T IF (ABS(X) .LE. ABS(ZZ)) GO TO 650 B(I+I,EN) = ( - R - W * T) / X GO TO 690 B(I+I,EN) = ( - S - Y * T) / Z Z ISW = 3 - ISW
216
*
B(J,EN)
7.1-81
700
710
CONTINUE ********** END REAL VECTOR ********** GO TO 800 *********~ COMPLEX VECTOR ********** M = NA ALMR = ALFR(M) ALMI = ALFI(M) BETM = BETA(M) ********** LAST VECTOR COMPONENT CHOSEN IMAGINARY SO THAT EIGENVECTOR MATRIX IS T R I A N G U L A R ********** Y = BETM * A(EN,NA) B(NA,NA) = -ALMI * B(EN,EN) / Y B(NA,EN) = (ALMR * B(EN,EN) - BETM * A(EN,EN)) / Y B(EN,NA) = 0.0 B(EN,EN) = 1.0 E N M 2 = NA i IF (ENM2 . E Q . O) G O T O 7 9 5 ********** FOR I=EN-2 STEP -I UNTIL 1 DO -- ********** D O 7 9 0 I I = I, E N M 2 I = NA II W = BETM * A(I,I) - ALMR * B(I,I) W1 = -ALMI * B(I,I) RA = 0.0 SA = 0.0 DO
760
770
773
775
760 J = M, EN X = BETM * A(I,J) - ALMR * XI = -ALMI * B(I,J) RA = RA + X * B(J,NA) - XI SA = SA + X * B(J,EN) + Xl CONTINUE
B(I,J) * B(J,EN) * B(J,NA)
I F (I .EQ. i .OR. I S W .EQ. 2) G O T O 7 7 0 IF ( B E T M * A ( I , I - I ) .EQ. 0.0) GO TO 770 ZZ = W Z1 = W I R = RA S = SA ISW = 2 GO TO 790 M = I I F ( I S W . E Q . 2) G O T O 7 8 0 • ********~ COMPLEX I-BY-1 BLOCK ********** TR = -RA TI = -SA DR = W DI = W1 • ********* COMPLEX DIVIDE (TI,T2) = (TR,TI) / IF (ABS(D!) .GT. ABS(DR)) GO TO 777 RR = DI / DR D = DR + DI * RR TI = (TR + TI * RR) / D T2 = (Ti - TR * RR) / D GO TO (787,782), ISW
217
(DR,DI)
**********
7.1-82
777
C 780
782
785 787 790 C 795 800 C C C
RR = DR / D! D = DR * RR + DI TI = (TR * RR + TI) / D T2 = (TI * RR - TR) / D GO TO (787,782), ISW ********** COMPLEX 2-BY-2 BLOCK ********** X = BETM * A(I,!+I) - ALMR * B(I,I+I) Xl = -ALMI * B(I,I+I) Y = BETM * A(I+I,I) TR = Y * RA - W * R + W1 * S T ! = Y * SA - W * S - W I * R D R = W * ZZ WI * El - X * Y DI = W * ZI + WI * ZZ - XI * Y I F ( D R . E Q . 0 . 0 . A N D . D I .EQ. 0 . 0 ) D R = E P S B GO TO 775 B(I+I,NA) = T1 B(I+I~EN) = T2 !SW = 1 IF (ABS(Y) .GT. ABS(W) + ABS(WI)) GO TO 785 TR = -RA - X * B(I+I,NA) + X1 * B(I+I,EN) TI = -SA - X * B(I+I,EN) - XI * B(I+I,NA) GO TO 773 TI = (-R - ZZ * B(I+I,NA) + Z1 * B ( I + I , E N ) ) / Y T2 = (-S - ZZ * B(I+I,EN) - ZI * B(I+I,NA)) / Y B(i,NA) = TI B(I,EN) = T2 CONTINUE ********** END COMPLEX VECTOR ********** ISW = 3 - ISW CONTINUE ********** END BACK SUBSTITUTION. TRANSFORM TO ORIGINAL COORDINATE SYSTEM. FOR J=N STEP -I UNTIL i DO -- ********** D O 8 8 0 J J = I, N J = N + 1 - JJ
C DO
880
I =
!,
N
0.0
ZZ
=
DO ZZ
8 6 0 K = I, J = ZZ + Z(I,K)
C 860
*
B(K,J)
C 880 C C C
Z(I,J) = ZZ CONTINUE ********** NORMALIZE SO THAT MODULUS COMPONENT OF EACH VECTOR ( I S W IS I I N I T I A L L Y FROM D O 9 5 0 J = I, N D=0.0 I F ( I S W o E Q . 2) G O T O 9 2 0 IF (ALPI(J) .NE. 0.0) GO TO 945
218
OF LARGEST IS i. BEFORE) **********
7.1-83
DO
8 9 0 1 = I, N IF ( A B S ( Z ( I , J ) ) CONTINUE
890
DO
900
GO
TO
1 =
I,
D)
X
/ D
950
9 3 0 1 = I, N R = ABS(Z(I,J-I)) + ABS(Z(I,J)) IF (R .NE. 0.0) R = R * S Q R T ( ( Z ( I , J - I ) / R ) * * 2 +(Z(I,J)/R)**2) IF (R .GT. D) D = R CONTINUE
DO
940 945 950
D = ABS(Z(I,J))
N
= z(I,J)
DO
920
930
900
z(I,J)
.GT.
9 4 0 1 = I, N Z(I,J-1) = Z(I,J-1) Z(I,J) = Z(l,J) / D CONTINUE
/ D
ISW = 3 - ISW CONTINUE RETURN END
219
7.1-84
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F225
PACKAGE
(EISPACK)
REBAK
A F o r t r a n IV S u b r o u t i n e to B a c k T r a n s f o r m the E i g e n v e c t o r s of that D e r i v e d S y m m e t r i c M a t r i x D e t e r m i n e d by REDUC or REDUC2.
July,
1975
I. P U R P O S E . The F o r t r a n IV s u b r o u t i n e REBAK f o r m s the e i g e n v e c t o r s of a g e n e r a l i z e d s y m m e t r i c e i g e n s y s t e m f r o m the e i g e n v e c t o r s of that d e r i v e d s y m m e t r i c m a t r i x d e t e r m i n e d by R E D U C (F224) or R E D U C 2 (F230),
2o U S A G E . A.
Calling The
Sequence°
SUBROUTINE SUBROUTINE
statement
is
REBAK(NM,N,B,DL,M,Z)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays B and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for B and Z in the calling program.
N
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the o r d e r of the m a t r i x s y s t e m . N m u s t be not g r e a t e r t h a n NM. is a w o r k i n g p r e c i s i o n r e a l i n p u t twodimensional variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N, The s t r i c t l o w e r t r i a n g l e of B contains some i n f o r m a t i o n a b o u t the t r a n s f o r m a t i o n ( C h o l e s k y d e c o m p o s i t i o n ) u s e d in the r e d u c t i o n to the s t a n d a r d form. The r e m a i n i n g u p p e r p a r t of the m a t r i x is arbitrary. See s e c t i o n 3 of F224 or of F 2 3 0 , as a p p r o p r i a t e , for the d e t a i l s .
220
7.1-85
DL
is a w o r k i n g p r e c i s i o n r e a l i n p u t o n e dimensional v a r i a b l e of d i m e n s i o n at l e a s t N containing the r e m a i n i n g information a b o u t the t r a n s f o r m a t i o n .
M
is an i n t e g e r the n u m b e r of transformed.
input variable c o l u m n s of Z
set e q u a l to to be b a c k
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and column d i m e n s i o n at l e a s t M. On i n p u t , the f i r s t M c o l u m n s of Z c o n t a i n the e i g e n v e c t o r s to be b a c k t r a n s f o r m e d . On o u t p u t , t h e s e c o l u m n s of Z c o n t a i n the t r a n s f o r m e d eigenvectors.
B.
Error
Conditions
and
Returns.
None.
C.
Applicability
and
Restrictions.
This subroutine s h o u l d be subroutine R E D U C (F224)
3. D I S C U S S I O N
OF M E T H O D
AND
u s e d in c o n j u n c t i o n with or w i t h R E D U C 2 (F230).
the
ALGORITHM.
S u p p o s e that the GX = (LAMBDA)FX
generalized symmetric eigensystem (say) has b e e n r e d u c e d to t h e s t a n d a r d f o r m -i -T AZ = ( L A M B D A ) Z by the t r a n s f o r m a t i o n A = L GL or that the s y s t e m GFX = (LAMBDA)X h a s b e e n r e d u c e d to the T s t a n d a r d f o r m by the t r a n s f o r m a t i o n A = L GL, w h e r e L is a C h o l e s k y f a c t o r of F e n c o d e d in DL a n d in the s t r i c t l o w e r t r i a n g l e of B. T h e n , g i v e n an a r r a y Z of c o l u m n -T vectors, REBAK c o m p u t e s the m a t r i x p r o d u c t L Z. If the eigenvectors of A a r e c o l u m n s of the a r r a y Z, then REBAK f o r m s the e i g e n v e c t o r s of the g e n e r a l i z e d s y s t e m in t h e i r place,
If the
the
input
output
vectors
vectors
This subroutine REBAKA written Wilkinson (I).
are
normalized so T satisfy X FX = i.
that
T Z Z =
i,
is a t r a n s l a t i o n of the A l g o l p r o c e d u r e and d i s c u s s e d in d e t a i l by M a r t i n a n d
221
then
7.1-86
4, REFERENCES.
l)
Martin, R.S, and Wilkinson, J.H., R e d u c t i o n of the S y m m e t r i c E i g e n p r o b l e m Ax = (Lambda)Bx and Related Problems to Standard Form, Num. Math. 11,99-110 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n II/i0, 303-314, S p r i n g e r - V e r l a g , 1971.)
5. CHECKOUT. A. Test
Cases,
See the section d i s c u s s i n g real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B, Accuracy. The a c c u r a c y of REBAK can best be d e s c r i b e d in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real s y m m e t r i c g e n e r a l i z e d m a t r i x systems° In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (i), This s t a b i l i t y c o n t r i b u t e s to the p r o p e r t y of these paths that the computed e i g e n v a l u e s are the exact e i g e n v a l u e s of a system close to the o r i g i n a l system and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
222
7.1-87
SUBROUTINE
REBAK(NM,N,B,DL,M,Z)
C INTEGER I,J,K,M,N, II,II,NM R E A L B (NM, N), DL (N), Z ( N M , M ) REAL X C IF
(M
.EQ.
0)
GO
TO
200
C D O I 0 0 J = I, M ********** F O R I = N S T E P -I U N T I L D O I 0 0 II = i, N I = N + 1 - II Ii = I + I X = Z(I,J) IF (I .EQ. N) GO TO 80
C
C DO 60 K = I I , N X = X - B(K,I) * Z(K,J)
60 C 80 I00
Z(I,J) CONTINUE
200
RETURN END
= X
/ DL(1)
C
223
I DO
--
**********
7.1-88
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F231
A Fortran of that
PACKAGE
(EISPACK)
REBAKB
IV S u b r o u t i n e to B a c k T r a n s f o r m the E i g e n v e c t o r s D e r i v e d S y m m e t r i c M a t r i x D e t e r m i n e d by REDUC2.
July,
1975
i. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e REBAKB f o r m s the e i g e n v e c t o r s of a g e n e r a l i z e d s y m m e t r i c e i g e n s y s t e m f r o m the e i g e n v e c t o r s of that d e r i v e d s y m m e t r i c m a t r i x d e t e r m i n e d by R E D U C 2 (F230).
2o U S A G E , A.
Calling The
Sequence,
SUBROUTINE SUBROUTINE
statement
is
REBAKB(NM,N,B,DL,M,Z)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the interpretation of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays B and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for B and Z in the calling program. is an i n t e g e r i n p u t v a r i a b l e set the o r d e r of the m a t r i x system. not g r e a t e r t h a n NM.
e q u a l to N m u s t be
is a w o r k i n g p r e c i s i o n r e a l i n p u t twodimensional variable with row dimension NM a n d c o l u m n d i m e n s i o n at l e a s t N. The s t r i c t l o w e r t r i a n g l e of B contains some i n f o r m a t i o n a b o u t the t r a n s f o r m a t i o n ( C h o l e s k y d e c o m p o s i t i o n ) u s e d in the r e d u c t i o n to the s t a n d a r d form. The r e m a i n i n g u p p e r p a r t of the m a t r i x is arbitrary. See s e c t i o n 3 of F230 for the details.
224
7.1-89
DL
is a w o r k i n g p r e c i s i o n r e a l i n p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the r e m a i n i n g i n f o r m a t i o n a b o u t the t r a n s f o r m a t i o n . is an i n t e g e r i n p u t v a r i a b l e the n u m b e r of c o l u m n s of Z transformed.
set e q u a l to to be b a c k
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t M. On input, the f i r s t M c o l u m n s of Z c o n t a i n the e i g e n v e c t o r s to be b a c k t r a n s f o r m e d . On o u t p u t , t h e s e c o l u m n s of Z c o n t a i n the t r a n s f o r m e d elgenvectors.
B.
Error
Conditions
and R e t u r n s .
None.
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
T h i s s u b r o u t i n e s h o u l d be used subroutine R E D U C 2 (F230).
3. D I S C U S S I O N
OF M E T H O D
in c o n j u n c t i o n
with
the
AND A L G O R I T H M .
S u p p o s e that the g e n e r a l i z e d s y m m e t r i c e i g e n s y s t e m FGX = (LAMBDA)X (say) has b e e n r e d u c e d to the s t a n d a r d f o r m T AZ = ( L A M B D A ) Z by the t r a n s f o r m a t i o n A = L GL where L is a C h o l e s k y f a c t o r of F e n c o d e d in DL and in the s t r i c t l o w e r t r i a n g l e of B. Then, g i v e n an a r r a y Z of c o l u m n vectors, REBAKB c o m p u t e s the m a t r i x p r o d u c t LZ. If the e i g e n v e c t o r s of A are c o l u m n s of the a r r a y Z, then REBAKB f o r m s the e i g e n v e c t o r s of the g e n e r a l i z e d s y s t e m in t h e i r place.
If
the
input
the o u t p u t
vectors
vectors
This subroutine REBAKB written W i l k i n s o n (I).
are n o r m a l i z e d so that T -i satisfy X F X = I.
T Z Z = I,
then
is a t r a n s l a t i o n of the A l g o l p r o c e d u r e and d i s c u s s e d in d e t a i l by M a r t i n and
225
7.1-90
4,
REFERENCES.
I)
Martin, R.S. and W i l k i n s o n , J.H.~ R e d u c t i o n of the Symmetric E i g e n p r o b l e m Ax = (Lambda)Bx and R e l a t e d Problems to Standard Form, Num, Math. 11,99-110 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c C o m p u t a t i o n , V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n II/I0, 303-314, S p r i n g e r - V e r l a g , 1971.)
5. CHECKOUT. A. Test
Cases.
See the section d i s c u s s i n g real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B. Accuracy, The accuracy of REBAKB can best be d e s c r i b e d in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real symmetric g e n e r a l i z e d m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (i). This stability c o n t r i b u t e s to the p r o p e r t y of these paths that the computed e i g e n v a i u e s are the exact e i g e n v a l u e s of a system close to the original s y s t e m and the computed e i g e n v e c t o r s are close (hut not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
226
7.1-91
SUBROUTINE
REBAKB
(NM, N, B, DL, M, Z)
C INTEGER I , J , K , M , N , II, I I , N M R E A L B (NM, N), D L (N), Z ( N M , M ) REAL X C IF
(M
.EQ.
0)
GO
TO
200
C D O I 0 0 J = i, M ********** F O R I = N S T E P -i U N T I L D O i 0 0 II = I, N Ii = N - II I = II + I X = DE(l) * Z(I,J) IF (I .EQ. i) G O T O 80
C
C D O 60 K = I, Ii X = X + B(I,K,) * Z ( K , J )
60 C 80 I00
Z(I,J) CONTINUE
200
RETURN END
= X
C
227
1 DO
--
***~******
7.1-92
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F224
PACKAGE
(EISPACK)
REDUC
A F o r t r a n IV S u b r o u t i n e to R e d u c e a C e r t a i n G e n e r a l i z e d S y m m e t r i c E i g e n p r o b l e m to the S t a n d a r d S y m m e t r i c Eigenproblem Using Cholesky Decomposition.
July,
1975
I. PURPOSE. The F o r t r a n IV s u b r o u t i n e REDUC r e d u c e s the g e n e r a l i z e d symmetric eigenproblem AX = (LAMBDA)BX, w h e r e B is p o s i t i v e d e f i n i t e , to the s t a n d a r d s y m m e t r i c e i g e n p r o b l e m u s i n g the C h o l e s k y f a c t o r i z a t i o n of B. This r e d u c e d form is used by other s u b r o u t i n e s to find the e i g e n v a l u e s a n d / o r e i g e n v e c t o r s of the o r i g i n a l m a t r i x system. See s e c t i o n 2C for the s p e c i f i c routines.
2.
USAGE. A. C a l l i n g The
Sequence°
SUBROUTINE SUBROUTINE
statement
is
REDUC(NM,N,A,B,DL,IERR)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is given in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and B as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and E in the c a l l i n g program. is an i n t e g e r input v a r i a b l e set equal to the order of the m a t r i c e s A and B. If the C h o l e s k y factor L of B is a l r e a d y available, N should be p r e f i x e d w i t h a minus sign. ABS(N) m u s t be not g r e a t e r than NM.
228
7.1-93
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at l e a s t N. O n input, A c o n t a i n s o n e of the s y m m e t r i c m a t r i c e s of order N that d e f i n e the e i g e n p r o b l e m AX = (LAMBDA)BX. O n l y the f u l l u p p e r t r i a n g l e of the m a t r i x n e e d be s u p p l i e d . On o u t p u t , the f u l l l o w e r t r i a n g l e of A c o n t a i n s the full l o w e r t r i a n g l e of the s y m m e t r i c m a t r i x d e r i v e d f r o m the r e d u c t i o n to the s t a n d a r d form. The strict upper t r i a n g l e of A is u n a l t e r e d . See s e c t i o n 3 for the d e t a i l s .
A
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input, B c o n t a i n s the p o s i t i v e d e f i n i t e s y m m e t r i c m a t r i x of o r d e r N in the s y s t e m . O n l y the full u p p e r t r i a n g l e of the m a t r i x n e e d b e supplied. A l t e r n a t i v e l y if N is n e g a t i v e , the s t r i c t l o w e r t r i a n g l e of B contains the s t r i c t l o w e r t r i a n g l e of its C h o l e s k y factor L. In this case, the f u l l u p p e r t r i a n g l e of the m a t r i x is a r b i t r a r y . On o u t p u t , the s t r i c t l o w e r t r i a n g l e of B c o n t a i n s the s t r i c t l o w e r t r i a n g l e of its Cholesky factor L. The full upper triangle of B is u n a l t e r e d . See s e c t i o n 3 for the details.
B. E r r o r
DL
is a w o r k i n g p r e c i s i o n real o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N. On input, if N is n e g a t i v e ~ DL c o n t a i n s the d i a g o n a l e l e m e n t s of the C h o l e s k y f a c t o r L of B. On o u t p u t ~ DL c o n t a i n s the d i a g o n a l e l e m e n t s of the C h o l e s k y f a c t o r L of B.
IERR
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n code zero.
Conditions
B
is
and R e t u r n s .
If the m a t r i x B is n o t p o s i t i v e d e f i n i t e , REDUC terminates with IERR set to 7*N+I. In this case, C h o l e s k y f a c t o r i z a t i o n of B does n o t exist. If
to
is p o s i t i v e
definite,
229
IERR
is set
to zero.
the
7.1-94
C. A p p l i c a b i l i t y
and Restrictions.
If all the e i g e n v a l u e s of the original matrix system are desired, this s u b r o u t i n e should be followed by TREDI (F277), and then by TQLI (F289), IMTQLI (F291), or TQLRAT (F235). If all the e i g e n v a l u e s and e i g e n v e c t o r s of the original m a t r i x system are desired, this s u b r o u t i n e should be followed by TRED2 (F278), then by TQL2 (F290) or IMTQL2 (F292), and finally by REBAK (F225). If some of the e i g e n v a l u e s of the original m a t r i x system are desired, this s u b r o u t i n e should be followed by TREDI (F277), and then by BISECT (F294) or TRIDiB (F237). If some of the e i g e n v a l u e s and e i g e n v e c t o r s of the original m a t r i x system are desired, this s u b r o u t i n e should be followed by TREDI (F277), then by TSTURM (F293), or by BISECT (F294) and TINVIT (F223), or by TRIDIB (F237) and TINVIT, or by IMTQLV (F234) and TINVIT, then by TRBAKI (F279), and finally by REBAK (F225).
3. D I S C U S S I O N
OF M E T H O D
AND ALGORITHM.
T The C h o l e s k y d e c o m p o s i t i o n of B into LL where L is lower triangular is first performed. If L is p r e v i o u s l y known, it may be p r o v i d e d as input (see section 2A) and this step skipped. If B is not p o s i t i v e definite, IERR will be set in the course of this step and an i m m e d i a t e error return made. -i -T Next, the c o m p o s i t i o n L AL is performed, r e s u l t i n g in a symmetric m a t r i x with the same e i g e n v a l u e s as the original m a t r i x system and with e i g e n v e c t o r s w h i c h can be t r a n s f o r m e d by s u b r o u t i n e R E B A K (F225) into those of the original system. This s u b r o u t i n e REDUCI written W i l k i n s o n (I).
is a t r a n s l a t i o n of the Algol p r o c e d u r e and discussed in detail by M a r t i n and
230
7 .i-95
4. REFERENCES. I)
Martin, R.S. and Wilkinson, J.H., R e d u c t i o n of the Symmetric E i g e n p r o b l e m Ax = (Lambda)Bx and Related Problems to Standard Form, Num. Math. 11,99-110 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C, Reinsch, C o n t r i b u t i o n II/I0, 303-314, Springer-Verlag, 1971.)
5. CHECKOUT. A. Test
Cases.
See the section discussing real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B. Accuracy. The accuracy of REDUC can best be d e s c r i b e d in terms of its role in those paths of EISPACK which find eigenvalues and e i g e n v e c t o r s of real symmetric g e n e r a l i z e d matrix systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (I). This s t a b i l i t y contributes to the property of these paths that the computed eigenvalues are the exact e i g e n v a l u e s of a system close to the original system and the computed e l g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
7.1-96
SUBROUTINE
REDUC(NM,N,A,B,DL,iERR)
INTEGER I,J~K,N,iI,JI,NM,NNslERR REAL A(NM,N),B(NM,N),DL(N) REAL X,Y REAL SQRT INTEGER IABS IERR = 0 N N = l A B S (N) IF (N .LT. O) GO TO I00 ********** F O R M L IN T H E DO 80 1 = I, N II = I - I DO
80 J = I, N X = B(I,J) IF (I .EQ. i) DO
20 40
60 80
i00
X
DL
**********
40
= i, II B(I,K) * B(J,K)
-
2 0 0 J = I, X = A(I,J) IF (I .EQ.
THE UPPER TRIANGLE OF I N V ( L ) * A OF T H E A R R A Y A * * * * * * * * * *
NN i)
GO
TO
180
DO !60 K = i, II X = X - B(I,K) * A(J,K)
160
Iso
X
TO
B AND
IF (J oNE. I) G O T O 60 IF (X .LE. 0.0) GO T O i 0 0 0 Y = SQRT(X) DE(I) = Y GO TO 80 B(J,I) = X / Y CONTINUE ********** FORM THE TRANSPOSE OF IN T H E L O W E R T R I A N G L E D O 2 0 0 1 = i, NN II = I - 1 Y = DE(I) DO
200
20 K =
GO
ARRAYS
A(J,I) = X / Y CONTINUE ~********* PRE-MULTIPLY D O 3 0 0 J = i, NN Jl = J - 1 DO
3 0 0 1 = J, X = A(I,J) IF (I .EQ. II
=
I
-
BY
INV(L)
NN J)
GO
TO
240
i
232
AND
OVERWRITE
**********
7.1-97
220
D O 2 2 0 K = J, I I X = X - A(K,J) *
B(I,K)
240
IF
TO
260
D O 2 6 0 K = I, J l X = X - A(J,K) *
C (J
.EQ.
I)
GO
280
C B(I,K)
C 280 300
A(I,J) CONTINUE
= X
/ DL(1)
C C I000 i001
GO TO i001 **~****** SET IERR = 7 e N + RETURN END
ERROR i
--
B
IS
233
NOT
POSITIVE
DEFINITE
****~**~**
7.1-98
NATS P R O J E C T
EIGENSYSTEM
SUBROUTINE F230
PACKAGE
(EISPACK)
REDUC2
A F o r t r a n IV S u b r o u t i n e to R e d u c e C e r t a i n G e n e r a l i z e d S y m m e t r i c E i g e n p r o b l e m s to S t a n d a r d S y m m e t r i c Eigenproblems Using Cholesky Decomposition.
July,
1975
Io PURPOSE. The F o r t r a n IV s u b r o u t i n e REDUC2 reduces either of the generalized symmetric eigenproblems ABX = (LAMBDA)X or BAX = (LAMBDA)X, w h e r e B is p o s i t i v e d e f i n i t e , to a s t a n d a r d s y m m e t r i c e i g e n p r o b l e m u s i n g the C h o l e s k y f a c t o r i z a t i o n of B. This r e d u c e d form is used by other s u b r o u t i n e s to find the e i g e n v a l u e s and/or e i g e n v e c t o r s of the o r i g i n a l m a t r i x system. See s e c t i o n 2C for the s p e c i f i c routines.
2.
USAGE° A. C a l l i n g The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
REDUC2(NM,N,A,B,DL,IERR)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is given in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and B as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and B in the c a l l i n g program. is an i n t e g e r input v a r i a b l e set equal to the order of the m a t r i c e s A and B. If the C h o l e s k y f a c t o r L of B is a l r e a d y available, N should be p r e f i x e d with a minus sign. ABS(N) m u s t be not g r e a t e r than NM.
234
7.1-99
A
is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at least N. On input, A contains one of the s y m m e t r i c m a t r i c e s of order N that define the g e n e r a l i z e d eigenproblem. Only the full upper t r i a n g l e of the m a t r i x need be supplied. On output, the full lower triangle of A contains the full lower triangle of the symmetric m a t r i x d e r i v e d from the r e d u c t i o n to the s t a n d a r d form. The strict upper t r i a n g l e of A is unaltered. See s e c t i o n 3 for the details. is a w o r k i n g p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and c o l u m n d i m e n s i o n at least N. On input, B contains the p o s i t i v e d e f i n i t e s y m m e t r i c m a t r i x of order N in the system. Only the full upper t r i a n g l e of the m a t r i x need be supplied. A l t e r n a t i v e l y if N is negative, the strict lower triangle of B contains the strict lower t r i a n g l e of its C h o l e s k y factor L. In this case, the full upper triangle of the m a t r i x is arbitKary. On output, the strict lower triangle of B c o n t a i n s the strict lower t r i a n g l e of its C h o l e s k y factor L. The full upper t r i a n g l e of B is u n a l t e r e d . See s e c t i o n 3 for the details.
DL
is a w o r k i n g p r e c i s i o n real o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N. On input, if N is n e g a t i v e , DL contains the d i a g o n a l elements of the C h o l e s k y factor L of B. On output, DL contains the d i a g o n a l elements of the C h o l e s k y factor L of B.
IERR
is an integer output v a r i a b l e set equal an error c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n code
to is
zero.
B. Error C o n d i t i o n s
and Returns.
If the m a t r i x B is not p o s i t i v e definite, REDUC2 t e r m i n a t e s with IERR set to 7*N+I. In this case, C h o l e s k y f a c t o r i z a t i o n of B does not exist. If
B
is p o s i t i v e
definite,
235
IERR
is set to zero.
the
7.1-100
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
If all the e i g e n v a l u e s of the original m a t r i x system are desired, this s u b r o u t i n e should be followed by TREDI (F277), and then by TQLI (F289), IMTQLI (F291), or TQLRAT (F235). If all the e i g e n v a l u e s and e i g e n v e c t o r s of the original m a t r i x system are desired, this s u b r o u t i n e should be followed by TRED2 (F278), then by TQL2 (F290) or IMTQL2 (F292), and finally by R E B A K (F225) for the back t r a n s f o r m a t i o n of the e i g e n v e c t o r s of ABX = (LAMBDA)X or by R E B A K B (F231) for the back t r a n s f o r m a t i o n of the e i g e n v e c t o r s of BAX = (LAMBDA)X. If some of the e i g e n v a l u e s of the o r i g i n a l m a t r i x system are desired, this s u b r o u t i n e should be followed by TREDI (F277), and then by BISECT (F294) or TRIDIB (F237). If some of the e i g e n v a l u e s and e i g e n v e c t o r s of the original m a t r i x system are desired, this s u b r o u t i n e should be followed by TREDI (F277), then by TSTURM (F293), or by BISECT (F294) and TINVIT (F223), or by TRIDIB (F237) and TINVIT, or by IMTQLV (F234) and TINVIT, then by TRBAKI (F279), and finally by REBAK (F225) for the back t r a n s f o r m a t i o n of the e i g e n v e c t o r s of ABX = (LAMBDA)X or by R E B A K B (F231) for the back t r a n s f o r m a t i o n of the e i g e n v e c t o r s of BAX = (LAMBDA)X. Note that left e i g e n v e c t o r s of AB can be o b t a i n e d by t r a n s p o s i n g the (right) e i g e n v e c t o r s of BA, and that left e i g e n v e c t o r s of BA can be obtained by transposing the (right) e i g e n v e c t o r s of AB.
3. D I S C U S S I O N
OF M E T H O D
AND ALGORITHM.
T The C h o l e s k y d e c o m p o s i t i o n of B into LL where L is lower t r i a n g u l a r is first performed. If L is p r e v i o u s l y known, it may be p r o v i d e d as input (see section 2A) and this step skipped. If B is not p o s i t i v e definite, IERR will be set in the course of this step and an immediate error return made. T Next, the c o m p o s i t i o n L AL is performed, r e s u l t i n g in a symmetric m a t r i x with the same e i g e n v a l u e s as the original m a t r i x system and with e i g e n v e c t o r s which can be transformed by s u b r o u t i n e R E B A K (F225) or R E B A K B (F231), as a p p r o p r i a t e , into those of the o r i g i n a l system.
236
7.1-I01
This subroutine REDUC2 written W i l k i n s o n (I).
is a t r a n s l a t i o n of the Algol p r o c e d u r e and d i s c u s s e d in detail by M a r t i n and
4. R E F E R E N C E S .
i)
Martin, R.S. and Wilkinson, J.H., R e d u c t i o n of the Symmetric E i g e n p r o b l e m Ax = (Lambda)Bx and Related Problems to Standard Form, Num. Math. 11,99-110 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n II/i0, 303-314, Springer-Verlag, 1971.)
5. CHECKOUT. A. Test
Cases.
See the section d i s c u s s i n g real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B. Accuracy. The accuracy of REDUC2 can best be described in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real symmetric g e n e r a l i z e d m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (I). This stability c o n t r i b u t e s to the property of these paths that the computed eigenvalues are the exact e i g e n v a l u e s of a system close to the original system and the computed eigenvectors are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
237
7.1-102
SUBROUTINE
REDUC2(NM,N,A,B,DL,IERR)
C INTEGER I,J,K,N,iI,JI,NM,NN,IERR REAL A(NM,N),B(NM,N),DE(N) REAL X,Y REAL SQRT INTEGER lABS C IERR = 0 N N = l A B S (N) IF (N .LT. 0) GO TO i 0 0 ******~*** F O R M L IN T H E DO 80 I = I, N II = I - 1
C
ARRAYS
B AND
DL
**********
C DO
80 J = I, N X = B(I,J) IF (I .EQ. I)
GO
TO
40
C DO 20 K = i, Ii X = X - B(I,K) * B(J,K)
20 C 40
IF (J oNEo !) GO TO 60 IF (X .LE. 0 . 0 ) GO T O I 0 0 0 Y = SQRT(X) D~(I)
60 80 C C
i00
=
Y
GO TO 80 B(J,I) = X / Y CONTINUE ********** FORM THE LOWER TRIANGLE OF A * L IN T H E L O W E R T R I A N G L E OF T H E A R R A Y D O 2 0 0 1 = i, N N !I = I + i
A
**********
C DO
2 0 0 J = I, I X = A(J,I) * DL(J) IF (J .EQ. I) GO TO Jl = J + i
140
C 120
DO 120 K = Jl, X = X + A(K,I)
I * B(K,J)
140
IF
GO
160
D O 1 6 0 K = II, X = X + A(!,K)
C (I
.EQ~
NN)
TO
180
C NN * B(K,J)
C 180 200 C
A(I,J) = X CONTINUE ********** PRE-MULTIPLY D O 3 0 0 1 = i, N N Ii = I + I Y = DE (I)
BY
TRANSPOSE(L)
238
AND
OVERWRITE
**********
7.1-103
DO
3 0 0 J = I, I X = Y * A(I,J) I F (I .EQ. N N )
GO
D O 2 6 0 K = Ii, X = X + A(K,J)
NN * B(K,I)
TO
280
C 260 C 280 300
A(I,J) CONTINUE
= X
C C i000 i001
GO TO I001 ********** SET IERR = 7 * N + RETURN END
ERROR I
--
B
IS
NOT
239
POSITIVE
DEFINITE
**********
7.1-104
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F312
A Fortran
PACKAGE
(EISPACK)
RGG
IV D r i v e r S u b r o u t i n e to D e t e r m i n e the E i g e n v a l u e s E i g e n v e c t o r s for the R e a l G e n e r a l G e n e r a l i z e d Eigenproblem A*X = (LAMBDA)*B*X.
July,
and
1975
i. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e RGG c a l l s the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s f r o m the e i g e n s y s t e m s u b r o u t i n e package EISPACK to d e t e r m i n e the e i g e n v a l u e s and eigenveetors (if d e s i r e d ) for the r e a l g e n e r a l g e n e r a l i z e d eigenproblem A*X = (LAMBDA)*B*X.
2. U S A G E , A.
Calling The
Sequence,
SUBROUTINE SUBROUTINE
statement
is
RGG(NM,N~A,B,ALFR,ALFI,BETA,MATZ,Z,!ERR)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is a n i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A, B, and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A, B, and Z in the c a l l i n g p r o g r a m .
N
is an i n t e g e r i n p u t v a r i a b l e set e q u a l the o r d e r of the m a t r i c e s A and B. m u s t not be g r e a t e r than NM.
A
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input9 A c o n t a i n s one of the r e a l g e n e r a l m a t r i c e s of order N that d e f i n e the e i g e n p r o b l e m w h o s e e i g e n v a l u e s a n d e i g e n v e c t o r s a r e to be found. On o u t p u t , A has b e e n d e s t r o y e d .
240
to N
7.1-105
is a working p r e c i s i o n real t w o - d i m e n s i o n a l variable with row d i m e n s i o n NM and column d i m e n s i o n at least N. On input, B contains the other real general m a t r i x of order N. On output, B has been destroyed. ALFR,ALFI are working p r e c i s i o n real output oned i m e n s i o n a l variables of d i m e n s i o n at least N containing the real and imaginary parts, r e s p e c t i v e l y , of the n u m e r a t o r s of the eigenvalues for the real general g e n e r a l i z e d eigenproblem. BETA
is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l variable of d i m e n s i o n at least N containing the d e n o m i n a t o r s of the eigenvalues which are thus given by the ratios (ALFR+I*ALFI)/BETA. The e i g e n v a l u e s are u n o r d e r e d except that c o m p l e x c o n j u g a t e pairs of eigenvalues appear c o n s e c u t i v e l y with the e i g e n v a l u e having the positive imaginary part first.
MATZ
is an integer input variable set equal to zero if only e i g e n v a l u e s are desired; otherwise it is set to any non-zero integer for both eigenvalues and eigenvectors. is, if MATZ is non-zero, a w o r k i n g p r e c i s i o n real output t w o - d i m e n s i o n a l variable with row d i m e n s i o n NM and column d i m e n s i o n at least N containing the real and imaginary parts of the eigenvectors. If the J-th e i g e n v a l u e is real, the J-th column of Z contains its eigenvector. If the J-th eigenvalue is complex with positive imaginary part, the J-th and (J+l)-th columns of Z contain the real and imaginary parts of its eigenvector. The conjugate of this vector is the e i g e n v e c t o r for the conjugate eigenvalue. Each eigenvector is n o r m a l i z e d so that the modulus of its largest c o m p o n e n t is 1.0. If MATZ is zero, Z is not r e f e r e n c e d and can be a dummy variable.
IERR
is an integer output v a r i a b l e set equal an error c o m p l e t i o n code d e s c r i b e d in section 2B. The n o r m a l completion code zero.
241
to is
7.1-106
B. Error
Conditions
and Returns°
If N is g r e a t e r than NM, the s u b r o u t i n e with IERR set equal to 10*N.
terminates
If more than 50 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e ~ the s u b r o u t i n e t e r m i n a t e s w i t h IERR set equal to the index of the e i g e n v a l u e for w h i c h the f a i l u r e occurs. The e i g e n v a l u e s in the ALFR, ALFI, and BETA arrays s h o u l d be correct for indices ! E R R + I , I E R R + 2 , . . . ~ N ~ but no e i g e n v e c t o r s are computed. If all the e i g e n v a l u e s are d e t e r m i n e d w i t h i n iterations, IERR is set to zero.
C. A p p l i c a b i l i t y
50
and R e s t r i c t i o n s .
This s u b r o u t i n e can be used to find all the e i g e n v a l u e s and all the e l g e n v e c t o r s (if desired) for the real general generalized eigenproblem A * X = (LAMBDA)*B*X.
3. D I S C U S S I O N
OF M E T H O D AND A L G O R I T H M .
This s u b r o u t i n e calls the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s from EISPACK to find the e l g e n v a l u e s and e i g e n v e c t o r s for the real g e n e r a l g e n e r a l i z e d e i g e n p r o b l e m A*X = ( L A M B D A ) e B * X . To find e i g e n v a l u e s only, the s e q u e n c e is the f o l l o w i n g . to s i m u l t a n e o u s l y r e d u c e one of a pair of real QZHES g e n e r a l m a t r i c e s to an upper H e s s e n b e r g m a t r i x and the other to an upper t r i a n g u l a r m a t r i x using o r t h o g o n a l t r a n s f o r m a t i o n s . QZIT - to r e d u c e one of a p a i r of real m a t r i c e s from upper H e s s e n b e r g to q u a s l - t r i a n g u l a r form w h i l e m a i n t a i n i n g the upper t r i a n g u l a r form of the other u s i n g o r t h o g o n a l t r a n s f o r m a t i o n s . QZVAL - to e x t r a c t the e i g e n v a l u e s for a real g e n e r a l g e n e r a l i z e d e l g e n p r o b l e m w i t h one m a t r i ~ in q u a s l - u p p e r t r i a n g u l a r f o r m and the other in upper t r i a n g u l a r form using o r t h o g o n a l transformations. -
To find e i g e n v a l u e s and e i g e n v e c t o r s , the s e q u e n c e is the following. to s i m u l t a n e o u s l y r e d u c e one of a pair of real QZHES g e n e r a l m a t r i c e s to an upper H e s s e n b e r g m a t r i x and the other to an upper t r i a n g u l a r m a t r i x using and a c c u m u l a t i n g o r t h o g o n a l transformations. -
242
7.1-107
QZIT
to reduce one of a pair of real m a t r i c e s from upper H e s s e n b e r g to q u a s i - t r i a n g u l a r form while m a i n t a i n i n g the upper triangular form of the other using and a c c u m u l a t i n g o r t h o g o n a l transformations. - to e x t r a c t t h e e i g e n v a l u e s for a real general g e n e r a l i z e d e l g e n p r o b l e m with one m a t r i x in quasi-upper triangular form and the other in upper triangular form using and a c c u m u l a t i n g o r t h o g o n a l transformations. - to determine the c o r r e s p o n d i n g e i g e n v e c t o r s by back substitution.
-
QZVAL
QZVEC
4. REFERENCES. I)
Garbow, B.S. April, 1974.
and Dongarra,
J.J.,
EISPACK
Path
Chart,
5. CHECKOUT. A.
Test
Cases.
See the section d i s c u s s i n g testing real g e n e r a l i z e d m a t r i x systems.
of the codes
for
B. Accuracy. The accuracy of RGG can be best d e s c r i b e d in terms of its role in those paths of E I S P A C K (i) which find e i g e n v a l u e s and e i g e n v e c t o r s of real generalized m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable. This s t a b i l i t y c o n t r i b u t e s to the p r o p e r t y of these paths that each computed e i g e n v a l u e and its c o r r e s p o n d i n g e i g e n v e c t o r are exact for a system close to the original system.
243
7.1-108
SUBROUTINE
RGG(NM,N,A,B,ALFR,ALFI,BETA,MATZ,Z,IERR)
INTEGER N,NM~IERR,MATZ REAL A(NM,N),B(NM,N),ALFR(N),ALFI(N),BETA(N),E(NM, L O G I C A L TF IF (N .LE. NM) I E R R = I0 ~ N GO TO 50
GO TO
N)
10
I0 IF (MATZ .NE. 0) GO TO 20 ********** FIND EIGENVALUES ONLY ********** TF = .FALSE. CALL QZHES(NM,N,A,B,TF,Z) CALL QZIT(NM,N,A,B,O.0,TF,Z,IERR) CALL QZVAL(NM,N~A,B,ALFR,ALFI,BETA,TF,Z) GO TO 50 ~********* FIND BOTH EIGENVALUES AND EIGENVECTORS 20 TF = .TRUE. CALL QZHES(NM,N,A,B,TF,Z) CALL QZIT(NM,N,A,B,0.O,TF,Z,IERR) CALL QZVAL(NM~N,A,B,ALFR,ALFI,BETA,TF,Z) IF ( I E R R .NE. 0) GO TO 50 CALL QZVEC(NM,N,A,B,ALFR,ALFI,BETA,Z) 50 R E T U R N END
244
**********
7.1-109
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F308
A Fortran
PACKAGE
(EISPACK)
RSB
IV D r i v e r S u b r o u t i n e to D e t e r m i n e the E i g e n v a l u e s E i g e n v e c t o r s of a R e a l S y m m e t r i c B a n d M a t r i x .
July,
and
1975
i. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e RSB c a l l s the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s f r o m the e i g e n s y s t e m s u b r o u t i n e package EISPACK to d e t e r m i n e the e i g e n v a l u e s a n d e i g e n v e c t o r s (if d e s i r e d ) of a real s y m m e t r i c b a n d m a t r i x .
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
RSB(NM,N,MB,A,W,MATZ,ZjFVI,FV2,1ERR)
The p a r a m e t e r s are d i s c u s s e d b e l o w a n d the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and Z as s p e c i f i e d in the for A and Z in the DIMENSION statements calling program.
N
is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x A. greater than NM.
MB
is a n i n t e g e r i n p u t v a r i a b l e set e q u a l to the (half) b a n d w i d t h of the m a t r i x A, d e f i n e d as the n u m b e r of a d j a c e n t d i a g o n a l s , i n c l u d i n g the p r i n c i p a l d i a g o n a l , r e q u i r e d to s p e c i f y the n o n - z e r o p o r t i o n of the l o w e r t r i a n g l e of the m a t r i x . MB m u s t not be greater than N.
245
set e q u a l to N m u s t not be
7,1-110
A
is a working p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least MB. On input, A contains the lower triangle of the real symmetric band m a t r i x of order N and (half) band width MB whose e i g e n v a l u e s and e i g e n v e c t o r s are to be found. Its lowest s u b d i a g o n a l is stored in the last N+I-MB p o s i t i o n s of the first column, its next s u b d i a g o n a l in the last N+2-MB positions of the second column, further s u b d i a g o n a l s similarly, and finally its p r i n c i p a l diagonal in the N positions of the last column. Contents of storage locations not part of the m a t r i x are arbitrary. For example, when N=5 and MB=3, A should contain ( * ( ~ (A(3,1) (A(4,2) (A(5,3)
* A(2,1) A(3,2) A(4,3) A(5,4)
w h e r e the subscripts for to the row and column of standard t w o - d i m e n s i o n a l (*) denotes an a r b i t r a r y A has been destroyed.
A(I,I) A(2,2) A(3,3) A(4,4) A(5,5)
) ) ) ) )
each element refer the element in the r e p r e s e n t a t i o n , and value. On output,
is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N c o n t a i n i n g the e l g e n v a l u e s of the real symmetric band m a t r i x in a s c e n d i n g order. MATZ
is an integer input v a r i a b l e set equal to zero if only e i g e n v a l u e s are desired; o t h e r w i s e it is set to any n o n - z e r o integer for both e i g e n v a l u e s and eigenvectors. is, if MATZ is non-zero, a w o r k i n g p r e c i s i o n real output t w o - d i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least N c o n t a i n i n g the eigenveetors. The e i g e n v e c t o r s are orthonormal. If MATZ is zero, Z is not r e f e r e n c e d and can be a dummy variable.
FVI~FV2
are w o r k i n g dimensional N.
246
precision variables
t e m p o r a r y oneof d i m e n s i o n at least
7.1-111
IERR
B. E r r o r
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n c o d e d e s c r i b e d in s e c t i o n 2B. T h e n o r m a l c o m p l e t i o n code zero.
Conditions
to is
and R e t u r n s .
If N is g r e a t e r t h a n NM, the s u b r o u t i n e with IERR set e q u a l to 10*N.
terminates
If MB is e i t h e r n o n - p o s l t i v e or g r e a t e r than subroutine terminates with IERR set e q u a l to
N, the 12*N.
If m o r e t h a n 30 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e , the s u b r o u t i n e t e r m i n a t e s w i t h IERR set e q u a l to the i n d e x of the e i g e n v a l u e for w h i c h the failure occurs. T h e e i g e n v a l u e s and e i g e n v e c t o r s in the W and Z a r r a y s s h o u l d be c o r r e c t for i n d i c e s 1,2,...,IERR-I. If all the e i g e n v a l u e s are d e t e r m i n e d iterations, IERR is set to zero.
C. A p p l i c a b i l i t y
within
30
and Restrictions.
T h i s s u b r o u t i n e can be u s e d to f i n d a l l the e i g e n v a l u e s and a l l the e i g e n v e c t o r s (if d e s i r e d ) of a r e a l symmetric band matrix.
3. D I S C U S S I O N This from real To
OF M E T H O D
AND ALGORITHM.
s u b r o u t i n e c a l l s the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s EISPACK to f i n d the e i g e n v a l u e s and e i g e n v e c t o r s of a symmetric band matrix.
f i n d e i g e n v a l u e s only, the s e q u e n c e is the f o l l o w i n g . to r e d u c e a r e a l s y m m e t r i c b a n d m a t r i x to a BANDR symmetric tridiagonal matrix using orthogonal transformations. T Q L R A T - to d e t e r m i n e the e i g e n v a l u e s of the o r i g i n a l m a t r i x f r o m the s y m m e t r i c t r i d i a g o n a l m a t r i x . -
To find e i g e n v a l u e s and e i g e n v e c t o r s , the s e q u e n c e is the following. to r e d u c e a r e a l s y m m e t r i c b a n d m a t r i x to a BANDR symmetric tridiagonal matrix using and accumulating orthogonal transformations. TQL2 - to d e t e r m i n e the e i g e n v a l u e s a n d e i g e n v e c t o r s of the o r i g i n a l m a t r i x f r o m the s y m m e t r i c tridiagonal matrix. -
247
7.1-112
4. R E F E R E N C E S ~ I)
Garbow~ B.So April, 1974.
and Dongarra,
J.J.~
EISPACK
Path Chart,
5. CHECKOUT. A. Test
Cases.
See the section d i s c u s s i n g testing real symmetric band matrices.
of
the codes
for
B. Accuracy. The accuracy of RSB can best be d e s c r i b e d in terms of its role in those paths of E I S P A C K (i) w h i c h find e i g e n v a l u e s and e i g e n v e c t o r s of real s y m m e t r i c band matrices. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable. This s t a b i l i t y contributes to the p r o p e r t y of these paths that the computed e i g e n v a l u e s are the exact e i g e n v a l u e s of a m a t r i x close to the original m a t r i x and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that matrix.
7.1-113
SUBROUTINE
RSB(NM,N,MB,A,W,MATZ,Z,FVI,FV2,1ERR)
C INTEGER N~MB~NM,IERR,MATZ REAL A(NM,MB),W(N),Z(NM,N),FVI(N),FV2(N) LOGICAL TF C IF (N .LE. NM) I E R R = I0 * N GO T O 50 5 IF (MB .GT. 0) I E R R = 12 * N GO TO 50 i0 IF (MB .LE. N) I E R R = 12 * N GO T O 50
GO
TO
5
GO
TO
I0
GO
TO
15
C 15
C
C
IF ( M A T Z .NE. 0) GO TO 20 ***~****** FIND EIGENVALUES ONLY ********** TF = . F A L S E . CALL BANDR(NM,N,MB,A,W,FVI,FV2,TF,Z) CALL TQLRAT(N,W,FV2,1ERR) GO T O 50 ********** FIND BOTH E!GENVALUES AND EIGENVECTORS 20 TF = . T R U E . CALL BANDR(NM,N,MB~A,W,FVI~FVI,TF,Z) CALL TQL2(NM3N,W,FVI,Z,IERR) 50 R E T U R N END
249
**********
7. 1-114
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F309
PACKAGE
(EISPACK)
RSG
A F o r t r a n IV D r i v e r S u b r o u t i n e to D e t e r m i n e t h e E i g e n v a l u e s E i g e n v e c t o r s for the R e a l S y m m e t r i c G e n e r a l i z e d Eigenproblem A*X = (LAMBDA)*B*X.
July,
and
1975
Io P U R P O S E . The F o r t r a n IV s u b r o u t i n e RSG c a l l s the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s f r o m the e i g e n s y s t e m s u b r o u t i n e package EISPACK to d e t e r m i n e the e i g e n v a l u e s a n d eigenvectors (if d e s i r e d ) for the r e a l s y m m e t r i c g e n e r a l i z e d eigenproblem A*X = (LAMBDA)*B*Xo
2. U S A G E . A.
Calling The
Sequence°
SUBROUTINE SUBROUTINE
statement
is
RSG(NM,N,A,B,W,MATZ,Z,FVI,FV2,1ERR)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A, B, and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A, B, and Z in the c a l l i n g p r o g r a m . is an i n t e g e r i n p u t v a r i a b l e set e q u a l the o r d e r of the m a t r i c e s A and B. m u s t not be g r e a t e r than NM.
to N
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at l e a s t N. On input, A c o n t a i n s one of the the r e a l s y m m e t r i c m a t r i c e s of o r d e r N that d e f i n e the
250
7.1-115
eigenproblem whose eigenvalues and e i g e n v e c t o r s are to be found. O n l y the f u l l u p p e r t r i a n g l e of A need be supplied. On o u t p u t , the s t r i c t u p p e r t r i a n g l e of A is unaltered. is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input, B c o n t a i n s the o t h e r r e a l s y m m e t r i c m a t r i x of order N. Further, B is r e q u i r e d to be positive definite. O n l y the f u l l u p p e r t r i a n g l e of B n e e d be s u p p l i e d . On o u t p u t , the f u l l u p p e r t r i a n g l e of B is unaltered. is a w o r k i n g p r e c i s i o n r e a l o u t p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the e i g e n v a l u e s for the r e a l s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m in a s c e n d i n g order. MATZ
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to zero if o n l y e i g e n v a l u e s a r e d e s i r e d ; o t h e r w i s e it is set to any n o n - z e r o i n t e g e r for b o t h e i g e n v a l u e s and e i g e n v e c t o r s . is, if MATZ is n o n - z e r o , a w o r k i n g precision real output two-dimensional variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N c o n t a i n i n g the eigenvectors. The e i g e n v e e t o r s a r e T n o r m a l i z e d so that Z BZ = I. If MATZ is zero, Z is n o t r e f e r e n c e d and c a n be a dummy variable.
FVI,FV2
are w o r k i n g dimensional
precision variables
t e m p o r a r y oneof d i m e n s i o n at
least
N.
IERR
B.
Error
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l a n e r r o r c o m p l e t i o n c o d e d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n code zero.
Conditions
to is
and R e t u r n s .
If N is g r e a t e r t h a n NM, the s u b r o u t i n e with IERR set e q u a l to 10*N. If the m a t r i x B is n o t p o s i t i v e subroutine terminates with IERR
251
terminates
d e f i n i t e , the set to 7*N+I.
7.1-i16
If m o r e than 30 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e ~ the s u b r o u t i n e t e r m i n a t e s with IERR set equal to the index of the e i g e n v a l u e for w h i c h the f a i l u r e occurs. The e i g e n v a l u e s in the W array s h o u l d be c o r r e c t for indices 1 , 2 , , , , , I E R R - I , but no e i g e n v e c t o r s are computed° If all the e i g e n v a l u e s are d e t e r m i n e d w i t h i n iterations, IERR is set to zero.
C. A p p l i c a b i l i t y
30
and R e s t r i c t i o n s .
This s u b r o u t i n e can be used to find all the e i g e n v a l u e s and all the e i g e n v e c t o r s (if desired) for the real symmetric generalized eigenproblem A*X = (LAMBDA)*B*X.
3. D I S C U S S I O N
OF M E T H O D
AND A L G O R I T H M .
This s u b r o u t i n e calls the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s from EISPACK to find the e i g e n v a l u e s and e i g e n v e c t o r s for the real s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m A*X = ( L A M B D A ) * B * X ~ To find e i g e n v a l u e s only, the s e q u e n c e is the following. to r e d u c e the g e n e r a l i z e d s y m m e t r i c REDUC e i g e n p r o b l e m to the s t a n d a r d s y m m e t r i c e i g e n p r o b l e m using C h o l e s k y d e c o m p o s i t i o n . to r e d u c e the real s y m m e t r i c m a t r i x of the TREDI s t a n d a r d p r o b l e m to a s y m m e t r i c t r i d i a g o n a l m a t r i x using o r t h o g o n a l t r a n s f o r m a t i o n s . TQLRAT - to d e t e r m i n e the e i g e n v a l u e s for the o r i g i n a l p r o b l e m f r o m the s y m m e t r i c t r i d i a g o n a l matrix. -
-
To find e i g e n v a l u e s and e i g e n v e c t o r s , the s e q u e n c e is the followings REDUC - to r e d u c e the g e n e r a l i z e d s y m m e t r i c e i g e n p r o b l e m to the s t a n d a r d s y m m e t r i c e i g e n p r o b l e m using C h o l e s k y d e c o m p o s i t i o n . to reduce the real s y m m e t r i c m a t r i x of the TRED2 s t a n d a r d p r o b l e m to a s y m m e t r i c t r i d i a g o n a l m a t r i x using and a c c u m u l a t i n g o r t h o g o n a l transformations. TQL2 - to d e t e r m i n e the e i g e n v a l u e s and e i g e n v e e t o r s for the s t a n d a r d p r o b l e m from the s y m m e t r i c t r i d i a g o n a l matrix. REBAK to b a c k t r a n s f o r m the e i g e n v e c t o r s to those of the o r i g i n a l problem. -
-
252
7.1-117
4. REFERENCES. I)
Garbow, B.S. April, 1974.
and Dongarra,
J.J.,
EISPACK
Path
Chart,
5. CHECKOUT. A. Test
Cases.
See the section d i s c u s s i n g real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B. Accuracy. The accuracy of RSG can best be d e s c r i b e d in terms of its role in those paths of EISPACK (I) which find eigenvalues and e i g e n v e c t o r s of real symmetric generalized m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable. This stability c o n t r i b u t e s to the property of these paths that the computed eigenvalues are the exact eigenvalues of a system close to the original system and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
253
7.1-118
SUBROUTINE
RSG(NM,N,A,B,W,MATZ,Z,FVI,FV2,1ERR)
C I N T E G E R N,NM, I E R R , M A T Z REAL A(NM,N),B(NM,N),W(N),Z(NM,N),FVI(N),FV2(N) C IF (N .LE. NM) i E R R = i0 * N GO T O 50
GO TO
i0
C
C
C
I0 C A L L REDUC(NM,N,A,B,FV2,1ERR) IF (IERR .NE. 0) G O TO 50 IF (MATZ .NE. 0) GO TO 20 ********** FIND EIGENVALUES ONLY CALL TREDI(NM,N,A,W,FVI,FV2) CALL TQLRAT(N,W,FV2,1ERR) GO TO 50 ********** FIND BOTH EIGENVALUES 20 C A L L TRED2(NM~N,A,W,FVI~Z) CALL TQL2(NM,N,W,FVI,Z,IERR) IF (IERR .NE. 0) GO TO 50 CALL REBAK(NM,N,B,FV2,N,Z) 50 R E T U R N END
254
**********
AND
EIGENVECTORS
7.1-119
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F310
PACKAGE
(EISPACK)
RSGAB
A F o r t r a n IV D r i v e r S u b r o u t i n e to D e t e r m i n e the E i g e n v a l u e s E i g e n v e c t o r s for the R e a l S y m m e t r i c G e n e r a l i z e d Eigenproblem A*B*X = (LAMBDA)*X.
July,
and
1975
I. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e RSGAB c a l l s the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s f r o m the e i g e n s y s t e m s u b r o u t i n e package EISPACK to d e t e r m i n e the e i g e n v a l u e s and e i g e n v e c t o r s (if d e s i r e d ) for the r e a l s y m m e t r i c g e n e r a l i z e d eigenproblem A*B*X = (LAMBDA)*X.
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
RSGAB(NM,N,A,B,W,MATZ,Z,FVI,FV2,1ERR)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A~ B, a n d Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A, B, and Z in the c a l l i n g p r o g r a m . is an i n t e g e r i n p u t v a r i a b l e set e q u a l the o r d e r of the m a t r i c e s A and B. m u s t n o t be g r e a t e r t h a n NM.
to N
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input, A c o n t a i n s one of the the r e a l s y m m e t r i c m a t r i c e s of o r d e r N that d e f i n e the
255
7.1-120
e i g e n p r o b l e m w h o s e e i g e n v a l u e s and e i g e n v e c t o r s a r e to be found. O n l y the f u l l u p p e r t r i a n g l e of A need he supplied. On o u t p u t , the s t r i c t u p p e r t r i a n g l e of A is unaltered. B
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. O n input, B c o n t a i n s the o t h e r r e a l s y m m e t r i c m a t r i x of order N. Further, B is r e q u i r e d to be positive definite. O n l y the f u l l u p p e r t r i a n g l e of B need be supplied. On o u t p u t , the f u l l u p p e r t r i a n g l e of B is unaltered.
W
is a w o r k i n g p r e c i s i o n r e a l o u t p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the e i g e n v a l u e s for the r e a l s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m in a s c e n d i n g order.
MATZ
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to zero if o n l y e i g e n v a l u e s are d e s i r e d ; o t h e r w i s e it is set to any n o n - z e r o i n t e g e r for b o t h e i g e n v a l u e s a n d e i g e n v e c t o r s .
Z
is~ if MATZ is n o n - z e r o , a w o r k i n g precision real output two-dimensional variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N c o n t a i n i n g the eigenvectors. The eigenvectors are T n o r m a l i z e d so that Z BZ = I. If MATZ is zero, Z is n o t r e f e r e n c e d and can be a dummy variable.
FVI,FV2
are w o r k i n g dimensional N.
IERR
B.
Error
precision variables
temporary oneof d i m e n s i o n at
least
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n code zero.
Conditions
to is
and R e t u r n s .
If N is g r e a t e r than NM, the with IERR set e q u a l to 10*N.
subroutine
If the m a t r i x B is n o t p o s i t i v e subroutine terminates with IERR
256
terminates
d e f i n i t e ~ the set to 7*N+I.
7.1-121
If more than 30 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e , the s u b r o u t i n e t e r m i n a t e s w i t h IERR set equal to the index of the e i g e n v a l u e for w h i c h the f a i l u r e occurs. The e i g e n v a l u e s in the W array should be c o r r e c t for i n d i c e s 1 , 2 , . . . , I E R R - I , but no e i g e n v e c t o r s are computed. If all the e i g e n v a l u e s are d e t e r m i n e d w i t h i n iterations, IERR is set to zero.
C.
Applicability
30
and R e s t r i c t i o n s .
This s u b r o u t i n e can be used to find all the e i g e n v a l u e s and all the e i g e n v e c t o r s (if desired) for the real symmetric generalized eigenproblem A * B * X = (LAMBDA)*X.
3. D I S C U S S I O N
OF M E T H O D AND A L G O R I T H M .
This s u b r o u t i n e calls the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s from EISPACK to find the e i g e n v a l u e s and e i g e n v e c t o r s for the real s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m A * B * X = (LAMBDA)*X. To find e i g e n v a l u e s only, the s e q u e n c e is the following. to reduce the g e n e r a l i z e d s y m m e t r i c REDUC2 e i g e n p r o b l e m to the s t a n d a r d s y m m e t r i c e i g e n p r o b l e m using C h o l e s k y d e c o m p o s i t i o n . to reduce the real s y m m e t r i c m a t r i x of the TREDI standard p r o b l e m to a s y m m e t r i c t r i d i a g o n a l m a t r i x Using o r t h o g o n a l t r a n s f o r m a t i o n s . TQLRAT - to d e t e r m i n e the e i g e n v a l u e s for the o r i g i n a l p r o b l e m from the s y m m e t r i c t r i d i a g o n a l matrix. -
-
To find e i g e n v a l u e s and e i g e n v e c t o r s , the s e q u e n c e is the following. R E D U C 2 - to reduce the g e n e r a l i z e d s y m m e t r i c e i g e n p r o b l e m to the s t a n d a r d s y m m e t r i c e i g e n p r o b i e m using C h o l e s k y d e c o m p o s i t i o n . to reduce the real s y m m e t r i c m a t r i x of the TRED2 s t a n d a r d p r o b l e m to a s y m m e t r i c t r i d i a g o n a l m a t r i x using and a c c u m u l a t i n g o r t h o g o n a i transformations. TQL2 - to d e t e r m i n e the e i g e n v a l u e s and e i g e n v e c t o r s for the s t a n d a r d p r o b l e m from the s y m m e t r i c t r i d i a g o n a ! matrix. to b a c k t r a n s f o r m the e i g e n v e c t o r s to those of REBAK the o r i g i n a l problem. -
-
257
7.1-!22
4o R E F E R E N C E S . I)
Garbow, B.S. April, 1974.
and Dongarra,
J.J.,
EISPACK
Path
Chart~
5~ CHECKOUT. A. Test
Cases~
See the s e c t i o n d i s c u s s i n g real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B. Accuracy° The accuracy of RSGAB can best be described in terms of its role in those paths of E I S P A C K (i) which find e i g e n v a l u e s and e i g e n v e c t o r s of real s y m m e t r i c g e n e r a l i z e d m a t r i x systems. In these paths, this subroutine is n u m e r i c a l l y stable. This stability c o n t r i b u t e s to the property of these paths that the c o m p u t e d e i g e n v a l u e s are the exact e i g e n v a l u e s of a system close to the original s y s t e m and the computed e i g e n v e c t e r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
258
7.1-123
SUBROUTINE
RSGAB(NM,N,A,B,W,MATZ,Z,FVI,FV2,1ERR)
C I N T E G E R N,NM, I E R R , M A T Z REAL A(NM,N),B(NM,N),W(N),Z(NM,N),FVI(N),FV2(N) C IF (N .LE. NM) I E R R = I0 * N GO TO 50
GO TO
i0
C
C
C
i0 C A L L REDUC2(NM,N,A,B,FV2,1ERR) IF (IERR .NE. 0) GO TO 50 IF (MATZ .NE. 0) GO TO 20 * * * * * * * * * * F I N D E I G E N V A L U E S ONLY CALL TREDI(NM,N,A,W,FVI,FV2) CALL TQLRAT(N,W,FV2,1ERR) GO TO 50 ~********* FIND BOTH EIGENVALUES 20 CALL TRED2(NM,N,A,W,FVI,Z) CALL TQL2(NM,N,W,FVI,Z,IERR) IF (IERR .NE. 0) GO TO 50 CALL REBAK(NM,N,B,FV2,N,Z) 50 R E T U R N END
259
*~********
AND
EIGENVECTORS
**********
7.1-124
NATS
E!GENSYSTEM
PROJECT
SUBROUTINE F311
PACKAGE
(EISPACK)
RSGBA
A F o r t r a n IV D r i v e r S u b r o u t i n e to D e t e r m i n e the E i g e n v a l u e s Eigenvectors for the R e a l S y m m e t r i c G e n e r a l i z e d Eigenproblem B*A*X = (LAMBDA)*X.
July,
and
1975
1. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e RSGBA c a l l s the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s f r o m the e i g e n s y s t e m s u b r o u t i n e package EISPACK to d e t e r m i n e the e i g e n v a l u e s a n d eigenvectors (if d e s i r e d ) for the r e a l s y m m e t r i c g e n e r a l i z e d eigenproblem B*A*X = (LAMBDA)*X.
2, U S A G E . A,
Calling The
Sequence°
SUBROUTINE SUBROUTINE
statement
is
RSGBA(NM,N,A,B~W,MATZ,Z,FVI,FV2,IERR)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the interpretation of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s l o n a l arrays A~ B~ and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A, B, and Z in the c a l l i n g p r o g r a m .
N
is an i n t e g e r i n p u t v a r i a b l e s e t e q u a l the o r d e r of the m a t r i c e s A and B. m u s t n o t be g r e a t e r t h a n NM.
A
is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input, A c o n t a i n s o n e of the the r e a l s y m m e t r i c m a t r i c e s of o r d e r N that d e f i n e the
260
to N
7.1-125
e l g e n p r o b l e m w h o s e e i g e n v a l u e s and e i g e n v e c t o r s are to be f o u n d . O n l y the f u l l u p p e r t r i a n g l e of A n e e d be s u p p l i e d . On o u t p u t , the s t r i c t u p p e r t r i a n g l e of A is unaltered. is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input, B c o n t a i n s the o t h e r real s y m m e t r i c m a t r i x of order N. Further, B is r e q u i r e d to be positive definite. O n l y the f u l l u p p e r t r i a n g l e of B n e e d be s u p p l i e d . On o u t p u t ~ the f u l l u p p e r t r i a n g l e of B is unaltered. is a w o r k i n g p r e c i s i o n r e a l o u t p u t oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the e l g e n v a l u e s for the r e a l s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m in a s c e n d i n g order. MATZ
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to zero if o n l y e i g e n v a l u e s are d e s i r e d ; o t h e r w i s e it is set to a n y n o n - z e r o i n t e g e r for b o t h e i g e n v a l u e s and e i g e n v e c t o r s . is, if MATZ is n o n - z e r o , a w o r k i n g precision real output two-dimensional variable with row dimension NM and column d i m e n s i o n at l e a s t N c o n t a i n i n g the eigenvectors. The e i g e n v e c t o r s a r e T -I n o r m a l i z e d so that Z B Z = I. If MATZ is zero, Z is not r e f e r e n c e d and can be a d u m m y v a r i a b l e .
FVI,FV2
are working dimensional
precision variables
temporary oneof d i m e n s i o n at
least
N.
IERR
B. E r r o r
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n code zero.
Conditions
to is
and R e t u r n s .
If N is g r e a t e r t h a n NM, the s u b r o u t i n e with IERR set e q u a l to 10*N. If the m a t r i x B is n o t p o s i t i v e subroutine terminates with IERR
261
terminates
d e f i n i t e , the set to 7*N+I.
7. 1-126
If m o r e than 30 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e ~ the s u b r o u t i n e t e r m i n a t e s w i t h IERR set equal to the index of the e i g e n v a ! u e for w h i c h the failure occurs. The e i g e n v a l u e s in the W array s h o u l d be c o r r e c t for indices 1 , 2 , . . . , I E R R - I , but no e i g e n v e c t o r s are computed. If all the e i g e n v a l u e s are d e t e r m i n e d w i t h i n iterations, !ERR is set to zero.
C. A p p l i c a b i l i t y
30
and R e s t r i c t i o n s .
This s u b r o u t i n e can be used to find all the e i g e n v a l u e s and all the e i g e n v e c t o r s (if desired) for the real symmetric generalized eigenproblem B * A * X = (LAMBDA)*X.
3. D I S C U S S I O N
OF M E T H O D
AND A L G O R I T H M .
This s u b r o u t i n e calls the r e c o m m e n d e d s e q u e n c e of s u b r o u t i n e s from EISPACK to find the e i g e n v a l u e s and e i g e n v e c t o r s for the real s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m B*A*X = (LAMBDA)*X. To find e i g e n v a l u e s only, the s e q u e n c e is the following. REDUC2 to reduce the g e n e r a l i z e d s y m m e t r i c e i g e n p r o b l e m to the s t a n d a r d s y m m e t r i c e i g e n p r o b l e m using C h o l e s k y d e c o m p o s i t i o n . TREDI to reduce the real s y m m e t r i c m a t r i x of the s t a n d a r d p r o b l e m to a s y m m e t r i c t r i d i a g o n a l matrix using orthogonal transformations. T Q L R A T - to d e t e r m i n e the e i g e n v a l u e s for the o r i g i n a l p r o b l e m f r o m the s y m m e t r i c t r i d i a g o n a l matrix. -
-
To find e i g e n v a l u e s and e i g e n v e c t o r s , the s e q u e n c e is the following. R E D U C 2 - to reduce the g e n e r a l i z e d s y m m e t r i c e i g e n p r o b l e m to the s t a n d a r d s y m m e t r i c e i g e n p r o b l e m using C h o l e s k y d e c o m p o s i t i o n . TRED2 to r e d u c e the real s y m m e t r i c m a t r i x of the s t a n d a r d p r o b l e m to a s y m m e t r i c t r i d i a g o n a l m a t r i x using and a c c u m u l a t i n g o r t h o g o n a l transformations. TQL2 - to d e t e r m i n e the e i g e n v a l u e s and e i g e n v e c t o r s for the s t a n d a r d p r o b l e m from the s y m m e t r i c t r i d i a g o n a l matrix. REBAKB to b a c k t r a n s f o r m the e i g e n v e c t o r s to those of the o r i g i n a l problem. -
-
262
7.1-127
4. REFERENCES. I)
Garbow, B.S. April, 1974.
and Dongarra,
J.J.,
EISPACK
Path
Chart,
5. CHECKOUT. A. Test
Cases.
See the section discussing real symmetric g e n e r a l i z e d
testing of the codes m a t r i x systems.
for
B, A c c u r a c y . The accuracy of RSGBA can best be described in terms of its role in those paths of E I S P A C K (I) w h i c h find eigenvalues and e i g e n v e c t o r s of real s y m m e t r i c g e n e r a l i z e d m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable. This s t a b i l i t y contributes to the property of these paths that the computed eigenvalues are the exact e i g e n v a l u e s of a system close to the original system and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that system.
263
7.1-128
SUBROUTINE
RSGBA(NM,N,A,B,W,MATZ,Z,FVI,FV2,1ERR)
C INTEGER N~NM, IERR,MATZ REAL A(NM,N),B(NM,N),W(N),Z(NM,N),FVI(N),FV2(N) C IF (N oLE. NM) I E R R = I0 * N GO TO 50
GO
TO
i0
C
C
C
i0 C A L L REDUC2(NM,N~A,B,FV2~IERR) IF ( I E R R .NE. 0) GO TO 50 IF (MATZ .NE. 0) GO TO 20 ********** FIND EIGENVALUE8 ONLY CALL TREDI(NM,N,A,W,FVI,FV2) CALL TQLRAT(N,W,FV2,1ERR) GO TO 50 ********** FIND BOTH EIGENVALUES 20 C A L L TRED2(NM,N,A~W,FVI,Z) CALL TQL2(NM,N,W,FVI,Z,IERR) IF ( I E R R .NE. 0) GO TO 50 CALL REBAKB(NM,N,B,FV2,N,E) 50 R E T U R N END
264
**********
AND
EIGENVECTORS
*****~****
7.1-129
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F232
PACKAGE
(EISPACK)
SVD
A F o r t r a n IV S u b r o u t i n e to C o m p u t e D e c o m p o s i t i o n of an A r b i t r a r y R e a l
July,
the S i n g u l a r V a l u e Rectangular Matrix.
1975
I. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e SVD c o m p u t e s the s i n g u l a r v a l u e s and c o m p l e t e o r t h o g o n a l d e c o m p o s i t i o n of a r e a l r e c t a n g u l a r matrix A. A is d e c o m p o s e d into T U * DIAG(S)
~ V
T T with U U = V V = I. T h e d i a g o n a l e l e m e n t s of S are the s i n g u l a r v a l u e s of A, e q u a l to the n o n - n e g a t i v e s q u a r e T r o o t s of the e i g e n v a l u e s of A A.
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
SVD(NM,M,N,A,W,MATU,U,MATV,V,IERR,RVl)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the row d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and U (and V if MATV is true) as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and U (and V) in the calling program.
M
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the n u m b e r of rows of r e c t a n g u l a r m a t r i c e s A and U. M m u s t be n o t g r e a t e r t h a n NM.
265
7.1-130
N
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the n u m b e r of c o l u m n s of A and U a n d the o r d e r of the s q u a r e m a t r i x V. N m u s t be not g r e a t e r than NM.
A
is a w o r k i n g p r e c i s i o n r e a l i n p u t twodimensional variable with row dimension and c o l u m n d i m e n s i o n at l e a s t N which c o n t a i n s the m a t r i x to be d e c o m p o s e d .
NM
W
is a w o r k i n g p r e c i s i o n r e a l o u t p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the s i n g u l a r v a l u e s of A.
MATU
is a l o g i c a l i n p u t v a r i a b l e set true matrix U is d e s i r e d and set f a l s e otherwise.
if
the
is~ if MATU is true, a w o r k i n g p r e c i s i o n real o u t p u t t w o - d i m e n s i o n a l v a r i a b l e w i t h row dimension NM and c o l u m n d i m e n s i o n at least N. It c o n t a i n s o r t h o g o n a l c o l u m n s of the U m a t r i x in the d e c o m p o s i t i o n . If MATU is f a l s e , U is u s e d as a t e m p o r a r y array, MATV
is a l o g i c a l i n p u t v a r i a b l e set true matrix V is d e s i r e d and set f a l s e otherwise.
if
the
is, if MATV is true, a w o r k i n g p r e c i s i o n real o u t p u t t w o - d i m e n s i o n a l v a r i a b l e w i t h row dimension NM and c o l u m n d i m e n s i o n at least N. It c o n t a i n s the o r t h o g o n a l V m a t r i x in the d e c o m p o s i t i o n . If MATV is false~ V is n o t r e f e r e n c e d and can be a dummy (working precision) variable. IERR
RV i
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The normal completion code zero.
to is
is a w o r k i n g p r e c i s i o n r e a l t e m p o r a r y o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N u s e d to h o l d the o f f - d i a g o n a l e l e m e n t s of the b i d i a g o n a l form.
266
7.1-131
B.
Error
Conditions
and
Returns.
If m o r e t h a n 30 i t e r a t i o n s a r e r e q u i r e d to d e t e r m i n e s i n g u l a r v a l u e , this s u b r o u t i n e terminates with IERR set to the i n d e x of the s i n g u l a r v a l u e for w h i c h the failure occurs. T h e s i n g u l a r v a l u e s in the W array s h o u l d be c o r r e c t for i n d i c e s IERR+I,IERR+2,...,N, as w e l l as the c o r r e s p o n d i n g c o l u m n s of U and V. If a l l the s i n g u l a r v a l u e s a r e d e t e r m i n e d iterations, IERR is set to zero.
C.
Applicability
and
within
a
30
Restrictions.
The generalized i n v e r s e of A can decomposition in SVD by f o r m i n g + V * DIAG(S
be
obtained
from
the
T ) * U
+ w h e r e e a c h e l e m e n t of S is the r e c i p r o c a l of the corresponding e l e m e n t of S w h e r e n o n - z e r o a n d zero where S is zero. S o m e zero t h r e s h o l d w o u l d h a v e to be employed (for e x a m p l e , the p r o d u c t of the s q u a r e r o o t of the m a c h i n e p r e c i s i o n and a n o r m of the m a t r i x ) . Sample c o d i n g to p e r f o r m this c o m p u t a t i o n m i g h t be: DO I00
200 300 C
I00 1 = I, N D O I00 J = I, M GENINV(I,J) = 0.0DO DO 300 K = I, N IF (W(K) .LT. T H R E S H ) GO TO 300 DO 200 1 = I, N • DO 200 J = i, M GENINV(I,J) = GENINV(I,J)+V(I,K)*U(J,K)/W(K) CONTINUE G E N I N V IS T H E G E N E R A L I Z E D INVERSE MATRIX.
S o l u t i o n s of a s y s t e m of h o m o g e n e o u s linear equations with coefficient matrix A c a n be o b t a i n e d as t h o s e c o l u m n s of V (or l i n e a r c o m b i n a t i o n s of them) w h i c h correspond to zero e l e m e n t s of S. Either
of
U
and
V
may
267
coincide
with
A
if
desired.
7.1-132
3.
DISCUSSION
OF M E T H O D
AND ALGORITHM.
T The singular value decomposition A = U * DIAG(S) * V is a c c o m p l i s h e d in two steps. A is f i r s t r e d u c e d to the bidiagonal form J by two s e q u e n c e s of H o u s e h o l d e r transformations, t h o s e on the left r e d u c i n g c o l u m n s of A, and t h o s e on the r i g h t r e d u c i n g r o w s of A. B e c a u s e the transformations are o r t h o g o n a l , J has the s a m e s i n g u l a r T v a l u e s as A, that is J = G * D ! A G ( S ) * H . F u r t h e r , if the p r o d u c t of the left t r a n s f o r m a t i o n s is d e n o t e d P and the p r o d u c t of the r i g h t t r a n s f o r m a t i o n s Q, so t h a t T J = P * A * Q, t h e n U = PG and V = QH. The b i d i a g o n a l f o r m J is then d e c o m p o s e d by a v a r i a n t of the QR m e t h o d a p p l i e d to the s y m m e t r i c t r i d i a g o n a l m a t r i x T J J. (The s i n g u l a r v a l u e s of J are the n o n - n e g a t i v e T s q u a r e r o o t s of the e i g e n v a l u e s of J J.) T h e e s s e n c e of this m e t h o d is a p r o c e s s w h e r e b y a s e q u e n c e of s y m m e t r i c T t r i d i a g o n a l m a t r i c e s , u n i t a r i l y s i m i l a r to J J, is f o r m e d w h i c h c o n v e r g e s to a d i a g o n a l m a t r i x . The r a t e of c o n v e r g e n c e of this s e q u e n c e is i m p r o v e d by s h i f t i n g the o r i g i n at e a c h i t e r a t i o n . B e f o r e the i t e r a t i o n s for e a c h e i g e n v a l u e , the s y m m e t r i c t r i d i a g o n a l m a t r i x is c h e c k e d for a possible splitting into submatrices. If a s p l i t t i n g o c o u r s ~ only the l o w e r m o s t s u b m a t r i x p a r t i c i p a t e s in the n e x t iteration. T h e l e f t and r i g h t t r a n s f o r m a t i o n s u s e d in e a c h i t e r a t i o n are a c c u m u l a t e d in the U and V arrays. T h e o r i g i n s h i f t at e a c h i t e r a t i o n is an e i g e n v a l u e of the current lowermost 2x2 principal minor. W h e n e v e r the lowermost Ixl p r i n c i p a l s u b m a t r i x f i n a l l y s p l i t s f r o m the rest of the m a t r i x , its e l e m e n t is t a k e n to be an e i g e n v a l u e of the o r i g i n a l m a t r i x a n d the a l g o r i t h m p r o c e e d s w i t h the remaining submatrix. T h i s p r o c e s s is c o n t i n u e d u n t i l the m a t r i x has s p l i t c o m p l e t e l y into s u b m a t r i c e s of o r d e r i. T h e t o l e r a n c e s in the s p l i t t i n g t e s t s are p r o p o r t i o n a l to the relative machine precision. T h i s s u b r o u t i n e is a t r a n s l a t i o n of the A l g o l p r o c e d u r e SVD w r i t t e n and d i s c u s s e d in d e t a i l by G o l u b a n d R e i n s c h (i).
268
7.1-133
4. REFERENCES.
1)
Golub, G.H. and Reinsch, C., Singular Value D e c o m p o s i t i o n and Least Squares Solutions, Num. Math. 14,403-420 (1970). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 1/10, 134-151, Springer-Verlag, 1971.)
5. CHECKOUT. A. Test
Cases.
See the section discussing testing singular value decomposition.
of the codes
for
B. Accuracy. The subroutine SVD is n u m e r i c a l l y stable (I); that is each computed singular value is exact for a m a t r i x close to the original real rectangular matrix.
269
7.1-134
SUBROUTINE
SVD(NM,M,N,A,W,MATU,U,MATV,V,iERR,RVI)
C INTEGER I,J,K,L,M,N,II,II,KK,KI,LL,LI,MN,NM, REAL A(NM,N),W(N),U(NM,N),V(NM,N),RVI(N) R E A L C , F , G , H, S, X, Y, Z, E P S , S C A L E , M A C H E P REAL SQRT, AMAXI ~ABS, SIGN LOGICAL MATU,MATV C C C C
******~***
MACHEP
=
ITS,IERR
MACHEP IS A M A C H I N E DEPENDENT PARAMETER SPECIFYING THE RELATIVE PRECISION OF F L O A T I N G POINT ARITHMETIC.
?
C IERR
=
0
C DO
I00
1 =
l,
M
C DO
I00 C
i 0 0 J = I, N U(I,J) = A(I,J) CONTINUE ********** HOUSEHOLDER G = 0.0 SCALE = 0.0 X = 0.0
REDUCTION
C DO
3 0 0 1 = i, N L = I + i RVI(1) = SCALE * G G = 0.0 S = 0.0 SCALE = 0.0 IF (I .GT. M) GO TO
210
C 120
D O 120 K = I, SCALE = SCALE
M + ABS(U(K,I))
C IF
(SCALE
.EQ.
0.0)
GO
TO
C DO
130
130 K = I, M U(K,I) = U(K,I) / SCALE S = S + U(K,I)**2 CONTINUE
C F = U(I,I) G = -SIGN(SQRT(S),F) H = F * G - S U(I,I) = F - G IF (I .EQ° N) G O TO
190
C DO
150 J = L, S = 0.0
N
270
210
TO
BIDIAGONAL
FORM
*******e**
7.1-135
D O 1 4 0 K = I, M S = S + U(K,I) * U(K,J)
140
F=S/n DO
150
1 5 0 K = I, M U(K,J) = U(K,J) CONTINUE
190 200
DO 200 U(K,I)
210
W(I) = SCALE G = 0.0 S = 0.0 SCALE = 0.0 I F (I . G T . M
220
K
=
=
SCALE
I,
(SCALE
F
* U(K,I)
M
* U(K)I)
* G
.OR.
D O 2 2 0 K = L, SCALE = SCALE IF
+
N +
.EQ.
I
.EQ.
N)
GO
TO
ABS(U(I,K)) 0.0)
GO
TO
290
DO
230
2 3 0 K = L, N U(I,K) = U(I,K) / SCALE S = S + U(I,K)**2 CONTINUE
F = U(I,L) G = -SIGN(SQRT(S),F) H = F * G - S U(I,L) = F - G
240
250
DO 240 RVI(K)
K = L, N = U(I,K)
/ H
IF
(I
.EQ.
M)
GO
DO
260 J = S=0.0
L,
M
TO
270
D O 2 5 0 K = L, N S = S + U(J,K) * U(I,K)
260
260 K = L, N U(J,K) = U(J,K) CONTINUE
270 280
DO 280 U(I,K)
DO
290 300
K
=
=
SCALE
L,
+
S
* RVI(K)
N
* U(I)K)
X = AMAXI(X,ABS(W(I))+ABS(RVI(I))) CONTINUE
271
290
7.1-136
C
********** ACCUMULATION OF RIGHT-HAND IF ( . N O T . M A T V ) G O T O 4 1 0 ********** F O R I = N S T E P -I U N T I L 1 D O D O 4 0 0 II = i, N I = N + 1 - II IF (I .EQ. N) G O T O 3 9 0 IF (G .EQ. 0 . 0 ) G O T O 3 6 0
C
TRANSFORMATIONS --
**********
**********
C D O 3 2 0 J = L, N ********** DOUBLE DIVISION
C
320
V(J,I)
= (U(I,J)
DO
J = L, 0.0
AVOIDS
/ U(I,L))
POSSIBLE
UNDERFLOW
**********
/ C
C 350 S =
N
C D O 3 4 0 K = L, N S = S + U(I,K) * V(K,J)
340 C
DO
350
3 5 0 K = L, N V(K,J) = V(K,J) CONTINUE
360
DO
+
S * V(K,I)
C 3 8 0 J = L, N V(I,J) = 0.0 v(J,i) = 0.0 CONTINUE
380 C 390
400 C 410 C
V(I,I) = !°0 G = RVl(1) L = I CONTINUE ********** ACCUMULATION OF L E F T - H A N D TRANSFORMATIONS ********** IF ( . N O T . M A T U ) G O TO 5 1 0 **********FOR I=MIN(M,N) S T E P -i U N T I L 1 D O - - * * * * * * * * * * MN = N IF (M .LT. N) M N = M
C DO
5 0 0 II = I, M N I = M N + 1 - II L = I + i G = W(I) IF (I .EQ. N) G O
TO
430
C 420
DO 420 U(I,J)
J = L, = 0.0
N
C 430
IF IF
(G (I
DO
450 S =
.EQ. .EQ.
0.0) GO TO 475 MN) GO TO 460
C J -- L, 0.0
N
C 440
D O 4 4 0 K = L, M S = S + U(K,I) * U(K,J)
272
7.1-137
C
********** F =
DOUBLE DIVISION AVOIDS (S / U ( I , I ) ) / G
POSSIBLE
UNDERFLOW
**********
C DO
450
4 5 0 K = I, M U(K,J) = U(K,J) CONTINUE
460 470
DO 470 U(J,I)
+ F
* U(K,I)
C J = I, M = U(J,I)
/ G
C GO
TO
490
C 475 480
DO 480 U(J,I)
J = I, = 0.0
M
C 490 500 C 510 C
C
C 520
C C 530 C 540
U(I,I) = U(I,I) + 1.0 CONTINUE ********** DIAGONALIZATION OF THE BIDIAGONAL FORM *******~** E P S -- M A C H E P * X *~******~* F O R K = N S T E P -i U N T I L 1 D O - - * * * * * * * * * * D O 7 0 0 K K = I, N K1 = N - KK K = KI + 1 ITS = 0 ********** TEST FOR SPLITTING. F O R L = K S T E P -I U N T I L 1 D O -- * * * * * * * * * * D O 5 3 0 L L = I, K LI = K - LL L = L1 + 1 IF ( A B S ( R V I ( L ) ) .LE. E P S ) G O TO 5 6 5 ********** R V I ( 1 ) IS A L W A Y S Z E R O , S O T H E R E IS N O E X I T THROUGH THE BOTTOM OF THE LOOP *******~** IF ( A B S ( W ( L I ) ) .LE. E P S ) G O T O 5 4 0 CONTINUE ***~****** CANCELLATION OF RVI(L) IF L GREATER THAN I ********** C = 0.0 S = 1.0
C DO
5 6 0 1 = L, K F = S * RVI(1) RVI(1) = C * RVI(1) I F ( A B S ( F ) .LE. E P S ) g = W(1) H = SQRT (F*F+G*G) W(I) = H
C=G/~ S=-F IF
GO
TO
/H
(.NOT.
MATU)
GO
TO
560
273
565
7.1-138
DO
5 5 0 J = I, M Y = U(J,LI) Z = U(J,I) U(J,LI) = Y * C + U(J,I) = -Y * S + CONTINUE
550 560 565
Z Z
* *
S C
CONTINUE ********** TEST FOR CONVERGENCE ********** Z = W (K) I F (L . E Q . K ) G O T O 6 5 0 ********** SHIFT FROM BOTTOM 2 BY 2 MINOR IF (ITS .EQ. 30) GO TO i000 ITS = ITS + I X = W(L) Y = W(KI) G = RVI(KI)
H
=
**********
RVt(K)
F = ( ( Y - Z) * (Y + Z) + (G - H) * (G + H ) ) / ( 2 . 0 * H * Y) G = SQRT(F*F+I.0) F = ( ( X - Z) * (X + Z ) + H * (Y / (F + S I G N ( G , F ) ) - H)) / X ********** NEXT QR TRANSFORMATION ********** C = 1.0 S = 1.0 DO
6 0 0 II = L, I = I I + i G = RVI(~)
KI
Y = w(1) H = S * G G = C * G Z = SQRT (F*F+H*H) RVI(II) = Z C = F / Z
s = H / z F = X * C + G * S G = -X ~ S + G * C H = Y * S Y = Y * C !F (.NOT. MATV) GO
TO
DO
570 575
5 7 0 J = I, N X = V(J,ll) Z = V (J, I) V(J,II) = X * C + V(J,I) = -X * S + CONTINUE
575
Z * Z *
Z = SQRT (F*F+H*H) W(II) -- Z
274
S C
7.1-139
C
********** ROTATION CAN BE ARBITRARY IF (Z .EQ. 0 . 0 ) G O T O 5 8 0
IF
Z
IS
ZERO
**********
C=FIZ s=H/Z 580
F = C * G + S * Y X = -S * G + C * Y IF ( . N O T . M A T U ) G O
TO
600
C DO
590
5 9 0 J = i, M Y -- u ( J , i I ) Z = U(J,I) U(J,II) = Y * C + U(J,I) = -Y * S + CONTINUE
Z * S Z * C
C 600
CONTINUE
C
C 650 C
RVI(L) = 0.0 R V I (K) = F W(K) = X GO TO 520 ********** CONVERGENCE ********** I F (Z .GE. 0 . 0 ) G O T O 7 0 0 ********** W ( K ) IS M A D E N O N - N E G A T I V E W(K) = -Z IF ( . N O T . M A T V ) G O T O 7 0 0
**********
C 690
DO 690 V(J,K)
J =
= i, N -V(J,K)
C 700
CONTINUE
C GO TO 1001 **********
C C i000 1001
S E T E R R O R -- N O C O N V E R G E N C E TO A S I N G U L A R V A L U E A F T E R 30 I T E R A T I O N S
IERR = K RETURN END
275
**********
7.1-140
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F223-2
A Fortran
PACKAGE
TINVIT
IV S u b r o u t i n e to D e t e r m i n e of a S y m m e t r i c T r i d i a g o n a l
May, July,
(E!SPACK)
Some E i g e n v e c t o r s Matrix.
1972 1975
!. P U R P O S E ° T h e F o r t r a n IV s u b r o u t i n e TINVIT determines those e i g e n v e c t o r s of a s y m m e t r i c t r i d i a g o n a l m a t r i x c o r r e s p o n d i n g to a set of o r d e r e d a p p r o x i m a t e e i g e n v a l u e s , u s i n g i n v e r s e iteration.
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
T I N V I T ( N M , N , D , E , E 2 , M , W , IND,Z, IERR,RVI,RV2,RV3,RV4,RV6)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l array Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t for Z in the c a l l i n g p r o g r a m . is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x . N greater than NM.
set e q u a l to m u s t be not
is a w o r k i n g p r e c i s i o n real i n p u t o n e d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N c o n t a i n i n g the d i a g o n a l e l e m e n t s of the symmetric tridiagonal matrix.
276
7.1-141
is a w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N c o n t a i n i n g , in its last N-I positions, the s u b d i a g o n a l elements of the s y m m e t r i c t r i d i a g o n a l matrix. E(1) is arbitrary. E2
is a w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N containing, in its last N-I positions, the squares of the c o r r e s p o n d i n g e l e m e n t s of E w i t h zeros c o r r e s p o n d i n g to n e g l i g i b l e elements of E. (The s u c c e s s i v e s u b m a t r i c e s are located from the zeros of E2.) If MACHEP denotes the r e l a t i v e m a c h i n e p r e c i s i o n , then E(1) is c o n s i d e r e d n e g l i g i b l e if it is not larger than the p r o d u c t of M A C H E P and the sum of the m a g n i t u d e s of D(1) and D(I-I). E2(1) should c o n t a i n 0.0 if the e i g e n v a l u e s are in a s c e n d i n g order and 2.0 if the e i g e n v a ! u e s are in d e s c e n d i n g order. If subroutine BISECT (F294) or T R I D I B (F237) has b e e n used to d e t e r m i n e the e i g e n v a l u e s , their output E2 array is s u i t a b l e for input to TINVIT. is an integer input v a r i a b l e set equal to the n u m b e r of s p e c i f i e d e i g e n v a l u e s for w h i c h the c o r r e s p o n d i n g e l g e n v e c t o r s are to be d e t e r m i n e d .
W
is a w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least M c o n t a i n i n g the M specified eigenvalnes of the s y m m e t r i c t r i d i a g o n a l matrix. The e i g e n v a l u e s must be in either a s c e n d i n g or d e s c e n d i n g order in W. The o r d e r i n g is r e q u i r e d to insure the d e t e r m i n a t i o n of independent orthogonal eigenvectors a s s o c i a t e d with close eigenvalues.
IND
is an i n t e g e r input o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least M c o n t a i n i n g the s u b m a t r i x indices a s s o c i a t e d w i t h the corresponding M e i g e n v a l u e s in W. E i g e n v a l u e s b e l o n g i n g to the first s u b m a t r i x have index I, those b e l o n g i n g to the second s u b m a t r i x have index 2, etc. If BISECT or TRIDIB has been used to d e t e r m i n e the e i g e n v a l u e s , their output IND array is s u i t a b l e for input to TINVIT.
277
7.1-142
Z
is a w o r k i n g p r e c i s i o n r e a l o u t p u t t w o dimensional variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t M. It contains M o r t h o n o r m a l e i g e n v e c t o r s of the symmetric tridiagonal matrix corresponding to the M e i g e n v a l u e s in W.
IERR
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n code d e s c r i b e d in s e c t i o n 2B. The normal completion code zero.
to is
RVI,RV2,RV3 are w o r k i n g p r e c i s i o n r e a l t e m p o r a r y o n e d i m e n s i o n a l v a r i a b l e s of d i m e n s i o n at l e a s t N u s e d to s t o r e the m a i n d i a g o n a l and the two a d j a c e n t d i a g o n a l s of the t r i a n g u l a r m a t r i x p r o d u c e d in the i n v e r s e i t e r a t i o n process. RV4,RV6
B.
Error
are w o r k i n g p r e c i s i o n r e a l t e m p o r a r y o n e d i m e n s i o n a l v a r i a b l e s of d i m e n s i o n at l e a s t N. RV4 h o l d s the m u l t i p l i e r s of the G a u s s i a n e l i m i n a t i o n step in the i n v e r s e iteration process t RV6 h o l d s the a p p r o x i m a t e e i g e n v e c t o r s in this p r o c e s s .
Conditions
and R e t u r n s .
If m o r e t h a n 5 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an eigenvector, TINVlT t e r m i n a t e s the c o m p u t a t i o n for that e i g e n v e c t o r a n d sets IERR to -R where R is the i n d e x of the e i g e n v e c t o r . If this f a i l u r e o c c u r s for m o r e t h a n one e i g e n v e c t o r , the l a s t o c c u r r e n c e is r e c o r d e d in iERR. T h e c o l u m n s of Z c o r r e s p o n d i n g to f a i l u r e s of the a b o v e s o r t a r e set to zero v e c t o r s . If all the e i g e n v e c t o r s a r e d e t e r m i n e d iterations~ IERR is set to zero.
C. A p p l i c a b i l i t y
within
5
and R e s t r i c t i o n s .
To d e t e r m i n e s o m e of the e i g e n v a l u e s and e i g e n v e c t o r s of a full symmetric matrix~ TINVIT s h o u l d b e p r e c e d e d by T R E D I (F277) to p r o v i d e a s u i t a b l e s y m m e t r i c t r i d i a g o n a i m a t r i x for B I S E C T (F294), T R I D I B (F237), or I M T Q L V (F234) w h i c h c a n t h e n be u s e d to d e t e r m i n e the e i g e n v a l u e s . It s h o u l d h e f o l l o w e d b y TKBAKI (F279) to b a c k t r a n s f o r m the e i g e n v e c t o r s f r o m TINVlT into t h o s e of the o r i g i n a l m a t r i x .
278
7.1-143
To d e t e r m i n e some of the e i g e n v a l u e s and e i g e n v e c t o r s of a c o m p l e x H e r m i t i a n matrix, TINVIT s h o u l d be p r e c e d e d by H T R I D I (F284) to p r o v i d e a s u i t a b l e real s y m m e t r i c t r i d i a g o n a l m a t r i x for BISECT (F294), T R I D I B (F237), or I M T Q L V (F234). It s h o u l d then be f o l l o w e d by H T R I B K (F285) to b a c k t r a n s f o r m the e i g e n v e c t o r s from TINVIT into those of the o r i g i n a l matrix. Some of the e i g e n v a l u e s and e i g e n v e c t o r s of c e r t a i n nons y m m e t r i c t r i d i a g o n a l m a t r i c e s can be c o m p u t e d using the c o m b i n a t i o n of FIGI (F280), BISECT (F294) or TRIDIB (F237), TINVlT, and BAKVEC (F281). See F280 for the d e s c r i p t i o n of this s p e c i a l class of matrices. For these m a t r i c e s , TINVIT should be p r e c e d e d by FIGI to p r o v i d e a suitable s y m m e t r i c m a t r i x for BISECT or TRIDIB. It should then be f o l l o w e d by BAKVEC to b a c k t r a n s f o r m the e i g e n v e c t o r s from TINVIT into those of the o r i g i n a l matrix. The c o m p u t a t i o n of the e i g e n v e c t o r s by inverse i t e r a t i o n r e q u i r e s that the p r e c i s i o n of the e i g e n v a l u e s be c o m m e n s u r a t e w i t h small r e l a t i v e p e r t u r b a t i o n s of the order of MACHEP in the m a t r i x elements. For m o s t s y m m e t r i c t r i d i a g o n a l matrices, it is enough that the a b s o l u t e error in the e i g e n v a l u e s for which e i g e n v e c t o r s are d e s i r e d be a p p r o x i m a t e l y MACHEP times a n o r m of the matrix. But some m a t r i c e s r e q u i r e a s m a l l e r a b s o l u t e error, p e r h a p s as small as MACHEP times the e i g e n v a l u e of smallest m a g n i t u d e .
3. D I S C U S S I O N
OF M E T H O D AND A L G O R I T H M .
The c a l c u l a t i o n s p r o c e e d as follows. First, the E2 array is i n s p e c t e d for the p r e s e n c e of a zero element d e f i n i n g a submatrix. The e i g e n v a l u e s b e l o n g i n g to this s u b m a t r i x are i d e n t i f i e d by their common s u b m a t r i x index in IND. The e i g e n v e c t o r s of the s u b m a t r i x are then c o m p u t e d by inverse iteration. First, the LU d e c o m p o s i t i o n of the s u b m a t r l x with an a p p r o x i m a t e e i g e n v a l u e s u b t r a c t e d from its d i a g o n a l elements is a c h i e v e d by G a u s s i a n e l i m i n a t i o n using p a r t i a l pivoting. The m u l t i p l i e r s d e f i n i n g the lower triangular matrix L are stored in the t e m p o r a r y array RV4 and the upper t r i a n g u l a r m a t r i x U is stored in the three t e m p o r a r y arrays RVI, RV2, and RV3. Saving these q u a n t i t i e s in RVl, RV2, RV3, and RV4 avoids r e p e a t i n g the LU d e c o m p o s i t i o n if further i t e r a t i o n s are required. An a p p r o x i m a t e vector, stored in RV6, is c o m p u t e d s t a r t i n g from an i n i t i a l vector, and the n o r m of the a p p r o x i m a t e v e c t o r is c o m p a r e d w i t h a n o r m of the s u b m a t r i x to d e t e r m i n e w h e t h e r the growth is s u f f i c i e n t to accept it as an eigenvector. If this vector is accepted, its E u c l i d e a n n o r m
279
7.1-144
is made io If the growth is not sufficient, this v e c t o r is used as the i n i t i a l v e c t o r in c o m p u t i n g the next a p p r o x i m a t e vector. This i t e r a t i o n p r o c e s s is r e p e a t e d at m o s t 5 times. E i g e n v e c t o r s c o m p u t e d in the above way c o r r e s p o n d i n g to w e l l s e p a r a t e d e i g e n v a l u e s of this s u b m a t r i x w i l l be orthogonal. However, e i g e n v e c t o r s c o r r e s p o n d i n g to close e i g e n v a l u e s of this s u b m a t r i x may not be s a t i s f a c t o r i l y o r t h o g o n a l . Hence, to i n s u r e o r t h o g o n a l e i g e n v e c t o r s , each a p p r o x i m a t e v e c t o r is made o r t h o g o n a l to those p r e v i o u s l y c o m p u t e d e i g e n v e c t o r s w h o s e e i g e n v a l u e s are close to the current e i g e n v a l u e . If the o r t h o g o n a l i z a t i o n p r o c e s s p r o d u c e s a zero v e c t o r , a c o l u m n of the i d e n t i t y m a t r i x is used as an i n i t i a l v e c t o r for the n e x t i t e r a t i o n . I d e n t i c a l e i g e n v a l u e s are p e r t u r b e d s l i g h t l y in an a t t e m p t to obtain independent eigenvectors. These p e r t u r b a t i o n s are not r e c o r d e d in the e i g e n v a l u e array W. The above steps are r e p e a t e d e i g e n v e c t o r s are computed.
on each
s u b m a t r i x until
all
the
This s u b r o u t i n e is a s u b s e t (except for the r e s o l u t i o n of n o n - c o n v e r g e n t e i g e n v e c t o r s ) of the F o r t r a n s u b r o u t i n e T S T U R M (F293), w h i c h is a t r a n s l a t i o n of the A l g o l p r o c e d u r e TRISTURM w r i t t e n and d i s c u s s e d in d e t a i l by Peters and W i l k i n s o n (I).
4. R E F E R E N C E S .
i)
Peters, G. and W i l k i n s o n ~ J.H., The C a l c u l a t i o n of S p e c i f i e d E i g e n v e c t o r s by Inverse I t e r a t i o n , H a n d b o o k A u t o m a t i c C o m p u t a t i o n , V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/18, 418-439, S p r i n g e r - V e r l a g , 1971.
5. CHECKOUTI A. Test
Cases.
See the s e c t i o n d i s c u s s i n g testing of the codes for c o m p l e x H e r m i t i a n , real s y m m e t r i c , real s y m m e t r i c t r i d i a g o n a l , and c e r t a i n real n o n - s y m m e t r i c tridiagonal matrices.
280
for
7.1-145
B. A c c u r a c y . T h e a c c u r a c y of TINVIT can b e s t be d e s c r i b e d in t e r m s of its r o l e in t h o s e p a t h s of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of r e a l s y m m e t r i c m a t r i c e s and m a t r i x s y s t e m s . In t h e s e p a t h s ~ this s u b r o u t i n e is n u m e r i c a l l y s t a b l e (i). This s t a b i l i t y c o n t r i b u t e s to the p r o p e r t y of t h e s e p a t h s that the c o m p u t e d e i g e n v a l u e s a r e the e x a c t e i g e n v a l u e s of a m a t r i x or s y s t e m c l o s e to the o r i g i n a l m a t r i x or s y s t e m and the c o m p u t e d e i g e n v e c t o r s are c l o s e (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that m a t r i x or system.
281
7.1-146
SUBROUTINE
TINVIT(NM,N,D,E,E2,M,W,IND,Z, IERR,RVI,RV2,RV3,RV4,RV6)
X
INTEGER I,J,M,N,P,Q,R,S,II,IP,JJ,NM, ITS,TAG,IERR,GROUP REAL D(N),E(N),E2(N),W(M),Z(NM,M), X RVI(N),RV2(N),RV3(N),RV4(N),RV6(N) REAL U~V~UK,XU,X0jXI,EPS2,EPS3~EPS4,NORM,ORDER~MACHEP REAL SQRT,ABS,FLOAT INTEGER IND(M) **********
MACHEP IS A M A C H I N E DEPENDENT PARAMETER SPECIFYING THE RELATIVE PRECISION OF F L O A T I N G POINT ARITHMETIC. *******@**
MACHEP
i00
=
?
IERR = 0 IF (M .EQ. 0) GO TO TAG = 0 O R D E R = 1.0 - E 2 ( 1 ) Q = 0 ********** ESTABLISH P = Q + i
i001
AND
PROCESS
NEXT
**********
DO
120 140
120 Q = P, N IF (Q ,EQ. N) GO TO 140 IF ( E 2 ( Q + I ) .EQ. 0 . 0 ) G O TO 140 CONTINUE ********** FIND VECTORS BY I N V E R S E TAG = TAG + I S = 0
SUBMATRIX
DO
9 2 0 R = I, M IF ( I N D ( R ) .NE. ITS = 1 El
490
500
=
TAG)
GO
TO
ITERATION
**********
920
W(R)
IF (S .NE. 0) GO TO 5 1 0 ********** CHECK FOR ISOLATED XU = 1,0 IF (P .NE. Q) GO TO 4 9 0 R V 6 ( P ) = 1.0 G O TO 8 7 0 NORM = ABS(D(P)) IP = P + i
ROOT
**********
DO 500 1 = IP, Q NORM = NORM + ABS(D(1)) + ABS(E(1)) ********** E P S 2 IS T H E C R I T E R I O N FOR GROUPING, EPS3 REPLACES ZERO PIVOTS AND EQUAL ROOTS ARE MODIFIED BY E P S 3 , E P S 4 IS T A K E N V E R Y S M A L L TO A V O I D O V E R F L O W EPS2 = 1.0E-3 * NORM EPS3 = MACHEP * NORM UK = FLOAT(Q-P+1)
282
**********
7.1-147
505
510
520
EPS4 = UK * EPS3 UK = EPS4 / SQRT(UK) S=P GROUP = 0 GO TO 520 • ********* LOOK FOR CLOSE OR COINCIDENT ROOTS ********** IF (ABS(XI-X0) .GE. EPS2) GO TO 505 GROUP = GROUP + 1 I F ( O R D E R * (El - X O ) . L E . 0 . 0 ) X 1 = X 0 + O R D E R * EPS3 • ********* ELIMINATION WITH INTERCHANGES AND INITIALIZATION OF VECTOR ********** V = 0.0 DO
540
560 580
5 8 0 1 = P, Q RV6(I) = UK I F (I . E Q . P) G O T O 5 6 0 IF (ABS(E(I)) .LT. ABS(U)) GO TO 540 ********** WARNING -- A DIVIDE CHECK MAY OCCUR HERE E2 ARRAY HAS NOT BEEN SPECIFIED CORRECTLY XU = U / E(1) RV4(1) = XU RVl(I-I) = E(I) RV2(I-I) = D(1) - XI RV3(l-l) = 0.0 I F (I . N E . Q) R V 3 ( I - I ) = E(I+I) U = V - XU * RV2(I-I) V = -XU * RV3(I-I) GO TO 580 XU = E(1) / U RV4(I) = XU RVI(I-I) = U RV2(I-1) = V RV3(I-I) = 0.0 U = D(I) - X1 - XU * V I F (I . N E . Q) v = E ( I + I ) CONTINUE
IF **********
I F (U .EQ. 0 . 0 ) U = E P S 3 RVI(Q) = U RV2(Q) = 0.0 RV3(Q) = 0.0 *********~ BACK SUBSTITUTION FOR I=Q STEP -i UNTIL P DO -- ********** D O 6 2 0 I ! = P, Q 600 I = P + Q - II RV6(1) = (RV6(1) - U * RV2(1) - V * RV3(1)) / RVI(1) V = U U = R V 6 (I) CONTINUE 620 ********** ORTHOGONALIZE WITH RESPECT TO PREVIOUS MEMBERS OF GROUP ********** IF (GROUP . E Q . 0) G O T O 7 0 0 J -- R
283
7.1-148
DO
630
6 8 0 JJ = I, G R O U P J = J - 1 IF ( I N D ( J ) .NE. T A G ) XU = 0 . 0
640
DO XU
6 4 0 1 = P, Q = XU + R V 6 ( I )
660
DO 6 6 0 RV6(I)
1 = P, Q = RV6(I) - XU
CONTINUE
700
NORM
720
DO 720 I = P, Q NORM = NORM + ABS(RV6(1))
740
760
780
TO
* Z(I,J)
0.0
IF ( N O R M .GE. 1.0) GO TO 8 4 0 ********** FORWARD SUBSTITUTION IF (ITS .EQ. 5) GO TO 8 3 0 IF ( N O R M .NE. 0 . 0 ) GO TO 740 RV6(S) = EPS4 S = S + I IF (S .GT. Q) S = P GO TO 78O XU = E P S 4 / N O R M DO 7 6 0 1 = F, Q RV6(I) = RV6(1) * XU • ********* ELIMINATION OPERATIONS ITERATE ********** DO 8 2 0 I = IP, Q u
=
630
* Z(I,J)
680
=
GO
**********
ON
NEXT
VECTOR
R V 6 (I)
• *********
800 820
C 830
IF R V I ( I - I ) ,EQ, E ( I ) , A R O W I N T E R C H A N G E WAS PERFORMED EARLIER IN T H E TRIANGULARIZATION PROCESS ********** IF ( R V I ( I - I ) .NE. E ( I ) ) G O TO 8 0 0 U = RV6(I-I) RV6(I-I) = RV6(1) RV6(1) = U - RV4(1) * RV6(I-I) CONTINUE
ITS = ITS + i GO TO 6 0 0 ********** S E T E R R O R -- N O N - C O N V E R G E D EIGENVECTOR IERR = -R 0.0 XU GO T O 8 7 0 ********** NORMALIZE SO T H A T S U M OF S Q U A R E S IS 1 A N D E X P A N D TO F U L L O R D E R * * * * * * * * * * U = 0.0 =
C C 840
284
**********
7.1-149
860
D O 8 6 0 1 = P, Q U = U + RV6(1)**2 XU
=
1.0
/ SQRT(U)
870 880
DO 8 8 0 Z(I,R)
1 = i, = 0.0
900
DO 9 0 0 Z(I,R)
1 = P, Q = RV6(1) * XU
XO
920
I001
=
N
Xl
CONTINUE I F (q . L T . RETURN END
N) GO TO 100
285
7.1-150
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F235
PACKAGE
(E!SPACK)
TQLRAT
A Fortran IV Subroutine to D e t e r m i n e the E i g e n v a l u e s of a Symmetric T r i d i a g o n a l Matrix.
July,
1975
I. PURPOSE. The F o r t r a n IV s u b r o u t i n e of a symmetric t r i d i a g o n a l the QL method.
TQLRAT matrix
determines the e i g e n v a l u e s using a r a t i o n a l v a r i a n t of
2. USAGE. A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
TQLRAT(N,D,E2,1ERR)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for various m a c h i n e s is given in the section d i s c u s s i n g certification. is an integer input v a r i a b l e the order of the matrix.
set equal
to
is a w o r k i n g p r e c i s i o n real o n e - d l m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N. On input, it contains the d i a g o n a l elements of the symmetric t r l d i a g o n a l matrix. On output, it contains the e i g e n v a l u e s of this m a t r i x in a s c e n d i n g order. E2
is a w o r k i n g p r e c i s i o n real o n e - d l m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N. On input, the last N-I p o s i t i o n s in this array contain the squares of the s u b d i a g o n a l e l e m e n t s of the s y m m e t r i c t r i d i a g o n a l matrix. E2(1) is arbitrary. Note that TQLRAT destroys E2.
286
7.1-151
IERR
B. E r r o r
is an i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n c o d e d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n c o d e zero.
Conditions
and
to is
Returns.
If m o r e than 30 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e , TQLRAT terminates with IERR set to the i n d e x of the e i g e n v a l u e for w h i c h the f a i l u r e occurs. T h e e i g e n v a l u e s in the D a r r a y s h o u l d be c o r r e c t for i n d i c e s 1,2,...,IERR-I. These eigenvalues are o r d e r e d but are n o t n e c e s s a r i l y the s m a l l e s t IERR-I eigenvalues. If all the e i g e n v a l u e s are d e t e r m i n e d iterations, IERR is set to zero.
C. A p p l i c a b i l i t y
within
30
and R e s t r i c t i o n s .
To d e t e r m i n e the e i g e n v a l u e s of a f u l l s y m m e t r i c m a t r i x , TQLRAT s h o u l d b e p r e c e d e d by T R E D I (F277) to p r o v i d e a s u i t a b l e s y m m e t r i c t r i d i a g o n a l m a t r i x for TQLRAT. To d e t e r m i n e the e i g e n v a l u e s of a c o m p l e x H e r m i t i a n matrix, TQLRAT s h o u l d be p r e c e d e d by H T R I D I (F284) to p r o v i d e a s u i t a b l e r e a l s y m m e t r i c t r i d i a g o n a l m a t r i x for TQLRAT. TQLRAT d o e s n o t p e r f o r m w e l l on m a t r i c e s w h o s e s u c c e s s i v e r o w sums v a r y w i d e l y in m a g n i t u d e and a r e n o t s t r i c t l y i n c r e a s i n g f r o m the f i r s t to the last row. The subroutine I M T Q L I (F291) is not s e n s i t i v e to s u c h r o w sums and is t h e r e f o r e r e c o m m e n d e d for s y m m e t r i c t r i d i a g o n a l m a t r i c e s w h o s e s t r u c t u r e is not k n o w n .
3. D I S C U S S I O N
OF M E T H O D
AND
ALGORITHM.
The e i g e n v a l u e s are d e t e r m i n e d by a r a t i o n a l v a r i a n t of the QL method. The e s s e n c e of this m e t h o d is a p r o c e s s w h e r e b y a s e q u e n c e of s y m m e t r i c t r i d i a g o n a l m a t r i c e s , u n i t a r i l y s i m i l a r to the o r i g i n a l s y m m e t r i c t r i d i a g o n a l m a t r i x , is f o r m e d w h i c h c o n v e r g e s to a d i a g o n a l m a t r i x . T h e r a t e of c o n v e r g e n c e of this s e q u e n c e is i m p r o v e d by s h i f t i n g the o r i g i n at each i t e r a t i o n . B e f o r e the i t e r a t i o n s for e a c h e i g e n v a l u e , the s y m m e t r i c t r i d i a g o n a l m a t r i x is c h e c k e d for a p o s s i b l e s p l i t t i n g into s u b m a t r i c e s . If a s p l i t t i n g o c c u r s , o n l y the u p p e r m o s t s u b m a t r i x p a r t i c i p a t e s in the n e x t iteration. T h e e i g e n v a l u e s are o r d e r e d in a s c e n d i n g o r d e r as they are found.
287
7.1-152
The origin shift at each i t e r a t i o n is the e i g e n v a l u e of the current u p p e r m o s t 2x2 p r i n c i p a l minor closer to the first diagonal element of this minor. W h e n e v e r the u p p e r m o s t Ixl p r i n c i p a l s u b m a t r i x finally splits from the rest of the matrix, its element is taken to be an e i g e n v a l u e of the original m a t r i x and the a l g o r i t h m proceeds with the remaining submatrix. This process is c o n t i n u e d until the m a t r i x has split c o m p l e t e l y into s u b m a t r i e e s of order i. The tolerances in the s p l i t t i n g tests are p r o p o r t i o n a l to the relative m a c h i n e precision. This s u b r o u t i n e is a t r a n s l a t i o n of the Algol p r o c e d u r e TQLRAT w r i t t e n and d i s c u s s e d in detail by R e i n s c h (I). It is a rational v a r i a n t of the s u b r o u t i n e TQLI which is a t r a n s l a t i o n of the Algol p r o c e d u r e TQLI w r i t t e n and d i s c u s s e d in detail by Bowdler, Martin, Reinsch, and W i l k i n s o n (2).
4. REFERENCES,
i)
Reinseh, C.H., A Stable R a t i o n a l QR A l g o r i t h m for C o m p u t a t i o n of the E i g e n v a l u e s of an Hermitian, T r i d i a g o n a l Matrix, Math. Comp. 25,591-597 (1971). ( A l g o r i t h m 464, Comm. ACM 16,689 (1973).)
2)
Bowdler, H., Martin, R.S., Reinsch, C., and Wilkinson, J.H., The QR and QL A l g o r i t h m s for S y m m e t r i c M a t r i c e s , Num. Math. 11,293-306 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/3, 227-240, S p r i n g e r - V e r l a g , 1971.)
the
5. CHECKOUT° Ao
Test
Cases~
See the section d i s c u s s i n g testing of the codes for complex Hermitian, real symmetric, real s y m m e t r i c tridiagonal, and certain real n o n - s y m m e t r i c t r i d i a g o n a l matrices.
B. Accuracy. The s u b r o u t i n e TQLRAT is n u m e r i c a l l y stable (1,2); that is~ the computed e i g e n v a l u e s are close to those of the original matrix. In addition, they are the exact e i g e n v a l u e s of a m a t r i x close to the o r i g i n a l real symmetric t r i d i a g o n a l matrix.
288
7.1-153
SUBROUTINE
TQLRAT(N,D,E2,1ERR)
C INTEGER I, J, L , M , N, II, L1 ,MML, I E R R R E A L D ( N ) ,E2 (N) R E A L B~ C , F , G , H , P , R , S , M A C H E P REAL SQRT,ABS ~SIGN C C C C
**~*******
MACHEP
=
MACHEP IS A M A C H I N E DEPENDENT PARAMETER SPECIFYING THE RELATIVE PRECISION OF F L O A T I N G POINT ARITHMETIC.
?
C IERR = 0 IF (N .EQ.
i)
GO
TO
i001
C I00
DO I 0 0 1 = 2, N E2(I-I) = E2(1)
C F = 0.0 B = 0.0 E2(N) = 0.0 C DO
C 105 C C Ii0
2 9 0 L = i, N J = 0 H = MACHEP * (ABS(D(L)) + SQRT(E2(L))) IF (B .GT. H) GO TO 105 B = H C = B * B ********** LOOK F0R SMALL SQUARED SUB-DIAGONAL ELEMENT D O ii0 M = L, N IF ( E 2 ( M ) .LE. C) GO TO 120 ********** E 2 ( N ) IS A L W A Y S Z E R O , SO T H E R E IS NO E X I T THROUGH T H E B O T T O M OF T H E L O O P * * * * * * * * * * CONTINUE
C 120 130 C
IF (M .EQ. L) GO T O 2 1 0 IF (J .EQ. 30) G O TO I 0 0 0 J = J + 1 ***~****** FORM SHIFT ********** LI = L + I S = SQRT(E2(L)) G
=
D(L)
P = ( D ( L I ) - G) / (2.0 * S) R = SQRT(P*P+I.0) D ( L ) = S / (P + S I G N ( R , P ) ) H = G - D(L) C 140
DO 140 1 = LI, N D(I) = D(1) - H F = F +
H
289
**********
7.1-154
200
C
210 C C
230 250
270 290
********** RATIONAL QL TRANSFORMATION ********** G = D (M) I F (G . E Q . 0 . 0 ) G = B H = G S = 0.0 MML = M - L ~********* FOR I=M-I STEP -i UNTIL L DO -- ~**~***~** D O 2 0 0 I I = i, M M L I = M - II p = G ~ H R = e + E2(1) E2(I+I) = S * R S = E2(1) / R D(I+I) = H + S * (H + D ( 1 ) ) G = D(1) - E2(1) / G I F (G . E Q . 0 . 0 ) G = B H = G * P / R CONTINUE E2(L) = S * G D (L) = H ********** GUARD AGAINST UNDERFLOW IN CONVERGENCE TEST I F (H .EQ. 0 . 0 ) G O T O 2 1 0 IF (ABS(E2(L)) .LE. A B S ( C / H ) ) GO TO 210 E2(L) = H * E2(L) IF (E2(L) .NE. 0.0) GO TO 130 P = D(L) + F ********** ORDER EIGENVALUES ********** I F (L . E Q . i) G O T O 2 5 0 ********** FOR I=L STEP -i UNTIL 2 DO -- ********** D O 2 3 0 I I = 2, L I = L + 2 - II I F (e . G E . D ( I - I ) ) GO TO 270 D(1) = D(I-I) CONTINUE I = I D(1) = CONTINUE GO TO I001 **********
i000 i001
IERR = RETURN END
P
SET ERROR EIGENVALUE
-- NO CONVERGENCE TO AFTER 30 ITERATIONS
L
290
AN **********
**********
7.1-155
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F290-2
PACKAGE
(EISPACK)
TQL2
A Fortran IV Subroutine to D e t e r m i n e the E i g e n v a l u e s E i g e n v e c t o r s of a Symmetric T r i d i a g o n a l Matrix.
May, July,
and
1972 1975
I. PURPOSE. The F o r t r a n IV subroutine TQL2 d e t e r m i n e s the eigenvalues and e i g e n v e c t o r s of a symmetric t r i d l a g o n a l matrix. TQL2 uses the QL method to compute the e i g e n v a l u e s and accumulates the QL t r a n s f o r m a t i o n s to compute the elgenvectors. The e l g e n v e c t o r s of a full s y m m e t r i c m a t r i x can also be computed directly by TQL2, if TRED2 (F278) has been used to reduce this m a t r i x to trldiagonal form.
2. USAGE. A. Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
TQL2(NM, N , D , E , Z , I E R R )
The parameters are d i s c u s s e d below and the i n t e r p r e t a t i o n of working p r e c i s i o n for various machines is given in the section d i s c u s s i n g certification. NM
is an integer input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l array Z as s p e c i f i e d in the D I M E N S I O N statement for Z in the calling program. is an integer input v a r i a b l e the order of the matrix. N greater than NM.
set equal to must be not
is a w o r k i n g p r e c i s i o n real o n e - d l m e n s i o n a l variable of d i m e n s i o n at least N. On input, it contains the diagonal elements of the symmetric tridiagonal matrix. On output, it contains the eigenvalues of this m a t r i x in a s c e n d i n g order.
291
7.1-156
is a w o r k i n g p r e c i s i o n r e a l o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N. On i n p u t , the last N-I p o s i t i o n s in this a r r a y c o n t a i n the s u b d i a g o n a l e l e m e n t s of the s y m m e t r i c t r i d i a g o n a l m a t r i x . E(1) is arbitrary. N o t e that TQL2 destroys E. is a w o r k i n g p r e c i s i o n r e a l t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. If the e i g e n v e c t o r s of the s y m m e t r i c t r i d i a g o n a l m a t r i x are d e s i r e d , t h e n on input~ Z c o n t a i n s the i d e n t i t y m a t r i x of o r d e r N, and on o u t p u t ~ c o n t a i n s the o r t h o n o r m a l e i g e n v e c t o r s of this t r i d i a g o n a ! m a t r i x . If the e i g e n v e c t o r s of a f u l l s y m m e t r i c m a t r i x a r e d e s i r e d , t h e n on i n p u t , Z c o n t a i n s the t r a n s f o r m a t i o n m a t r i x p r o d u c e d in TRED2 w h i c h r e d u c e d the f u l l m a t r i x to t r i d i a g o n a l form, and on o u t p u t ~ c o n t a i n s the o r t h o n o r m a l e i g e n v e c t o r s of this f u l l symmetric matrix. IERR
B° E r r o r
is a n i n t e g e r o u t p u t v a r i a b l e set e q u a l an e r r o r c o m p l e t i o n c o d e d e s c r i b e d in s e c t i o n 2B. The n o r m a l c o m p l e t i o n c o d e zero.
Conditions
and
to is
Returns°
If m o r e t h a n 30 i t e r a t i o n s are r e q u i r e d to d e t e r m i n e an e i g e n v a l u e , TQL2 terminates with IERR set to the i n d e x of the e i g e n v a l u e for w h i c h the f a i l u r e o c c u r s . T h e e i g e n v a l u e s a n d e i g e n v e c t o r s in the D and Z a r r a y s s h o u l d be c o r r e c t for i n d i c e s 1,2,...,!ERR-I, b u t the e i g e n v a l u e s are u n o r d e r e d . If all the e i g e n v a l u e s are d e t e r m i n e d iterations, IERR is set to zero.
Co A p p l i c a b i l i t y
and
within
30
Restrictions.
To d e t e r m i n e the e i g e n v a l u e s a n d e i g e n v e c t o r s of a f u l l symmetric matrix, TQL2 s h o u l d be p r e c e d e d b y TRED2 (F278) to p r o v i d e a s u i t a b l e s y m m e t r i c t r i d i a g o n a l m a t r i x for TQL2.
292
7.1-157
To d e t e r m i n e the e i g e n v a l u e s and e i g e n v e c t o r s of a complex H e r m i t i a n matrix, TQL2 should be preceded by HTRIDI (F284) to provide a suitable real symmetric tridiagonal m a t r i x for TQL2,' and the input array Z to TQL2 should be initialized to the identity matrix. TQL2 should then be followed by H T R I B K (F285) to back transform the e i g e n v e c t o r s from TQL2 into those of the original matrix. TQL2 does not p e r f o r m well on matrices whose successive row sums vary w i d e l y in m a g n i t u d e and are not strictly increasing from the first to the last row. The subroutine IMTQL2 (F292) is not s e n s i t i v e to such row sums and is therefore r e c o m m e n d e d for symmetric tridiagonal matrices whose structure is not known.
3. D I S C U S S I O N
OF METHOD
AND ALGORITHM.
The eigenvalues are determined by the QL method. The essence of this method is a process w h e r e b y a sequence of symmetric tridiagonal matrices, unitarily similar to the original symmetric tridiagonal matrix, is formed which converges to a diagonal matrix. The rate of convergence of this sequence is improved by shifting the origin at each iteration. Before the iterations for each eigenvalue, the symmetric tridiagonal m a t r i x is checked for a possible splitting into submatrices. If a splitting occurs, only the u p p e r m o s t s u b m a t r i x p a r t i c i p a t e s in the next iteration. The similarity t r a n s f o r m a t i o n s used in each iteration are a c c u m u l a t e d in the Z array, p r o d u c i n g the o r t h o n o r m a l e i g e n v e c t o r s for the original matrix. Finally, the eigenvalues are ordered in ascending order and the e i g e n v e c t o r s are ordered consistently. The origin shift at each i t e r a t i o n is the eigenvalue of the current u p p e r m o s t 2x2 p r i n c i p a l minor closer to the first diagonal element of this minor. W h e n e v e r the u p p e r m o s t ixl p r i n c i p a l s u b m a t r i x finally splits from the rest of the matrix, its element is taken to be an e i g e n v a l u e of the original m a t r i x and the a l g o r i t h m proceeds with the r e m a i n i n g submatrixo This process is continued until the matrix has split completely into submatrices of order i. The tolerances in the splitting tests are p r o p o r t i o n a l to the relative m a c h i n e precision. This subroutine is a translation of the A l g o l p r o c e d u r e TQL2 w r i t t e n and discussed in detail by Bowdler, Martin, Reinsch, and W i l k i n s o n (i).
293
7.1-158
4. REFERENCES.
I)
Bowdler~ H., Martin, R.S., Reinsch, C., and Wilkinson, J~H., The QR and QL A l g o r i t h m s for Symmetric Matrices, Num. Math. 11,293-306 (1968). (Reprinted in H a m d b o o k for A u t o m a t i c Computation, Volume II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/3, 227-240, S p r i n g e r - V e r l a g , 1971.)
5. CHECKOUT. As Test Cases. See the section d i s c u s s i n g testing of the codes for complex Hermitian, real symmetric, real symmetric tridiagonal, and certain real n o n - s y m m e t r i c tridiagonal matrices.
B. Accuracy~ The subroutine TQL2 is n u m e r i c a l l y stable (I); that is, the computed eigenvalues are close to those of the original matrix. In addition, they are the exact eigenvalues of a matrix close to the original real symmetric t r i d i a g o n a l m a t r i x and the computed eigenvectors are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that matrix.
294
7,1-159
SUBROUTINE
T Q L 2 (NM, N, D, E, Z, I E R R )
C INTEGER I, J , K , L , M , N, II, L I , N M , M M L , REAL D(N),E(N),Z(NM,N) R E A L B, C , F , G , H , P , R, S , M A C H E P REAL SQRT,ABS, SIGN C C C C
***~*****~
MACHEP
=
IERR
MACHEP IS A M A C H I N E DEPENDENT PARAMETER SPECIFYING THE RELATIVE PRECISION OF FLOATING POINT ARITHMETIC.
?
C IERR = 0 IF (N .EQ.
I) G O
TO
I001
C i00
DO I00 E(I-I)
1 = 2, = E(1)
N
C F = 0.0 B = 0.0 E(N) = 0.0 C DO
C
C C Ii0
2 4 0 L = i, N J = 0 H = MACHEP * (ABS(D(L)) + ABS(E(L))) IF (B .LT. H) B = H *~***~**** LOOK FOR SMALL SUE-DIAGONAL ELEMENT ****~***** D O ii0 M = L, N IF ( A B S ( E ( M ) ) .LE. B) G O TO 1 2 0 ********e* E ( N ) IS A L W A Y S Z E R O , SO T H E R E IS NO E X I T T H R O U G H T H E B O T T O M OF T H E L O O P ~ * * ~ * * * * * * CONTINUE
C 120 130 C
IF (M .EQ. L) GO TO 2 2 0 IF (J .EQ. 30) G O TO i 0 0 0 J = J + I ********** FORM SHIFT ****~***** L1 = L + i G = D(L) P = ( D ( L I ) - G) / ( 2 . 0 * E ( L ) ) R = SQRT(P*P+I.0) D ( L ) = E ( L ) / (P + S I G N ( R , P ) ) H = C - D(L)
C 140
D O 140 1 = LI, N D(1) = D(1) - H
C C
F = F + H *********~ QL T R A N S F O R M A T I O N P = D (M) C = 1.0 S= 0.0 MML = M - L
295
********~*
7.1-160
C
********** FOR I=M-I STEP -i UNTIL L DO -D O 2 0 0 I I = I, M M L I = M - II G = C * E(1) H = C * P IF (ABS(P) .LT. ABS(E(1))) GO TO 150 C = E(1) / e R = SQRT(C*C+I.0) E(i+I) = S * P * R
**********
S=C/R 150
160 C
180
C = 1.0 / R GO TO 160 C = e / E(1) R = SQRT(C*C+I.0) E(I+I) = S * E(1) * R S = 1.0 / R C = C * S P = C * D(1) - S * G D(I+!) = H + S * (C * G + S * D ( I ) ) ********** FORM VECTOR ********** D O 1 8 0 K = i, N H = Z(K,I+I) Z(K,I+I) = S * Z(K,I) + C * H Z(K,I) = C * Z(K,I) - S * H CONTINUE
C 200
CONTINUE
C
220 240 C
E(L) = S * e D(L) = C * P IF (ABS(E(L)) D(L) = D(L) + CONTINUE ********** ORDER D O 3 0 0 II = 2, N I = II - 1 K = I P = D(1)
.GT. F
B)
GO
EIGENVALUES
TO
130
AND
C DO
260
2 6 0 J = II, N IF ( D ( J ) .GE. K = J e = D(J) CONTINUE
P)
GO
TO
300
TO
C I F ( K ~ E Q . I) D(K) = D(1) O(1)
=
GO
e
C DO
280
2 8 0 J = i, N P = Z(J,I) Z(J,I) = Z(J,E) Z(J,K) = P CONTINUE
296
260
EIGENVECTORS
*~********
7.1-161
C 300
CONTINUE
C G O TO i 0 0 1 **~***~ee
C C i000 1001
S E T E R R O R -- N O C O N V E R G E N C E TO EIGENVALUE A F T E R 30 I T E R A T I O N S
IERR = L RETURN END
297
AN *~****e***
7.1-162
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F279-2
PACKAGE
(EISPACK)
TRBAKI
A F o r t r a n IV S u b r o u t i n e to B a c k T r a n s f o r m the E i g e n v e e t o r s of that S y m m e t r i c T r i d i a g o n a l M a t r i x D e t e r m i n e d by TREDI.
May, July,
1972 1975
I. P U R P O S E . T h e F o r t r a n IV s u b r o u t i n e TRBAKI f o r m s the e i g e n v e c t o r s a real s y m m e t r i c m a t r i x f r o m the e i g e n v e c t o r s of that s y m m e t r i c t r i d i a g o n a l m a t r i x d e t e r m i n e d by T R E D I (F277).
of
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
TRBAKI(NM, N,A,E,M,Z)
T h e p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and Z in the calling program. is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x . N greater than NM.
set e q u a l to m u s t be not
is a w o r k i n g p r e c i s i o n r e a l i n p u t t w o dimensional variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. The s t r i c t l o w e r t r i a n g l e of A contains some i n f o r m a t i o n a b o u t the o r t h o g o n a l t r a n s f o r m a t i o n s u s e d in the r e d u c t i o n to the t r i d i a g o n a l form. The remaining upper part of the m a t r i x is a r b i t r a r y . See section 3 of F277 for the d e t a i l s .
298
7.1-163
is a w o r k i n g p r e c i s i o n real input oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N containing, in its last N-I positions, the s u b d i a g o n a l e l e m e n t s of the t r i d i a g o n a l matrix. The e l e m e n t E(1) is a r b i t r a r y . These elements serve to p r o v i d e the r e m a i n i n g i n f o r m a t i o n about the o r t h o g o n a l transformations. M
is an integer input v a r i a b l e the n u m b e r of columns of Z transformed.
set equal to to be b a c k
is a w o r k i n g p r e c i s i o n real t w o - d l m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and column d i m e n s i o n at least M. On input, the first M columns of Z c o n t a i n the e i g e n v e c t o r s to be b a c k t r a n s f o r m e d . On output, these columns of Z c o n t a i n the t r a n s f o r m e d eigenvectors. The t r a n s f o r m e d e i g e n v e c t o r s are o r t h o n o r m a l if the input e i g e n v e c t o r s are o r t h o n o r m a l .
B. Error
Conditions
and Returns.
None.
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
This s u b r o u t i n e should be used subroutine TREDI (F277).
3. D I S C U S S I O N
in c o n j u n c t i o n with
the
OF M E T H O D AND A L G O R I T H M .
S u p p o s e that the s y m m e t r i c m a t r i x C (say) has b e e n r e d u c e d to the t r i d i a g o n a l s y m m e t r i c m a t r i x F by the s i m i l a r i t y transformation T F = Q CQ
where Q is a p r o d u c t of the o r t h o g o n a l s y m m e t r i c m a t r i c e s e n c o d e d in E and in the strict lower triangle of A. Then, given an array Z of c o l u m n vectors, TRBAKI computes the matrix product QZ. If the e i g e n v e c t o r s of F are columns of the array Z, then TRBAKI forms the e i g e n v e c t o r s of C in their place. Since Q is o r t h o g o n a l , v e c t o r E u c l i d e a n norms are p r e s e r v e d .
299
7.1-164
This s u b r o u t i n e is a t r a n s l a t i o n of the Algol p r o c e d u r e TRBAKI w r i t t e n and d i s c u s s e d in detail by Martin~ Reinsch, and W i l k i n s o n (i).
4.
REFERENCES~ i)
Martin, R.S., Reinsch, C.~ and Wilkinson, J.H., H o u s e h o l d e r ' s T r i d i a g o n a l i z a t i o n of a S y m m e t r i c Matrix, Num. Math. 11,181-195 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c C o m p u t a t i o n , V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/2, 212-226, Springer-Verlag, 1971.)
5. CHECKOUT. Ao Test
Cases.
See the section d i s c u s s i n g real s y m m e t r i c matrices.
testing
of the codes
for
B. Accuracy° The accuracy of TRBAKI can best be d e s c r i b e d in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real symmetric m a t r i c e s and m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (I). This stability contributes to the p r o p e r t y of these paths that the computed e i g e n v a l u e s are the exact e i g e n v a l u e s of a m a t r i x or system close to the original m a t r i x or system and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that m a t r i x or system.
300
7.1-165
SUBROUTINE
TRBAKI(NM,N,A,E,M,Z)
C INTEGER I,J,K,L,M,N,NM REAL A(NM,N),E(N),Z(NM,M) REAL S C IF IF
(M (N
.EQ. .EQ.
O) I)
GO GO
DO
1 4 0 1 = 2, N L = I - 1 IF (E(I) .EQ.
TO TO
200 200
C
0.0)
GO
TO
140
C DO
130 J = S = 0.0
I, M
C II0 C C
DO II0 K = I, L S = S + A(I,K) * Z(K,J) ********** DIVISOR B E L O W IS N E G A T I V E OF H F O R M E D IN DOUBLE DIVISION AVOIDS POSSIBLE UNDERFLOW S = (S / A ( I , L ) ) / E(1)
C DO 120 Z(K,J)
120
K = i, L = Z(K,J) +
S * A(I,K)
C 130
CONTINUE
C 140
CONTINUE
200
RETURN END
C
301
TREDI. **********
7.1-166
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F277-2
A Fortran
PACKAGE
(EISPACK)
TREDI
IV S u b r o u t i n e to R e d u c e a Real S y m m e t r i c M a t r i x to a S y m m e t r i c T r i d i a g o n a l M a t r i x U s i n g Orthogonal Transformations.
May, July,
1972 1975
I. PURPOSE. The F o r t r a n IV s u b r o u t i n e TREDI reduces a real s y m m e t r i c m a t r i x to a s y m m e t r i c t r i d i a g o n a l m a t r i x using o r t h o g o n a l similarity transformations. This r e d u c e d f o r m is u s e d by other s u b r o u t i n e s to find the e i g e n v a l u e s a n d / o r e i g e n v e c t o r s of the o r i g i n a l matrix. See s e c t i o n 2C for the s p e c i f i c routines.
2.
USAGE. A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
TREDI(NM,N,A,D,E,E2)
The p a r a m e t e r s are d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r input v a r i a b l e set equal to the row d i m e n s i o n of the t w o - d i m e n s i o n a l array A as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t for A in the c a l l i n g program. is an i n t e g e r input v a r i a b l e the order of the m a t r i x A. g r e a t e r than NM.
set equal to N must be not
is a w o r k i n g p r e c i s i o n real t w o - d l m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at least N. On input, A c o n t a i n s the s y m m e t r i c m a t r i x of order N to be r e d u c e d to t r i d i a g o n a l form. O n l y the full lower t r i a n g l e of the m a t r i x need be
302
7.1-167
supplied. On output, the strict lower triangle of A contains i n f o r m a t i o n about the o r t h o g o n a l t r a n s f o r m a t i o n s used in the reduction. The full upper triangle of A is unaltered. See section 3 for the details. D
is a working p r e c i s i o n real output oned i m e n s i o n a l variable of d i m e n s i o n at least N c o n t a i n i n g the d i a g o n a l elements of the tridiagonal matrix. is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N containing, in its last N-I positions, the s u b d i a g o n a l elements of the tridiagonal matrix. The element E(1) is set to zero.
E2
B. Error
is a working p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N containing, in its last N-I positions, the squares of the s u b d i a g o n a l elements of the tridiagonal matrix. The element E2(1) is set to zero. E2 need not be distinct from E (non-standard usage a c c e p t a b l e w i t h at least those compilers included in the c e r t i f i c a t i o n statement), in which case no squares are returned.
Conditions
and Returns.
None.
C. A p p l i c a b i l i t y
and Restrictions.
If all the eigenvalues of the original m a t r i x are desired, this subroutine should be followed by TQLI (F289), IMTQLI (F291), or TQLRAT (F235). If some of the eigenvalues of the original m a t r i x are desired, this subroutine should be followed by BISECT (F294) or TRIDIB (F237). If some of the eigenvalues and e i g e n v e c t o r s of the original m a t r i x are desired, this s u b r o u t i n e should be followed by T S T U R M (F293), or by BISECT (F294) and TINVlT (F223), or by TRIDIB (F237) and TINVlT, or by IMTQLV (F234) and TINVIT, and then by TRBAKI (F279).
308
7.1-168
If all the e i g e n v a l u e s and e i g e n v e c t o r s of the o r i g i n a l m a t r i x are desired, s u b r o u t i n e TRED2 (F278) should be used rather than TREDI to p e r f o r m the t r i d i a g o n a l r e d u c t i o n , and should be followed by TQL2 (F290) or IMTQL2 (F292). if the m a t r i x has e l e m e n t s of w i d e l y v a r y i n g m a g n i t u d e s , ~he s m a l l e r ones should be in the top l e f t - h a n d corner.
3. D I S C U S S I O N
OF M E T H O D
AND A L G O R I T H M .
The t r i d i a g o n a l r e d u c t i o n is p e r f o r m e d in the f o l l o w i n g way. Starting with J=N, the e l e m e n t s in the J-th row to the left of the d i a g o n a l are first scaled, to avoid p o s s i b l e u n d e r f l o w in the t r a n s f o r m a t i o n that m i g h t result in severe d e p a r t u r e from o r t h o g o n a l i t y . The sum of s q u a r e s SIGMA of these scaled e l e m e n t s is n e x t formed. Then, a v e c t o r U and a scalar T =
define
u
u/2
an o p e r a t o r T P = I -UU
/H
w h i c h is o r t h o g o n a l and s y m m e t r i c and for w h i c h the similarity transformation PAP e l i m i n a t e s the e l e m e n t s in the J-th row of A to the left of the s u b d i a g o n a l and the s y m m e t r i c a l elements in the J-th column. The n o n - z e r o c o m p o n e n t s of U are the e l e m e n t s of the J-th row to the left of the d i a g o n a l w i t h the last of them a u g m e n t e d by the square root of SIGMA p r e f i x e d by the sign of the s u b d i a g o n a l element. By s t o r i n g the t r a n s f o r m e d s u b d i a g o n a l e l e m e n t in E(J) and not o v e r w r i t i n g the row e l e m e n t s e l i m i n a t e d in the t r a n s f o r m a t i o n , full i n f o r m a t i o n about P is saved for later use in TRBAKI. The t r a n s f o r m a t i o n sets E2(J) equal to SIGMA and E(J) equal to the square root of SIGMA p r e f i x e d by sign o p p o s i t e to that of the r e p l a c e d s u b d i a g o n a l element. The above steps are r e p e a t e d on f u r t h e r rows of the transformed A in r e v e r s e order until A is r e d u c e d to t r i d i a g o n a l form; that is, r e p e a t e d for J = N-I,N-2,...,3. Only the e l e m e n t s in the lower triangle of A are accessed, and a l t h o u g h the d i a g o n a l e l e m e n t s are m o d i f i e d in the a l g o r i t h m , they are r e s t o r e d to their o r i g i n a l c o n t e n t s by the end of the s u b r o u t i n e , thus p r e s e r v i n g the full upper t r i a n g l e of A.
304
7.1-169
This s u b r o u t i n e is a translation of the A l g o l p r o c e d u r e TREDI w r i t t e n and discussed in detail by Martin, Reinsch, and W i l k i n s o n (i).
4. REFERENCES.
1)
Martin, R.S., Reinsch, C., and Wilkinson, J.H.~ H o u s e h o l d e r ' s T r i d i a g o n a l i z a t i o n of a Symmetric Matrix, Num. Math. 11,181-195 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n 11/2, 212-226, Springer-Verlag, 1971.)
5. CHECKOUT. A. Test
Cases.
See the section discussing real symmetric matrices.
testing
of the codes
for
B. Accuracy. The accuracy of TREDI can best be described in terms of its role in those paths of EISPACK which find e i g e n v a l u e s and e i g e n v e c t o r s of real symmetric m a t r i c e s and m a t r i x systems. In these paths, this s u b r o u t i n e is n u m e r i c a l l y stable (i). This stability contributes to the property of these paths that the computed eigenvalues are the exact e i g e n v a l u e s of a m a t r i x or system close to the original m a t r i x or system and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that m a t r i x or system.
305
7.1-170
SUBROUTINE
TREDI(NM,N,A,D=E,E2)
INTEGER I,J,K,L,N,II,NM,JPI REAL A(NM,N),D(N),E(N),E2(N) REAL F,G,H,SCALE REAL SQRT,ABS,SIGN
i00 C
C 120
130
140
150
D O I 0 0 I = i, N D(1) = A(I,I) ********** FOR I=N STEP -I UNTIL I DO -D O 3 0 0 i i = I, N I = N + i - II L = I - 1 H = 0.0 SCALE = 0.0 I F (L . L T . i) G O T O 1 3 0 ********** SCALE ROW (ALGOL TOL THEN NOT D O 1 2 0 K = i, L SCALE = SCALE + ABS(A(I,K)) IF (SCALE .NE. E(1) = 0.0 E2(1) = 0.0 GO TO 290
0.0)
GO
TO
140
DO
1 5 0 K = i, L A(I,K) = A(I,K) / SCALE H = H + A(I,K) * A(I,K) CONTINUE
E2(1) = SCALE * SCALE * H F = A(I,L) g = -SIGN(SQET (N) ,F) E(1) = SCALE * G H = H - F * G A(I,L) = F - G I F (L . E Q . I) G O T O 2 7 0 F = 0.0 DO
180
2 4 0 J = i, L G = 0.0 ********** FORM ELEMENT OF A*U D O 1 8 0 K = i, J G = G + A(J,K) * A(I,K) JPI = ! P (L
200 220 240
J + I .LT. JPI)
GO
TO
DO 200 K = JPI, L G = g + A(K,J) * A(I,K) • ********* FORM ELEMENT OF P E(J) = G / H F = F + E(J) * A(I,J) CONTINUE
306
**********
220
**********
**********
NEEDED)
********~*
7.1-171
H = F ******~*** DO 260 F = G =
/
(H + ~) FORM REDUCED J = I, L A(I,J) E(J) - H * F
DO
260
260 K A(J,K) CONTINUE
270 280
DO 280 A(I,K)
300
****~**~*~
= c
E(J)
29O
A
K =
= =
i, J A(J,K)
= I, L SCALE *
-
A(I,K)
~ = O(I) O(I) = A(I,I) A(I,I) = H CONTINUE RETURN END
307
F
*
E(K)
-
G
*
A(I,K)
7.1-172
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F278-2
PACKAGE
(EISPACK)
TRED2
A F o r t r a n IV S u b r o u t i n e to R e d u c e a R e a l S y m m e t r i c to a S y m m e t r i c T r i d i a g o n a l M a t r i x A c c u m u l a t i n g Orthogonal Transformations.
May, July,
Matrix the
1972 1975
I. P U R P O S E . The F o r t r a n IV s u b r o u t i n e TRED2 reduces a real symmetric m a t r i x to a s y m m e t r i c t r i d i a g o n a l m a t r i x u s i n g a n d accumulating orthogonal similarity transformations. This r e d u c e d f o r m and the t r a n s f o r m a t i o n m a t r i x a r e u s e d by subroutine T Q L 2 (F290) or I M T Q L 2 (F292) to f i n d the e i g e n v a l u e s and e i g e n v e c t o r s of the o r i g i n a l m a t r i x .
2. U S A G E . A.
Calling The
Sequence.
SUBROUTINE SUBROUTINE
statement
is
TRED2(NM,N,A,D,E,Z)
T h e p a r a m e t e r s a r e d i s c u s s e d b e l o w and the i n t e r p r e t a t i o n of w o r k i n g p r e c i s i o n for v a r i o u s m a c h i n e s is g i v e n in the s e c t i o n d i s c u s s i n g c e r t i f i c a t i o n . NM
is an i n t e g e r i n p u t v a r i a b l e set e q u a l to the r o w d i m e n s i o n of the t w o - d i m e n s i o n a l arrays A and Z as s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for A and Z in the calling program.
N
is an i n t e g e r i n p u t v a r i a b l e the o r d e r of the m a t r i x A. greater than NM.
308
set e q u a l to N m u s t be not
7.1-173
is a w o r k i n g p r e c i s i o n real input twod i m e n s i o n a l v a r i a b l e with row d i m e n s i o n NM and column d i m e n s i o n at least N. A contains the s y m m e t r i c m a t r i x of order N to be r e d u c e d to t r i d i a g o n a l form. Only the full lower t r i a n g l e of the m a t r i x need be supplied. is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N c o n t a i n i n g the d i a g o n a l elements of the t r i d i a g o n a l matrix. is a w o r k i n g p r e c i s i o n real output oned i m e n s i o n a l v a r i a b l e of d i m e n s i o n at least N c o n t a i n i n g , in its last N-I positions, the s u b d i a g o n a l elements of the t r i d i a g o n a l matrix. The e l e m e n t E(1) is set to zero. is a w o r k i n g p r e c i s i o n real output twod i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n and c o l u m n d i m e n s i o n at least N. It contains the o r t h o g o n a l t r a n s f o r m a t i o n m a t r i x p r o d u c e d in the r e d u c t i o n to the t r i d i a g o n a l form.
B. Error C o n d i t i o n s
NM
and Returns.
None.
C. A p p l i c a b i l i t y
and R e s t r i c t i o n s .
If all the e i g e n v a l u e s and e i g e n v e c t o r s of the o r i g i n a l m a t r i x are desired, this s u b r o u t i n e should be f o l l o w e d by TQL2 (F290) or IMTQL2 (F292). If some other c o m b i n a t i o n of e i g e n v a l u e s and e i g e n v e c t o r s is desired, s u b r o u t i n e TREDI (F277) should be used rather than TRED2 to p e r f o r m the t r i d i a g o n a l reduction. If the m a t r i x has e l e m e n t s of w i d e l y v a r y i n g m a g n i t u d e s , the s m a l l e r ones should be in the top l e f t - h a n d corner. Parameters
A
and
Z
need not be distinct.
309
7.1-174
3.
DISCUSSION The all
OF M E T H O D
AND
ALGORITHM.
l o w e r t r i a n g l e of A subsequent operations
is i n i t i a l l y c o p i e d into are p e r f o r m e d on Z.
Z
and
T h e t r i d i a g o n a l r e d u c t i o n is p e r f o r m e d in the f o l l o w i n g way. Starting with J=N, the e l e m e n t s in the J-th r o w to the left of the d i a g o n a l are f i r s t s c a l e d , to a v o i d p o s s i b l e u n d e r f l o w in the t r a n s f o r m a t i o n that m i g h t r e s u l t in s e v e r e departure from orthogonality. T h e s u m of s q u a r e s SIGMA of t h e s e s c a l e d e l e m e n t s is n e x t f o r m e d . Then, a v e c t o r U and a scalar T H
define
=
u
u/2
an o p e r a t o r T P = I - UU
/H
w h i c h is o r t h o g o n a l and s y m m e t r i c and for w h i c h the similarity transformation PAP e l i m i n a t e s the e l e m e n t s in the J-th r o w of A to the left of the s u b d i a g o n a l and the s y m m e t r i c a l e l e m e n t s in the J-th column. The n o n - z e r o c o m p o n e n t s of U are the e l e m e n t s of the J-th r o w to the left of the d i a g o n a l w i t h the last of t h e m a u g m e n t e d b y the s q u a r e r o o t of SIGMA p r e f i x e d b y the s i g n of the s u b d i a g o n a l e l e m e n t . By s t o r i n g the t r a n s f o r m e d s u b d i a g o n a l e l e m e n t in E(J) a n d n o t o v e r w r i t i n g the r o w e l e m e n t s e l i m i n a t e d in the t r a n s f o r m a t i o n ~ f u l l i n f o r m a t i o n about P is s a v e d for l a t e r a c c u m u l a t i o n of t r a n s f o r m a t i o n s . T h e t r a n s f o r m a t i o n sets SIGMA p r e f i x e d by s i g n subdiagonal element.
E(J) e q u a l to the s q u a r e r o o t of o p p o s i t e to that of the r e p l a c e d
T h e a b o v e s t e p s are r e p e a t e d on f u r t h e r rows of the transformed A in r e v e r s e o r d e r u n t i l A is r e d u c e d to t r i d i a g o n a l form; that is, r e p e a t e d for J = N-I,N-2,...,3. F i n a l l y , the o r t h o g o n a l t r a n s f o r m a t i o n m a t r i x is a c c u m u l a t e d in Z as the p r o d u c t of the N-2 o p e r a t o r s d e f i n e d in the tridiagona! reduction. T h i s s u b r o u t i n e is a t r a n s l a t i o n of the A l g o l p r o c e d u r e TRED2 w r i t t e n and d i s c u s s e d in d e t a i l by M a r t i n , R e i n s c h , and W i l k i n s o n (I).
310
7.1-175
4. REFERENCES.
i)
Martin, R.S., Reinsch, C., and Wilkinson, J.H., H o u s e h o l d e r ' s T r i d i a g o n a l i z a t i o n of a Symmetric Matrix, Num. Math. 11,181-195 (1968). (Reprinted in H a n d b o o k for A u t o m a t i c Computation, V o l u m e II, Linear Algebra, J. H. W i l k i n s o n - C. Reinsch, C o n t r i b u t i o n II/2, 212-226, Springer-Verlag, 1971.)
5. CHECKOUT. A. Test
Cases.
See the section discussing real symmetric matrices.
testing
of the codes
for
B. Accuracy. The accuracy of TRED2 can best be described in terms of its role in those paths of EISPACK which find e i g e n v a l u e s a n d eigenvectors of real symmetric m a t r i c e s and m a t r i x systems. In these paths, this subroutine is n u m e r i c a l l y stable (I). This stability contributes to the p r o p e r t y of these paths that the computed eigenvalues are the exact elgenvalues of a m a t r i x or s y s t e m close to the original m a t r i x or system and the computed e i g e n v e c t o r s are close (but not n e c e s s a r i l y equal) to the e i g e n v e c t o r s of that m a t r i x or system.
311
7.1-176
SUBROUTINE
TRED2(NM,N,A,D,E,Z)
INTEGER I,J,K,L,N,II,NM,JPI REAL A(NM,N),D(N),E(N),Z(NM,N) REAL F,G,H,HH,SCALE REAL SQRT,ABS,SIGN DO
i00
1 =
DO
I00
i, J
Z(I,J) i00
N
=
i, =
I
A(I,J)
CONTINUE I F (N . E Q . I) G O T O 3 2 0 ********** FOR I=N STEP D O 3 0 0 I I = 2, N I = N + 2 - II L = I - I H=
120
150
2 DO
--
(SCALE .NE. = Z(I,L) TO 290
GO TO 130 ROW (ALGOL TOL L + ABS(Z(I,K)) 0.0)
GO
TO
THEN
NOT
140
E(!) GO
140
UNTIL
DO
1 5 0 K = i, L Z(I,K) = Z(I,K) / SCALE H = H + Z(I,K) * Z(I,K) CONTINUE
F = Z(I,L) G = -SIGN(SQRT(H),F) E(!) = SCALE * G H = H - F * G Z(I,L) = F - G F = 0.0 DO
180
2 4 0 J = i, L Z(J,i) = Z(I,J) / H G = 0.0 ********** FORM ELEMENT OF A*U D O 1 8 0 K = I, J G = G + Z(J,K) * Z(I,K) JPI = IF (L
200
**********
0.0
SCALE = 0.0 I F (L .LT. 2) ********** SCALE D O 1 2 0 K = I, = SCALE SCALE IF
130
-i
J + i .LT. J P I )
GO
TO
DO 200 K = JPI, L G = G + Z(K,J) * Z(I,K)
312
220
**********
NEEDED)
**********
7.1-177
220 240
********** FORM ELEMENT OF P E(J) = G / N F = F + E(J) * Z(I,J) CONTINUE HH = F ********** DO 260
(H + H) FORM REDUCED J = i, L
**********
/
A
**********
F = Z(I,J) G = E(J) - HH E(J) = G
* F
DO
260
2 6 0 K = i, J Z(J,K) = Z(J,K) CONTINUE
290 300
D(1) CONTINUE
32o
D(1)
- F
*
E(K)
- G
= H
= 0.0
E(1) = 0.0 ********** ACCUMULATION OF TRANSFORMATION D O 5 0 0 I = I, N L = I - 1 IF (D(I) .EQ. 0.0) GO TO 380 DO
360 J G=0.0
=
I,
L
D O 3 4 0 K = i, L G = G + Z(I,K) * Z(K,J)
340
DO
360
380
3 6 0 K = i, L Z(K,J) = Z(K,J) CONTINUE
D(1) = Z(I,I) Z ( I , I ) = 1.0 IF (L .LT. I)
GO
TO
- G
500
DO
400 500
* Z(I,K)
4 0 0 J = I, L Z(I,J) = 0.0 Z(J,I) = 0.0 CONTINUE CONTINUE RETURN END
3t3
*
Z(K,I)
MATRICES
**********
7.2-1
NATS
EIGENSYSTEM
PROJECT
SUBROUTINE F299-2
PACKAGE
(EISPACK)
EISPAC
A Control P r o g r a m for the E i g e n s y s t e m Package (F269 to F298 and F220 to F247).
May, July,
1972 1975
I. PURPOSE. The Fortran IV and 0 S / 3 6 0 - 3 7 0 assembly language s u b r o u t i n e EISPAC (together with its a s s o c i a t e d "keyword" entry points) is designed to s i m p l i f y the solution of the standard and g e n e r a l i z e d m a t r i x e i g e n p r o b l e m s using the subroutines in the e i g e n s y s t e m package (F269-F298, F220-F247). It thus may he used to compute some or all of the eigenvalues, with or w~thout eigenvectors, of complex general, complex Hermitian, real general, real symmetric, real symmetric tridiagonal, certain real n o n - s y m m e t r i c tridiagonal, and real symmetric band matrices; and it may also be used to compute some or all of the eigenvalues, w i t h or w i t h o u t eigenvectors, for the real s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m , or all of the eigenvalues, with or w i t h o u t eigenvectors, for the real nonsymmetric g e n e r a l i z e d eigenproblem. EISPAC offers the f o l l o w i n g advantages if you wish to solve an eigenproblem: I~ You describe the p r o b l e m to EISPAC in simple, familiar terms. 2. Using your d e s c r i p t i o n , EISPAC automatically selects subroutines to solve your p r o b l e m and executes them in the proper order and with parameters passed from one to another in the proper way. In general, EISPAC selects the sequence of subroutines in the e i g e n s y s t e m p a c k a g e which will solve your p r o b l e m as rapidly as possible with r e a s o n a b l e assurance of s t a b i l i t y in the calculations. 3. EISPAC loads each selected subroutine only as it is required, thus making a v a i l a b l e for data storage as much m e m o r y as possible. On the other hand, if sufficient m e m o r y is available, the subroutines used are retained in m e m o r y and are not reloaded when you r e p e a t e d l y call EISPAC to solve the same problem. (See section 3 below.) 4. EISPAC a l l o c a t e s and frees any n e c e s s a r y auxiliary storage automatically.
314
7.2-2
5. U s e of EISPAC m i n i m i z e s the n u m b e r of c h a n g e s y o u m u s t m a k e to y o u r p r o g r a m if y o u w i s h to s o l v e a s l i g h t v a r i a t i o n of y o u r o r i g i n a l p r o b l e m or if y o u w i s h to take a d v a n t a g e of n e w m e t h o d s w h e n they are introduced. 6. E I S P A C is c a l l e d as a s u b r o u t i n e f r o m y o u r own driver program. Thus the m a t r i x w h o s e e i g e n s y s t e m is b e i n g c o m p u t e d m a y i t s e l f be the r e s u l t of o t h e r c o m p u t a t i o n s in y o u r p r o g r a m , and the c o m p u t e d e i g e n s y s t e m m a y c o n v e n i e n t l y be u s e d in f u r t h e r calculations. Thus EISPAC r e l i e v e s y o u of h a v i n g to d e v e l o p a d e t a i l e d k n o w l e d g e of the a p p l i c a b i l i t y , e f f i c i e n c y , and c a l l i n g s e q u e n c e s of the i n d i v i d u a l EISPACK subroutines.
2. U S A G E . A.
Calling
Sequence.
EISPAC e m p l o y s v a r i a b l e l e n g t h p a r a m e t e r lists and " k e y w o r d " p a r a m e t e r s to s i m p l i f y s p e c i f i c a t i o n of y o u r p r o b l e m and to g r o u p r e l a t e d s u b p a r a m e t e r s . An o v e r v i e w of the c a l l s to EISPAC is g i v e n b y the p r o t o t y p e c a l l s b e l o w ; s p e c i f i c calls for d i f f e r e n t c l a s s e s of m a t r i c e s are d i s c u s s e d in s e c t i o n 2.B. The prototype call e i g e n p r o b l e m is:
to
EISPAC
for
the s t a n d a r d
CALL EISPAC (NM, N, MATRIX (...), BAND (...), VALUES (...), VECTOR (...), METHOD (...), E R R O R ( . . . ) , SU~R ( . . . ) ) where NM
is an i n t e g e r v a r i a b l e w h i c h s u p p l i e s the r o w (first) d i m e n s i o n of any twod i m e n s i o n a l a r r a y s a p p e a r i n g in the c a l l to E I S P A C (as that d i m e n s i o n is s p e c i f i e d in the D I M E N S I O N s t a t e m e n t s for t h e m in the c a l l i n g p r o g r a m ) . For e x a m p l e , if your program contains arrays dimensioned: A(50,50), Z(50,50) w h i c h a p p e a r in the call to E I S P A C , and the o r d e r of the e i g e n p r o b l e m b e i n g s o l v e d is 25, then N M = 50 and N = 25.
315
7.2-3
is an i n t e g e r v a r i a b l e w h i c h s u p p l i e s the o r d e r of the i n p u t m a t r i x . N is c h e c k e d to v e r i f y that it is n e i t h e r g r e a t e r t h a n NM n o r less t h a n i. MATRIX,
BAND, V A L U E S , V E C T O R , M E T H O D , E R R O R , SUBR are k e y w o r d p a r a m e t e r s . T h e y a c c e p t sets of s u b p a r a m e t e r s w h i c h d e f i n e the eigenproblem being solved. (These s u b p a r a m e t e r s are d i s c u s s e d in d e t a i l in section 2.C below.) Keyword parameters not n e e d e d to s p e c i f y a p a r t i c u l a r p r o b l e m are o m i t t e d f r o m the c a l l to EISPAC; t h o s e a p p e a r i n g m a y a p p e a r in any order.
The p r o t o t y p e call e i g e n p r o b l e m is: C A L L E I S P A C (NM, (...), V E C T O R
to
EISPAC
for
the g e n e r a l i z e d
N, M A T A (...), M A T B (...), E R R O R (...),
(...), V A L U E S SUBR (...))
where MATA and MATB replace MATRIX as k e y w o r d parameters. Note: MATRIX and MATA are a l t e r n a t e f o r m s of the same k e y w o r d and can be u s e d interchangeably. To u s e E I S P A C , y o u m u s t i n c l u d e a p r i v a t e l i b r a r y DD card for E I S P A C L B (the d y n a m i c load l i b r a r y , see section 3 b e l o w ) in the G O - s t e p of y o u r job. This card a s s o c i a t e s EISPACLB w i t h the d a t a s e t w h e r e the load m o d u l e s for EISPAC and the e i g e n s y s t e m p a c k a g e subroutines reside. If y o u are u s i n g a t y p i c a l F o r t r a n c a t a l o g e d p r o c e d u r e , this c a r d is: //GO.EISPACLB
DD D I S P = S H R , D S N A M E = . . .
S i m i l a r l y , if y o u are u s i n g the TSO time s y s t e m , y o u s h o u l d e x e c u t e the c o m m a n d : ALLOC before
FILE(EISPACLB)
executing
your
DATASET(...)
sharing
SHR
program.
F i n a l l y , if y o u w i s h to use EISPAC from a PL/I ( C h e c k o u t or O p t i m i z e r ) p r o g r a m b y m e a n s of the interlanguage communication facility, you should write a s i m p l e F o r t r a n s u b r o u t i n e w h i c h is c a l l e d f r o m y o u r P L / I p r o g r a m and w h i c h in turn calls EISPAC as d e s c r i b e d below. T h i s is n e c e s s a r y b e c a u s e EISPAC makes certain ( n o n - s t a n d a r d ) a s s u m p t i o n s a b o u t the F o r t r a n e n v i r o n m e n t of the p r o g r a m c a l l i n g it w h i c h m a y not be s a t i s f i e d
316
7.2-4
w h e n the p r o g r a m is w r i t t e n in PL/I. The F o r t r a n program calling EISPAC s h o u l d h a v e as p a r a m e t e r s v a r i a b l e s to be p a s s e d to E I S P A C ; y o u s h o u l d take that the v e c t o r s and a r r a y s a p p e a r in D I M E N S I O N s t a t e m e n t s in it. T h u s for the e x a m p l e c o n c l u d i n g s e c t i o n on real s y m m e t r i c m a t r i c e s in s e c t i o n 2.B b e l o w , the F o r t r a n s u b r o u t i n e c a l l e d by y o u r P L / I p r o g r a m s h o u l d look like: S U B R O U T I N E E I S C A L (N, A, W, Z) INTEGER N R E A L * 8 A ( N , N ) , W(N), Z(N,N) C A L L E I S P A C (N, N, M A T R I X ('REAL, V A L U E S (W), V E C T O R (Z)) RETURN END
A,
the care the
'SYMMETRIC'),
This e x a m p l e a s s u m e s that the P L / I a r r a y s c o r r e s p o n d i n g to the m a t r i c e s A and Z are d i m e n s i o n e d e x a c t l y NxN, and h e n c e that the p a r a m e t e r NM can be r e p l a c e d by N. In the P L / I c a l l i n g p r o g r a m , EISCAL w o u l d be declared: DCL
EISCAL
ENTRY
(FIXED B I N A R Y ( 3 1 , 0 ) , (*,*) F L O A T D E C I M A L ( 1 6 ) , (*) FLOAT DECIMAL(16), (*,*) F L O A T D E C I M A L ( 1 6 ) ) OPTIONS (FORTRAN) EXTERNAL;
Y o u m u s t p r o v i d e a DD card or a l l o c a t i o n for F T 0 6 F 0 0 1 , the s t a n d a r d F o r t r a n o u t p u t file, b e c a u s e F o r t r a n a u t o m a t i c a l l y t r i e s to open it. This f i l e s h o u l d be a s s o c i a t e d w i t h the same d a t a s e t as the o u t p u t f r o m the P L / I p r o g r a m , so that EISPAC e r r o r m e s s a g e s , if any, a p p e a r w i t h it. F i n a l l y , if you are u s i n g the P L / I C h e c k o u t c o m p i l e r , y o u n e e d to s p e c i f y the o p t i o n S I Z E ( - n K ) to the e x e c u t i o n step to r e s e r v e d y n a m i c s t o r a g e for E I S P A C ; at a m i n i m u m n = 1 4 , and it m u s t be l a r g e e n o u g h to a c c o m m o d a t e any t e m p o r a r y a r r a y s that are a l l o c a t e d . (An i n s u f f i c i e n t l y l a r g e v a l u e of n w i l l r e s u l t in e i t h e r of the s y s t e m c o m p l e t i o n c o d e s 804 or 80A (see s e c t i o n 2.D).) The use of EISPAC to s o l v e v a r i o u s k i n d s of e i g e n p r o b l e m s is i l l u s t r a t e d in the f o l l o w i n g s e c t i o n . You m a y w i s h to read f i r s t the e x a m p l e s for the type of m a t r i x y o u h a v e and then c o n s u l t s e c t i o n 2.C for f u r t h e r d e t a i l s a b o u t the k e y w o r d s u b p a r a m e t e r s . (Note that in t h e s e e x a m p l e s the c o n t i n u a t i o n s y m b o l w h i c h m u s t a p p e a r in c o l u m n 6 of a F o r t r a n c o n t i n u a t i o n card has b e e n o m i t t e d . )
317
7.2-5
B. EISPAC
Examples
Complex
for D i f f e r e n t
General
The basic (WR~ WI) is:
Classes
of Matrices.
Matrix
call, which finds all of the eigenvalues of the complex general m a t r i x (AR, AI),
CALL EISPAC (NM, N, M A T R I X VALUES (WR, WI))
('COMPLEX ~, AR,
AI),
If you wish to find all of the e i g e n v e c t o r s (ZR, Z!), add: V E C T O R (ZR, ZI). If you wish to find all of the e i g e n v a l u e s and only selected eigenvectors, add: V E C T O R (ZR, ZI, MM, M, SELECT). If you prefer METHOD ('NO',
not to balance 'BALANCE').
the matrix,
add:
If you wish to use e l e m e n t a r y instead of unitary similarities, add: METHOD ('ELEMENTARY'). Thus a call to find all of the eigenvalues and some of the e i g e n v e c t o r s of a complex general m a t r i x is: CALL EISPAC (NM, N, M A T R I X VALUES (WR, WI), V E C T O R SELECT))
Complex
Hermitian
('COMPLEX', AR, AI), (ZR, ZI, MM, M,
Matrix
Recall that a c o m p l e x H e r m i t i a n m a t r i x is a m a t r i x which is equal to its c o m p l e x conjugate transpose. If you wish to solve an e i g e n p r o b l e m for a complex symmetric m a t r i x (a m a t r i x which is equal to its transpose without conjugation), you must follow the complex general m a t r i x examples. The basic call, which finds W of the complex H e r m i t i a n
all of the eigenvalues matrix (AR, AI), is:
CALL EISPAC (NM, N, M A T R I X ('COMPLEX', 'HERMITIAN'), VALUES (W))
318
AR,
AI,
7.2-6
If the complex Hermitian m a t r i x is packed into a single two-dimensional array, HP, substitute for M A T R I X ('COMPLEX', AR, AI, 'HERMITIAN'): MATRIX ('COMPLEX', HP, HP, 'HERMITIAN', 'PACKED'). If you wish to find only the eigenvalues in the interval (RLB,RUB), substitute for VALUES (W) (see note 3): VALUES (W, MM, M, RLB, RUB). Alternatively, if you wish to find exactly M eigenvalues, starting from the M l l - t h smallest one, substitute for VALUES (W): VALUES (W, MII, M). (See notes i and 3.) If you wish to find the eigenvectors (ZR, ZI) corresponding to the eigenvalues found, add: VECTOR (ZR, ZI). Thus a call to find a few eigenvalues and their corresponding eigenvectors of a complex H e r m i t i a n matrix is: CALL EISPAC (NM, N, M A T R I X ('COMPLEX', AR, AI, 'HERMITIAN'), VALUES (W, MM, M, RLB, RUB), V E C T O R (ZR, ZI))
Real General Matrix
The basic call, which finds all of the eigenvalues (WR, WI) of the real general m a t r i x A, is: CALL EISPAC (NM, N, MATRIX (WR, WI))
('REAL', A), VALUES
If you wish to find all of the eigenvectors add: VECTOR (ZP).
ZP,
If you wish to find all of the eigenvalues and only selected eigenvectors, add: VECTOR (ZP, MM, M, SELECT). If you prefer not to balance METHOD ('NO', 'BALANCE').
the matrix,
add:
If you wish to use orthogonal instead of elementary similarities for the reduction to upper Hessenberg form, add (see note 5): METHOD ('ORTHOGONAL').
319
7.2-7
Thus a call to find all of the eigenvalues of a real general m a t r i x w i t h o u t b a l a n c i n g and using orthogonal similarities is: CALL EISPAC (NM, N, M A T R I X (WR, WI), METHOD ('NO', 'ORTHOGONAL'))
Real .
.
.
.
Non-Symmetric .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Tridiagonal .
.
.
.
.
.
.
.
.
.
.
.
.
('REAL', A), VALUES 'BALANCE',
Matrix .
.
The f o l l o w i n g examples apply only if the products of c o r r e s p o n d i n g o f f - d i a g o n a l elements of the t r i d i a g o n a l m a t r i x all are non-negative. (Read note 4 below for an additional r e s t r i c t i o n if you wish to compute eigenvectors.) O t h e r w i s e the real general m a t r i x examples must be followed. The basic call, which finds all of the eigenvalues W of the real tridiagonal m a t r i x UST, is: CALL EISPAC (NM, N, M A T R I X ('REAL', 'TRIDIAGONAL'), VALUES (W))
UST,
If you wish to find only the eigenvalues in the interval (RLB,RUB), substitute for VALUES (W) (see note 3): VALUES (W, MM, M, RLB, RUB). A l t e r n a t i v e l y , if you wish to find exactly M eigenvalues, starting from the Mll-th smallest one, s u b s t i t u t e for VALUES (W): V A L U E S (W, MII, M). (See notes I and 3.) If you wish to find the e i g e n v e c t o r s Z c o r r e s p o n d i n g to the eigenvalues found, add: V E C T O R (Z). Thus a call to find exactly M eigenvalues, starting from the Mll-th smallest one, of a real n o n - s y m m e t r i c tridiagonal m a t r i x is: CALL EISPAC (NM, N, M A T R I X ('REAL', UST, 'TRIDIAGONAL'), VALUES (W, MII, M))
Real
Symmetric
Matrix
The basic call, which finds all of the eigenvalues W of the real symmetric m a t r i x A, is (see note 2):
320
7.2-8
CALL EISPAC (NM, N, M A T R I X ('REAL', A, 'SYMMETRIC'), VALUES (W)) If the real symmetric matrix is packed into a single o n e - d i m e n s i o n a l array, SP, substitute for MATRIX ('REAL', A, 'SYMMETRIC'): M A T R I X ('REAL', SP, 'SYMMETRIC', 'PACKED'). If you wish to find only the eigenvalues in the interval (RLB,RUB), substitute for VALUES (W) (see note 3): VALUES (W, MM, M, RLB, RUB). Alternatively, if you wish to find exactly M eigenvalues, starting from the Mll-th smallest one, substitute for VALUES (W): VALUES (W, MII, M). (See notes i and 3.) If you wish to find the eigenvectors Z corresponding to the eigenvalues found, add: VECTOR (Z). Thus a call to find all of the eigenvalues and eigenvectors of a real symmetric m a t r i x is: CALL EISPAC (NM, N, M A T R I X ('REAL', A, 'SYMMETRIC'), VALUES (W), VECTOR (Z))
Real Symmetric Tridiagona! M a t r i x .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
The basic call, which finds all of the eigenvalues W of the real symmetric tridiagonal m a t r i x ST, is (see note 2): CALL EISPAC (NM, N, MATRIX ('REAL', ST, 'SYMMETRIC', 'TRIDIAGONAL'), VALUES (W)) If you wish to find only the eigenvalues in the interval (RLB,RUB), substitute for VALUES (W) (see note 3): VALUES (W, MM, M, RLB, RUB). A l t e r n a t i v e l y , if you wish to find exactly M eigenvalues, starting from the Mll-th smallest one, substitute for VALUES (W): VALUES (W, MII, M). (See notes 1 and 3.) If you wish to find the eigenvectors Z c o r r e s p o n d i n g to the eigenvalues found, add: VECTOR (Z).
321
7.2-9
Thus real
a call to find some of the e i g e n v a l u e s s y m m e t r i c t r i d i a g o n a l m a t r i x is:
of a
CALL E I S P A C (NM, N, M A T R I X ('REAL', ST, 'SYMMETRIC', 'TRIDIAGONAL'), V A L U E S (W, MM, M, RLB, RUB))
Real .
.
.
.
Symmetric .
.
.
.
.
.
.
.
.
.
Band .
.
.
.
.
.
Matrix .
.
.
The b a s i c call, w h i c h finds all of the e i g e n v a l u e s W of the real s y m m e t r i c h a n d m a t r i x SB, is (see n o t e s 2 and 6): CALL E I S P A C (NM, 'SYMMETRIC'),
N, M A T R I X ('REAL', SB, BAND (MB), V A L U E S (W))
If you w i s h to find only the e i g e n v a l u e s in the interval (RLB,RUB), s u b s t i t u t e for V A L U E S (W) (see n o t e 3): V A L U E S (W, MM, M, RLB, RUB). Alternatively, if you w i s h to find e x a c t l y M eigenvalues, s t a r t i n g from the Mll-th smallest one, s u b s t i t u t e for V A L U E S (W): V A L U E S (W, MII, M). (See n o t e s 1 and 3.) If you w i s h to find the e i g e n v e c t o r s Z corresponding to the e i g e n v a l u e s found, add: V E C T O R (Z). Thus real
a call to find symmetric band
some of the m a t r i x is:
CALL E I S P A C (NM, 'SYMMETRIC'), RLB, RUB))
Generalized .
.
.
.
.
.
.
.
.
.
.
Real .
.
.
.
.
.
.
.
.
.
.
.
.
of a
N, M A T R I X ('REAL', SB, BAND (MB), V A L U E S (W, MM,
Symmetric .
eigenvalues
.
.
Matrix .
.
.
.
.
.
.
M,
Sys=ems .
.
.
T h e r e are three forms of the real s y m m e t r i c g e n e r a l i z e d e i g e n p r o b l e m that can be s o l v e d w i t h EISPAC: n a m e l y , the forms Ax = ( l a m b d a ) B x , ABx = ( l a m b d a ) x , and BAx = (lambda)x, w h e r e A and B are b o t h s y m m e t r i c and B is p o s i t i v e definite.
322
7.2-10
The basic call, which finds all of the eigenvalues W of the real symmetric generalized system Ax = (lambda)Bx, is (see notes 2 and 7): CALL EISPAC (NM, N, MATA ('REAL', A, 'SYMMETRIC'), MATB ('REAL', B, 'SYMMETRIC', 'POSITIVE DEFINITE'), VALUES (W)) If you wish to find only the eigenvalues in the interval (RLB,RUB), substitute for VALUES (W) (see note 3): VALUES (W, MM, M, RLB, RUB). Alternatively, if you wish to find exactly M eigenvalues, starting from the Mll-th smallest one, substitute for VALUES (W): VALUES (W, MII, M). (See notes I and 3.) If you wish to find the eigenvectors Z qorresponding to the eigenvalues found, add: V E C T O R (Z). If the problem is of the form ABx = (lambda)x or BAx = (lambda)x, supply 'ABX=LX' or 'BAX=LX', respectively, to MATB (in a position after the B parameter). Thus a call to find exactly M eigenvalues, starting from the Mll-th smallest one, and the corresponding eigenvectors of the real symmetric generalized system ABx = (lambda)x, is: CALL EISPAC (NM, N, MATA ('REAL', A, 'SYMMETRIC'), MATB ('REAL', B, 'SYMMETRIC', 'POSITIVE DEFINITE', 'ABX=LX'), VALUES (W, MII, M), VECTOR (Z))
Generalized Real Non-Symmetric Matrix System .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
The basic call, which finds all of the eigenvalues (ALPHAR/BETA, ALPHAI/BETA) for the real nonsymmetric generalized e i g e n p r o b l e m Ax = (lambda)Bx, is (see note 8): CALL EISPAC (NM, N, MATA ('REAL', A), MATB ('REAL', B), VALUES (ALPHAR, ALPHAI, BETA)) If you wish to find all of the eigenvectors, of the system, add: VECTOR (ZP).
323
ZP,
7.2-11
Thus a call to find all of the eigenvalues and e i g e n v e c t o r s of a real n o n - s y m m e t r i c g e n e r a l i z e d system is: CALL EISPAC ('REAL',
(NM, N, MATA ('REAL', A), MATB B) VALUES (ALPHAR, ALPHAI, BETA),
VECTOR (ZP)~ C. Meanings
of Keyword
Subparameters TREAL~
for
Subparameters.
MATRIX,
MATA,
and
MATB:
specifies that the m a t r i x whose e i g e n s y s t e m is to be computed is real. (See note 9.)
~COMPLEX' specifies that the m a t r i x whose e i g e n s y s t e m is to be computed is complex. (See note
9.) AR,
A,
AI
B
are long p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e s with row d i m e n s i o n NM and column d i m e n s i o n at least N. They supply, respectively, the real and imaginary parts of the complex m a t r i x whose e i g e n s y s t e m is to be computed. In the n o n - H e r m i t i a n case, the i n f o r m a t i o n in the full AR and AI arrays specifies the matrix, and all of it is destroyed. In the H e r m i t i a n case, the i n f o r m a t i o n in the full lower triangle of AR and the strict lower triangle of AI specifies the matrix, and is destroyed as well as the diagonal of AI; the full upper triangle of AR and the strict upper triangle of AI are left unaltered. are long p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e s with row d i m e n s i o n NM and column d i m e n s i o n at least N. They supply the real matrices whose e i g e n s y s t e m is to be computed. (For the standard eigenproblem, only A is supplied.) In the n o n - s y m m e t r l c case, the i n f o r m a t i o n in the full A and B arrays specifies the matrices, and all of it is destroyed. In the symmetric standard case, the i n f o r m a t i o n in the full lower triangle of A specifies the matrix; that in the strict lower triangle may be destroyed, and that in the full upper triangle is left
324
7.2-12
unaltered. In the s y m m e t r i c g e n e r a l i z e d case, the i n f o r m a t i o n in the f u l l u p p e r t r i a n g l e s of A and B s p e c i f i e s the m a t r i c e s ; the f u l l l o w e r t r i a n g l e of A and the s t r i c t l o w e r t r i a n g l e of B are d e s t r o y e d , and the s t r i c t u p p e r t r i a n g l e of A and the f u l l u p p e r t r i a n g l e of B are left u n a l t e r e d . UST
is a long p r e c i s i o n r e a l t w o - d i m e n s i o n a l v a r i a b l e w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at l e a s t 3. It s u p p l i e s a r e a l non-symmetric tridiagonal matrix whose s u b d i a g o n a l e l e m e n t s are s t o r e d in the last N-I p o s i t i o n s of the f i r s t c o l u m n , w h o s e d i a g o n a l e l e m e n t s are s t o r e d in the s e c o n d c o l u m n , and w h o s e s u p e r d i a g o n a l e l e m e n t s are s t o r e d in the f i r s t N-I p o s i t i o n s of the t h i r d c o l u m n . UST(I,I) and UST(N,3) are a r b i t r a r y . N o n e of the i n f o r m a t i o n in UST is d e s t r o y e d . The n o n - s y m m e t r i c t r i d i a g o n a l m a t r i x s u p p l i e d by UST must h a v e the a d d i t i o n a l s p e c i a l p r o p e r t y that the p r o d u c t s of c o r r e s p o n d i n g o f f - d i a g o n a l e l e m e n t s all are n o n - n e g a t i v e . (Read n o t e 4 for an a d d i t i o n a l r e s t r i c t i o n on UST if eigenvectors are being computed.) V i o l a t i o n of t h e s e r e s t r i c t i o n s on UST c a u s e s an EISPAC execution phase error (see s e c t i o n 2.D below).
ST
is a long p r e c i s i o n real t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t 2. It s u p p l i e s a r e a l symmetric tridiagonal matrix whose s u b d i a g o n a l e l e m e n t s are s t o r e d in the last N-I p o s i t i o n s of the f i r s t c o l u m n and w h o s e d i a g o n a l e l e m e n t s are s t o r e d in the second column. ST(I,1) is a r b i t r a r y . The i n f o r m a t i o n in the s u b d i a g o n a l (first column) only is d e s t r o y e d .
HP
is a long p r e c i s i o n real t w o - d i m e n s i o n a l variable with row dimension NM and c o l u m n d i m e n s i o n at l e a s t N. On input, HP c o n t a i n s the l o w e r t r i a n g l e of a p a c k e d c o m p l e x H e r m i t i a n m a t r i x of o r d e r N whose e i g e n s y s t e m is to be c o m p u t e d . If the r e a l part of the m a t r i x is d e n o t e d by AR and the i m a g i n a r y p a r t b y AI, then the f u l l
325
7.2-13
lower triangle of AR should be stored in the full lower triangle of HP, and the strict lower triangle of AI should be stored in the strict upper triangle of HP in t r a n s p o s e d form. For example when N=4, HP should contain (AR(I,I) (AR(2,1) (AR(3,1) (AR(4,1)
AI(2,1) AR(2,2) AR(3,2) AR(4,2)
AI(3,1) AI(3,2) AR(3,3) AR(4,3)
All of the i n f o r m a t i o n destroyed. SP
in
HP
AI(4,1) AI(4,2) Ai(4,3) AN(4,4)
) ) ) ).
is
is a long p r e c i s i o n real o n e - d i m e n s i o n a l variable with d i m e n s i o n at least N*(N+I)/2. It supplies the lower triangle of a real symmetric matrix A of order N, packed row-wise. For example when N=3, SP should contain (A(I,I),A(2,1),A(2,2),A(3,1),A(3,2),A(3,3)) where the subscripts of each element refer to the row and column of the element in the standard t w o - d i m e n s i o n a l r e p r e s e n t a t i o n . All of the information in SP is destroyed.
SB
is a long p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e with row dimension NM and column d i m e n s i o n at least MB. It supplies the lower triangle of a real symmetric m a t r i x A of order N in band form with half bandwidth MB. The lowest s u b d i a g o n a l of the m a t r i x is stored in the last N+I-MB p o s i t i o n s of the first column of SB, the next s u b d i a g o n a l in the last N+2-MB p o s i t i o n s of the second column, further diagonals similarly, and finally the p r i n c i p a l diagonal in the N positions of the last column. Contents of storage locations not part of the m a t r i x are arbitrary. For example, when N=5 and MB=3, SB should contain ( * ( * (A(3,1) (A(4,2) (A(5,3)
326
* A(2,1) A(3,2) A(4,3) A(5,4)
A(I,I) A(2,2) A(3,3) A(4,4) A(5,5)
) ) ) ) ).
7.2-14
All of the i n f o r m a t i o n destroyed.
in
SB
is
'HERMIT!AN', 'SYMMETRIC', 'TRIDIAGONAL', 'POSITIVE DEFINITE', 'NEGATIVE DEFINITE', 'PACKED' specify that the m a t r i x whose e i g e n s y s t e m is to be found has the stated special property. (See also notes I, 2, and 9.) 'ABX=LX',
Subparameter MB
for
BAND:
is an integer variable which supplies the half b a n d w i d t h of a real symmetric band matrix. It is defined as the number of adjacent diagonals, including the p r i n c i p a l diagonal, required to specify the non-zero portion of the lower triangle of the matrix.
Subparameters WR,
'BAX=LX' (as subparameters for MATB) specify the c o r r e s p o n d i n g v a r i a n t of the real symmetric generalized eigenproblem.
WI
for
VALUES:
are long p r e c i s i o n real o n e - d i m e n s i o n a l v a r i a b l e s of d i m e n s i o n at least N. They receive, respectively, the real and imaginary parts of the N complex eigenvalues computed. is a long precision real o n e - d l m e n s i o n a l v a r i a b l e of dimension at least sufficient (N, MM, or M) to hold the eigenvalues. It receives the N (M) eigenvalues computed.
MM
is an integer variable which, when it is a s u b p a r a m e t e r to VALUES, supplies a m a x i m u m for the number of eigenvalues expected in the interval (RLB,RUB); more than MM eigenvalues in (RLB,RUB) is an error. The dimension of W, and the column dimension of ZR and ZI or Z if used, must be at least MM.
M
is an integer variable which, when it is a s u b p a r a m e t e r to VALUES, denotes the number of eigenvalues actually stored in W. It is supplied (in conjunction with MII) by the user if a specified number of eigenvalues is to be computed. It is set by the program, if an interval (RLB,RUB) has been specified, to the number of eigenvalues actually found.
327
7.2-15
RLB,
RUB
are long p r e c i s i o n r e a l v a r i a b l e s w h i c h d e f i n e an i n t e r v a l to be s e a r c h e d for eigenvalues. The e i g e n v a l u e s f o u n d lie in the i n t e r v a l ( R L B , R U B ) , w h i c h is c l o s e d on the l e f t and o p e n on the r i g h t ; if RLB is not less t h a n RUB, no e i g e n v a l u e s are found. (RLB,RUB) must not contain more than MM eigenvalues.
MII
is an i n t e g e r v a r i a b l e w h i c h , w h e n it is a s u b p a r a m e t e r to V A L U E S , s u p p l i e s the i n d e x of the s m a l l e s t e i g e n v a l u e to be c o m p u t e d .
EPSI
is a long p r e c i s i o n r e a l v a r i a b l e w h i c h s u p p l i e s an a b s o l u t e e r r o r t o l e r a n c e for the c o m p u t e d e i g e n v a l u e s ; if the i n p u t v a l u e of EPSI is n o n - p o s i t i v e , a d e f a u l t v a l u e w i l l be used. (See n o t e 3.)
ALPHAR,
ALPHAI, BETA are long p r e c i s i o n real o n e - d i m e n s i o n a l v a r i a b l e s w i t h d i m e n s i o n at l e a s t N which r e c e i v e the c o m p l e x e i g e n v a l u e s for a real non-symmetric generalized eigenproblem. The r e a l p a r t of e a c h e i g e n v a l u e is g i v e n by ALPHAR(1)/BETA(1) and the i m a g i n a r y p a r t by ALPHAI(1)/BETA(!). (See n o t e 8.)
~ L A R G E S T v, ' S M A L L E S T ' s p e c i f y that the M l a r g e s t or s m a l l e s t e i g e n v a l u e s are to be c o m p u t e d if the rational QR m e t h o d has b e e n s e l e c t e d . In this c a s e s u b s t i t u t e for VALUES(W): V A L U E S (W, M, ' L A R G E S T ' ) or V A L U E S (W, M, 'SMALLEST'), respectively. (See n o t e s I and 9.) Subparameters ZR,
ZP
ZI
for
VECTOR:
are long p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e s w i t h row d i m e n s i o n NM and c o l u m n d i m e n s i o n at l e a s t s u f f i c i e n t (N, MM, or M) to h o l d the e i g e n v e c t o r s . They r e c e i v e , r e s p e c t i v e l y , the r e a l and i m a g i n a r y p a r t s of the N (M) eigenvectors computed. is a long p r e c i s i o n r e a l t w o - d i m e n s i o n a l v a r i a b l e w i t h r o w and c o l u m n d i m e n s i o n s as d e s c r i b e d for ZR and ZI. It r e c e i v e s N (M) columns which represent eigenvectors of a r e a l g e n e r a l m a t r i x or m a t r i x system. To c o n s e r v e s t o r a g e , t h e s e e i g e n v e c t o r s are s t o r e d in ZP in p a c k e d form:
328
7.2-16
c o r r e s p o n d i n g to a real e i g e n v a l u e , one c o l u m n r e p r e s e n t i n g the real e i g e n v e c t o r is s t o r e d ; c o r r e s p o n d i n g to a c o m p l e x c o n j u g a t e p a i r of e i g e n v a ! u e s , two c o n s e c u t i v e c o l u m n s r e p r e s e n t i n g the r e a l and i m a g i n a r y p a r t s of the e i g e n v e c t o r c o r r e s p o n d i n g to the first, or f i r s t f l a g g e d (see SELECT b e l o w ) , of the pair are s t o r e d . For e x a m p l e , s u p p o s e all of the e i g e n v e c t o r s of a real g e n e r a l m a t r i x are b e i n g c o m p u t e d . If the K-th e i g e n v a l u e is r e a l (WI(K) = O) t h e n ZP(K) is the c o r r e s p o n d i n g e i g e n v e c t o r . If the K-th and (K+l)-th e i g e n v a l u e s are a c o m p l e x c o n j u g a t e pair (with WI(K) .GT. 0) then ZP(K) is the r e a l p a r t and ZP(K+I) is the i m a g i n a r y part of the e i g e n v e c t o r c o r r e s p o n d i n g to the K-th eigenvalue. The c o n j u g a t e of this v e c t o r is the e i g e n v e c t o r for the c o n j u g a t e e i g e n v a l u e . ( E x a m p l e F o r t r a n s t a t e m e n t s for u n p a c k i n g the e i g e n v e c t o r s m a y be f o u n d in s e c t i o n 2.3.2 of (6).) is a long p r e c i s i o n real t w o - d i m e n s i o n a l v a r i a b l e w i t h r o w and c o l u m n d i m e n s i o n s as d e s c r i b e d for ZR and ZI. It r e c e i v e s the N (M) eigenvectors computed. When all of the e i g e n v e c t o r s of a r e a l s y m m e t r i c (full) m a t r i x or g e n e r a l i z e d m a t r i x s y s t e m are b e i n g c o m p u t e d , the a r r a y A which s u p p l i e s the i n p u t m a t r i x m a y b e u s e d for Z; the e i g e n v e c t o r s t h e n o v e r w r i t e the input matrix. MM
is an i n t e g e r v a r i a b l e w h i c h , w h e n it is a s u b p a r a m e t e r to V E C T O R , s u p p l i e s the m a x i m u m n u m b e r of c o l u m n s of ZR and ZI or ZP w h i c h w i l l be used. The column d i m e n s i o n of ZR and ZI or ZP m u s t be at l e a s t MM.
M
is an i n t e g e r v a r i a b l e w h i c h , w h e n it is a s u b p a r a m e t e r to V E C T O R , r e c e i v e s the n u m b e r of c o l u m n s u s e d to s t o r e e i g e n v e c t o r s in ZR and ZI or ZP.
SELECT
is a l o g i c a l o n e - d i m e n s i o n a l v a r i a b l e of d i m e n s i o n at l e a s t N w h o s e true e l e m e n t s f l a g those e i g e n v a l u e s of a r e a l or c o m p l e x g e n e r a l m a t r i x w h o s e e i g e n v e c t o r s are to be computed. If e i g e n v e c t o r s of a r e a l g e n e r a l m a t r i x are b e i n g c o m p u t e d and b o t h of a pair of c o m p l e x c o n j u g a t e e i g e n v a l u e s
329
7.2-17
are flagged, the second flag is set false and only the e i g e n v e c t o r c o r r e s p o n d i n g to the first of the pair is computed. An error results if MM is smaller than the number of columns required to hold the selected eigenvectors. Subparameters
for
METHOD:
(See note 9 concerning parameters.)
alphanumeric
~ORTHOGONAL ~ specifies that o r t h o g o n a l similarities (instead of e l e m e n t a r y similarities) are to be used to reduce a real general m a t r i x to upper H e s s e n b e r g form. R e d u c t i o n by orthogonal s i m i l a r i t i e s is somewhat slower than that by e l e m e n t a r y similarities, but in some cases it may improve the accuracy of the computed eigensystem. In particular, if you wish to calculate the c o n d i t i o n numbers for the c o m p u t a t i o n of the e i g e n s y s t e m of a m a t r i x (see (3), p. 199 and (4), pp. 86-89), you should use the c o n d i t i o n - n u m b e r - p r e s e r v i n g orthogonal transformations. 'ELEMENTARY' specifies that e l e m e n t a r y s i m i l a r i t i e s (instead of unitary similarities) are to be used on a complex general m a t r i x (the LR rather than the QR transformation). E l e m e n t a r y s i m i l a r i t i e s are somewhat faster than unitary similarities, but in some cases d i m i n i s h the accuracy of the computed (complex general) eigensystem, 'NO',
'RATQR
'BALANCE' specifies that a real or c o m p l e x general m a t r i x is not to be b a l a n c e d before its e i g e n s y s t e m is computed. In general, b a l a n c i n g improves the accuracy of the computed e i g e n s y s t e m and requires very little a d d i t i o n a l computation time. specifies that the rational QR method is to be used to compute a few of the largest or smallest eigenvalues. (See note I.)
330
7.2-18
Subparameter IERROR
Subparameter USUB
for
ERROR:
is an integer v a r i a b l e which receives a value indicating w h e t h e r certain errors occurred during the solution of the eigensystem. See section 2.D below. for
SUBR:
is a u s e r - s u p p l i e d s u b r o u t i n e following p a r a m e t e r list:
with
the
USUB (SUBRNO, NM, N~ AR, AI, WR, Wl, ZR, ZI, MM, M, RLB, RUB, EPSI, SELECT, IDEF, SMLSTV, IERROR, LOW, UPP, BND, D, E, E2, IND, INT, ORTR, SCALE, TAU, ORTI, MII, NV, MB, BR, DL, ALPHAR, ALPHAI, BETA). The keyword p a r a m e t e r SUBR (USUB) may be added to any EISPAC call. (Note that USUB must be m e n t i o n e d in an EXTERNAL statement in the calling program.) USUB will be called before execution begins and after execution of each numbered routine in the path determined by the parameters to EISPAC and defined in the "EISPAC E i g e n s y s t e m Path Chart" (I); the number of the routine (zero before e x e c u t i o n begins) is passed by the integer v a r i a b l e SUBRNO. USUB may be used to examine i n t e r m e d i a t e results, to obtain timing information, etc.; its use is quite analogous to that of the procedure "INFORM" described by Rutishauser (5). For the meanings of the parameters it receives, and a p p r o p r i a t e dimensions for those requiring them~ see (i), (2), and section 2.3.7 of (6). Note
I:
Computing a Few of the Largest Eigenvalues.
or Smallest
The recommended procedure for computing a few of the extreme eigenvalues of a real symmetric or complex H e r m i t i a n m a t r i x is by a p p r o p r i a t e s p e c i f i c a t i o n of the s u b p a r a m e t e r s MII and M to VALUES. A l t e r n a t i v e l y , the rational QR method may be employed, although it has proven less stable numerically. If the rational QR method is selected and you know that the m a t r i x is positive (negative) definite, you may indicate so by adding the s u b p a r a m e t e r 'POSITIVE DEFINITE' ('NEGATIVE DEFINITE') to MATRIX, e.g.,
33t
7.2-19
M A T R I X (~REAL', ST~ 'SYMMETRIC', 'TRIDIAGONAL' 'POSITIVE DEFINITE') METHOD ('RATQR'), VALUES (W, M, 'SMALLEST'). C o m p u t a t i o n a l economy results only when the largest (smallest) eigenvalues of a negative (positive) definite m a t r i x are sought. Note that s u b p a r a m e t e r W to VALUES must be of d i m e n s i o n at least N, if the rational QR method is used, even though only M eigenvalues are requested. Note
2:
'HERMITIAN'
for Real Matrices.
For a real matrix, are synonymous. Note
3:
EPSI
'HERMITIAN'
as a S u b p a r a m e t e r
to
and
'SYMMETRIC'
VALUES.
EPSI is a long p r e c i s i o n real variable which supplies an absolute error tolerance for the computed eigenvalues when only a few eigenvalues (or a few e i g e n v a l u e s and their c o r r e s p o n d i n g eigenvectors) are being c a l c u l a t e d for the standard or g e n e r a l i z e d real symmetric problems; or for the n o n - s y m m e t r i c g e n e r a l i z e d p r o b l e m where all eigenvalues and p o s s i b l y e i g e n v e c t o r s are being found. If the input value of EPSI is nonpositive, a suitable default value, which is related to the m a c h i n e p r e c i s i o n and the norm of the matrix, is used in place of EPSI; this same default is used if EPSI is not supplied to EISPAC~ The input value, if any, of EPSI is not altered when the default value is employed; however, for the standard p r o b l e m only, the (last) default value used may be examined by means of a user s u b r o u t i n e supplied as the s u b p a r a m e t e r to SUBR (see above). To supply EPSI to EISPAC, s u b s t i t u t e for the r e c o m m e n d e d call to VALUES: VALUES (W, MM, M, RLB, RUB, EPSI) or VALUES (ALPHAR, ALPHAI, BETA, EPSI) as appropriate. If e i g e n v a l u e s only (no eigenvectors) are being computed, EPSI may be used to control the tradeoff between c o m p u t a t i o n time and absolute accuracy of the computed eigenvalues, if less (or more) accuracy than that given by the default value of EPSI is required.
332
7.2-20
If e i g e n v a l u e s and t h e i r c o r r e s p o n d i n g e i g e n v e c t o r s are b e i n g c o m p u t e d , e x t r e m e care m u s t be t a k e n in c h o o s i n g a v a l u e for EPSI o t h e r t h a n the d e f a u l t , s i n c e if EPSI is too large, the e i g e n v e c t o r s m a y be p o o r b e c a u s e the e i g e n v a l u e s are not s u f f i c i e n t l y a c c u r a t e ; w h e r e a s if EPSI is s m a l l e r than n e c e s s a r y for c o n v e r g e n c e , the a d d i t i o n a l a c c u r a c y of the c o m p u t e d e i g e n v a l u e s w i l l n o t i n c r e a s e the a c c u r a c y of the e i g e n v e c t o r s . For f u r t h e r d i s c u s s i o n , or in case of d i f f i c u l t y , see section 2.3.3 of (6), and also the NATS s u b r o u t i n e d o c u m e n t s for F223 TINVIT, F294 BISECT, F 2 3 7 T R I D I B , and F239 QZIT (2). Note
4:
Class which
of N o n - S y m m e t r i c Eigenvectors may
Tridiagonal be Found.
Matrices
for
The c l a s s of real n o n - s y m m e t r i c t r i d i a g o n a l m a t r i c e s for w h i c h e l g e n v e c t o r s can be c o m p u t e d is s o m e w h a t m o r e r e s t r i c t e d t h a n that for w h i c h e i g e n v a l u e s c a n be found. For the e i g e n v e c t o r c o m p u t a t i o n to be s u c c e s s f u l , not o n l y m u s t the p r o d u c t s of c o r r e s p o n d i n g o f f - d i a g o n a l e l e m e n t s all be n o n - n e g a t i v e , but also w h e n s u c h a p r o d u c t is zero, the c o r r e s p o n d i n g o f f - d i a g o n a l e l e m e n t s m u s t b o t h be zero. Note
Note
5:
'UNITARY'
for R e a l M a t r i c e s .
For are
a real matrix, synonymous.
6:
Symmetric
'UNITARY'
Band M a t r i c e s
and
of H a l f
'ORTHOGONAL'
Bandwidth
2.
If MB is s p e c i f i e d as 2 for a r e a l s y m m e t r i c band m a t r i x , EISPAC s e l e c t s the same s u b r o u t i n e s as if 'TRIDIAGONAL' h a d b e e n s p e c i f i e d as a s u b p a r a m e t e r to MATRIX. Note
7:
Generalized
Problem
Matrix
Subparameters.
As d i s c u s s e d e a r l i e r , for a p r o b l e m to be c l a s s i f i e d " R e a l S y m m e t r i c G e n e r a l i z e d " , the A and B i n p u t m a t r i c e s m u s t each be s y m m e t r i c w i t h B positive definite. U n l e s s ' S Y M M E T R I C ' is s p e c i f i e d as a s u b p a r a m e t e r to MATA and b o t h ' S Y M M E T R I C ' and ' P O S I T I V E D E F I N I T E ' are s p e c i f i e d as s u b p a r a m e t e r s to MATB, EISPAC will select a p a t h c o r r e s p o n d i n g to the real n o n - s y m m e t r i c g e n e r a l i z e d case i n s t e a d (and a s s u m e s t o r a g e of the full A and B matrices).
333
7.2-21
Note
8:
Eigenva!ues Problem.
for
the N o n - S y m m e t r i c
Generalized
The d i v i s i o n s ALPHAR(1)/BETA(1) and ALPHAI(1)/BETA(1) to obtain the real and imaginary parts of the eigenvalues for the real n o n - s y m m e t r i c g e n e r a l i z e d p r o b l e m are left to the user. The arrays ALPHAR, ALPHAI, and BETA themselves are returned instead, because they have more i n f o r m a t i o n than the quotients when B (or both A and B) is nearly singular. Indeed, if B is singular, at least one element of BETA will be zero and division dare not be attempted. Note
9:
N e g a t i o n and A b b r e v i a t i o n Subparameterso
of A l p h a n u m e r i c
Any a l p h a n u m e r i c s u b p a r a m e t e r (e.g., 'BALANCE') is n e g a t e d if its i m m e d i a t e l y p r e c e d i n g s u b p a r a m e t e r is 'NO', 'NON', or 'NOT' Similarly, the subparameters 'YES', 'IS', 'USE', and 'DO' act as identity a l p h a n u m e r i c subparameters. These conventions are useful when you desire to use a single EISPAC call to compute the e i g e n s y s t e m of a m a t r i x which sometimes is to be balanced and sometimes not, say, since the s u b p a r a m e t e r 'NO' or 'YES' may be an a l p h a n u m e r i c variable. Any a l p h a n u m e r i c s u b p a r a m e t e r may be a b b r e v i a t e d by enough of its initial letters to u n a m b i g u o u s l y d i s t i n g u i s h it from all other a l p h a n u m e r i c subparameters. For p r o t e c t i o n against a m b i g u i t i e s arising from the future i n t r o d u c t i o n of new a l p h a n u m e r i c subparameters, you should use at least three (perhaps four) letter a b b r e v i a t i o n s when they exist. The a l p h a n u m e r i c s u b p a r a m e t e r s currently in use are listed below (synonyms are separated by commas, antonyms by hyphens): DO', 'IS', 'USE' 'YES' NO', 'NON', 'NOT I REAL' - 'COMPLEX' HERMITIAN' 'GENERAL' (see note 2) SYMMETRIC' - 'GENERAL' TRIDIAGONAL' 'FULL' P O S I T I V E DEFINITE' N E G A T I V E DEFINITE' BALANCE' ORTHOGONAL' - 'ELEMENTARY' UNITARY' 'ELEMENTARY' (see note 5) AX=LBX', 'AZ=WBZ' ABX=LX' 'ABZ=WZ' ~BAX=LX' 'BAZ=WZ' 'LARGEST' - 'SMALLEST'. -
-
334
7.2-22
As a final e x a m p l e i l l u s t r a t i n g these c o n c e p t s , s u p p o s e you w i s h to c o m p u t e the e i g e n v a l u e s and e i g e n v e c t o r s of an order N real g e n e r a l m a t r i x w i t h o u t b a l a n c i n g and using o r t h o g o n a l t r a n s f o r m a t i o n s , w i t h r e t r i e v a l of the error i n d i c a t o r and calls to a user s u b r o u t i n e , in a program with variables dimensioned: A(100,100), W R ( 1 0 0 ) , WI(100), Z ( 1 0 0 , 1 0 0 ) . T h e n two of s e v e r a l p o s s i b l e calls are: CALL E I S P A C (I00, N, M A T R I X ('REAL', A), V A L U E S (WR, WI), V E C T O R (Z), M E T H O D ( ' O R T H O G O N A L ' , 'NO', 'BALANCE'), E R R O R (IERROR), SUBR (USUB)) CALL E I S P A C (I00, N, M A T R I X ('NOT', 'COMPLEX', A), M E T H O D ('USE', 'ORTHOG', 'NO', 'NO', 'NO', 'BALAN'), V A L U E S (WR, WI), V E C T O R (Z), SUBR (USUB), ERROR (IERROR)) (Recall in the last e x a m p l e that k e y w o r d p a r a m e t e r s can a p p e a r in any o r d e r in the third p a r a m e t e r p o s i t i o n and b e y o n d . )
D. E r r o r
Conditions
and Returns.
Three types of e r r o r s can occur in EISPAC: "decision p h a s e " e r r o r s , " e x e c u t i o n phase" errors, and " l i n k a g e " errors. (See s e c t i o n 3 below.) D e c i s i o n p h a s e errors arise when EISPAC d e t e c t s a m i s t a k e or i n c o n s i s t e n c y in the form of the p a r a m e t e r s it r e c e i v e s . Execution p h a s e e r r o r s are those w h i c h it d e t e c t s d u r i n g the e x e c u t i o n of the e i g e n s y s t e m - p a c k a g e subroutines themselves. D e c i s i o n p h a s e errors a l w a y s result in a m e s s a g e d e s c r i b i n g the error and the f u r t h e r m e s s a g e " E X E C U T I O N C O N T I N U I N G " or " E X E C U T I O N T E R M I N A T E D " and the a p p r o p r i a t e action. E x e c u t i o n p h a s e errors a l w a y s result in a m e s s a g e d e s c r i b i n g the error and t e r m i n a t i o n of e x e c u t i o n , unless the ERROR k e y w o r d was s u p p l i e d (see below). L i n k a g e errors may occur e i t h e r d u r i n g the d e c i s i o n or e x e c u t i o n phases and always cause t e r m i n a t i o n of execution. L i n k a g e error 00 arises w h e n the i n t e r n a l file name EISPACLB has not been a s s o c i a t e d w i t h a d a t a s e t via a DD card or A L L O C command. L i n k a g e error 01 arises w h e n such an a s s o c i a t i o n has b e e n made but a r e q u e s t e d s u b r o u t i n e or p h a s e of EISPAC c a n n o t be found in the a s s o c i a t e d dataset. In this case, check that it c o n t a i n s the r e q u i r e d e i g e n s y s t e m - p a c k a g e s u b r o u t i n e s and the p h a s e s of EISPAC. (See s e c t i o n s 3 and 5 b e l o w . )
335
7.2-23
Y o u m a y m o d i f y the b e h a v i o r of EISPAC w h e n an e x e c u t i o n p h a s e e r r o r is d e t e c t e d by s u p p l y i n g the ERROR keyword. W h e n it is s u p p l i e d , its s u b p a r a m e t e r !ERROR is set to a v a l u e c h a r a c t e r i z i n g the e r r o r and r e t u r n is m a d e to the c a l l i n g p r o g r a m (i.e., e x e c u t i o n is not t e r m i n a t e d ) . F u r t h e r m o r e , y o u m a y s u p p r e s s the p r i n t i n g of the e r r o r m e s s a g e by s e t t i n g IERROR to the value -755 870 989 before calling EISPAC. A n o n - z e r o v a l u e of IERROR on r e t u r n f r o m EISPAC i n d i c a t e s that an e x e c u t i o n p h a s e e r r o r has o c c u r r e d . If iERROR is p o s i t i v e , the c o m p u t a t i o n has b e e n a b a n d o n e d , and few, if any, u s e f u l r e s u l t s h a v e b e e n produced. H o w e v e r , if IERROR is n e g a t i v e , the c o m p u t a t i o n has b e e n c o n t i n u e d d e s p i t e the e r r o r ( s ) and some m e a n i n g f u l r e s u l t s h a v e b e e n p r o d u c e d ; u s e of the ERROR k e y w o r d thus p e r m i t s y o u to r e c o v e r t h e s e results. The v a l u e s IERROR m a y a s s u m e and t h e i r s i g n i f i c a n c e are d i s c u s s e d below. (See a l s o (2) and
(6).) V a l u e of IERROR
Error Msg. No. None
Significance No
execution
phase
errors
occurred.
I
00
The c a l c u l a t i o n of the l-th e i g e n v a l u e f a i l e d to c o n v e r g e . If the e i g e n s y s t e m of a r e a l or c o m p l e x g e n e r a l m a t r i x or for a n o n - s y m m e t r i c g e n e r a l i z e d p r o b l e m was b e i n g computed, eigenvalues I+IjI+2,...,N s h o u l d be c o r r e c t ; o t h e r w i s e , eigenvalues 1,2,...,1-1 s h o u l d be correct.
N+I
01
For a real non-symmetric tridiagonal matrix, A(I, I ) * A ( I - I , 3 ) .LT. 0, v i o l a t i n g the r e s t r i c t i o n d i s c u s s e d above. No u s e f u l r e s u l t s are produced.
2*N+I
02
For the e i g e n v e e t o r s of a real n o n symmetric tridiagonal matrix, A(I,I) and A(I-I,3) v i o l a t e d the r e s t r i c t i o n of n o t e 4, above. All e i g e n v a l u e s , b u t no e i g e n v e c t o r s , are correct.
336
7.2-24
3*N+I
03
Either: (I) Parameter MM specified i n s u f f i c i e n t s t o r a g e to h o l d all of the e i g e n v a l u e s in the i n t e r v a l (RLB,RUB). The only useful result is M, w h i c h c o n t a i n s the n u m b e r of e i g e n v a l u e s w h i c h lie in the interval. Or: (2) It is n o t p o s s i b l e to c o m p u t e exactly M eigenvalues (starting f r o m the M l l - t h ) b e c a u s e of e x a c t m u l t i p l i c i t y at i n d e x MII. No u s e f u l r e s u l t s are p r o d u c e d .
3"N+2
04
It is n o t p o s s i b l e to c o m p u t e e x a c t l y M e i g e n v a l u e s ( s t a r t i n g f r o m the M l l - t h ) b e c a u s e of e x a c t m u l t i p l i c i t y at i n d e x MII+M-I. No u s e f u l r e s u l t s are p r o d u c e d .
4*N+I
None
5*N+I
05
The M l a r g e s t or s m a l l e s t e i g e n v a l u e s w e r e b e i n g c o m p u t e d by the ~ a t i o n a ! QR m e t h o d and the l-th e i g e n v a l u e f a i l e d to c o n v e r g e . All eigenvalues probably have some a c c u r a c y , b u t no s t r o n g e r s t a t e m e n t can be m a d e .
6*N+I
06
The M l a r g e s t or s m a l l e s t e i g e n v a l u e s w e r e b e i n g c o m p u t e d by the r a t i o n a l QR m e t h o d , the m a t r i x was s p e c i f i e d n e g a t i v e or p o s i t i v e d e f i n i t e , b u t the c o m p u t a t i o n s u g g e s t s it m a y not be; try a g a i n o m i t t i n g the d e f i n i t e n e s s specification. No u s e f u l r e s u l t s are produced.
7*N+I
07
The e l g e n s y s t e m for a real s y m m e t r i c generalized problem was being c o m p u t e d and the m a t r i x s u p p l i e d to MATB was n o t p o s i t i v e d e f i n i t e . No u s e f u l r e s u l t s are p r o d u c e d .
50
The c a l c u l a t i o n of one or m o r e e i g e n v e c t o r s i n c l u d i n g the l-th f a i l e d to c o n v e r g e . All eigenvalues and the n o n - z e r o e i g e n v e c t o r s are correct.
-I
Not
used
337
in
EISPAC.
7.2-25
-(N+!)
None
-(2*N+I)
52
-(3*N+I)
None
Both error 50 below occurred.
above
and
error
52
Parameter MM specified insufficient c o l u m n s to h o l d the s e l e c t e d eigenvectors. A l l e i g e n v a l u e s and the f i r s t MM c o l u m n s of (ZR, ZI) or Z are c o r r e c t . T h i s e r r o r p r e d i c t s that e r r o r 02 a b o v e w i l l occur. It w i l l not n o r m a l l y be r e t u r n e d f r o m EISPAC b u t m a y be o b s e r v e d w h e n the u s e r s u b r o u t i n e is e m p l o y e d .
In a d d i t i o n to the a b o v e e r r o r s w h i c h are d i a g n o s e d by EISPAC, other errors may produce System/360-370 c o m p l e t i o n codes (SCC). The m o s t c o m m o n l y p r o d u c e d c o m p l e t i o n c o d e s and t h e i r m e a n i n g s in c o n j u n c t i o n w i t h EISPAC a r e the f o l l o w i n g : 804
T h e r e was not e n o u g h s t o r a g e to d y n a m i c a l l y load a r e q u e s t e d s u b r o u t i n e . Provide more s t o r a g e ( r e g i o n ) ~ r e d u c e the size of the e i g e n p r o b l e m b e i n g s o l v e d , or c h o o s e a p a t h w h i c h r e q u i r e s less t e m p o r a r y s t o r a g e (see (i) and (6)). T h e m i n i m u m s t o r a g e r e q u i r e m e n t for EISPAC is a p p r o x i m a t e l y 2 2 , 0 0 0 ( d e c i m a l ) b y t e s on S y s t e m / 3 6 0 - 3 7 0 .
606
Same
80A
T h e r e was not e n o u g h s t o r a g e t e m p o r a r y v e c t o r or m a t r i x . u n d e r S C C 8 0 4 above.
E. A p p l i c a b i l i t y
as
SCC804
above. to a l l o c a t e a See s u g g e s t i o n s
and R e s t r i c t i o n s .
EISPAC is a p p l i c a b l e to the s o l u t i o n of the s t a n d a r d and g e n e r a l i z e d e i g e n s y s t e m p r o b l e m s for the c l a s s e s of m a t r i c e s for w h i c h e x a m p l e s are g i v e n above. For f u r t h e r d e t a i l s on a p p l i c a b i l i t y , see (6), or c o n s u l t the " E I S P A C E i g e n s y s t e m P a t h C h a r t " (I) to d e t e r m i n e w h i c h s u b r o u t i n e s are u s e d in the p a t h of i n t e r e s t and t h e n the NATS s u b r o u t i n e d o c u m e n t s (2) for t h o s e subroutines.
338
7.2-26
3. D I S C U S S I O N
OF METHOD
AND ALGORITHM.
EISPAC consists of three major parts, the p a r a m e t e r interpreter phase, the decision phase, and the execution phase, which are c o - o r d i n a t e d by a supervisor. The supervisor employs brief assembly language routines to count the number of s u b p a r a m e t e r s supplied to each of the keywords and the number of parameters supplied to EISPAC itself. It then loads the p a r a m e t e r - i n t e r p r e t e r phase dynamically and passes the p a r a m e t e r information to it. The p a r a m e t e r - i n t e r p r e t e r phase analyzes the parameters, checks them for consistency, supplies defaults for omitted optional parameters, and produces a c h a r a c t e r i z a t i o n of the p r o b l e m they specify. It returns this c h a r a c t e r i z a t i o n and a s t a n d a r d i z e d list of parameters to the supervisor. If errors have been detected in the p a r a m e t e r - i n t e r p r e t e r phase, the supervisor loads an error m e s s a g e module d y n a m i c a l l y which prints error m e s s a g e s and which may terminate execution. Otherwise, the supervisor loads a decision phase appropriate to the problem being solved and passes the c h a r a c t e r i z a t i o n to it. The decision phase determines the "path", or sequence, of e i g e n s y s t e m - p a c k a g e subroutines and auxiliary actions (e.g., temporary storage allocations) needed to solve the specified eigenproblem. It then returns a r e p r e s e n t a t i o n of this path to the supervisor. The supervisor then calls the execution phase, which interprets the r e p r e s e n t a t i o n of the path (and i n f o r m a t i o n about order of execution) to load dynamically the required e i g e n s y s t e m subroutines and to allocate and free needed temporary storage. (Loading, allocating, and freeing are p e r f o r m e d by o p e r a t i n g system requests contained in brief assembly language routines.) When execution is complete, or as soon as a fatal error occurs, the e x e c u t i o n phase returns to the supervisor. If execution phase errors have occurred and error messages are to be printed (see section 2.D above), the s u p e r v i s o r loads the error m e s s a g e m o d u l e d y n a m i c a l l y and prints them; execution terminates or continues as described above. When execution continues, the supervisor returns the results of the computation to the calling program. Certain economies of execution are possible when EISPAC is called r e p e a t e d l y to solve the same eigenproblem. After the first execution of the path for the problem, usable copies of the e i g e n s y s t e m - p a c k a g e subroutines for it may remain in memory (if sufficient storage is available), and if so they are reused w i t h o u t being reloaded on subsequent executions of the path.
389
7.2-27
The design and i m p l e m e n t a t i o n of EISPAC are highly modular, so that a d d i t i o n a l subroutines and paths can be added relatively easily and with only a m i n i m u m of disturbance to existing paths. This m o d u l a r design of EISPAC and the p h i l o s o p h y behind it are d i s c u s s e d in detail in (7).
4. REFERENCES.
I)
Boyle, J.M., Hauser, C.H., and Rothaar~ H.R.~ EISPAC E i g e n s y s t e m Package Path Chart, Release 2, Argonne N a t i o n a l Laboratory, Applied M a t h e m a t i c s Division, February, 1975.
2)
NATS Project, E i g e n s y s t e m Subroutine Package Subroutines F269 to F298 and F220 to F247.
3)
Wilkinson, J.H. and Reinsch, C., H a n d b o o k for Automatic Computation, Volume II, Linear Algebra, Springer-Verlag, (1971).
4)
Wilkinson, J.H., The Algebraic Eigenvalue Problem, Oxford, Clarendon Press (1965).
5)
Rutishauser, H.~ I n t e r f e r e n c e With an Algol-Procedure, Annual Review in Automatic Programming, Vol. 2 (R. Goodman, Ed.), P e r g a m o n Press, (1961).
6)
This publication. (Reference retained to resolve User Guide pointers, thus enabling c o m p a t i b i l i t y with d i s t r i b u t e d documentation.)
7)
Boyle, J.M. and Grau, A.A., Modular Design of a UserOriented Control P r o g r a m for EiSPACK, Applied M a t h e m a t i c s D i v i s i o n T e c h n i c a l M e m o r a n d u m No. 242, Argonne National Laboratory, Argonne, Illinois 60439, November 1973.
5. PROGRAM
(EISPACK),
STATISTICS~
A. A d d i t i o n a l
Entry Point Names
in
EISPAC.
The entry point names listed below are entry point names in the part of EISPAC loaded with your program. Your program must not include other subroutines or functions having any of these names: BAND, COREEP, EERMEP, E!DFEP, EISPAC, ERROR, FIDFEP, LINKEP~ MATA, MATB, MATRIX, METHOD, SUBR~ SUPVEP, VALUES, VECTOR.
340
7.2-28
In addition, the other phases of EISPAC contain entry points with the names DGNHEP, DGSHEP, DIDFEP, DSNHEP, EGNHEP, EGSHEP, ERMSEP, ERSEP, ESNHEP, FIDFEP, IBCMEP, IBCOM#, ICHREP, INTREP, and LKUPEP. These entry points will not, however, conflict with those in your program, since these phases are loaded dynamically.
B. Common
Storage.
None.
C. Space
Requirements.
The parts of EISPAC loaded with your p r o g r a m (subroutine EISPAC and the supervisor) require 2738 (HEX) = 10040 (DECIMAL) bytes under FORTRAN H, OPT=2, Release 21.7 of 0S/360. However, EISPAC requires an a d d i t i o n a l amount of storage for the dynamically loaded subroutines and the temporary arrays some of them require. At a minimum, this r e q u i r e m e n t is 2EA0 (HEX) = 11936 (DECIMAL) bytes for the p a r a m e t e r interpreter phase of EISPAC. During execution, up to 3100 (HEX) = 12544 (DECIMAL) bytes are required for the appropriate execution phase of EISPAC and a typical EISPACK subroutine, plus w h a t e v e r a d d i t i o n a l storage is needed for dynamically allocated temporary arrays. See (i) and (2) for further i n f o r m a t i o n for estimating this d y n a m i c a l l y - d e t e r m i n e d amount of storage.
6. CHECKOUT. A. Test
Cases.
EISPAC has been tested on the same matrices separate EISPACK subroutines. See Section "VALIDATION OF EISPACK".
as have 3 --
B. Accuracy. The accuracy of EISPAC depends directly upon the subroutines used from the EISPACK package (2). Consult the path chart (I) to learn which subroutines have been selected, and then reference the separate accuracy statements that apply to these subroutines.
the
REFERENCES
i°
Wilkinson, J. H. and Reinsch, C., Handbook for Automatic Computation, Volume II, Linear Algebra, Part 2, Springer-Verlag, New York, Heidelberg, Berlin, 1971.
2.
Wilkinson, J. H., The Algebraic Eigenvalue Problem, Clarendon Press, Oxford, !965.
3.
Boyle~ J. M., Cody, Wo 7o, Cowell, W. R., Garbow, B. S., Ikebe, Y., Moler, C. B.~ and Smith, B. T., NATS, A Collaborative Effort to Certify and Disseminate Mathematical Software, Proceedings 1972 National ACM Conference, Volume II, Association for Computing Machinery, New York, 1972, pp. 630-635.
4.
Smith, B. T., The NATS Project, A National Activity to Test Software, SHAP~ SSD 228, October, 1972, item C-5732, pp. 35-42.
5.
Smith, B. T.= Boyle, J. M., Cody, W. J., The NATS Approach to Quality Software, Software for Numerical Mathematics, D. J. Evans, ed., Academic Press, London, New York, 1974, pp. 393-405.
6.
Boyle, J. M. and Grau, A~ A., Modular Design of a User-Oriented Control Program for EiSPACK, Technical Memorandum No. 242, Applied Mathematics Division, Argonne National Laboratory, 1973.
7.
Garbow, B. S., EISPACK - A Package of Matrix Eigensystem Routines, Computer Physics Communications, North-Holland, Amsterdam, Vol. 7, 1974, pp. 179-184.
342
8.
Moler, C° B. and Stewart, G. W., An Algorithm for Generalized Matrix Eigenvalue Problems, SIAM Journal of Numerical Analysis, Vol. i0, 1973, pp. 241-256.
9.
Ward, R. C., An Extension of the QZ Algorithm for Solving the Generalized Matrix Eigenvalue Problem, Technical Note NASA TN D-7305, National Aeronautics and Space Administration, Washington, 1973.
i0.
Smith, B. T., Boyle, J. M., Dongarra, J. J., Garbow, B. S., Ikebe, Y., Klema, V. C., and Moler, C. B., Matrix Eigensystem Routines - EISPACK Guide, Lecture Notes in Computer Science, Vol. 6, Second Edition, Springer-Verlag, New York, Heidelberg, Berlin, 1976.
343