nag_real_eigenvalues (f02afc) (PDF version)
f02 Chapter Contents
f02 Chapter Introduction
NAG Library Manual
NAG Library Function Document
nag_real_eigenvalues (f02afc)
+
−
Contents
1
Purpose
2
Specification
3
Description
4
References
5
Arguments
6
Error Indicators and Warnings
7
Accuracy
8
Parallelism and Performance
9
Further Comments
+
−
10
Example
10.1
Program Text
10.2
Program Data
10.3
Program Results
1 Purpose
nag_real_eigenvalues (f02afc) calculates all the eigenvalues of a real unsymmetric matrix.
2 Specification
#include <nag.h>
#include <nagf02.h>
void
nag_real_eigenvalues (Integer
n
, double
a
[], Integer
tda
, Complex
r
[], Integer
iter
[], NagError *
fail
)
3 Description
The matrix
A
is first balanced and then reduced to upper Hessenberg form using stabilised elementary similarity transformations. The eigenvalues are then found using the
Q
R
algorithm for real Hessenberg matrices.
4 References
Wilkinson J H and Reinsch C (1971)
Handbook for Automatic Computation II, Linear Algebra
Springer–Verlag
5 Arguments
1:
n
–
Integer
Input
On entry
:
n
, the order of the matrix
A
.
Constraint
:
n
≥
1
.
2:
a
[
n
×
tda
]
–
double
Input/Output
Note:
the
i
,
j
th element of the matrix
A
is stored in
a
[
i
-
1
×
tda
+
j
-
1
]
.
On entry
: the
n
by
n
matrix
A
.
On exit
:
a
is overwritten.
3:
tda
–
Integer
Input
On entry
: the stride separating matrix column elements in the array
a
.
Constraint
:
tda
≥
n
.
4:
r
[
n
]
–
Complex
Output
On exit
: the eigenvalues.
5:
iter
[
n
]
–
Integer
Output
On exit
:
iter
[
i
-
1
]
contains the number of iterations used to find the
i
th eigenvalue. If
iter
[
i
-
1
]
is negative, the
i
th eigenvalue is the second of a pair found simultaneously.
Note:
the eigenvalues are found in reverse order, starting with the
n
th.
6:
fail
–
NagError *
Input/Output
The NAG error argument (see
Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
NE_2_INT_ARG_LT
On entry,
tda
=
value
while
n
=
value
. These arguments must satisfy
tda
≥
n
.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_INT_ARG_LT
On entry,
n
=
value
.
Constraint:
n
≥
1
.
NE_TOO_MANY_ITERATIONS
More than
value
iterations are required to isolate all the eigenvalues.
7 Accuracy
The accuracy of the results depends on the original matrix and the multiplicity of the roots. For a detailed error analysis see pages 352 and 367
Wilkinson and Reinsch (1971)
.
8 Parallelism and Performance
Not applicable.
9 Further Comments
The time taken by nag_real_eigenvalues (f02afc) is approximately proportional to
n
3
.
10 Example
To calculate all the eigenvalues of the real matrix
1.5
0.1
4.5
-
1.5
-
22.5
3.5
12.5
-
2.5
-
2.5
0.3
4.5
-
2.5
-
2.5
0.1
4.5
2.5
.
10.1 Program Text
Program Text (f02afce.c)
10.2 Program Data
Program Data (f02afce.d)
10.3 Program Results
Program Results (f02afce.r)
nag_real_eigenvalues (f02afc) (PDF version)
f02 Chapter Contents
f02 Chapter Introduction
NAG Library Manual
© The Numerical Algorithms Group Ltd, Oxford, UK. 2014