| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# GENERATED WITH PDL::PP! Don't modify! |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
package PDL::LinearAlgebra::Real; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
@EXPORT_OK = qw( PDL::PP gesvd PDL::PP gesdd PDL::PP ggsvd PDL::PP geev PDL::PP geevx PDL::PP ggev PDL::PP ggevx PDL::PP gees PDL::PP geesx PDL::PP gges PDL::PP ggesx PDL::PP syev PDL::PP syevd PDL::PP syevx PDL::PP syevr PDL::PP sygv PDL::PP sygvd PDL::PP sygvx PDL::PP gesv PDL::PP gesvx PDL::PP sysv PDL::PP sysvx PDL::PP posv PDL::PP posvx PDL::PP gels PDL::PP gelsy PDL::PP gelss PDL::PP gelsd PDL::PP gglse PDL::PP ggglm PDL::PP getrf PDL::PP getf2 PDL::PP sytrf PDL::PP sytf2 PDL::PP potrf PDL::PP potf2 PDL::PP getri PDL::PP sytri PDL::PP potri PDL::PP trtri PDL::PP trti2 PDL::PP getrs PDL::PP sytrs PDL::PP potrs PDL::PP trtrs PDL::PP latrs PDL::PP gecon PDL::PP sycon PDL::PP pocon PDL::PP trcon PDL::PP geqp3 PDL::PP geqrf PDL::PP orgqr PDL::PP ormqr PDL::PP gelqf PDL::PP orglq PDL::PP ormlq PDL::PP geqlf PDL::PP orgql PDL::PP ormql PDL::PP gerqf PDL::PP orgrq PDL::PP ormrq PDL::PP tzrzf PDL::PP ormrz PDL::PP gehrd PDL::PP orghr PDL::PP hseqr PDL::PP trevc PDL::PP tgevc PDL::PP gebal PDL::PP gebak PDL::PP lange PDL::PP lansy PDL::PP lantr PDL::PP gemm PDL::PP mmult PDL::PP crossprod PDL::PP syrk PDL::PP dot PDL::PP axpy PDL::PP nrm2 PDL::PP asum PDL::PP scal PDL::PP rot PDL::PP rotg PDL::PP lasrt PDL::PP lacpy PDL::PP laswp PDL::PP lamch PDL::PP labad PDL::PP tricpy PDL::PP cplx_eigen PDL::PP augment PDL::PP mstack PDL::PP charpol ); |
|
8
|
|
|
|
|
|
|
%EXPORT_TAGS = (Func=>[@EXPORT_OK]); |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use PDL::Core; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
11
|
1
|
|
|
1
|
|
398
|
use PDL::Exporter; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
9
|
|
|
12
|
1
|
|
|
1
|
|
18
|
use DynaLoader; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
80
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$PDL::LinearAlgebra::Real::VERSION = '0.11'; |
|
17
|
|
|
|
|
|
|
@ISA = ( 'PDL::Exporter','DynaLoader' ); |
|
18
|
|
|
|
|
|
|
push @PDL::Core::PP, __PACKAGE__; |
|
19
|
|
|
|
|
|
|
bootstrap PDL::LinearAlgebra::Real $VERSION; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
70
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
{ |
|
28
|
|
|
|
|
|
|
package # hide from CPAN |
|
29
|
|
|
|
|
|
|
PDL; |
|
30
|
|
|
|
|
|
|
my $warningFlag; |
|
31
|
|
|
|
|
|
|
BEGIN{ |
|
32
|
1
|
|
|
1
|
|
3
|
$warningFlag = $^W; |
|
33
|
1
|
|
|
|
|
44
|
$^W = 0; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use overload ( |
|
37
|
0
|
|
|
0
|
|
0
|
'x' => sub {PDL::mmult($_[0], $_[1])}, |
|
38
|
1
|
|
|
1
|
|
16
|
); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
12
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
1
|
|
|
1
|
|
2158
|
BEGIN{ $^W = $warningFlag;} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding Latin-1 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
PDL::LinearAlgebra::Real - PDL interface to the real lapack linear algebra programming library |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use PDL::LinearAlgebra::Real; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$a = random (100,100); |
|
57
|
|
|
|
|
|
|
$s = zeroes(100); |
|
58
|
|
|
|
|
|
|
$u = zeroes(100,100); |
|
59
|
|
|
|
|
|
|
$v = zeroes(100,100); |
|
60
|
|
|
|
|
|
|
$info = 0; |
|
61
|
|
|
|
|
|
|
$job = 0; |
|
62
|
|
|
|
|
|
|
gesdd($a, $job, $info, $s , $u, $v); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Blas vector routine use increment. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This module provides an interface to parts of the real lapack library. |
|
70
|
|
|
|
|
|
|
These routines accept either float or double piddles. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 gesvd |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=for sig |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int jobu(); int jobvt(); [o,phys]s(r); [o,phys]U(p,q); [o,phys]VT(s,t); int [o,phys]info()) |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=for ref |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Computes the singular value decomposition (SVD) of a real |
|
100
|
|
|
|
|
|
|
M-by-N matrix A. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The SVD is written |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
A = U * SIGMA * V' |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
where SIGMA is an M-by-N matrix which is zero except for its |
|
107
|
|
|
|
|
|
|
min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and |
|
108
|
|
|
|
|
|
|
V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA |
|
109
|
|
|
|
|
|
|
are the singular values of A; they are real and non-negative, and |
|
110
|
|
|
|
|
|
|
are returned in descending order. The first min(m,n) columns of |
|
111
|
|
|
|
|
|
|
U and V are the left and right singular vectors of A. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Note that the routine returns VT = V', not V. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
jobu: Specifies options for computing all or part of the matrix U: |
|
116
|
|
|
|
|
|
|
= 0: no columns of U (no left singular vectors) are |
|
117
|
|
|
|
|
|
|
computed. |
|
118
|
|
|
|
|
|
|
= 1: all M columns of U are returned in array U: |
|
119
|
|
|
|
|
|
|
= 2: the first min(m,n) columns of U (the left singular |
|
120
|
|
|
|
|
|
|
vectors) are returned in the array U; |
|
121
|
|
|
|
|
|
|
= 3: the first min(m,n) columns of U (the left singular |
|
122
|
|
|
|
|
|
|
vectors) are overwritten on the array A; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
jobvt: Specifies options for computing all or part of the matrix |
|
126
|
|
|
|
|
|
|
V': |
|
127
|
|
|
|
|
|
|
= 0: no rows of V' (no right singular vectors) are |
|
128
|
|
|
|
|
|
|
computed. |
|
129
|
|
|
|
|
|
|
= 1: all N rows of V' are returned in the array VT; |
|
130
|
|
|
|
|
|
|
= 2: the first min(m,n) rows of V' (the right singular |
|
131
|
|
|
|
|
|
|
vectors) are returned in the array VT; |
|
132
|
|
|
|
|
|
|
= 3: the first min(m,n) rows of V' (the right singular |
|
133
|
|
|
|
|
|
|
vectors) are overwritten on the array A; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
jobvt and jobu cannot both be 3. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
138
|
|
|
|
|
|
|
On exit, |
|
139
|
|
|
|
|
|
|
if jobu = 3, A is overwritten with the first min(m,n) |
|
140
|
|
|
|
|
|
|
columns of U (the left singular vectors, |
|
141
|
|
|
|
|
|
|
stored columnwise); |
|
142
|
|
|
|
|
|
|
if jobvt = 3, A is overwritten with the first min(m,n) |
|
143
|
|
|
|
|
|
|
rows of V' (the right singular vectors, |
|
144
|
|
|
|
|
|
|
stored rowwise); |
|
145
|
|
|
|
|
|
|
if jobu != 3 and jobvt != 3, the contents of A |
|
146
|
|
|
|
|
|
|
are destroyed. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
s: The singular values of A, sorted so that s(i) >= s(i+1). |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
U: If jobu = 1, U contains the M-by-M orthogonal matrix U; |
|
151
|
|
|
|
|
|
|
if jobu = 3, U contains the first min(m,n) columns of U |
|
152
|
|
|
|
|
|
|
(the left singular vectors, stored columnwise); |
|
153
|
|
|
|
|
|
|
if jobu = 0 or 3, U is not referenced. |
|
154
|
|
|
|
|
|
|
Min size = [1,1]. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
VT: If jobvt = 1, VT contains the N-by-N orthogonal matrix |
|
157
|
|
|
|
|
|
|
V'; |
|
158
|
|
|
|
|
|
|
if jobvt = 2, VT contains the first min(m,n) rows of |
|
159
|
|
|
|
|
|
|
V' (the right singular vectors, stored rowwise); |
|
160
|
|
|
|
|
|
|
if jobvt = 0 or 3, VT is not referenced. |
|
161
|
|
|
|
|
|
|
Min size = [1,1]. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
164
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
165
|
|
|
|
|
|
|
> 0: if bdsqr did not converge, info specifies how many |
|
166
|
|
|
|
|
|
|
superdiagonals of an intermediate bidiagonal form B |
|
167
|
|
|
|
|
|
|
did not converge to zero. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=for example |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
$a = random (float, 100,100); |
|
172
|
|
|
|
|
|
|
$s = zeroes(float, 100); |
|
173
|
|
|
|
|
|
|
$u = zeroes(float, 100,100); |
|
174
|
|
|
|
|
|
|
$vt = zeroes(float, 100,100); |
|
175
|
|
|
|
|
|
|
$info = pdl(long, 0); |
|
176
|
|
|
|
|
|
|
gesvd($a, 2, 2, $s , $u, $vt, $info); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=for bad |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
gesvd ignores the bad-value flag of the input piddles. |
|
183
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
*gesvd = \&PDL::gesvd; |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 gesdd |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=for sig |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int job(); [o,phys]s(r); [o,phys]U(p,q); [o,phys]VT(s,t); int [o,phys]info()) |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=for ref |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Computes the singular value decomposition (SVD) of a real |
|
210
|
|
|
|
|
|
|
M-by-N matrix A. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
This routine use the Coppen's divide and conquer algorithm. |
|
213
|
|
|
|
|
|
|
It is much faster than the simple driver for large matrices, but uses more workspace. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
job: Specifies options for computing all or part of matrix: |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
= 0: no columns of U or rows of V' are computed; |
|
218
|
|
|
|
|
|
|
= 1: all M columns of U and all N rows of V' are |
|
219
|
|
|
|
|
|
|
returned in the arrays U and VT; |
|
220
|
|
|
|
|
|
|
= 2: the first min(M,N) columns of U and the first |
|
221
|
|
|
|
|
|
|
min(M,N) rows of V' are returned in the arrays U |
|
222
|
|
|
|
|
|
|
and VT; |
|
223
|
|
|
|
|
|
|
= 3: If M >= N, the first N columns of U are overwritten |
|
224
|
|
|
|
|
|
|
on the array A and all rows of V' are returned in |
|
225
|
|
|
|
|
|
|
the array VT; |
|
226
|
|
|
|
|
|
|
otherwise, all columns of U are returned in the |
|
227
|
|
|
|
|
|
|
array U and the first M rows of V' are overwritten |
|
228
|
|
|
|
|
|
|
on the array A. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
231
|
|
|
|
|
|
|
On exit, |
|
232
|
|
|
|
|
|
|
if job = 3, A is overwritten with the first N columns |
|
233
|
|
|
|
|
|
|
of U (the left singular vectors, stored |
|
234
|
|
|
|
|
|
|
columnwise) if M >= N; |
|
235
|
|
|
|
|
|
|
A is overwritten with the first M rows |
|
236
|
|
|
|
|
|
|
of V' (the right singular vectors, stored |
|
237
|
|
|
|
|
|
|
rowwise) otherwise. |
|
238
|
|
|
|
|
|
|
if job != 3, the contents of A are destroyed. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
s: The singular values of A, sorted so that s(i) >= s(i+1). |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
U: If job = 1 or job = 3 and M < N, U contains the M-by-M |
|
243
|
|
|
|
|
|
|
orthogonal matrix U; |
|
244
|
|
|
|
|
|
|
if job = 2, U contains the first min(M,N) columns of U |
|
245
|
|
|
|
|
|
|
(the left singular vectors, stored columnwise); |
|
246
|
|
|
|
|
|
|
if job = 3 and M >= N, or job = 0, U is not referenced. |
|
247
|
|
|
|
|
|
|
Min size = [1,1]. |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
VT: If job = 1 or job = 3 and M >= N, VT contains the |
|
250
|
|
|
|
|
|
|
N-by-N orthogonal matrix V'; |
|
251
|
|
|
|
|
|
|
if job = 2, VT contains the first min(M,N) rows of |
|
252
|
|
|
|
|
|
|
V' (the right singular vectors, stored rowwise); |
|
253
|
|
|
|
|
|
|
if job = 3 and M < N, or job = 0, VT is not referenced. |
|
254
|
|
|
|
|
|
|
Min size = [1,1]. |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
257
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
258
|
|
|
|
|
|
|
> 0: bdsdc did not converge, updating process failed. |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=for example |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
$lines = 50; |
|
263
|
|
|
|
|
|
|
$columns = 100; |
|
264
|
|
|
|
|
|
|
$a = random (float, $lines, $columns); |
|
265
|
|
|
|
|
|
|
$min = $lines < $columns ? $lines : $columns; |
|
266
|
|
|
|
|
|
|
$s = zeroes(float, $min); |
|
267
|
|
|
|
|
|
|
$u = zeroes(float, $lines, $lines); |
|
268
|
|
|
|
|
|
|
$vt = zeroes(float, $columns, $columns); |
|
269
|
|
|
|
|
|
|
$info = long (0); |
|
270
|
|
|
|
|
|
|
gesdd($a, 1, $s , $u, $vt, $info); |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=for bad |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
gesdd ignores the bad-value flag of the input piddles. |
|
277
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
*gesdd = \&PDL::gesdd; |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 ggsvd |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=for sig |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int jobu(); int jobv(); int jobq(); [io,phys]B(p,n); int [o,phys]k(); int [o,phys]l();[o,phys]alpha(n);[o,phys]beta(n); [o,phys]U(q,r); [o,phys]V(s,t); [o,phys]Q(u,v); int [o,phys]iwork(n); int [o,phys]info()) |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=for ref |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Computes the generalized singular value decomposition (GSVD) |
|
304
|
|
|
|
|
|
|
of an M-by-N real matrix A and P-by-N real matrix B: |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
U'*A*Q = D1*( 0 R ), V'*B*Q = D2*( 0 R ) |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
where U, V and Q are orthogonal matrices, and Z' is the transpose |
|
309
|
|
|
|
|
|
|
of Z. |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
Let K+L = the effective numerical rank of the matrix (A',B')', |
|
312
|
|
|
|
|
|
|
then R is a K+L-by-K+L nonsingular upper triangular matrix, D1 and |
|
313
|
|
|
|
|
|
|
D2 are M-by-(K+L) and P-by-(K+L) "diagonal" matrices and of the |
|
314
|
|
|
|
|
|
|
following structures, respectively: |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
If M-K-L >= 0, |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
K L |
|
319
|
|
|
|
|
|
|
D1 = K ( I 0 ) |
|
320
|
|
|
|
|
|
|
L ( 0 C ) |
|
321
|
|
|
|
|
|
|
M-K-L ( 0 0 ) |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
K L |
|
324
|
|
|
|
|
|
|
D2 = L ( 0 S ) |
|
325
|
|
|
|
|
|
|
P-L ( 0 0 ) |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
N-K-L K L |
|
328
|
|
|
|
|
|
|
( 0 R ) = K ( 0 R11 R12 ) |
|
329
|
|
|
|
|
|
|
L ( 0 0 R22 ) |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
where |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
C = diag( ALPHA(K+1), ... , ALPHA(K+L) ), |
|
334
|
|
|
|
|
|
|
S = diag( BETA(K+1), ... , BETA(K+L) ), |
|
335
|
|
|
|
|
|
|
C**2 + S**2 = I. |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
R is stored in A(1:K+L,N-K-L+1:N) on exit. |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
If M-K-L < 0, |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
K M-K K+L-M |
|
342
|
|
|
|
|
|
|
D1 = K ( I 0 0 ) |
|
343
|
|
|
|
|
|
|
M-K ( 0 C 0 ) |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
K M-K K+L-M |
|
346
|
|
|
|
|
|
|
D2 = M-K ( 0 S 0 ) |
|
347
|
|
|
|
|
|
|
K+L-M ( 0 0 I ) |
|
348
|
|
|
|
|
|
|
P-L ( 0 0 0 ) |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
N-K-L K M-K K+L-M |
|
351
|
|
|
|
|
|
|
( 0 R ) = K ( 0 R11 R12 R13 ) |
|
352
|
|
|
|
|
|
|
M-K ( 0 0 R22 R23 ) |
|
353
|
|
|
|
|
|
|
K+L-M ( 0 0 0 R33 ) |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
where |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
C = diag( ALPHA(K+1), ... , ALPHA(M) ), |
|
358
|
|
|
|
|
|
|
S = diag( BETA(K+1), ... , BETA(M) ), |
|
359
|
|
|
|
|
|
|
C**2 + S**2 = I. |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
(R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), and R33 is stored |
|
362
|
|
|
|
|
|
|
( 0 R22 R23 ) |
|
363
|
|
|
|
|
|
|
in B(M-K+1:L,N+M-K-L+1:N) on exit. |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
The routine computes C, S, R, and optionally the orthogonal |
|
366
|
|
|
|
|
|
|
transformation matrices U, V and Q. |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
In particular, if B is an N-by-N nonsingular matrix, then the GSVD of |
|
369
|
|
|
|
|
|
|
A and B implicitly gives the SVD of A*inv(B): |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
A*inv(B) = U*(D1*inv(D2))*V'. |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
If ( A',B')' has orthonormal columns, then the GSVD of A and B is |
|
374
|
|
|
|
|
|
|
also equal to the CS decomposition of A and B. Furthermore, the GSVD |
|
375
|
|
|
|
|
|
|
can be used to derive the solution of the eigenvalue problem: |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
A'*A x = lambda* B'*B x. |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
In some literature, the GSVD of A and B is presented in the form |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
U'*A*X = ( 0 D1 ), V'*B*X = ( 0 D2 ) |
|
382
|
|
|
|
|
|
|
where U and V are orthogonal and X is nonsingular, D1 and D2 are "diagonal". |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
The former GSVD form can be converted to the latter |
|
385
|
|
|
|
|
|
|
form by taking the nonsingular matrix X as |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
X = Q*( I 0 ) |
|
388
|
|
|
|
|
|
|
( 0 inv(R) ). |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
Arguments |
|
391
|
|
|
|
|
|
|
========= |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
jobu: = 0: U is not computed. |
|
394
|
|
|
|
|
|
|
= 1: Orthogonal matrix U is computed; |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
jobv: = 0: V is not computed. |
|
397
|
|
|
|
|
|
|
= 1: Orthogonal matrix V is computed; |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
jobq: = 0: Q is not computed. |
|
400
|
|
|
|
|
|
|
= 1: Orthogonal matrix Q is computed; |
|
401
|
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
k: |
|
403
|
|
|
|
|
|
|
l: On exit, k and l specify the dimension of the subblocks |
|
404
|
|
|
|
|
|
|
described in the Purpose section. |
|
405
|
|
|
|
|
|
|
k + l = effective numerical rank of (A',B')'. |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
408
|
|
|
|
|
|
|
On exit, A contains the triangular matrix R, or part of R. |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
B: On entry, the P-by-N matrix B. |
|
411
|
|
|
|
|
|
|
On exit, B contains the triangular matrix R if M-k-l < 0. |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
alpha: |
|
414
|
|
|
|
|
|
|
beta: On exit, alpha and beta contain the generalized singular |
|
415
|
|
|
|
|
|
|
value pairs of A and B; |
|
416
|
|
|
|
|
|
|
alpha(1:k) = 1, |
|
417
|
|
|
|
|
|
|
beta(1:k) = 0, |
|
418
|
|
|
|
|
|
|
and if M-k-l >= 0, |
|
419
|
|
|
|
|
|
|
alpha(k+1:k+l) = C, |
|
420
|
|
|
|
|
|
|
beta(k+1:k+l) = S, |
|
421
|
|
|
|
|
|
|
or if M-k-l < 0, |
|
422
|
|
|
|
|
|
|
alpha(k+1:M)=C, alpha(M+1:k+l)=0 |
|
423
|
|
|
|
|
|
|
beta(k+1:M) =S, beta(M+1:k+l) =1 |
|
424
|
|
|
|
|
|
|
and |
|
425
|
|
|
|
|
|
|
alpha(k+l+1:N) = 0 |
|
426
|
|
|
|
|
|
|
beta(k+l+1:N) = 0 |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
U: If jobu = 1, U contains the M-by-M orthogonal matrix U. |
|
429
|
|
|
|
|
|
|
If jobu = 0, U is not referenced. |
|
430
|
|
|
|
|
|
|
Need a minimum array of (1,1) if jobu = 0; |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
V: If jobv = 1, V contains the P-by-P orthogonal matrix V. |
|
433
|
|
|
|
|
|
|
If jobv = 0, V is not referenced. |
|
434
|
|
|
|
|
|
|
Need a minimum array of (1,1) if jobv = 0; |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
Q: If jobq = 1, Q contains the N-by-N orthogonal matrix Q. |
|
437
|
|
|
|
|
|
|
If jobq = 0, Q is not referenced. |
|
438
|
|
|
|
|
|
|
Need a minimum array of (1,1) if jobq = 0; |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
iwork: On exit, iwork stores the sorting information. More |
|
441
|
|
|
|
|
|
|
precisely, the following loop will sort alpha |
|
442
|
|
|
|
|
|
|
for I = k+1, min(M,k+l) |
|
443
|
|
|
|
|
|
|
swap alpha(I) and alpha(iwork(I)) |
|
444
|
|
|
|
|
|
|
endfor |
|
445
|
|
|
|
|
|
|
such that alpha(1) >= alpha(2) >= ... >= alpha(N). |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
info: = 0: successful exit |
|
448
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
449
|
|
|
|
|
|
|
> 0: if info = 1, the Jacobi-type procedure failed to |
|
450
|
|
|
|
|
|
|
converge. For further details, see subroutine tgsja. |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=for example |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
$k = null; |
|
455
|
|
|
|
|
|
|
$l = null; |
|
456
|
|
|
|
|
|
|
$A = random(5,6); |
|
457
|
|
|
|
|
|
|
$B = random(7,6); |
|
458
|
|
|
|
|
|
|
$alpha = zeroes(6); |
|
459
|
|
|
|
|
|
|
$beta = zeroes(6); |
|
460
|
|
|
|
|
|
|
$U = zeroes(5,5); |
|
461
|
|
|
|
|
|
|
$V = zeroes(7,7); |
|
462
|
|
|
|
|
|
|
$Q = zeroes(6,6); |
|
463
|
|
|
|
|
|
|
$iwork = zeroes(long, 6); |
|
464
|
|
|
|
|
|
|
$info = null; |
|
465
|
|
|
|
|
|
|
ggsvd($A,1,1,1,$B,$k,$l,$alpha, $beta,$U, $V, $Q, $iwork,$info); |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=for bad |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
ggsvd ignores the bad-value flag of the input piddles. |
|
472
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=cut |
|
476
|
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
*ggsvd = \&PDL::ggsvd; |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=head2 geev |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
=for sig |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int jobvl(); int jobvr(); [o,phys]wr(n); [o,phys]wi(n); [o,phys]vl(m,m); [o,phys]vr(p,p); int [o,phys]info()) |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=for ref |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
Computes for an N-by-N real nonsymmetric matrix A, the |
|
499
|
|
|
|
|
|
|
eigenvalues and, optionally, the left and/or right eigenvectors. |
|
500
|
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
The right eigenvector v(j) of A satisfies: |
|
502
|
|
|
|
|
|
|
A * v(j) = lambda(j) * v(j) |
|
503
|
|
|
|
|
|
|
where lambda(j) is its eigenvalue. |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
The left eigenvector u(j) of A satisfies: |
|
506
|
|
|
|
|
|
|
u(j)**H * A = lambda(j) * u(j)**H |
|
507
|
|
|
|
|
|
|
where u(j)**H denotes the conjugate transpose of u(j). |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
The computed eigenvectors are normalized to have Euclidean norm |
|
510
|
|
|
|
|
|
|
equal to 1 and largest component real. |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
Arguments |
|
513
|
|
|
|
|
|
|
========= |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
jobvl: = 0: left eigenvectors of A are not computed; |
|
516
|
|
|
|
|
|
|
= 1: left eigenvectors of A are computed. |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
jobvr: = 0: right eigenvectors of A are not computed; |
|
519
|
|
|
|
|
|
|
= 1: right eigenvectors of A are computed. |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
A: A is overwritten. |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
wr: |
|
524
|
|
|
|
|
|
|
wi: wr and wi contain the real and imaginary parts, |
|
525
|
|
|
|
|
|
|
respectively, of the computed eigenvalues. Complex |
|
526
|
|
|
|
|
|
|
conjugate pairs of eigenvalues appear consecutively |
|
527
|
|
|
|
|
|
|
with the eigenvalue having the positive imaginary part |
|
528
|
|
|
|
|
|
|
first. |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
vl: If jobvl = 1, the left eigenvectors u(j) are stored one |
|
531
|
|
|
|
|
|
|
after another in the columns of vl, in the same order |
|
532
|
|
|
|
|
|
|
as their eigenvalues else vl is not referenced. |
|
533
|
|
|
|
|
|
|
If the j-th eigenvalue is real, then u(j) = vl(:,j), |
|
534
|
|
|
|
|
|
|
the j-th column of vl. |
|
535
|
|
|
|
|
|
|
If the j-th and (j+1)-st eigenvalues form a complex |
|
536
|
|
|
|
|
|
|
conjugate pair, then u(j) = vl(:,j) + i*vl(:,j+1) and |
|
537
|
|
|
|
|
|
|
u(j+1) = vl(:,j) - i*vl(:,j+1). |
|
538
|
|
|
|
|
|
|
Min size = [1]. |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
vr: If jobvr = 1, the right eigenvectors v(j) are stored one |
|
541
|
|
|
|
|
|
|
after another in the columns of vr, in the same order |
|
542
|
|
|
|
|
|
|
as their eigenvalues else vr is not referenced. |
|
543
|
|
|
|
|
|
|
If the j-th eigenvalue is real, then v(j) = vr(:,j), |
|
544
|
|
|
|
|
|
|
the j-th column of vr. |
|
545
|
|
|
|
|
|
|
If the j-th and (j+1)-st eigenvalues form a complex |
|
546
|
|
|
|
|
|
|
conjugate pair, then v(j) = vr(:,j) + i*vr(:,j+1) and |
|
547
|
|
|
|
|
|
|
v(j+1) = vr(:,j) - i*vr(:,j+1). |
|
548
|
|
|
|
|
|
|
Min size = [1]. |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
info: = 0: successful exit |
|
551
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
552
|
|
|
|
|
|
|
> 0: if info = i, the QR algorithm failed to compute all the |
|
553
|
|
|
|
|
|
|
eigenvalues, and no eigenvectors have been computed; |
|
554
|
|
|
|
|
|
|
elements i+1:N of wr and wi contain eigenvalues which |
|
555
|
|
|
|
|
|
|
have converged. |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
=for example |
|
559
|
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
$a = random (5, 5); |
|
561
|
|
|
|
|
|
|
$wr = zeroes(5); |
|
562
|
|
|
|
|
|
|
$wi = zeroes($wr); |
|
563
|
|
|
|
|
|
|
$vl = zeroes($a); |
|
564
|
|
|
|
|
|
|
$vr = zeroes($a); |
|
565
|
|
|
|
|
|
|
$info = null; |
|
566
|
|
|
|
|
|
|
geev($a, 1, 1, $wr, $wi, $vl, $vr, $info); |
|
567
|
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
=for bad |
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
geev ignores the bad-value flag of the input piddles. |
|
573
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=cut |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
*geev = \&PDL::geev; |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=head2 geevx |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=for sig |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobvl(); int jobvr(); int balance(); int sense(); [o,phys]wr(n); [o,phys]wi(n); [o,phys]vl(m,m); [o,phys]vr(p,p); int [o,phys]ilo(); int [o,phys]ihi(); [o,phys]scale(n); [o,phys]abnrm(); [o,phys]rconde(q); [o,phys]rcondv(r); int [o,phys]info()) |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=for ref |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
Computes for an N-by-N real nonsymmetric matrix A, the |
|
600
|
|
|
|
|
|
|
eigenvalues and, optionally, the left and/or right eigenvectors. |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
Optionally also, it computes a balancing transformation to improve |
|
603
|
|
|
|
|
|
|
the conditioning of the eigenvalues and eigenvectors (ilo, ihi, |
|
604
|
|
|
|
|
|
|
scale, and abnrm), reciprocal condition numbers for the eigenvalues |
|
605
|
|
|
|
|
|
|
(rconde), and reciprocal condition numbers for the right |
|
606
|
|
|
|
|
|
|
eigenvectors (rcondv). |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
The right eigenvector v(j) of A satisfies: |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
A * v(j) = lambda(j) * v(j) |
|
611
|
|
|
|
|
|
|
where lambda(j) is its eigenvalue. |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
The left eigenvector u(j) of A satisfies: |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
u(j)**H * A = lambda(j) * u(j)**H |
|
616
|
|
|
|
|
|
|
where u(j)**H denotes the conjugate transpose of u(j). |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
The computed eigenvectors are normalized to have Euclidean norm |
|
619
|
|
|
|
|
|
|
equal to 1 and largest component real. |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
Balancing a matrix means permuting the rows and columns to make it |
|
622
|
|
|
|
|
|
|
more nearly upper triangular, and applying a diagonal similarity |
|
623
|
|
|
|
|
|
|
transformation D * A * D**(-1), where D is a diagonal matrix, to |
|
624
|
|
|
|
|
|
|
make its rows and columns closer in norm and the condition numbers |
|
625
|
|
|
|
|
|
|
of its eigenvalues and eigenvectors smaller. The computed |
|
626
|
|
|
|
|
|
|
reciprocal condition numbers correspond to the balanced matrix. |
|
627
|
|
|
|
|
|
|
Permuting rows and columns will not change the condition numbers |
|
628
|
|
|
|
|
|
|
(in exact arithmetic) but diagonal scaling will. For further |
|
629
|
|
|
|
|
|
|
explanation of balancing, see section 4.10.2 of the LAPACK |
|
630
|
|
|
|
|
|
|
Users' Guide. |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
Arguments |
|
633
|
|
|
|
|
|
|
========= |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
balance: |
|
636
|
|
|
|
|
|
|
Indicates how the input matrix should be diagonally scaled |
|
637
|
|
|
|
|
|
|
and/or permuted to improve the conditioning of its |
|
638
|
|
|
|
|
|
|
eigenvalues. |
|
639
|
|
|
|
|
|
|
= 0: Do not diagonally scale or permute; |
|
640
|
|
|
|
|
|
|
= 1: Perform permutations to make the matrix more nearly |
|
641
|
|
|
|
|
|
|
upper triangular. Do not diagonally scale; |
|
642
|
|
|
|
|
|
|
= 2: Diagonally scale the matrix, i.e. replace A by |
|
643
|
|
|
|
|
|
|
D*A*D**(-1), where D is a diagonal matrix chosen |
|
644
|
|
|
|
|
|
|
to make the rows and columns of A more equal in |
|
645
|
|
|
|
|
|
|
norm. Do not permute; |
|
646
|
|
|
|
|
|
|
= 3: Both diagonally scale and permute A. |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
Computed reciprocal condition numbers will be for the matrix |
|
649
|
|
|
|
|
|
|
after balancing and/or permuting. Permuting does not change |
|
650
|
|
|
|
|
|
|
condition numbers (in exact arithmetic), but balancing does. |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
jobvl: = 0: left eigenvectors of A are not computed; |
|
653
|
|
|
|
|
|
|
= 1: left eigenvectors of A are computed. |
|
654
|
|
|
|
|
|
|
If sense = 1 or 3, jobvl must = 1. |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
jobvr; = 0: right eigenvectors of A are not computed; |
|
657
|
|
|
|
|
|
|
= 1: right eigenvectors of A are computed. |
|
658
|
|
|
|
|
|
|
If sense = 1 or 3, jobvr must = 1. |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
sense: Determines which reciprocal condition numbers are computed. |
|
661
|
|
|
|
|
|
|
= 0: None are computed; |
|
662
|
|
|
|
|
|
|
= 1: Computed for eigenvalues only; |
|
663
|
|
|
|
|
|
|
= 2: Computed for right eigenvectors only; |
|
664
|
|
|
|
|
|
|
= 3: Computed for eigenvalues and right eigenvectors. |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
If sense = 1 or 3, both left and right eigenvectors |
|
667
|
|
|
|
|
|
|
must also be computed (jobvl = 1 and jobvr = 1). |
|
668
|
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
A: The N-by-N matrix. |
|
670
|
|
|
|
|
|
|
It is overwritten. If jobvl = 1 or |
|
671
|
|
|
|
|
|
|
jobvr = 1, A contains the real Schur form of the balanced |
|
672
|
|
|
|
|
|
|
version of the input matrix A. |
|
673
|
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
wr |
|
675
|
|
|
|
|
|
|
wi: wr and wi contain the real and imaginary parts, |
|
676
|
|
|
|
|
|
|
respectively, of the computed eigenvalues. Complex |
|
677
|
|
|
|
|
|
|
conjugate pairs of eigenvalues will appear consecutively |
|
678
|
|
|
|
|
|
|
with the eigenvalue having the positive imaginary part |
|
679
|
|
|
|
|
|
|
first. |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
vl: If jobvl = 1, the left eigenvectors u(j) are stored one |
|
682
|
|
|
|
|
|
|
after another in the columns of vl, in the same order |
|
683
|
|
|
|
|
|
|
as their eigenvalues else vl is not referenced. |
|
684
|
|
|
|
|
|
|
If the j-th eigenvalue is real, then u(j) = vl(:,j), |
|
685
|
|
|
|
|
|
|
the j-th column of vl. |
|
686
|
|
|
|
|
|
|
If the j-th and (j+1)-st eigenvalues form a complex |
|
687
|
|
|
|
|
|
|
conjugate pair, then u(j) = vl(:,j) + i*vl(:,j+1) and |
|
688
|
|
|
|
|
|
|
u(j+1) = vl(:,j) - i*vl(:,j+1). |
|
689
|
|
|
|
|
|
|
Min size = [1]. |
|
690
|
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
vr: If jobvr = 1, the right eigenvectors v(j) are stored one |
|
692
|
|
|
|
|
|
|
after another in the columns of vr, in the same order |
|
693
|
|
|
|
|
|
|
as their eigenvalues else vr is not referenced. |
|
694
|
|
|
|
|
|
|
If the j-th eigenvalue is real, then v(j) = vr(:,j), |
|
695
|
|
|
|
|
|
|
the j-th column of vr. |
|
696
|
|
|
|
|
|
|
If the j-th and (j+1)-st eigenvalues form a complex |
|
697
|
|
|
|
|
|
|
conjugate pair, then v(j) = vr(:,j) + i*vr(:,j+1) and |
|
698
|
|
|
|
|
|
|
v(j+1) = vr(:,j) - i*vr(:,j+1). |
|
699
|
|
|
|
|
|
|
Min size = [1]. |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
ilo,ihi:Integer values determined when A was |
|
702
|
|
|
|
|
|
|
balanced. The balanced A(i,j) = 0 if I > J and |
|
703
|
|
|
|
|
|
|
J = 1,...,ilo-1 or I = ihi+1,...,N. |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
scale: Details of the permutations and scaling factors applied |
|
706
|
|
|
|
|
|
|
when balancing A. If P(j) is the index of the row and column |
|
707
|
|
|
|
|
|
|
interchanged with row and column j, and D(j) is the scaling |
|
708
|
|
|
|
|
|
|
factor applied to row and column j, then |
|
709
|
|
|
|
|
|
|
scale(J) = P(J), for J = 1,...,ilo-1 |
|
710
|
|
|
|
|
|
|
= D(J), for J = ilo,...,ihi |
|
711
|
|
|
|
|
|
|
= P(J) for J = ihi+1,...,N. |
|
712
|
|
|
|
|
|
|
The order in which the interchanges are made is N to ihi+1, |
|
713
|
|
|
|
|
|
|
then 1 to ilo-1. |
|
714
|
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
abnrm: The one-norm of the balanced matrix (the maximum |
|
716
|
|
|
|
|
|
|
of the sum of absolute values of elements of any column). |
|
717
|
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
rconde: rconde(j) is the reciprocal condition number of the j-th |
|
719
|
|
|
|
|
|
|
eigenvalue. |
|
720
|
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
rcondv: rcondv(j) is the reciprocal condition number of the j-th |
|
722
|
|
|
|
|
|
|
right eigenvector. |
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
info: = 0: successful exit |
|
725
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
726
|
|
|
|
|
|
|
> 0: if info = i, the QR algorithm failed to compute all the |
|
727
|
|
|
|
|
|
|
eigenvalues, and no eigenvectors or condition numbers |
|
728
|
|
|
|
|
|
|
have been computed; elements 1:ilo-1 and i+1:N of wr |
|
729
|
|
|
|
|
|
|
and wi contain eigenvalues which have converged. |
|
730
|
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
=for example |
|
732
|
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
$a = random (5,5); |
|
734
|
|
|
|
|
|
|
$wr = zeroes(5); |
|
735
|
|
|
|
|
|
|
$wi = zeroes(5); |
|
736
|
|
|
|
|
|
|
$vl = zeroes(5,5); |
|
737
|
|
|
|
|
|
|
$vr = zeroes(5,5); |
|
738
|
|
|
|
|
|
|
$ilo = null; |
|
739
|
|
|
|
|
|
|
$ihi = null; |
|
740
|
|
|
|
|
|
|
$scale = zeroes(5); |
|
741
|
|
|
|
|
|
|
$abnrm = null; |
|
742
|
|
|
|
|
|
|
$rconde = zeroes(5); |
|
743
|
|
|
|
|
|
|
$rcondv = zeroes(5); |
|
744
|
|
|
|
|
|
|
$info = null; |
|
745
|
|
|
|
|
|
|
geevx($a, 1,1,3,3,$wr, $wi, $vl, $vr, $ilo, $ihi, $scale, $abnrm,$rconde, $rcondv, $info); |
|
746
|
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
=for bad |
|
750
|
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
geevx ignores the bad-value flag of the input piddles. |
|
752
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
753
|
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
=cut |
|
756
|
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
*geevx = \&PDL::geevx; |
|
763
|
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=head2 ggev |
|
769
|
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=for sig |
|
771
|
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int jobvl();int jobvr();[phys]B(n,n);[o,phys]alphar(n);[o,phys]alphai(n);[o,phys]beta(n);[o,phys]VL(m,m);[o,phys]VR(p,p);int [o,phys]info()) |
|
773
|
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=for ref |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
Computes for a pair of N-by-N real nonsymmetric matrices (A,B) |
|
779
|
|
|
|
|
|
|
the generalized eigenvalues, and optionally, the left and/or right |
|
780
|
|
|
|
|
|
|
generalized eigenvectors. |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
A generalized eigenvalue for a pair of matrices (A,B) is a scalar |
|
783
|
|
|
|
|
|
|
lambda or a ratio alpha/beta = lambda, such that A - lambda*B is |
|
784
|
|
|
|
|
|
|
singular. It is usually represented as the pair (alpha,beta), as |
|
785
|
|
|
|
|
|
|
there is a reasonable interpretation for beta=0, and even for both |
|
786
|
|
|
|
|
|
|
being zero. |
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
The right eigenvector v(j) corresponding to the eigenvalue lambda(j) |
|
789
|
|
|
|
|
|
|
of (A,B) satisfies |
|
790
|
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
A * v(j) = lambda(j) * B * v(j). |
|
792
|
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
The left eigenvector u(j) corresponding to the eigenvalue lambda(j) |
|
794
|
|
|
|
|
|
|
of (A,B) satisfies |
|
795
|
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
u(j)**H * A = lambda(j) * u(j)**H * B . |
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
where u(j)**H is the conjugate-transpose of u(j). |
|
799
|
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
Arguments |
|
802
|
|
|
|
|
|
|
========= |
|
803
|
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
jobvl: = 0: do not compute the left generalized eigenvectors; |
|
805
|
|
|
|
|
|
|
= 1: compute the left generalized eigenvectors. |
|
806
|
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
jobvr: = 0: do not compute the right generalized eigenvectors; |
|
808
|
|
|
|
|
|
|
= 1: compute the right generalized eigenvectors. |
|
809
|
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
A: On entry, the matrix A in the pair (A,B). |
|
811
|
|
|
|
|
|
|
On exit, A has been overwritten. |
|
812
|
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
B: On entry, the matrix B in the pair (A,B). |
|
814
|
|
|
|
|
|
|
On exit, B has been overwritten. |
|
815
|
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
alphar: |
|
817
|
|
|
|
|
|
|
alphai: |
|
818
|
|
|
|
|
|
|
beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will |
|
819
|
|
|
|
|
|
|
be the generalized eigenvalues. If alphai(j) is zero, then |
|
820
|
|
|
|
|
|
|
the j-th eigenvalue is real; if positive, then the j-th and |
|
821
|
|
|
|
|
|
|
(j+1)-st eigenvalues are a complex conjugate pair, with |
|
822
|
|
|
|
|
|
|
alphai(j+1) negative. |
|
823
|
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j) |
|
825
|
|
|
|
|
|
|
may easily over- or underflow, and beta(j) may even be zero. |
|
826
|
|
|
|
|
|
|
Thus, the user should avoid naively computing the ratio |
|
827
|
|
|
|
|
|
|
alpha/beta. However, alphar and alphai will be always less |
|
828
|
|
|
|
|
|
|
than and usually comparable with norm(A) in magnitude, and |
|
829
|
|
|
|
|
|
|
beta always less than and usually comparable with norm(B). |
|
830
|
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
VL: If jobvl = 1, the left eigenvectors u(j) are stored one |
|
832
|
|
|
|
|
|
|
after another in the columns of VL, in the same order as |
|
833
|
|
|
|
|
|
|
their eigenvalues. If the j-th eigenvalue is real, then |
|
834
|
|
|
|
|
|
|
u(j) = VL(:,j), the j-th column of VL. If the j-th and |
|
835
|
|
|
|
|
|
|
(j+1)-th eigenvalues form a complex conjugate pair, then |
|
836
|
|
|
|
|
|
|
u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1). |
|
837
|
|
|
|
|
|
|
Each eigenvector will be scaled so the largest component have |
|
838
|
|
|
|
|
|
|
abs(real part)+abs(imag. part)=1. |
|
839
|
|
|
|
|
|
|
Not referenced if jobvl = 0. |
|
840
|
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
VR: If jobvr = 1, the right eigenvectors v(j) are stored one |
|
842
|
|
|
|
|
|
|
after another in the columns of VR, in the same order as |
|
843
|
|
|
|
|
|
|
their eigenvalues. If the j-th eigenvalue is real, then |
|
844
|
|
|
|
|
|
|
v(j) = VR(:,j), the j-th column of VR. If the j-th and |
|
845
|
|
|
|
|
|
|
(j+1)-th eigenvalues form a complex conjugate pair, then |
|
846
|
|
|
|
|
|
|
v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1). |
|
847
|
|
|
|
|
|
|
Each eigenvector will be scaled so the largest component have |
|
848
|
|
|
|
|
|
|
abs(real part)+abs(imag. part)=1. |
|
849
|
|
|
|
|
|
|
Not referenced if jobvr = 0. |
|
850
|
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
info: = 0: successful exit |
|
852
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
853
|
|
|
|
|
|
|
= 1,...,N: |
|
854
|
|
|
|
|
|
|
The QZ iteration failed. No eigenvectors have been |
|
855
|
|
|
|
|
|
|
calculated, but alphar(j), alphai(j), and beta(j) |
|
856
|
|
|
|
|
|
|
should be correct for j=info+1,...,N. |
|
857
|
|
|
|
|
|
|
> N: =N+1: other than QZ iteration failed in hgeqz. |
|
858
|
|
|
|
|
|
|
=N+2: error return from tgevc. |
|
859
|
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
=for example |
|
862
|
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
$a = random(5,5); |
|
864
|
|
|
|
|
|
|
$b = random(5,5); |
|
865
|
|
|
|
|
|
|
$alphar = zeroes(5); |
|
866
|
|
|
|
|
|
|
$alphai = zeroes(5); |
|
867
|
|
|
|
|
|
|
$beta = zeroes(5); |
|
868
|
|
|
|
|
|
|
$vl = zeroes(5,5); |
|
869
|
|
|
|
|
|
|
$vr = zeroes(5,5); |
|
870
|
|
|
|
|
|
|
ggev($a, 1, 1, $b, $alphar, $alphai, $beta, $vl, $vr, ($info=null)); |
|
871
|
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
=for bad |
|
875
|
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
ggev ignores the bad-value flag of the input piddles. |
|
877
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
878
|
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
=cut |
|
881
|
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
*ggev = \&PDL::ggev; |
|
888
|
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
=head2 ggevx |
|
894
|
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
=for sig |
|
896
|
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n);int balanc();int jobvl();int jobvr();int sense();[io,phys]B(n,n);[o,phys]alphar(n);[o,phys]alphai(n);[o,phys]beta(n);[o,phys]VL(m,m);[o,phys]VR(p,p);int [o,phys]ilo();int [o,phys]ihi();[o,phys]lscale(n);[o,phys]rscale(n);[o,phys]abnrm();[o,phys]bbnrm();[o,phys]rconde(r);[o,phys]rcondv(s);int [o,phys]info()) |
|
898
|
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
=for ref |
|
902
|
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
Computes for a pair of N-by-N real nonsymmetric matrices (A,B) |
|
904
|
|
|
|
|
|
|
the generalized eigenvalues, and optionally, the left and/or right |
|
905
|
|
|
|
|
|
|
generalized eigenvectors. |
|
906
|
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
Optionally also, it computes a balancing transformation to improve |
|
908
|
|
|
|
|
|
|
the conditioning of the eigenvalues and eigenvectors (ilo, ihi, |
|
909
|
|
|
|
|
|
|
lscale, rscale, abnrm, and bbnrm), reciprocal condition numbers for |
|
910
|
|
|
|
|
|
|
the eigenvalues (rconde), and reciprocal condition numbers for the |
|
911
|
|
|
|
|
|
|
right eigenvectors (rcondv). |
|
912
|
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
A generalized eigenvalue for a pair of matrices (A,B) is a scalar |
|
914
|
|
|
|
|
|
|
lambda or a ratio alpha/beta = lambda, such that A - lambda*B is |
|
915
|
|
|
|
|
|
|
singular. It is usually represented as the pair (alpha,beta), as |
|
916
|
|
|
|
|
|
|
there is a reasonable interpretation for beta=0, and even for both |
|
917
|
|
|
|
|
|
|
being zero. |
|
918
|
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
The right eigenvector v(j) corresponding to the eigenvalue lambda(j) |
|
920
|
|
|
|
|
|
|
of (A,B) satisfies |
|
921
|
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
A * v(j) = lambda(j) * B * v(j) . |
|
923
|
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
The left eigenvector u(j) corresponding to the eigenvalue lambda(j) |
|
925
|
|
|
|
|
|
|
of (A,B) satisfies |
|
926
|
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
u(j)**H * A = lambda(j) * u(j)**H * B. |
|
928
|
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
where u(j)**H is the conjugate-transpose of u(j). |
|
930
|
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
Further Details |
|
932
|
|
|
|
|
|
|
=============== |
|
933
|
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
Balancing a matrix pair (A,B) includes, first, permuting rows and |
|
935
|
|
|
|
|
|
|
columns to isolate eigenvalues, second, applying diagonal similarity |
|
936
|
|
|
|
|
|
|
transformation to the rows and columns to make the rows and columns |
|
937
|
|
|
|
|
|
|
as close in norm as possible. The computed reciprocal condition |
|
938
|
|
|
|
|
|
|
numbers correspond to the balanced matrix. Permuting rows and columns |
|
939
|
|
|
|
|
|
|
will not change the condition numbers (in exact arithmetic) but |
|
940
|
|
|
|
|
|
|
diagonal scaling will. For further explanation of balancing, see |
|
941
|
|
|
|
|
|
|
section 4.11.1.2 of LAPACK Users' Guide. |
|
942
|
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
An approximate error bound on the chordal distance between the i-th |
|
944
|
|
|
|
|
|
|
computed generalized eigenvalue w and the corresponding exact |
|
945
|
|
|
|
|
|
|
eigenvalue lambda is |
|
946
|
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
chord(w, lambda) <= EPS * norm(abnrm, bbnrm) / rconde(I) |
|
948
|
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
An approximate error bound for the angle between the i-th computed |
|
950
|
|
|
|
|
|
|
eigenvector vl(i) or vr(i) is given by |
|
951
|
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
EPS * norm(abnrm, bbnrm) / DIF(i). |
|
953
|
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
For further explanation of the reciprocal condition numbers rconde |
|
955
|
|
|
|
|
|
|
and rcondv, see section 4.11 of LAPACK User's Guide. |
|
956
|
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
Arguments |
|
959
|
|
|
|
|
|
|
========= |
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
balanc: Specifies the balance option to be performed. |
|
962
|
|
|
|
|
|
|
= 0: do not diagonally scale or permute; |
|
963
|
|
|
|
|
|
|
= 1: permute only; |
|
964
|
|
|
|
|
|
|
= 2: scale only; |
|
965
|
|
|
|
|
|
|
= 3: both permute and scale. |
|
966
|
|
|
|
|
|
|
Computed reciprocal condition numbers will be for the |
|
967
|
|
|
|
|
|
|
matrices after permuting and/or balancing. Permuting does |
|
968
|
|
|
|
|
|
|
not change condition numbers (in exact arithmetic), but |
|
969
|
|
|
|
|
|
|
balancing does. |
|
970
|
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
jobvl: = 0: do not compute the left generalized eigenvectors; |
|
972
|
|
|
|
|
|
|
= 1: compute the left generalized eigenvectors. |
|
973
|
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
jobvr: = 0: do not compute the right generalized eigenvectors; |
|
975
|
|
|
|
|
|
|
= 1: compute the right generalized eigenvectors. |
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
sense: Determines which reciprocal condition numbers are computed. |
|
978
|
|
|
|
|
|
|
= 0: none are computed; |
|
979
|
|
|
|
|
|
|
= 1: computed for eigenvalues only; |
|
980
|
|
|
|
|
|
|
= 2: computed for eigenvectors only; |
|
981
|
|
|
|
|
|
|
= 3: computed for eigenvalues and eigenvectors. |
|
982
|
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
A: On entry, the matrix A in the pair (A,B). |
|
984
|
|
|
|
|
|
|
On exit, A has been overwritten. If jobvl=1 or jobvr=1 |
|
985
|
|
|
|
|
|
|
or both, then A contains the first part of the real Schur |
|
986
|
|
|
|
|
|
|
form of the "balanced" versions of the input A and B. |
|
987
|
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
B: On entry, the matrix B in the pair (A,B). |
|
989
|
|
|
|
|
|
|
On exit, B has been overwritten. If jobvl=1 or jobvr=1 |
|
990
|
|
|
|
|
|
|
or both, then B contains the second part of the real Schur |
|
991
|
|
|
|
|
|
|
form of the "balanced" versions of the input A and B. |
|
992
|
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
alphar: |
|
994
|
|
|
|
|
|
|
alphai: |
|
995
|
|
|
|
|
|
|
beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will |
|
996
|
|
|
|
|
|
|
be the generalized eigenvalues. If alphai(j) is zero, then |
|
997
|
|
|
|
|
|
|
the j-th eigenvalue is real; if positive, then the j-th and |
|
998
|
|
|
|
|
|
|
(j+1)-st eigenvalues are a complex conjugate pair, with |
|
999
|
|
|
|
|
|
|
alphai(j+1) negative. |
|
1000
|
|
|
|
|
|
|
|
|
1001
|
|
|
|
|
|
|
Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j) |
|
1002
|
|
|
|
|
|
|
may easily over- or underflow, and beta(j) may even be zero. |
|
1003
|
|
|
|
|
|
|
Thus, the user should avoid naively computing the ratio |
|
1004
|
|
|
|
|
|
|
ALPHA/beta. However, alphar and alphai will be always less |
|
1005
|
|
|
|
|
|
|
than and usually comparable with norm(A) in magnitude, and |
|
1006
|
|
|
|
|
|
|
beta always less than and usually comparable with norm(B). |
|
1007
|
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
vl: If jobvl = 1, the left eigenvectors u(j) are stored one |
|
1009
|
|
|
|
|
|
|
after another in the columns of vl, in the same order as |
|
1010
|
|
|
|
|
|
|
their eigenvalues. If the j-th eigenvalue is real, then |
|
1011
|
|
|
|
|
|
|
u(j) = vl(:,j), the j-th column of vl. If the j-th and |
|
1012
|
|
|
|
|
|
|
(j+1)-th eigenvalues form a complex conjugate pair, then |
|
1013
|
|
|
|
|
|
|
u(j) = vl(:,j)+i*vl(:,j+1) and u(j+1) = vl(:,j)-i*vl(:,j+1). |
|
1014
|
|
|
|
|
|
|
Each eigenvector will be scaled so the largest component have |
|
1015
|
|
|
|
|
|
|
abs(real part) + abs(imag. part) = 1. |
|
1016
|
|
|
|
|
|
|
Not referenced if jobvl = 0. |
|
1017
|
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
vr: If jobvr = 1, the right eigenvectors v(j) are stored one |
|
1019
|
|
|
|
|
|
|
after another in the columns of vr, in the same order as |
|
1020
|
|
|
|
|
|
|
their eigenvalues. If the j-th eigenvalue is real, then |
|
1021
|
|
|
|
|
|
|
v(j) = vr(:,j), the j-th column of vr. If the j-th and |
|
1022
|
|
|
|
|
|
|
(j+1)-th eigenvalues form a complex conjugate pair, then |
|
1023
|
|
|
|
|
|
|
v(j) = vr(:,j)+i*vr(:,j+1) and v(j+1) = vr(:,j)-i*vr(:,j+1). |
|
1024
|
|
|
|
|
|
|
Each eigenvector will be scaled so the largest component have |
|
1025
|
|
|
|
|
|
|
abs(real part) + abs(imag. part) = 1. |
|
1026
|
|
|
|
|
|
|
Not referenced if jobvr = 0. |
|
1027
|
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
ilo,ihi:ilo and ihi are integer values such that on exit |
|
1029
|
|
|
|
|
|
|
A(i,j) = 0 and B(i,j) = 0 if i > j and |
|
1030
|
|
|
|
|
|
|
j = 1,...,ilo-1 or i = ihi+1,...,N. |
|
1031
|
|
|
|
|
|
|
If balanc = 0 or 2, ilo = 1 and ihi = N. |
|
1032
|
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
lscale: Details of the permutations and scaling factors applied |
|
1034
|
|
|
|
|
|
|
to the left side of A and B. If PL(j) is the index of the |
|
1035
|
|
|
|
|
|
|
row interchanged with row j, and DL(j) is the scaling |
|
1036
|
|
|
|
|
|
|
factor applied to row j, then |
|
1037
|
|
|
|
|
|
|
lscale(j) = PL(j) for j = 1,...,ilo-1 |
|
1038
|
|
|
|
|
|
|
= DL(j) for j = ilo,...,ihi |
|
1039
|
|
|
|
|
|
|
= PL(j) for j = ihi+1,...,N. |
|
1040
|
|
|
|
|
|
|
The order in which the interchanges are made is N to ihi+1, |
|
1041
|
|
|
|
|
|
|
then 1 to ilo-1. |
|
1042
|
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
rscale: Details of the permutations and scaling factors applied |
|
1044
|
|
|
|
|
|
|
to the right side of A and B. If PR(j) is the index of the |
|
1045
|
|
|
|
|
|
|
column interchanged with column j, and DR(j) is the scaling |
|
1046
|
|
|
|
|
|
|
factor applied to column j, then |
|
1047
|
|
|
|
|
|
|
rscale(j) = PR(j) for j = 1,...,ilo-1 |
|
1048
|
|
|
|
|
|
|
= DR(j) for j = ilo,...,ihi |
|
1049
|
|
|
|
|
|
|
= PR(j) for j = ihi+1,...,N |
|
1050
|
|
|
|
|
|
|
The order in which the interchanges are made is N to ihi+1, |
|
1051
|
|
|
|
|
|
|
then 1 to ilo-1. |
|
1052
|
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
abnrm: The one-norm of the balanced matrix A. |
|
1054
|
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
bbnrm: The one-norm of the balanced matrix B. |
|
1056
|
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
rconde: If sense = 1 or 3, the reciprocal condition numbers of |
|
1058
|
|
|
|
|
|
|
the selected eigenvalues, stored in consecutive elements of |
|
1059
|
|
|
|
|
|
|
the array. For a complex conjugate pair of eigenvalues two |
|
1060
|
|
|
|
|
|
|
consecutive elements of rconde are set to the same value. |
|
1061
|
|
|
|
|
|
|
Thus rconde(j), rcondv(j), and the j-th columns of vl and vr |
|
1062
|
|
|
|
|
|
|
all correspond to the same eigenpair (but not in general the |
|
1063
|
|
|
|
|
|
|
j-th eigenpair, unless all eigenpairs are selected). |
|
1064
|
|
|
|
|
|
|
If sense = 2, rconde is not referenced. |
|
1065
|
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
rcondv: If sense = 2 or 3, the estimated reciprocal condition |
|
1067
|
|
|
|
|
|
|
numbers of the selected eigenvectors, stored in consecutive |
|
1068
|
|
|
|
|
|
|
elements of the array. For a complex eigenvector two |
|
1069
|
|
|
|
|
|
|
consecutive elements of rcondv are set to the same value. If |
|
1070
|
|
|
|
|
|
|
the eigenvalues cannot be reordered to compute rcondv(j), |
|
1071
|
|
|
|
|
|
|
rcondv(j) is set to 0; this can only occur when the true |
|
1072
|
|
|
|
|
|
|
value would be very small anyway. |
|
1073
|
|
|
|
|
|
|
If sense = 1, rcondv is not referenced. |
|
1074
|
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
info: = 0: successful exit |
|
1076
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
1077
|
|
|
|
|
|
|
= 1,...,N: |
|
1078
|
|
|
|
|
|
|
The QZ iteration failed. No eigenvectors have been |
|
1079
|
|
|
|
|
|
|
calculated, but alphar(j), alphai(j), and beta(j) |
|
1080
|
|
|
|
|
|
|
should be correct for j=info+1,...,N. |
|
1081
|
|
|
|
|
|
|
> N: =N+1: other than QZ iteration failed in hgeqz. |
|
1082
|
|
|
|
|
|
|
=N+2: error return from tgevc. |
|
1083
|
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
=for example |
|
1086
|
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
$a = random(5,5); |
|
1088
|
|
|
|
|
|
|
$b = random(5,5); |
|
1089
|
|
|
|
|
|
|
$alphar = zeroes(5); |
|
1090
|
|
|
|
|
|
|
$alphai = zeroes(5); |
|
1091
|
|
|
|
|
|
|
$beta = zeroes(5); |
|
1092
|
|
|
|
|
|
|
$vl = zeroes(5,5); |
|
1093
|
|
|
|
|
|
|
$vr = zeroes(5,5); |
|
1094
|
|
|
|
|
|
|
$lscale = zeroes(5); |
|
1095
|
|
|
|
|
|
|
$rscale = zeroes(5); |
|
1096
|
|
|
|
|
|
|
$ilo = null; |
|
1097
|
|
|
|
|
|
|
$ihi = null; |
|
1098
|
|
|
|
|
|
|
$abnrm = null; |
|
1099
|
|
|
|
|
|
|
$bbnrm = null; |
|
1100
|
|
|
|
|
|
|
$rconde = zeroes(5); |
|
1101
|
|
|
|
|
|
|
$rcondv = zeroes(5); |
|
1102
|
|
|
|
|
|
|
ggevx($a, 3, 1, 1, 3, $b, $alphar, $alphai, $beta, $vl, $vr, |
|
1103
|
|
|
|
|
|
|
$ilo, $ihi, $lscale, $rscale, $abnrm, $bbnrm, $rconde,$rcondv,($info=null)); |
|
1104
|
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
=for bad |
|
1108
|
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
ggevx ignores the bad-value flag of the input piddles. |
|
1110
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
=cut |
|
1114
|
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
*ggevx = \&PDL::ggevx; |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
=head2 gees |
|
1127
|
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
=for sig |
|
1129
|
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobvs(); int sort(); [o,phys]wr(n); [o,phys]wi(n); [o,phys]vs(p,p); int [o,phys]sdim(); int [o,phys]info(); SV* select_func) |
|
1131
|
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
=for ref |
|
1135
|
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
Computes for an N-by-N real nonsymmetric matrix A, the |
|
1137
|
|
|
|
|
|
|
eigenvalues, the real Schur form T, and, optionally, the matrix of |
|
1138
|
|
|
|
|
|
|
Schur vectors Z. This gives the Schur factorization A = Z*T*Z'. |
|
1139
|
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
Optionally, it also orders the eigenvalues on the diagonal of the |
|
1141
|
|
|
|
|
|
|
real Schur form so that selected eigenvalues are at the top left. |
|
1142
|
|
|
|
|
|
|
The leading columns of Z then form an orthonormal basis for the |
|
1143
|
|
|
|
|
|
|
invariant subspace corresponding to the selected eigenvalues. |
|
1144
|
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
A matrix is in real Schur form if it is upper quasi-triangular with |
|
1146
|
|
|
|
|
|
|
1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in the |
|
1147
|
|
|
|
|
|
|
form |
|
1148
|
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
[ a b ] |
|
1150
|
|
|
|
|
|
|
[ c a ] |
|
1151
|
|
|
|
|
|
|
where b*c < 0. |
|
1152
|
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
The eigenvalues of such a block are a +- sqrt(bc). |
|
1154
|
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
Arguments |
|
1156
|
|
|
|
|
|
|
========= |
|
1157
|
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
jobvs: = 0: Schur vectors are not computed; |
|
1159
|
|
|
|
|
|
|
= 1: Schur vectors are computed. |
|
1160
|
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
sort: Specifies whether or not to order the eigenvalues on the |
|
1162
|
|
|
|
|
|
|
diagonal of the Schur form. |
|
1163
|
|
|
|
|
|
|
= 0: Eigenvalues are not ordered; |
|
1164
|
|
|
|
|
|
|
= 1: Eigenvalues are ordered (see select_func). |
|
1165
|
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
select_func: |
|
1167
|
|
|
|
|
|
|
If sort = 1, select_func is used to select eigenvalues to sort |
|
1168
|
|
|
|
|
|
|
to the top left of the Schur form. |
|
1169
|
|
|
|
|
|
|
If sort = 0, select_func is not referenced. |
|
1170
|
|
|
|
|
|
|
An eigenvalue wr(j)+sqrt(-1)*wi(j) is selected if |
|
1171
|
|
|
|
|
|
|
select_func(SCALAR(wr(j)), SCALAR(wi(j))) is true; i.e., |
|
1172
|
|
|
|
|
|
|
if either one of a complex conjugate pair of eigenvalues |
|
1173
|
|
|
|
|
|
|
is selected, then both complex eigenvalues are selected. |
|
1174
|
|
|
|
|
|
|
Note that a selected complex eigenvalue may no longer |
|
1175
|
|
|
|
|
|
|
satisfy select_func(wr(j),wi(j)) = 1 after ordering, since |
|
1176
|
|
|
|
|
|
|
ordering may change the value of complex eigenvalues |
|
1177
|
|
|
|
|
|
|
(especially if the eigenvalue is ill-conditioned); in this |
|
1178
|
|
|
|
|
|
|
case info is set to N+2 (see info below). |
|
1179
|
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
A: The N-by-N matrix A. |
|
1181
|
|
|
|
|
|
|
On exit, A has been overwritten by its real Schur form T. |
|
1182
|
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
sdim: If sort = 0, sdim = 0. |
|
1184
|
|
|
|
|
|
|
If sort = 1, sdim = number of eigenvalues (after sorting) |
|
1185
|
|
|
|
|
|
|
for which select_func is true. (Complex conjugate |
|
1186
|
|
|
|
|
|
|
pairs for which select_func is true for either |
|
1187
|
|
|
|
|
|
|
eigenvalue count as 2.) |
|
1188
|
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
wr: |
|
1190
|
|
|
|
|
|
|
wi: wr and wi contain the real and imaginary parts, |
|
1191
|
|
|
|
|
|
|
respectively, of the computed eigenvalues in the same order |
|
1192
|
|
|
|
|
|
|
that they appear on the diagonal of the output Schur form T. |
|
1193
|
|
|
|
|
|
|
Complex conjugate pairs of eigenvalues will appear |
|
1194
|
|
|
|
|
|
|
consecutively with the eigenvalue having the positive |
|
1195
|
|
|
|
|
|
|
imaginary part first. |
|
1196
|
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
vs: If jobvs = 1, vs contains the orthogonal matrix Z of Schur |
|
1198
|
|
|
|
|
|
|
vectors else vs is not referenced. |
|
1199
|
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
info = 0: successful exit |
|
1201
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
1202
|
|
|
|
|
|
|
> 0: if info = i, and i is |
|
1203
|
|
|
|
|
|
|
<= N: the QR algorithm failed to compute all the |
|
1204
|
|
|
|
|
|
|
eigenvalues; elements 1:ILO-1 and i+1:N of wr and wi |
|
1205
|
|
|
|
|
|
|
contain those eigenvalues which have converged; if |
|
1206
|
|
|
|
|
|
|
jobvs = 1, vs contains the matrix which reduces A |
|
1207
|
|
|
|
|
|
|
to its partially converged Schur form. |
|
1208
|
|
|
|
|
|
|
= N+1: the eigenvalues could not be reordered because some |
|
1209
|
|
|
|
|
|
|
eigenvalues were too close to separate (the problem |
|
1210
|
|
|
|
|
|
|
is very ill-conditioned); |
|
1211
|
|
|
|
|
|
|
= N+2: after reordering, roundoff changed values of some |
|
1212
|
|
|
|
|
|
|
complex eigenvalues so that leading eigenvalues in |
|
1213
|
|
|
|
|
|
|
the Schur form no longer satisfy select_func = 1 This |
|
1214
|
|
|
|
|
|
|
could also be caused by underflow due to scaling. |
|
1215
|
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
=for example |
|
1217
|
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
sub select_function{ |
|
1219
|
|
|
|
|
|
|
my ($a, $b ) = @_; |
|
1220
|
|
|
|
|
|
|
# Stable "continuous time" eigenspace |
|
1221
|
|
|
|
|
|
|
return $a < 0 ? 1 : 0; |
|
1222
|
|
|
|
|
|
|
} |
|
1223
|
|
|
|
|
|
|
$A = random (5,5); |
|
1224
|
|
|
|
|
|
|
$wr= zeroes(5); |
|
1225
|
|
|
|
|
|
|
$wi = zeroes(5); |
|
1226
|
|
|
|
|
|
|
$vs = zeroes(5,5); |
|
1227
|
|
|
|
|
|
|
$sdim = null; |
|
1228
|
|
|
|
|
|
|
$info = null; |
|
1229
|
|
|
|
|
|
|
gees($A, 1,1, $wr, $wi, $vs, $sdim, $info,\&select_function); |
|
1230
|
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
|
|
1233
|
|
|
|
|
|
|
=for bad |
|
1234
|
|
|
|
|
|
|
|
|
1235
|
|
|
|
|
|
|
gees ignores the bad-value flag of the input piddles. |
|
1236
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1237
|
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
|
|
1239
|
|
|
|
|
|
|
=cut |
|
1240
|
|
|
|
|
|
|
|
|
1241
|
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
*gees = \&PDL::gees; |
|
1247
|
|
|
|
|
|
|
|
|
1248
|
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
|
|
1250
|
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
=head2 geesx |
|
1253
|
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
=for sig |
|
1255
|
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobvs(); int sort(); int sense(); [o,phys]wr(n); [o,phys]wi(n); [o,phys]vs(p,p); int [o,phys]sdim(); [o,phys]rconde();[o,phys]rcondv(); int [o,phys]info(); SV* select_func) |
|
1257
|
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
=for ref |
|
1261
|
|
|
|
|
|
|
|
|
1262
|
|
|
|
|
|
|
Computes for an N-by-N real nonsymmetric matrix A, the |
|
1263
|
|
|
|
|
|
|
eigenvalues, the real Schur form T, and, optionally, the matrix of |
|
1264
|
|
|
|
|
|
|
Schur vectors Z. This gives the Schur factorization A = Z*T*Z'. |
|
1265
|
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
Optionally, it also orders the eigenvalues on the diagonal of the |
|
1267
|
|
|
|
|
|
|
real Schur form so that selected eigenvalues are at the top left; |
|
1268
|
|
|
|
|
|
|
computes a reciprocal condition number for the average of the |
|
1269
|
|
|
|
|
|
|
selected eigenvalues (rconde); and computes a reciprocal condition |
|
1270
|
|
|
|
|
|
|
number for the right invariant subspace corresponding to the |
|
1271
|
|
|
|
|
|
|
selected eigenvalues (rcondv). The leading columns of Z form an |
|
1272
|
|
|
|
|
|
|
orthonormal basis for this invariant subspace. |
|
1273
|
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
For further explanation of the reciprocal condition numbers rconde |
|
1275
|
|
|
|
|
|
|
and rcondv, see Section 4.10 of the LAPACK Users' Guide (where |
|
1276
|
|
|
|
|
|
|
these quantities are called s and sep respectively). |
|
1277
|
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
A real matrix is in real Schur form if it is upper quasi-triangular |
|
1279
|
|
|
|
|
|
|
with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in |
|
1280
|
|
|
|
|
|
|
the form |
|
1281
|
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
[ a b ] |
|
1283
|
|
|
|
|
|
|
[ c a ] |
|
1284
|
|
|
|
|
|
|
where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc). |
|
1285
|
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
Arguments |
|
1287
|
|
|
|
|
|
|
========= |
|
1288
|
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
jobvs: = 0: Schur vectors are not computed; |
|
1290
|
|
|
|
|
|
|
= 1: Schur vectors are computed. |
|
1291
|
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
sort: Specifies whether or not to order the eigenvalues on the |
|
1293
|
|
|
|
|
|
|
diagonal of the Schur form. |
|
1294
|
|
|
|
|
|
|
= 0: Eigenvalues are not ordered; |
|
1295
|
|
|
|
|
|
|
= 1: Eigenvalues are ordered (see select_func). |
|
1296
|
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
select_func: |
|
1298
|
|
|
|
|
|
|
If sort = 1, select_func is used to select eigenvalues to sort |
|
1299
|
|
|
|
|
|
|
to the top left of the Schur form else select_func is not referenced. |
|
1300
|
|
|
|
|
|
|
An eigenvalue wr(j)+sqrt(-1)*wi(j) is selected if |
|
1301
|
|
|
|
|
|
|
select_func(wr(j),wi(j)) is true; i.e., if either one of a |
|
1302
|
|
|
|
|
|
|
complex conjugate pair of eigenvalues is selected, then both |
|
1303
|
|
|
|
|
|
|
are. Note that a selected complex eigenvalue may no longer |
|
1304
|
|
|
|
|
|
|
satisfy select_func(wr(j),wi(j)) = 1 after ordering, since |
|
1305
|
|
|
|
|
|
|
ordering may change the value of complex eigenvalues |
|
1306
|
|
|
|
|
|
|
(especially if the eigenvalue is ill-conditioned); in this |
|
1307
|
|
|
|
|
|
|
case info may be set to N+3 (see info below). |
|
1308
|
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
sense: Determines which reciprocal condition numbers are computed. |
|
1310
|
|
|
|
|
|
|
= 0: None are computed; |
|
1311
|
|
|
|
|
|
|
= 1: Computed for average of selected eigenvalues only; |
|
1312
|
|
|
|
|
|
|
= 2: Computed for selected right invariant subspace only; |
|
1313
|
|
|
|
|
|
|
= 3: Computed for both. |
|
1314
|
|
|
|
|
|
|
If sense = 1, 2 or 3, sort must equal 1. |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
A: On entry, the N-by-N matrix A. |
|
1317
|
|
|
|
|
|
|
On exit, A is overwritten by its real Schur form T. |
|
1318
|
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
sdim: If sort = 0, sdim = 0. |
|
1320
|
|
|
|
|
|
|
If sort = 1, sdim = number of eigenvalues (after sorting) |
|
1321
|
|
|
|
|
|
|
for which select_func is 1. (Complex conjugate |
|
1322
|
|
|
|
|
|
|
pairs for which select_func is 1 for either |
|
1323
|
|
|
|
|
|
|
eigenvalue count as 2.) |
|
1324
|
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
wr: |
|
1326
|
|
|
|
|
|
|
wi: wr and wi contain the real and imaginary parts, respectively, |
|
1327
|
|
|
|
|
|
|
of the computed eigenvalues, in the same order that they |
|
1328
|
|
|
|
|
|
|
appear on the diagonal of the output Schur form T. Complex |
|
1329
|
|
|
|
|
|
|
conjugate pairs of eigenvalues appear consecutively with the |
|
1330
|
|
|
|
|
|
|
eigenvalue having the positive imaginary part first. |
|
1331
|
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
vs If jobvs = 1, vs contains the orthogonal matrix Z of Schur |
|
1333
|
|
|
|
|
|
|
vectors else vs is not referenced. |
|
1334
|
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
rconde: If sense = 1 or 3, rconde contains the reciprocal |
|
1336
|
|
|
|
|
|
|
condition number for the average of the selected eigenvalues. |
|
1337
|
|
|
|
|
|
|
Not referenced if sense = 0 or 2. |
|
1338
|
|
|
|
|
|
|
|
|
1339
|
|
|
|
|
|
|
rcondv: If sense = 2 or 3, rcondv contains the reciprocal |
|
1340
|
|
|
|
|
|
|
condition number for the selected right invariant subspace. |
|
1341
|
|
|
|
|
|
|
Not referenced if sense = 0 or 1. |
|
1342
|
|
|
|
|
|
|
|
|
1343
|
|
|
|
|
|
|
info: = 0: successful exit |
|
1344
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
1345
|
|
|
|
|
|
|
> 0: if info = i, and i is |
|
1346
|
|
|
|
|
|
|
<= N: the QR algorithm failed to compute all the |
|
1347
|
|
|
|
|
|
|
eigenvalues; elements 1:ilo-1 and i+1:N of wr and wi |
|
1348
|
|
|
|
|
|
|
contain those eigenvalues which have converged; if |
|
1349
|
|
|
|
|
|
|
jobvs = 1, vs contains the transformation which |
|
1350
|
|
|
|
|
|
|
reduces A to its partially converged Schur form. |
|
1351
|
|
|
|
|
|
|
= N+1: the eigenvalues could not be reordered because some |
|
1352
|
|
|
|
|
|
|
eigenvalues were too close to separate (the problem |
|
1353
|
|
|
|
|
|
|
is very ill-conditioned); |
|
1354
|
|
|
|
|
|
|
= N+2: after reordering, roundoff changed values of some |
|
1355
|
|
|
|
|
|
|
complex eigenvalues so that leading eigenvalues in |
|
1356
|
|
|
|
|
|
|
the Schur form no longer satisfy select_func=1 This |
|
1357
|
|
|
|
|
|
|
could also be caused by underflow due to scaling. |
|
1358
|
|
|
|
|
|
|
|
|
1359
|
|
|
|
|
|
|
=for example |
|
1360
|
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
sub select_function{ |
|
1362
|
|
|
|
|
|
|
my ($a, $b) = @_; |
|
1363
|
|
|
|
|
|
|
# Stable "discrete time" eigenspace |
|
1364
|
|
|
|
|
|
|
return sqrt($a**2 + $b**2) < 1 ? 1 : 0; |
|
1365
|
|
|
|
|
|
|
} |
|
1366
|
|
|
|
|
|
|
$A = random (5,5); |
|
1367
|
|
|
|
|
|
|
$wr= zeroes(5); |
|
1368
|
|
|
|
|
|
|
$wi = zeroes(5); |
|
1369
|
|
|
|
|
|
|
$vs = zeroes(5,5); |
|
1370
|
|
|
|
|
|
|
$sdim = null; |
|
1371
|
|
|
|
|
|
|
$rconde = null; |
|
1372
|
|
|
|
|
|
|
$rcondv = null; |
|
1373
|
|
|
|
|
|
|
$info = null; |
|
1374
|
|
|
|
|
|
|
geesx($A, 1,1, 3, $wr, $wi, $vs, $sdim, $rconde, $rcondv, $info, \&select_function); |
|
1375
|
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
=for bad |
|
1379
|
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
geesx ignores the bad-value flag of the input piddles. |
|
1381
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1382
|
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
=cut |
|
1385
|
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
*geesx = \&PDL::geesx; |
|
1392
|
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
=head2 gges |
|
1398
|
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
=for sig |
|
1400
|
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobvsl();int jobvsr();int sort();[io,phys]B(n,n);[o,phys]alphar(n);[o,phys]alphai(n);[o,phys]beta(n);[o,phys]VSL(m,m);[o,phys]VSR(p,p);int [o,phys]sdim();int [o,phys]info(); SV* select_func) |
|
1402
|
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
=for ref |
|
1406
|
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
Computes for a pair of N-by-N real nonsymmetric matrices (A,B), |
|
1408
|
|
|
|
|
|
|
the generalized eigenvalues, the generalized real Schur form (S,T), |
|
1409
|
|
|
|
|
|
|
optionally, the left and/or right matrices of Schur vectors (VSL and |
|
1410
|
|
|
|
|
|
|
VSR). This gives the generalized Schur factorization |
|
1411
|
|
|
|
|
|
|
|
|
1412
|
|
|
|
|
|
|
(A,B) = ( (VSL)*S*(VSR)', (VSL)*T*(VSR)' ) |
|
1413
|
|
|
|
|
|
|
|
|
1414
|
|
|
|
|
|
|
Optionally, it also orders the eigenvalues so that a selected cluster |
|
1415
|
|
|
|
|
|
|
of eigenvalues appears in the leading diagonal blocks of the upper |
|
1416
|
|
|
|
|
|
|
quasi-triangular matrix S and the upper triangular matrix T.The |
|
1417
|
|
|
|
|
|
|
leading columns of VSL and VSR then form an orthonormal basis for the |
|
1418
|
|
|
|
|
|
|
corresponding left and right eigenspaces (deflating subspaces). |
|
1419
|
|
|
|
|
|
|
|
|
1420
|
|
|
|
|
|
|
(If only the generalized eigenvalues are needed, use the driver |
|
1421
|
|
|
|
|
|
|
ggev instead, which is faster.) |
|
1422
|
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
A generalized eigenvalue for a pair of matrices (A,B) is a scalar w |
|
1424
|
|
|
|
|
|
|
or a ratio alpha/beta = w, such that A - w*B is singular. It is |
|
1425
|
|
|
|
|
|
|
usually represented as the pair (alpha,beta), as there is a |
|
1426
|
|
|
|
|
|
|
reasonable interpretation for beta=0 or both being zero. |
|
1427
|
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
A pair of matrices (S,T) is in generalized real Schur form if T is |
|
1429
|
|
|
|
|
|
|
upper triangular with non-negative diagonal and S is block upper |
|
1430
|
|
|
|
|
|
|
triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond |
|
1431
|
|
|
|
|
|
|
to real generalized eigenvalues, while 2-by-2 blocks of S will be |
|
1432
|
|
|
|
|
|
|
"standardized" by making the corresponding elements of T have the |
|
1433
|
|
|
|
|
|
|
form: |
|
1434
|
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
[ a 0 ] |
|
1436
|
|
|
|
|
|
|
[ 0 b ] |
|
1437
|
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
and the pair of corresponding 2-by-2 blocks in S and T will have a |
|
1439
|
|
|
|
|
|
|
complex conjugate pair of generalized eigenvalues. |
|
1440
|
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
|
|
1442
|
|
|
|
|
|
|
Arguments |
|
1443
|
|
|
|
|
|
|
========= |
|
1444
|
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
jobvsl: = 0: do not compute the left Schur vectors; |
|
1446
|
|
|
|
|
|
|
= 1: compute the left Schur vectors. |
|
1447
|
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
jobvsr: = 0: do not compute the right Schur vectors; |
|
1449
|
|
|
|
|
|
|
= 1: compute the right Schur vectors. |
|
1450
|
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
sort: Specifies whether or not to order the eigenvalues on the |
|
1452
|
|
|
|
|
|
|
diagonal of the generalized Schur form. |
|
1453
|
|
|
|
|
|
|
= 0: Eigenvalues are not ordered; |
|
1454
|
|
|
|
|
|
|
= 1: Eigenvalues are ordered (see delztg); |
|
1455
|
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
delztg: If sort = 0, delztg is not referenced. |
|
1457
|
|
|
|
|
|
|
If sort = 1, delztg is used to select eigenvalues to sort |
|
1458
|
|
|
|
|
|
|
to the top left of the Schur form. |
|
1459
|
|
|
|
|
|
|
An eigenvalue (alphar(j)+alphai(j))/beta(j) is selected if |
|
1460
|
|
|
|
|
|
|
delztg(alphar(j),alphai(j),beta(j)) is true; i.e. if either |
|
1461
|
|
|
|
|
|
|
one of a complex conjugate pair of eigenvalues is selected, |
|
1462
|
|
|
|
|
|
|
then both complex eigenvalues are selected. |
|
1463
|
|
|
|
|
|
|
|
|
1464
|
|
|
|
|
|
|
Note that in the ill-conditioned case, a selected complex |
|
1465
|
|
|
|
|
|
|
eigenvalue may no longer satisfy delztg(alphar(j),alphai(j), |
|
1466
|
|
|
|
|
|
|
beta(j)) = 1 after ordering. info is to be set to N+2 |
|
1467
|
|
|
|
|
|
|
in this case. |
|
1468
|
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
A: On entry, the first of the pair of matrices. |
|
1470
|
|
|
|
|
|
|
On exit, A has been overwritten by its generalized Schur |
|
1471
|
|
|
|
|
|
|
form S. |
|
1472
|
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
B: On entry, the second of the pair of matrices. |
|
1474
|
|
|
|
|
|
|
On exit, B has been overwritten by its generalized Schur |
|
1475
|
|
|
|
|
|
|
form T. |
|
1476
|
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
sdim: If sort = 0, sdim = 0. |
|
1478
|
|
|
|
|
|
|
If sort = 1, sdim = number of eigenvalues (after sorting) |
|
1479
|
|
|
|
|
|
|
for which delztg is true. (Complex conjugate pairs for which |
|
1480
|
|
|
|
|
|
|
delztg is true for either eigenvalue count as 2.) |
|
1481
|
|
|
|
|
|
|
|
|
1482
|
|
|
|
|
|
|
alphar: |
|
1483
|
|
|
|
|
|
|
alphai: |
|
1484
|
|
|
|
|
|
|
beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will |
|
1485
|
|
|
|
|
|
|
be the generalized eigenvalues. alphar(j) + alphai(j)*i, |
|
1486
|
|
|
|
|
|
|
and beta(j),j=1,...,N are the diagonals of the complex Schur |
|
1487
|
|
|
|
|
|
|
form (S,T) that would result if the 2-by-2 diagonal blocks of |
|
1488
|
|
|
|
|
|
|
the real Schur form of (A,B) were further reduced to |
|
1489
|
|
|
|
|
|
|
triangular form using 2-by-2 complex unitary transformations. |
|
1490
|
|
|
|
|
|
|
If alphai(j) is zero, then the j-th eigenvalue is real; if |
|
1491
|
|
|
|
|
|
|
positive, then the j-th and (j+1)-st eigenvalues are a |
|
1492
|
|
|
|
|
|
|
complex conjugate pair, with alphai(j+1) negative. |
|
1493
|
|
|
|
|
|
|
|
|
1494
|
|
|
|
|
|
|
Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j) |
|
1495
|
|
|
|
|
|
|
may easily over- or underflow, and beta(j) may even be zero. |
|
1496
|
|
|
|
|
|
|
Thus, the user should avoid naively computing the ratio. |
|
1497
|
|
|
|
|
|
|
However, alphar and alphai will be always less than and |
|
1498
|
|
|
|
|
|
|
usually comparable with norm(A) in magnitude, and beta always |
|
1499
|
|
|
|
|
|
|
less than and usually comparable with norm(B). |
|
1500
|
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
VSL: If jobvsl = 1, VSL will contain the left Schur vectors. |
|
1502
|
|
|
|
|
|
|
Not referenced if jobvsl = 0. |
|
1503
|
|
|
|
|
|
|
The leading dimension must always be >=1. |
|
1504
|
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
VSR: If jobvsr = 1, VSR will contain the right Schur vectors. |
|
1506
|
|
|
|
|
|
|
Not referenced if jobvsr = 0. |
|
1507
|
|
|
|
|
|
|
The leading dimension must always be >=1. |
|
1508
|
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
info: = 0: successful exit |
|
1510
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
1511
|
|
|
|
|
|
|
= 1,...,N: |
|
1512
|
|
|
|
|
|
|
The QZ iteration failed. (A,B) are not in Schur |
|
1513
|
|
|
|
|
|
|
form, but alphar(j), alphai(j), and beta(j) should |
|
1514
|
|
|
|
|
|
|
be correct for j=info+1,...,N. |
|
1515
|
|
|
|
|
|
|
> N: =N+1: other than QZ iteration failed in hgeqz. |
|
1516
|
|
|
|
|
|
|
=N+2: after reordering, roundoff changed values of |
|
1517
|
|
|
|
|
|
|
some complex eigenvalues so that leading |
|
1518
|
|
|
|
|
|
|
eigenvalues in the Generalized Schur form no |
|
1519
|
|
|
|
|
|
|
longer satisfy delztg=1 This could also |
|
1520
|
|
|
|
|
|
|
be caused due to scaling. |
|
1521
|
|
|
|
|
|
|
=N+3: reordering failed in tgsen. |
|
1522
|
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
=for example |
|
1525
|
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
sub my_select{ |
|
1527
|
|
|
|
|
|
|
my ($zr, $zi, $d) = @_; |
|
1528
|
|
|
|
|
|
|
# stable generalized eigenvalues for continuous time |
|
1529
|
|
|
|
|
|
|
return ( ($zr < 0 && $d > 0 ) || ($zr > 0 && $d < 0) ) ? 1 : 0; |
|
1530
|
|
|
|
|
|
|
} |
|
1531
|
|
|
|
|
|
|
$a = random(5,5); |
|
1532
|
|
|
|
|
|
|
$b = random(5,5); |
|
1533
|
|
|
|
|
|
|
$sdim = null; |
|
1534
|
|
|
|
|
|
|
$alphar = zeroes(5); |
|
1535
|
|
|
|
|
|
|
$alphai = zeroes(5); |
|
1536
|
|
|
|
|
|
|
$beta = zeroes(5); |
|
1537
|
|
|
|
|
|
|
$vsl = zeroes(5,5); |
|
1538
|
|
|
|
|
|
|
$vsr = zeroes(5,5); |
|
1539
|
|
|
|
|
|
|
gges($a, 1, 1, 1, $b, $alphar, $alphai, $beta, $vsl, $vsr, $sdim,($info=null), \&my_select); |
|
1540
|
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
|
|
1542
|
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
=for bad |
|
1544
|
|
|
|
|
|
|
|
|
1545
|
|
|
|
|
|
|
gges ignores the bad-value flag of the input piddles. |
|
1546
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1547
|
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
=cut |
|
1550
|
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
|
|
1552
|
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
|
|
1556
|
|
|
|
|
|
|
*gges = \&PDL::gges; |
|
1557
|
|
|
|
|
|
|
|
|
1558
|
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
|
|
1560
|
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
|
|
1562
|
|
|
|
|
|
|
=head2 ggesx |
|
1563
|
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
=for sig |
|
1565
|
|
|
|
|
|
|
|
|
1566
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobvsl();int jobvsr();int sort();int sense();[io,phys]B(n,n);[o,phys]alphar(n);[o,phys]alphai(n);[o,phys]beta(n);[o,phys]VSL(m,m);[o,phys]VSR(p,p);int [o,phys]sdim();[o,phys]rconde(q);[o,phys]rcondv(r);int [o,phys]info(); SV* select_func) |
|
1567
|
|
|
|
|
|
|
|
|
1568
|
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
|
|
1570
|
|
|
|
|
|
|
=for ref |
|
1571
|
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
Computes for a pair of N-by-N real nonsymmetric matrices |
|
1573
|
|
|
|
|
|
|
(A,B), the generalized eigenvalues, the real Schur form (S,T), and, |
|
1574
|
|
|
|
|
|
|
optionally, the left and/or right matrices of Schur vectors (VSL and |
|
1575
|
|
|
|
|
|
|
VSR). This gives the generalized Schur factorization |
|
1576
|
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
(A,B) = ( (VSL) S (VSR)', (VSL) T (VSR)' ) |
|
1578
|
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
Optionally, it also orders the eigenvalues so that a selected cluster |
|
1580
|
|
|
|
|
|
|
of eigenvalues appears in the leading diagonal blocks of the upper |
|
1581
|
|
|
|
|
|
|
quasi-triangular matrix S and the upper triangular matrix T; computes |
|
1582
|
|
|
|
|
|
|
a reciprocal condition number for the average of the selected |
|
1583
|
|
|
|
|
|
|
eigenvalues (RCONDE); and computes a reciprocal condition number for |
|
1584
|
|
|
|
|
|
|
the right and left deflating subspaces corresponding to the selected |
|
1585
|
|
|
|
|
|
|
eigenvalues (RCONDV). The leading columns of VSL and VSR then form |
|
1586
|
|
|
|
|
|
|
an orthonormal basis for the corresponding left and right eigenspaces |
|
1587
|
|
|
|
|
|
|
(deflating subspaces). |
|
1588
|
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
A generalized eigenvalue for a pair of matrices (A,B) is a scalar w |
|
1590
|
|
|
|
|
|
|
or a ratio alpha/beta = w, such that A - w*B is singular. It is |
|
1591
|
|
|
|
|
|
|
usually represented as the pair (alpha,beta), as there is a |
|
1592
|
|
|
|
|
|
|
reasonable interpretation for beta=0 or for both being zero. |
|
1593
|
|
|
|
|
|
|
|
|
1594
|
|
|
|
|
|
|
A pair of matrices (S,T) is in generalized real Schur form if T is |
|
1595
|
|
|
|
|
|
|
upper triangular with non-negative diagonal and S is block upper |
|
1596
|
|
|
|
|
|
|
triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond |
|
1597
|
|
|
|
|
|
|
to real generalized eigenvalues, while 2-by-2 blocks of S will be |
|
1598
|
|
|
|
|
|
|
"standardized" by making the corresponding elements of T have the |
|
1599
|
|
|
|
|
|
|
form: |
|
1600
|
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
[ a 0 ] |
|
1602
|
|
|
|
|
|
|
[ 0 b ] |
|
1603
|
|
|
|
|
|
|
|
|
1604
|
|
|
|
|
|
|
and the pair of corresponding 2-by-2 blocks in S and T will have a |
|
1605
|
|
|
|
|
|
|
complex conjugate pair of generalized eigenvalues. |
|
1606
|
|
|
|
|
|
|
|
|
1607
|
|
|
|
|
|
|
Further details |
|
1608
|
|
|
|
|
|
|
=============== |
|
1609
|
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
An approximate (asymptotic) bound on the average absolute error of |
|
1611
|
|
|
|
|
|
|
the selected eigenvalues is |
|
1612
|
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
EPS * norm((A, B)) / RCONDE( 1 ). |
|
1614
|
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
An approximate (asymptotic) bound on the maximum angular error in |
|
1616
|
|
|
|
|
|
|
the computed deflating subspaces is |
|
1617
|
|
|
|
|
|
|
|
|
1618
|
|
|
|
|
|
|
EPS * norm((A, B)) / RCONDV( 2 ). |
|
1619
|
|
|
|
|
|
|
|
|
1620
|
|
|
|
|
|
|
See LAPACK User's Guide, section 4.11 for more information. |
|
1621
|
|
|
|
|
|
|
|
|
1622
|
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
Arguments |
|
1624
|
|
|
|
|
|
|
========= |
|
1625
|
|
|
|
|
|
|
|
|
1626
|
|
|
|
|
|
|
jobvsl: = 0: do not compute the left Schur vectors; |
|
1627
|
|
|
|
|
|
|
= 1: compute the left Schur vectors. |
|
1628
|
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
jobvsr: = 0: do not compute the right Schur vectors; |
|
1630
|
|
|
|
|
|
|
= 1: compute the right Schur vectors. |
|
1631
|
|
|
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
sort: Specifies whether or not to order the eigenvalues on the |
|
1633
|
|
|
|
|
|
|
diagonal of the generalized Schur form. |
|
1634
|
|
|
|
|
|
|
= 0: Eigenvalues are not ordered; |
|
1635
|
|
|
|
|
|
|
= 1: Eigenvalues are ordered (see delztg); |
|
1636
|
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
delztg: If sort = 0, delztg is not referenced. |
|
1638
|
|
|
|
|
|
|
If sort = 1, delztg is used to select eigenvalues to sort |
|
1639
|
|
|
|
|
|
|
to the top left of the Schur form. |
|
1640
|
|
|
|
|
|
|
An eigenvalue (alphar(j)+alphai(j))/beta(j) is selected if |
|
1641
|
|
|
|
|
|
|
delztg(alphar(j),alphai(j),beta(j)) is true; i.e. if either |
|
1642
|
|
|
|
|
|
|
one of a complex conjugate pair of eigenvalues is selected, |
|
1643
|
|
|
|
|
|
|
then both complex eigenvalues are selected. |
|
1644
|
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
Note that in the ill-conditioned case, a selected complex |
|
1646
|
|
|
|
|
|
|
eigenvalue may no longer satisfy delztg(alphar(j),alphai(j), |
|
1647
|
|
|
|
|
|
|
beta(j)) = 1 after ordering. info is to be set to N+2 |
|
1648
|
|
|
|
|
|
|
in this case. |
|
1649
|
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
sense: Determines which reciprocal condition numbers are computed. |
|
1651
|
|
|
|
|
|
|
= 0 : None are computed; |
|
1652
|
|
|
|
|
|
|
= 1 : Computed for average of selected eigenvalues only; |
|
1653
|
|
|
|
|
|
|
= 2 : Computed for selected deflating subspaces only; |
|
1654
|
|
|
|
|
|
|
= 3 : Computed for both. |
|
1655
|
|
|
|
|
|
|
If sense = 1, 2, or 3, sort must equal 1. |
|
1656
|
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
A: On entry, the first of the pair of matrices. |
|
1658
|
|
|
|
|
|
|
On exit, A has been overwritten by its generalized Schur |
|
1659
|
|
|
|
|
|
|
form S. |
|
1660
|
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
B: On entry, the second of the pair of matrices. |
|
1662
|
|
|
|
|
|
|
On exit, B has been overwritten by its generalized Schur |
|
1663
|
|
|
|
|
|
|
form T. |
|
1664
|
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
sdim: If sort = 0, sdim = 0. |
|
1666
|
|
|
|
|
|
|
If sort = 1, sdim = number of eigenvalues (after sorting) |
|
1667
|
|
|
|
|
|
|
for which delztg is true. (Complex conjugate pairs for which |
|
1668
|
|
|
|
|
|
|
delztg is true for either eigenvalue count as 2.) |
|
1669
|
|
|
|
|
|
|
|
|
1670
|
|
|
|
|
|
|
alphar: |
|
1671
|
|
|
|
|
|
|
alphai: |
|
1672
|
|
|
|
|
|
|
beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will |
|
1673
|
|
|
|
|
|
|
be the generalized eigenvalues. alphar(j) + alphai(j)*i, |
|
1674
|
|
|
|
|
|
|
and beta(j),j=1,...,N are the diagonals of the complex Schur |
|
1675
|
|
|
|
|
|
|
form (S,T) that would result if the 2-by-2 diagonal blocks of |
|
1676
|
|
|
|
|
|
|
the real Schur form of (A,B) were further reduced to |
|
1677
|
|
|
|
|
|
|
triangular form using 2-by-2 complex unitary transformations. |
|
1678
|
|
|
|
|
|
|
If alphai(j) is zero, then the j-th eigenvalue is real; if |
|
1679
|
|
|
|
|
|
|
positive, then the j-th and (j+1)-st eigenvalues are a |
|
1680
|
|
|
|
|
|
|
complex conjugate pair, with alphai(j+1) negative. |
|
1681
|
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j) |
|
1683
|
|
|
|
|
|
|
may easily over- or underflow, and beta(j) may even be zero. |
|
1684
|
|
|
|
|
|
|
Thus, the user should avoid naively computing the ratio. |
|
1685
|
|
|
|
|
|
|
However, alphar and alphai will be always less than and |
|
1686
|
|
|
|
|
|
|
usually comparable with norm(A) in magnitude, and beta always |
|
1687
|
|
|
|
|
|
|
less than and usually comparable with norm(B). |
|
1688
|
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
VSL: If jobvsl = 1, VSL will contain the left Schur vectors. |
|
1690
|
|
|
|
|
|
|
Not referenced if jobvsl = 0. |
|
1691
|
|
|
|
|
|
|
The leading dimension must always be >=1. |
|
1692
|
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
VSR: If jobvsr = 1, VSR will contain the right Schur vectors. |
|
1694
|
|
|
|
|
|
|
Not referenced if jobvsr = 0. |
|
1695
|
|
|
|
|
|
|
The leading dimension must always be >=1. |
|
1696
|
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
rconde: If sense = 1 or 3, rconde(1) and rconde(2) contain the |
|
1698
|
|
|
|
|
|
|
reciprocal condition numbers for the average of the selected |
|
1699
|
|
|
|
|
|
|
eigenvalues. |
|
1700
|
|
|
|
|
|
|
Not referenced if sense = 0 or 2. |
|
1701
|
|
|
|
|
|
|
|
|
1702
|
|
|
|
|
|
|
rcondv: If sense = 2 or 3, rcondv(1) and rcondv(2) contain the |
|
1703
|
|
|
|
|
|
|
reciprocal condition numbers for the selected deflating |
|
1704
|
|
|
|
|
|
|
subspaces. |
|
1705
|
|
|
|
|
|
|
Not referenced if sense = 0 or 1. |
|
1706
|
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
info: = 0: successful exit |
|
1708
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
1709
|
|
|
|
|
|
|
= 1,...,N: |
|
1710
|
|
|
|
|
|
|
The QZ iteration failed. (A,B) are not in Schur |
|
1711
|
|
|
|
|
|
|
form, but alphar(j), alphai(j), and beta(j) should |
|
1712
|
|
|
|
|
|
|
be correct for j=info+1,...,N. |
|
1713
|
|
|
|
|
|
|
> N: =N+1: other than QZ iteration failed in hgeqz. |
|
1714
|
|
|
|
|
|
|
=N+2: after reordering, roundoff changed values of |
|
1715
|
|
|
|
|
|
|
some complex eigenvalues so that leading |
|
1716
|
|
|
|
|
|
|
eigenvalues in the Generalized Schur form no |
|
1717
|
|
|
|
|
|
|
longer satisfy delztg=1 This could also |
|
1718
|
|
|
|
|
|
|
be caused due to scaling. |
|
1719
|
|
|
|
|
|
|
=N+3: reordering failed in tgsen. |
|
1720
|
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
|
|
1722
|
|
|
|
|
|
|
=for example |
|
1723
|
|
|
|
|
|
|
|
|
1724
|
|
|
|
|
|
|
sub my_select{ |
|
1725
|
|
|
|
|
|
|
my ($zr, $zi, $d) = @_; |
|
1726
|
|
|
|
|
|
|
# Eigenvalue : (ZR/D) + sqrt(-1)*(ZI/D) |
|
1727
|
|
|
|
|
|
|
# stable generalized eigenvalues for discrete time |
|
1728
|
|
|
|
|
|
|
return (sqrt($zr**2 + $zi**2) < abs($d) ) ? 1 : 0; |
|
1729
|
|
|
|
|
|
|
|
|
1730
|
|
|
|
|
|
|
} |
|
1731
|
|
|
|
|
|
|
$a = random(5,5); |
|
1732
|
|
|
|
|
|
|
$b = random(5,5); |
|
1733
|
|
|
|
|
|
|
$sdim = null; |
|
1734
|
|
|
|
|
|
|
$alphar = zeroes(5); |
|
1735
|
|
|
|
|
|
|
$alphai = zeroes(5); |
|
1736
|
|
|
|
|
|
|
$beta = zeroes(5); |
|
1737
|
|
|
|
|
|
|
$vsl = zeroes(5,5); |
|
1738
|
|
|
|
|
|
|
$vsr = zeroes(5,5); |
|
1739
|
|
|
|
|
|
|
$rconde = zeroes(2); |
|
1740
|
|
|
|
|
|
|
$rcondv = zeroes(2); |
|
1741
|
|
|
|
|
|
|
ggesx($a, 1, 1, 1, 3,$b, $alphar, $alphai, $beta, $vsl, $vsr, $sdim, $rconde, $rcondv, ($info=null), \&my_select); |
|
1742
|
|
|
|
|
|
|
|
|
1743
|
|
|
|
|
|
|
|
|
1744
|
|
|
|
|
|
|
|
|
1745
|
|
|
|
|
|
|
=for bad |
|
1746
|
|
|
|
|
|
|
|
|
1747
|
|
|
|
|
|
|
ggesx ignores the bad-value flag of the input piddles. |
|
1748
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1749
|
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
|
|
1751
|
|
|
|
|
|
|
=cut |
|
1752
|
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
|
|
1755
|
|
|
|
|
|
|
|
|
1756
|
|
|
|
|
|
|
|
|
1757
|
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
*ggesx = \&PDL::ggesx; |
|
1759
|
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
|
|
1761
|
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
|
|
1763
|
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
=head2 syev |
|
1765
|
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
=for sig |
|
1767
|
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobz(); int uplo(); [o,phys]w(n); int [o,phys]info()) |
|
1769
|
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
|
|
1771
|
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
=for ref |
|
1773
|
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
Computes all eigenvalues and, optionally, eigenvectors of a |
|
1775
|
|
|
|
|
|
|
real symmetric matrix A. |
|
1776
|
|
|
|
|
|
|
|
|
1777
|
|
|
|
|
|
|
Arguments |
|
1778
|
|
|
|
|
|
|
========= |
|
1779
|
|
|
|
|
|
|
|
|
1780
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
1781
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
1782
|
|
|
|
|
|
|
|
|
1783
|
|
|
|
|
|
|
uplo = 0: Upper triangle of A is stored; |
|
1784
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
1785
|
|
|
|
|
|
|
|
|
1786
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
1787
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
1788
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
1789
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
1790
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
1791
|
|
|
|
|
|
|
On exit, if jobz = 1, then if info = 0, A contains the |
|
1792
|
|
|
|
|
|
|
orthonormal eigenvectors of the matrix A. |
|
1793
|
|
|
|
|
|
|
If jobz = 0, then on exit the lower triangle (if uplo=1) |
|
1794
|
|
|
|
|
|
|
or the upper triangle (if uplo=0) of A, including the |
|
1795
|
|
|
|
|
|
|
diagonal, is destroyed. |
|
1796
|
|
|
|
|
|
|
|
|
1797
|
|
|
|
|
|
|
w: If info = 0, the eigenvalues in ascending order. |
|
1798
|
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
info: = 0: successful exit |
|
1800
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
1801
|
|
|
|
|
|
|
> 0: if info = i, the algorithm failed to converge; i |
|
1802
|
|
|
|
|
|
|
off-diagonal elements of an intermediate tridiagonal |
|
1803
|
|
|
|
|
|
|
form did not converge to zero. |
|
1804
|
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
=for example |
|
1806
|
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
1808
|
|
|
|
|
|
|
$a = random (5,5); |
|
1809
|
|
|
|
|
|
|
syev($a, 1,1, (my $w = zeroes(5)), (my $info=null)); |
|
1810
|
|
|
|
|
|
|
|
|
1811
|
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
|
|
1813
|
|
|
|
|
|
|
=for bad |
|
1814
|
|
|
|
|
|
|
|
|
1815
|
|
|
|
|
|
|
syev ignores the bad-value flag of the input piddles. |
|
1816
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1817
|
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
|
|
1819
|
|
|
|
|
|
|
=cut |
|
1820
|
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
|
|
1823
|
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
|
|
1825
|
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
*syev = \&PDL::syev; |
|
1827
|
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
|
|
1829
|
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
|
|
1831
|
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
=head2 syevd |
|
1833
|
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
=for sig |
|
1835
|
|
|
|
|
|
|
|
|
1836
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int jobz(); int uplo(); [o,phys]w(n); int [o,phys]info()) |
|
1837
|
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
|
|
1839
|
|
|
|
|
|
|
|
|
1840
|
|
|
|
|
|
|
=for ref |
|
1841
|
|
|
|
|
|
|
|
|
1842
|
|
|
|
|
|
|
Computes all eigenvalues and, optionally, eigenvectors of a |
|
1843
|
|
|
|
|
|
|
real symmetric matrix A. If eigenvectors are desired, it uses a |
|
1844
|
|
|
|
|
|
|
divide and conquer algorithm. |
|
1845
|
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
The divide and conquer algorithm makes very mild assumptions about |
|
1847
|
|
|
|
|
|
|
floating point arithmetic. It will work on machines with a guard |
|
1848
|
|
|
|
|
|
|
digit in add/subtract, or on those binary machines without guard |
|
1849
|
|
|
|
|
|
|
digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or |
|
1850
|
|
|
|
|
|
|
Cray-2. It could conceivably fail on hexadecimal or decimal machines |
|
1851
|
|
|
|
|
|
|
without guard digits, but we know of none. |
|
1852
|
|
|
|
|
|
|
|
|
1853
|
|
|
|
|
|
|
Because of large use of BLAS of level 3, syevd needs N**2 more |
|
1854
|
|
|
|
|
|
|
workspace than syevx. |
|
1855
|
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
Arguments |
|
1857
|
|
|
|
|
|
|
========= |
|
1858
|
|
|
|
|
|
|
|
|
1859
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
1860
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
1861
|
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
uplo = 0: Upper triangle of A is stored; |
|
1863
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
1864
|
|
|
|
|
|
|
|
|
1865
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
1866
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
1867
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
1868
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
1869
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
1870
|
|
|
|
|
|
|
On exit, if jobz = 1, then if info = 0, A contains the |
|
1871
|
|
|
|
|
|
|
orthonormal eigenvectors of the matrix A. |
|
1872
|
|
|
|
|
|
|
If jobz = 0, then on exit the lower triangle (if uplo=1) |
|
1873
|
|
|
|
|
|
|
or the upper triangle (if uplo=0) of A, including the |
|
1874
|
|
|
|
|
|
|
diagonal, is destroyed. |
|
1875
|
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
w: If info = 0, the eigenvalues in ascending order. |
|
1877
|
|
|
|
|
|
|
|
|
1878
|
|
|
|
|
|
|
info: = 0: successful exit |
|
1879
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
1880
|
|
|
|
|
|
|
> 0: if info = i, the algorithm failed to converge; i |
|
1881
|
|
|
|
|
|
|
off-diagonal elements of an intermediate tridiagonal |
|
1882
|
|
|
|
|
|
|
form did not converge to zero. |
|
1883
|
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
=for example |
|
1885
|
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
1887
|
|
|
|
|
|
|
$a = random (5,5); |
|
1888
|
|
|
|
|
|
|
syevd($a, 1,1, (my $w = zeroes(5)), (my $info=null)); |
|
1889
|
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
|
|
1891
|
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
=for bad |
|
1893
|
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
syevd ignores the bad-value flag of the input piddles. |
|
1895
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
1896
|
|
|
|
|
|
|
|
|
1897
|
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
=cut |
|
1899
|
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
|
|
1901
|
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
|
|
1905
|
|
|
|
|
|
|
*syevd = \&PDL::syevd; |
|
1906
|
|
|
|
|
|
|
|
|
1907
|
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
|
|
1909
|
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
|
|
1911
|
|
|
|
|
|
|
=head2 syevx |
|
1912
|
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
=for sig |
|
1914
|
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int jobz(); int range(); int uplo(); [phys]vl(); [phys]vu(); int [phys]il(); int [phys]iu(); [phys]abstol(); int [o,phys]m(); [o,phys]w(n); [o,phys]z(p,q);int [o,phys]ifail(r); int [o,phys]info()) |
|
1916
|
|
|
|
|
|
|
|
|
1917
|
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
|
|
1919
|
|
|
|
|
|
|
=for ref |
|
1920
|
|
|
|
|
|
|
|
|
1921
|
|
|
|
|
|
|
Computes selected eigenvalues and, optionally, eigenvectors |
|
1922
|
|
|
|
|
|
|
of a real symmetric matrix A. Eigenvalues and eigenvectors can be |
|
1923
|
|
|
|
|
|
|
selected by specifying either a range of values or a range of indices |
|
1924
|
|
|
|
|
|
|
for the desired eigenvalues. |
|
1925
|
|
|
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
Arguments |
|
1927
|
|
|
|
|
|
|
========= |
|
1928
|
|
|
|
|
|
|
|
|
1929
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
1930
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
1931
|
|
|
|
|
|
|
|
|
1932
|
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
range: = 0: all eigenvalues will be found. |
|
1934
|
|
|
|
|
|
|
= 1: all eigenvalues in the half-open interval (vl,vu] |
|
1935
|
|
|
|
|
|
|
will be found. |
|
1936
|
|
|
|
|
|
|
= 1: the il-th through iu-th eigenvalues will be found. |
|
1937
|
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
uplo = 0: Upper triangle of A is stored; |
|
1939
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
1940
|
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
1942
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
1943
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
1944
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
1945
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
1946
|
|
|
|
|
|
|
On exit, the lower triangle (if uplo=1) or the upper |
|
1947
|
|
|
|
|
|
|
triangle (if uplo=0) of A, including the diagonal, is |
|
1948
|
|
|
|
|
|
|
destroyed. |
|
1949
|
|
|
|
|
|
|
|
|
1950
|
|
|
|
|
|
|
vl: |
|
1951
|
|
|
|
|
|
|
vu: If range=1, the lower and upper bounds of the interval to |
|
1952
|
|
|
|
|
|
|
be searched for eigenvalues. vl < vu. |
|
1953
|
|
|
|
|
|
|
Not referenced if range = 0 or 2. |
|
1954
|
|
|
|
|
|
|
|
|
1955
|
|
|
|
|
|
|
il: |
|
1956
|
|
|
|
|
|
|
iu: If range=2, the indices (in ascending order) of the |
|
1957
|
|
|
|
|
|
|
smallest and largest eigenvalues to be returned. |
|
1958
|
|
|
|
|
|
|
1 <= il <= iu <= N, if N > 0; il = 1 and iu = 0 if N = 0. |
|
1959
|
|
|
|
|
|
|
Not referenced if range = 0 or 1. |
|
1960
|
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
abstol: The absolute error tolerance for the eigenvalues. |
|
1962
|
|
|
|
|
|
|
An approximate eigenvalue is accepted as converged |
|
1963
|
|
|
|
|
|
|
when it is determined to lie in an interval [a,b] |
|
1964
|
|
|
|
|
|
|
of width less than or equal to |
|
1965
|
|
|
|
|
|
|
|
|
1966
|
|
|
|
|
|
|
abstol + EPS * max( |a|,|b| ) , |
|
1967
|
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
where EPS is the machine precision. If abstol is less than |
|
1969
|
|
|
|
|
|
|
or equal to zero, then EPS*|T| will be used in its place, |
|
1970
|
|
|
|
|
|
|
where |T| is the 1-norm of the tridiagonal matrix obtained |
|
1971
|
|
|
|
|
|
|
by reducing A to tridiagonal form. |
|
1972
|
|
|
|
|
|
|
|
|
1973
|
|
|
|
|
|
|
Eigenvalues will be computed most accurately when abstol is |
|
1974
|
|
|
|
|
|
|
set to twice the underflow threshold 2*lamch(1), not zero. |
|
1975
|
|
|
|
|
|
|
If this routine returns with info>0, indicating that some |
|
1976
|
|
|
|
|
|
|
eigenvectors did not converge, try setting abstol to |
|
1977
|
|
|
|
|
|
|
2*lamch(1). |
|
1978
|
|
|
|
|
|
|
|
|
1979
|
|
|
|
|
|
|
See "Computing Small Singular Values of Bidiagonal Matrices |
|
1980
|
|
|
|
|
|
|
with Guaranteed High Relative Accuracy," by Demmel and |
|
1981
|
|
|
|
|
|
|
Kahan, LAPACK Working Note #3. |
|
1982
|
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
m: The total number of eigenvalues found. 0 <= m <= N. |
|
1984
|
|
|
|
|
|
|
If range = 0, m = N, and if range = 2, m = iu-il+1. |
|
1985
|
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
w: On normal exit, the first M elements contain the selected |
|
1987
|
|
|
|
|
|
|
eigenvalues in ascending order. |
|
1988
|
|
|
|
|
|
|
|
|
1989
|
|
|
|
|
|
|
z: If jobz = 1, then if info = 0, the first m columns of z |
|
1990
|
|
|
|
|
|
|
contain the orthonormal eigenvectors of the matrix A |
|
1991
|
|
|
|
|
|
|
corresponding to the selected eigenvalues, with the i-th |
|
1992
|
|
|
|
|
|
|
column of z holding the eigenvector associated with w(i). |
|
1993
|
|
|
|
|
|
|
If an eigenvector fails to converge, then that column of z |
|
1994
|
|
|
|
|
|
|
contains the latest approximation to the eigenvector, and the |
|
1995
|
|
|
|
|
|
|
index of the eigenvector is returned in ifail. |
|
1996
|
|
|
|
|
|
|
If jobz = 0, then z is not referenced. |
|
1997
|
|
|
|
|
|
|
Note: the user must ensure that at least max(1,m) columns are |
|
1998
|
|
|
|
|
|
|
supplied in the array z; if range = 1, the exact value of m |
|
1999
|
|
|
|
|
|
|
is not known in advance and an upper bound must be used. |
|
2000
|
|
|
|
|
|
|
|
|
2001
|
|
|
|
|
|
|
ifail: If jobz = 1, then if info = 0, the first m elements of |
|
2002
|
|
|
|
|
|
|
ifail are zero. If info > 0, then ifail contains the |
|
2003
|
|
|
|
|
|
|
indices of the eigenvectors that failed to converge. |
|
2004
|
|
|
|
|
|
|
If jobz = 0, then ifail is not referenced. |
|
2005
|
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2007
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2008
|
|
|
|
|
|
|
> 0: if info = i, then i eigenvectors failed to converge. |
|
2009
|
|
|
|
|
|
|
Their indices are stored in array ifail. |
|
2010
|
|
|
|
|
|
|
|
|
2011
|
|
|
|
|
|
|
=for example |
|
2012
|
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
2014
|
|
|
|
|
|
|
$a = random (5,5); |
|
2015
|
|
|
|
|
|
|
$unfl = lamch(1); |
|
2016
|
|
|
|
|
|
|
$ovfl = lamch(9); |
|
2017
|
|
|
|
|
|
|
labad($unfl, $ovfl); |
|
2018
|
|
|
|
|
|
|
$abstol = $unfl + $unfl; |
|
2019
|
|
|
|
|
|
|
$m = null; |
|
2020
|
|
|
|
|
|
|
$info = null; |
|
2021
|
|
|
|
|
|
|
$ifail = zeroes(5); |
|
2022
|
|
|
|
|
|
|
$w = zeroes(5); |
|
2023
|
|
|
|
|
|
|
$z = zeroes(5,5); |
|
2024
|
|
|
|
|
|
|
syevx($a, 1,0,1,0,0,0,0,$abstol, $m, $w, $z ,$ifail, $info); |
|
2025
|
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
|
|
2027
|
|
|
|
|
|
|
|
|
2028
|
|
|
|
|
|
|
=for bad |
|
2029
|
|
|
|
|
|
|
|
|
2030
|
|
|
|
|
|
|
syevx ignores the bad-value flag of the input piddles. |
|
2031
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2032
|
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
|
|
2034
|
|
|
|
|
|
|
=cut |
|
2035
|
|
|
|
|
|
|
|
|
2036
|
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
|
|
2038
|
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
|
|
2040
|
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
*syevx = \&PDL::syevx; |
|
2042
|
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
|
|
2045
|
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
=head2 syevr |
|
2048
|
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
=for sig |
|
2050
|
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int jobz(); int range(); int uplo(); [phys]vl(); [phys]vu(); int [phys]il(); int [phys]iu();[phys]abstol();int [o,phys]m();[o,phys]w(n); [o,phys]z(p,q);int [o,phys]isuppz(r); int [o,phys]info()) |
|
2052
|
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
|
|
2055
|
|
|
|
|
|
|
=for ref |
|
2056
|
|
|
|
|
|
|
|
|
2057
|
|
|
|
|
|
|
Computes selected eigenvalues and, optionally, eigenvectors |
|
2058
|
|
|
|
|
|
|
of a real symmetric matrix T. Eigenvalues and eigenvectors can be |
|
2059
|
|
|
|
|
|
|
selected by specifying either a range of values or a range of |
|
2060
|
|
|
|
|
|
|
indices for the desired eigenvalues. |
|
2061
|
|
|
|
|
|
|
|
|
2062
|
|
|
|
|
|
|
Whenever possible, syevr calls stegr to compute the |
|
2063
|
|
|
|
|
|
|
eigenspectrum using Relatively Robust Representations. stegr |
|
2064
|
|
|
|
|
|
|
computes eigenvalues by the dqds algorithm, while orthogonal |
|
2065
|
|
|
|
|
|
|
eigenvectors are computed from various "good" L D L^T representations |
|
2066
|
|
|
|
|
|
|
(also known as Relatively Robust Representations). Gram-Schmidt |
|
2067
|
|
|
|
|
|
|
orthogonalization is avoided as far as possible. More specifically, |
|
2068
|
|
|
|
|
|
|
the various steps of the algorithm are as follows. For the i-th |
|
2069
|
|
|
|
|
|
|
unreduced block of T, |
|
2070
|
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
(a) Compute T - sigma_i = L_i D_i L_i^T, such that L_i D_i L_i^T |
|
2072
|
|
|
|
|
|
|
is a relatively robust representation, |
|
2073
|
|
|
|
|
|
|
(b) Compute the eigenvalues, lambda_j, of L_i D_i L_i^T to high |
|
2074
|
|
|
|
|
|
|
relative accuracy by the dqds algorithm, |
|
2075
|
|
|
|
|
|
|
(c) If there is a cluster of close eigenvalues, "choose" sigma_i |
|
2076
|
|
|
|
|
|
|
close to the cluster, and go to step (a), |
|
2077
|
|
|
|
|
|
|
(d) Given the approximate eigenvalue lambda_j of L_i D_i L_i^T, |
|
2078
|
|
|
|
|
|
|
compute the corresponding eigenvector by forming a |
|
2079
|
|
|
|
|
|
|
rank-revealing twisted factorization. |
|
2080
|
|
|
|
|
|
|
|
|
2081
|
|
|
|
|
|
|
The desired accuracy of the output can be specified by the input |
|
2082
|
|
|
|
|
|
|
parameter abstol. |
|
2083
|
|
|
|
|
|
|
|
|
2084
|
|
|
|
|
|
|
For more details, see "A new O(n^2) algorithm for the symmetric |
|
2085
|
|
|
|
|
|
|
tridiagonal eigenvalue/eigenvector problem", by Inderjit Dhillon, |
|
2086
|
|
|
|
|
|
|
Computer Science Division Technical Report No. UCB//CSD-97-971, |
|
2087
|
|
|
|
|
|
|
UC Berkeley, May 1997. |
|
2088
|
|
|
|
|
|
|
|
|
2089
|
|
|
|
|
|
|
|
|
2090
|
|
|
|
|
|
|
Note 1 : syevr calls stegr when the full spectrum is requested |
|
2091
|
|
|
|
|
|
|
on machines which conform to the ieee-754 floating point standard. |
|
2092
|
|
|
|
|
|
|
syevr calls stebz and stein on non-ieee machines and |
|
2093
|
|
|
|
|
|
|
when partial spectrum requests are made. |
|
2094
|
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
Normal execution of stegr may create NaNs and infinities and |
|
2096
|
|
|
|
|
|
|
hence may abort due to a floating point exception in environments |
|
2097
|
|
|
|
|
|
|
which do not handle NaNs and infinities in the ieee standard default |
|
2098
|
|
|
|
|
|
|
manner. |
|
2099
|
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
Arguments |
|
2101
|
|
|
|
|
|
|
========= |
|
2102
|
|
|
|
|
|
|
|
|
2103
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
2104
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
2105
|
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
range: = 0: all eigenvalues will be found. |
|
2107
|
|
|
|
|
|
|
= 1: all eigenvalues in the half-open interval (vl,vu] |
|
2108
|
|
|
|
|
|
|
will be found. |
|
2109
|
|
|
|
|
|
|
= 2: the il-th through iu-th eigenvalues will be found. |
|
2110
|
|
|
|
|
|
|
********* For range = 1 or 2 and iu - il < N - 1, stebz and |
|
2111
|
|
|
|
|
|
|
********* stein are called |
|
2112
|
|
|
|
|
|
|
|
|
2113
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
2114
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
2115
|
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
2117
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
2118
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
2119
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
2120
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
2121
|
|
|
|
|
|
|
On exit, the lower triangle (if uplo=1) or the upper |
|
2122
|
|
|
|
|
|
|
triangle (if uplo=0) of A, including the diagonal, is |
|
2123
|
|
|
|
|
|
|
destroyed. |
|
2124
|
|
|
|
|
|
|
|
|
2125
|
|
|
|
|
|
|
vl: |
|
2126
|
|
|
|
|
|
|
vu: If range=1, the lower and upper bounds of the interval to |
|
2127
|
|
|
|
|
|
|
be searched for eigenvalues. vl < vu. |
|
2128
|
|
|
|
|
|
|
Not referenced if range = 0 or 2. |
|
2129
|
|
|
|
|
|
|
|
|
2130
|
|
|
|
|
|
|
il: |
|
2131
|
|
|
|
|
|
|
iu: If range=2, the indices (in ascending order) of the |
|
2132
|
|
|
|
|
|
|
smallest and largest eigenvalues to be returned. |
|
2133
|
|
|
|
|
|
|
1 <= il <= iu <= N, if N > 0; il = 1 and iu = 0 if N = 0. |
|
2134
|
|
|
|
|
|
|
Not referenced if range = 0 or 1. |
|
2135
|
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
abstol: The absolute error tolerance for the eigenvalues. |
|
2137
|
|
|
|
|
|
|
An approximate eigenvalue is accepted as converged |
|
2138
|
|
|
|
|
|
|
when it is determined to lie in an interval [a,b] |
|
2139
|
|
|
|
|
|
|
of width less than or equal to |
|
2140
|
|
|
|
|
|
|
|
|
2141
|
|
|
|
|
|
|
abstol + EPS * max( |a|,|b| ) , |
|
2142
|
|
|
|
|
|
|
|
|
2143
|
|
|
|
|
|
|
where EPS is the machine precision. If abstol is less than |
|
2144
|
|
|
|
|
|
|
or equal to zero, then EPS*|T| will be used in its place, |
|
2145
|
|
|
|
|
|
|
where |T| is the 1-norm of the tridiagonal matrix obtained |
|
2146
|
|
|
|
|
|
|
by reducing A to tridiagonal form. |
|
2147
|
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
See "Computing Small Singular Values of Bidiagonal Matrices |
|
2149
|
|
|
|
|
|
|
with Guaranteed High Relative Accuracy," by Demmel and |
|
2150
|
|
|
|
|
|
|
Kahan, LAPACK Working Note #3. |
|
2151
|
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
If high relative accuracy is important, set abstol to |
|
2153
|
|
|
|
|
|
|
lamch(1). Doing so will guarantee that |
|
2154
|
|
|
|
|
|
|
eigenvalues are computed to high relative accuracy when |
|
2155
|
|
|
|
|
|
|
possible in future releases. The current code does not |
|
2156
|
|
|
|
|
|
|
make any guarantees about high relative accuracy, but |
|
2157
|
|
|
|
|
|
|
furure releases will. See J. Barlow and J. Demmel, |
|
2158
|
|
|
|
|
|
|
"Computing Accurate Eigensystems of Scaled Diagonally |
|
2159
|
|
|
|
|
|
|
Dominant Matrices", LAPACK Working Note #7, for a discussion |
|
2160
|
|
|
|
|
|
|
of which matrices define their eigenvalues to high relative |
|
2161
|
|
|
|
|
|
|
accuracy. |
|
2162
|
|
|
|
|
|
|
|
|
2163
|
|
|
|
|
|
|
m: The total number of eigenvalues found. 0 <= m <= N. |
|
2164
|
|
|
|
|
|
|
If range = 0, m = N, and if range = 2, m = iu-il+1. |
|
2165
|
|
|
|
|
|
|
|
|
2166
|
|
|
|
|
|
|
w: The first m elements contain the selected eigenvalues in |
|
2167
|
|
|
|
|
|
|
ascending order. |
|
2168
|
|
|
|
|
|
|
|
|
2169
|
|
|
|
|
|
|
z: If jobz = 1, then if info = 0, the first m columns of z |
|
2170
|
|
|
|
|
|
|
contain the orthonormal eigenvectors of the matrix A |
|
2171
|
|
|
|
|
|
|
corresponding to the selected eigenvalues, with the i-th |
|
2172
|
|
|
|
|
|
|
column of z holding the eigenvector associated with w(i). |
|
2173
|
|
|
|
|
|
|
If jobz = 0, then z is not referenced. |
|
2174
|
|
|
|
|
|
|
Note: the user must ensure that at least max(1,m) columns are |
|
2175
|
|
|
|
|
|
|
supplied in the array z; if range = 1, the exact value of m |
|
2176
|
|
|
|
|
|
|
is not known in advance and an upper bound must be used. |
|
2177
|
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
isuppz: array of int, dimension ( 2*max(1,m) ) |
|
2179
|
|
|
|
|
|
|
The support of the eigenvectors in z, i.e., the indices |
|
2180
|
|
|
|
|
|
|
indicating the nonzero elements in z. The i-th eigenvector |
|
2181
|
|
|
|
|
|
|
is nonzero only in elements isuppz( 2*i-1 ) through |
|
2182
|
|
|
|
|
|
|
isuppz( 2*i ). |
|
2183
|
|
|
|
|
|
|
********* Implemented only for range = 0 or 2 and iu - il = N - 1 |
|
2184
|
|
|
|
|
|
|
|
|
2185
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2186
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2187
|
|
|
|
|
|
|
> 0: Internal error |
|
2188
|
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
=for example |
|
2190
|
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
2192
|
|
|
|
|
|
|
$a = random (5,5); |
|
2193
|
|
|
|
|
|
|
$unfl = lamch(1); |
|
2194
|
|
|
|
|
|
|
$ovfl = lamch(9); |
|
2195
|
|
|
|
|
|
|
labad($unfl, $ovfl); |
|
2196
|
|
|
|
|
|
|
$abstol = $unfl + $unfl; |
|
2197
|
|
|
|
|
|
|
$m = null; |
|
2198
|
|
|
|
|
|
|
$info = null; |
|
2199
|
|
|
|
|
|
|
$isuppz = zeroes(10); |
|
2200
|
|
|
|
|
|
|
$w = zeroes(5); |
|
2201
|
|
|
|
|
|
|
$z = zeroes(5,5); |
|
2202
|
|
|
|
|
|
|
syevr($a, 1,0,1,0,0,0,0,$abstol, $m, $w, $z ,$isuppz, $info); |
|
2203
|
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
|
|
2205
|
|
|
|
|
|
|
|
|
2206
|
|
|
|
|
|
|
=for bad |
|
2207
|
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
syevr ignores the bad-value flag of the input piddles. |
|
2209
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2210
|
|
|
|
|
|
|
|
|
2211
|
|
|
|
|
|
|
|
|
2212
|
|
|
|
|
|
|
=cut |
|
2213
|
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
|
|
2215
|
|
|
|
|
|
|
|
|
2216
|
|
|
|
|
|
|
|
|
2217
|
|
|
|
|
|
|
|
|
2218
|
|
|
|
|
|
|
|
|
2219
|
|
|
|
|
|
|
*syevr = \&PDL::syevr; |
|
2220
|
|
|
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
|
|
2223
|
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
|
|
2225
|
|
|
|
|
|
|
=head2 sygv |
|
2226
|
|
|
|
|
|
|
|
|
2227
|
|
|
|
|
|
|
=for sig |
|
2228
|
|
|
|
|
|
|
|
|
2229
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n);int [phys]itype();int jobz(); int uplo();[io,phys]B(n,n);[o,phys]w(n); int [o,phys]info()) |
|
2230
|
|
|
|
|
|
|
|
|
2231
|
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
|
|
2233
|
|
|
|
|
|
|
=for ref |
|
2234
|
|
|
|
|
|
|
|
|
2235
|
|
|
|
|
|
|
Computes all the eigenvalues, and optionally, the eigenvectors |
|
2236
|
|
|
|
|
|
|
of a real generalized symmetric-definite eigenproblem, of the form |
|
2237
|
|
|
|
|
|
|
A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. |
|
2238
|
|
|
|
|
|
|
Here A and B are assumed to be symmetric and B is also |
|
2239
|
|
|
|
|
|
|
positive definite. |
|
2240
|
|
|
|
|
|
|
|
|
2241
|
|
|
|
|
|
|
Arguments |
|
2242
|
|
|
|
|
|
|
========= |
|
2243
|
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
itype: Specifies the problem type to be solved: |
|
2245
|
|
|
|
|
|
|
= 1: A*x = (lambda)*B*x |
|
2246
|
|
|
|
|
|
|
= 2: A*B*x = (lambda)*x |
|
2247
|
|
|
|
|
|
|
= 3: B*A*x = (lambda)*x |
|
2248
|
|
|
|
|
|
|
|
|
2249
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
2250
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
2251
|
|
|
|
|
|
|
|
|
2252
|
|
|
|
|
|
|
uplo: = 0: Upper triangles of A and B are stored; |
|
2253
|
|
|
|
|
|
|
= 1: Lower triangles of A and B are stored. |
|
2254
|
|
|
|
|
|
|
|
|
2255
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
2256
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
2257
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
2258
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
2259
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
2260
|
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
On exit, if jobz = 1, then if info = 0, A contains the |
|
2262
|
|
|
|
|
|
|
matrix Z of eigenvectors. The eigenvectors are normalized |
|
2263
|
|
|
|
|
|
|
as follows: |
|
2264
|
|
|
|
|
|
|
if itype = 1 or 2, Z'*B*Z = I; |
|
2265
|
|
|
|
|
|
|
if itype = 3, Z'*inv(B)*Z = I. |
|
2266
|
|
|
|
|
|
|
If jobz = 0, then on exit the upper triangle (if uplo=0) |
|
2267
|
|
|
|
|
|
|
or the lower triangle (if uplo=1) of A, including the |
|
2268
|
|
|
|
|
|
|
diagonal, is destroyed. |
|
2269
|
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
B: On entry, the symmetric positive definite matrix B. |
|
2271
|
|
|
|
|
|
|
If uplo = 0, the leading N-by-N upper triangular part of B |
|
2272
|
|
|
|
|
|
|
contains the upper triangular part of the matrix B. |
|
2273
|
|
|
|
|
|
|
If uplo = 1, the leading N-by-N lower triangular part of B |
|
2274
|
|
|
|
|
|
|
contains the lower triangular part of the matrix B. |
|
2275
|
|
|
|
|
|
|
|
|
2276
|
|
|
|
|
|
|
On exit, if info <= N, the part of B containing the matrix is |
|
2277
|
|
|
|
|
|
|
overwritten by the triangular factor U or L from the Cholesky |
|
2278
|
|
|
|
|
|
|
factorization B = U'*U or B = L*L'. |
|
2279
|
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
W: If info = 0, the eigenvalues in ascending order. |
|
2281
|
|
|
|
|
|
|
|
|
2282
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2283
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2284
|
|
|
|
|
|
|
> 0: potrf or syev returned an error code: |
|
2285
|
|
|
|
|
|
|
<= N: if info = i, syev failed to converge; |
|
2286
|
|
|
|
|
|
|
i off-diagonal elements of an intermediate |
|
2287
|
|
|
|
|
|
|
tridiagonal form did not converge to zero; |
|
2288
|
|
|
|
|
|
|
> N: if info = N + i, for 1 <= i <= N, then the leading |
|
2289
|
|
|
|
|
|
|
minor of order i of B is not positive definite. |
|
2290
|
|
|
|
|
|
|
The factorization of B could not be completed and |
|
2291
|
|
|
|
|
|
|
no eigenvalues or eigenvectors were computed. |
|
2292
|
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
=for example |
|
2294
|
|
|
|
|
|
|
|
|
2295
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
2296
|
|
|
|
|
|
|
$a = random (5,5); |
|
2297
|
|
|
|
|
|
|
# Assume $a is symmetric and positive definite ;) |
|
2298
|
|
|
|
|
|
|
$b = random (5,5); |
|
2299
|
|
|
|
|
|
|
sygv($a, 1,1, 0, $b, (my $w = zeroes(5)), (my $info=null)); |
|
2300
|
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
|
|
2303
|
|
|
|
|
|
|
=for bad |
|
2304
|
|
|
|
|
|
|
|
|
2305
|
|
|
|
|
|
|
sygv ignores the bad-value flag of the input piddles. |
|
2306
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2307
|
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
=cut |
|
2310
|
|
|
|
|
|
|
|
|
2311
|
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
|
|
2313
|
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
|
|
2315
|
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
*sygv = \&PDL::sygv; |
|
2317
|
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
|
|
2319
|
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
|
|
2321
|
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
=head2 sygvd |
|
2323
|
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
=for sig |
|
2325
|
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n);int [phys]itype();int jobz(); int uplo();[io,phys]B(n,n);[o,phys]w(n); int [o,phys]info()) |
|
2327
|
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
|
|
2329
|
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
=for ref |
|
2331
|
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
Computes all the eigenvalues, and optionally, the eigenvectors |
|
2333
|
|
|
|
|
|
|
of a real generalized symmetric-definite eigenproblem, of the form |
|
2334
|
|
|
|
|
|
|
A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. |
|
2335
|
|
|
|
|
|
|
Here A and B are assumed to be symmetric and B is also |
|
2336
|
|
|
|
|
|
|
positive definite. |
|
2337
|
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
The divide and conquer algorithm makes very mild assumptions about |
|
2339
|
|
|
|
|
|
|
floating point arithmetic. It will work on machines with a guard |
|
2340
|
|
|
|
|
|
|
digit in add/subtract, or on those binary machines without guard |
|
2341
|
|
|
|
|
|
|
digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or |
|
2342
|
|
|
|
|
|
|
Cray-2. It could conceivably fail on hexadecimal or decimal machines |
|
2343
|
|
|
|
|
|
|
without guard digits, but we know of none. |
|
2344
|
|
|
|
|
|
|
|
|
2345
|
|
|
|
|
|
|
Arguments |
|
2346
|
|
|
|
|
|
|
========= |
|
2347
|
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
itype: Specifies the problem type to be solved: |
|
2349
|
|
|
|
|
|
|
= 1: A*x = (lambda)*B*x |
|
2350
|
|
|
|
|
|
|
= 2: A*B*x = (lambda)*x |
|
2351
|
|
|
|
|
|
|
= 3: B*A*x = (lambda)*x |
|
2352
|
|
|
|
|
|
|
|
|
2353
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
2354
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
2355
|
|
|
|
|
|
|
|
|
2356
|
|
|
|
|
|
|
uplo: = 0: Upper triangles of A and B are stored; |
|
2357
|
|
|
|
|
|
|
= 1: Lower triangles of A and B are stored. |
|
2358
|
|
|
|
|
|
|
|
|
2359
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
2360
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
2361
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
2362
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
2363
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
2364
|
|
|
|
|
|
|
|
|
2365
|
|
|
|
|
|
|
On exit, if jobz = 1, then if info = 0, A contains the |
|
2366
|
|
|
|
|
|
|
matrix Z of eigenvectors. The eigenvectors are normalized |
|
2367
|
|
|
|
|
|
|
as follows: |
|
2368
|
|
|
|
|
|
|
if itype = 1 or 2, Z'*B*Z = I; |
|
2369
|
|
|
|
|
|
|
if itype = 3, Z'*inv(B)*Z = I. |
|
2370
|
|
|
|
|
|
|
If jobz = 0, then on exit the upper triangle (if uplo=0) |
|
2371
|
|
|
|
|
|
|
or the lower triangle (if uplo=1) of A, including the |
|
2372
|
|
|
|
|
|
|
diagonal, is destroyed. |
|
2373
|
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
B: On entry, the symmetric positive definite matrix B. |
|
2375
|
|
|
|
|
|
|
If uplo = 0, the leading N-by-N upper triangular part of B |
|
2376
|
|
|
|
|
|
|
contains the upper triangular part of the matrix B. |
|
2377
|
|
|
|
|
|
|
If uplo = 1, the leading N-by-N lower triangular part of B |
|
2378
|
|
|
|
|
|
|
contains the lower triangular part of the matrix B. |
|
2379
|
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
On exit, if info <= N, the part of B containing the matrix is |
|
2381
|
|
|
|
|
|
|
overwritten by the triangular factor U or L from the Cholesky |
|
2382
|
|
|
|
|
|
|
factorization B = U'*U or B = L*L'. |
|
2383
|
|
|
|
|
|
|
|
|
2384
|
|
|
|
|
|
|
W: If info = 0, the eigenvalues in ascending order. |
|
2385
|
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2387
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2388
|
|
|
|
|
|
|
> 0: potrf or syev returned an error code: |
|
2389
|
|
|
|
|
|
|
<= N: if info = i, syevd failed to converge; |
|
2390
|
|
|
|
|
|
|
i off-diagonal elements of an intermediate |
|
2391
|
|
|
|
|
|
|
tridiagonal form did not converge to zero; |
|
2392
|
|
|
|
|
|
|
> N: if info = N + i, for 1 <= i <= N, then the leading |
|
2393
|
|
|
|
|
|
|
minor of order i of B is not positive definite. |
|
2394
|
|
|
|
|
|
|
The factorization of B could not be completed and |
|
2395
|
|
|
|
|
|
|
no eigenvalues or eigenvectors were computed. |
|
2396
|
|
|
|
|
|
|
|
|
2397
|
|
|
|
|
|
|
=for example |
|
2398
|
|
|
|
|
|
|
|
|
2399
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
2400
|
|
|
|
|
|
|
$a = random (5,5); |
|
2401
|
|
|
|
|
|
|
# Assume $b is symmetric positive definite ;) |
|
2402
|
|
|
|
|
|
|
$b = random (5,5); |
|
2403
|
|
|
|
|
|
|
sygvd($a, 1,1, 0, $b, (my $w = zeroes(5)), (my $info=null)); |
|
2404
|
|
|
|
|
|
|
|
|
2405
|
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
|
|
2407
|
|
|
|
|
|
|
=for bad |
|
2408
|
|
|
|
|
|
|
|
|
2409
|
|
|
|
|
|
|
sygvd ignores the bad-value flag of the input piddles. |
|
2410
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2411
|
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
|
|
2413
|
|
|
|
|
|
|
=cut |
|
2414
|
|
|
|
|
|
|
|
|
2415
|
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
|
|
2417
|
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
|
|
2419
|
|
|
|
|
|
|
|
|
2420
|
|
|
|
|
|
|
*sygvd = \&PDL::sygvd; |
|
2421
|
|
|
|
|
|
|
|
|
2422
|
|
|
|
|
|
|
|
|
2423
|
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
|
|
2425
|
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
=head2 sygvx |
|
2427
|
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
=for sig |
|
2429
|
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n);int [phys]itype();int jobz();int range(); int uplo();[io,phys]B(n,n);[phys]vl();[phys]vu();int [phys]il();int [phys]iu();[phys]abstol();int [o,phys]m();[o,phys]w(n); [o,phys]Z(p,q);int [o,phys]ifail(r);int [o,phys]info()) |
|
2431
|
|
|
|
|
|
|
|
|
2432
|
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
=for ref |
|
2435
|
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
Computes selected eigenvalues, and optionally, eigenvectors |
|
2437
|
|
|
|
|
|
|
of a real generalized symmetric-definite eigenproblem, of the form |
|
2438
|
|
|
|
|
|
|
A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A |
|
2439
|
|
|
|
|
|
|
and B are assumed to be symmetric and B is also positive definite. |
|
2440
|
|
|
|
|
|
|
Eigenvalues and eigenvectors can be selected by specifying either a |
|
2441
|
|
|
|
|
|
|
range of values or a range of indices for the desired eigenvalues. |
|
2442
|
|
|
|
|
|
|
|
|
2443
|
|
|
|
|
|
|
Arguments |
|
2444
|
|
|
|
|
|
|
========= |
|
2445
|
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
itype: Specifies the problem type to be solved: |
|
2447
|
|
|
|
|
|
|
= 1: A*x = (lambda)*B*x |
|
2448
|
|
|
|
|
|
|
= 2: A*B*x = (lambda)*x |
|
2449
|
|
|
|
|
|
|
= 3: B*A*x = (lambda)*x |
|
2450
|
|
|
|
|
|
|
|
|
2451
|
|
|
|
|
|
|
jobz: = 0: Compute eigenvalues only; |
|
2452
|
|
|
|
|
|
|
= 1: Compute eigenvalues and eigenvectors. |
|
2453
|
|
|
|
|
|
|
|
|
2454
|
|
|
|
|
|
|
range: = 0: all eigenvalues will be found. |
|
2455
|
|
|
|
|
|
|
= 1: all eigenvalues in the half-open interval (vl,vu] |
|
2456
|
|
|
|
|
|
|
will be found. |
|
2457
|
|
|
|
|
|
|
= 2: the il-th through iu-th eigenvalues will be found. |
|
2458
|
|
|
|
|
|
|
|
|
2459
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A and B are stored; |
|
2460
|
|
|
|
|
|
|
= 1: Lower triangle of A and B are stored. |
|
2461
|
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the |
|
2463
|
|
|
|
|
|
|
leading N-by-N upper triangular part of A contains the |
|
2464
|
|
|
|
|
|
|
upper triangular part of the matrix A. If uplo = 1, |
|
2465
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of A contains |
|
2466
|
|
|
|
|
|
|
the lower triangular part of the matrix A. |
|
2467
|
|
|
|
|
|
|
|
|
2468
|
|
|
|
|
|
|
On exit, the lower triangle (if uplo=1) or the upper |
|
2469
|
|
|
|
|
|
|
triangle (if uplo=0) of A, including the diagonal, is |
|
2470
|
|
|
|
|
|
|
destroyed. |
|
2471
|
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
B: On entry, the symmetric matrix B. If uplo = 0, the |
|
2473
|
|
|
|
|
|
|
leading N-by-N upper triangular part of B contains the |
|
2474
|
|
|
|
|
|
|
upper triangular part of the matrix B. If uplo = 1, |
|
2475
|
|
|
|
|
|
|
the leading N-by-N lower triangular part of B contains |
|
2476
|
|
|
|
|
|
|
the lower triangular part of the matrix B. |
|
2477
|
|
|
|
|
|
|
|
|
2478
|
|
|
|
|
|
|
On exit, if info <= N, the part of B containing the matrix is |
|
2479
|
|
|
|
|
|
|
overwritten by the triangular factor U or L from the Cholesky |
|
2480
|
|
|
|
|
|
|
factorization B = U'*U or B = L*L'. |
|
2481
|
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
vl: |
|
2483
|
|
|
|
|
|
|
vu: If range=1, the lower and upper bounds of the interval to |
|
2484
|
|
|
|
|
|
|
be searched for eigenvalues. vl < vu. |
|
2485
|
|
|
|
|
|
|
Not referenced if range = 0 or 2. |
|
2486
|
|
|
|
|
|
|
|
|
2487
|
|
|
|
|
|
|
il: |
|
2488
|
|
|
|
|
|
|
iu: If range=2, the indices (in ascending order) of the |
|
2489
|
|
|
|
|
|
|
smallest and largest eigenvalues to be returned. |
|
2490
|
|
|
|
|
|
|
1 <= il <= iu <= N, if N > 0; il = 1 and iu = 0 if N = 0. |
|
2491
|
|
|
|
|
|
|
Not referenced if range = 0 or 1. |
|
2492
|
|
|
|
|
|
|
|
|
2493
|
|
|
|
|
|
|
abstol: The absolute error tolerance for the eigenvalues. |
|
2494
|
|
|
|
|
|
|
An approximate eigenvalue is accepted as converged |
|
2495
|
|
|
|
|
|
|
when it is determined to lie in an interval [a,b] |
|
2496
|
|
|
|
|
|
|
of width less than or equal to |
|
2497
|
|
|
|
|
|
|
|
|
2498
|
|
|
|
|
|
|
abstol + EPS * max( |a|,|b| ) , |
|
2499
|
|
|
|
|
|
|
|
|
2500
|
|
|
|
|
|
|
where EPS is the machine precision. If abstol is less than |
|
2501
|
|
|
|
|
|
|
or equal to zero, then EPS*|T| will be used in its place, |
|
2502
|
|
|
|
|
|
|
where |T| is the 1-norm of the tridiagonal matrix obtained |
|
2503
|
|
|
|
|
|
|
by reducing A to tridiagonal form. |
|
2504
|
|
|
|
|
|
|
|
|
2505
|
|
|
|
|
|
|
Eigenvalues will be computed most accurately when abstol is |
|
2506
|
|
|
|
|
|
|
set to twice the underflow threshold 2*lamch(1), not zero. |
|
2507
|
|
|
|
|
|
|
If this routine returns with info>0, indicating that some |
|
2508
|
|
|
|
|
|
|
eigenvectors did not converge, try setting abstol to |
|
2509
|
|
|
|
|
|
|
2* lamch(1). |
|
2510
|
|
|
|
|
|
|
|
|
2511
|
|
|
|
|
|
|
m: The total number of eigenvalues found. 0 <= m <= N. |
|
2512
|
|
|
|
|
|
|
If range = 0, m = N, and if range = 2, m = iu-il+1. |
|
2513
|
|
|
|
|
|
|
|
|
2514
|
|
|
|
|
|
|
w: On normal exit, the first m elements contain the selected |
|
2515
|
|
|
|
|
|
|
eigenvalues in ascending order. |
|
2516
|
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
Z: If jobz = 0, then Z is not referenced. |
|
2518
|
|
|
|
|
|
|
If jobz = 1, then if info = 0, the first m columns of Z |
|
2519
|
|
|
|
|
|
|
contain the orthonormal eigenvectors of the matrix A |
|
2520
|
|
|
|
|
|
|
corresponding to the selected eigenvalues, with the i-th |
|
2521
|
|
|
|
|
|
|
column of Z holding the eigenvector associated with w(i). |
|
2522
|
|
|
|
|
|
|
The eigenvectors are normalized as follows: |
|
2523
|
|
|
|
|
|
|
if itype = 1 or 2, Z'*B*Z = I; |
|
2524
|
|
|
|
|
|
|
if itype = 3, Z'*inv(B)*Z = I. |
|
2525
|
|
|
|
|
|
|
|
|
2526
|
|
|
|
|
|
|
If an eigenvector fails to converge, then that column of Z |
|
2527
|
|
|
|
|
|
|
contains the latest approximation to the eigenvector, and the |
|
2528
|
|
|
|
|
|
|
index of the eigenvector is returned in ifail. |
|
2529
|
|
|
|
|
|
|
Note: the user must ensure that at least max(1,m) columns are |
|
2530
|
|
|
|
|
|
|
supplied in the array Z; if range = 1, the exact value of m |
|
2531
|
|
|
|
|
|
|
is not known in advance and an upper bound must be used. |
|
2532
|
|
|
|
|
|
|
|
|
2533
|
|
|
|
|
|
|
ifail: If jobz = 1, then if info = 0, the first M elements of |
|
2534
|
|
|
|
|
|
|
ifail are zero. If info > 0, then ifail contains the |
|
2535
|
|
|
|
|
|
|
indices of the eigenvectors that failed to converge. |
|
2536
|
|
|
|
|
|
|
If jobz = 0, then ifail is not referenced. |
|
2537
|
|
|
|
|
|
|
|
|
2538
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2539
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2540
|
|
|
|
|
|
|
> 0: potrf or syevx returned an error code: |
|
2541
|
|
|
|
|
|
|
<= N: if info = i, syevx failed to converge; |
|
2542
|
|
|
|
|
|
|
i eigenvectors failed to converge. Their indices |
|
2543
|
|
|
|
|
|
|
are stored in array ifail. |
|
2544
|
|
|
|
|
|
|
> N: if info = N + i, for 1 <= i <= N, then the leading |
|
2545
|
|
|
|
|
|
|
minor of order i of B is not positive definite. |
|
2546
|
|
|
|
|
|
|
The factorization of B could not be completed and |
|
2547
|
|
|
|
|
|
|
no eigenvalues or eigenvectors were computed. |
|
2548
|
|
|
|
|
|
|
|
|
2549
|
|
|
|
|
|
|
=for example |
|
2550
|
|
|
|
|
|
|
|
|
2551
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
2552
|
|
|
|
|
|
|
$a = random (5,5); |
|
2553
|
|
|
|
|
|
|
# Assume $b is symmetric positive definite ;) |
|
2554
|
|
|
|
|
|
|
$b = random (5,5); |
|
2555
|
|
|
|
|
|
|
$unfl = lamch(1); |
|
2556
|
|
|
|
|
|
|
$ovfl = lamch(9); |
|
2557
|
|
|
|
|
|
|
labad($unfl, $ovfl); |
|
2558
|
|
|
|
|
|
|
$abstol = $unfl + $unfl; |
|
2559
|
|
|
|
|
|
|
$m = null; |
|
2560
|
|
|
|
|
|
|
$w=zeroes(5); |
|
2561
|
|
|
|
|
|
|
$z = zeroes(5,5); |
|
2562
|
|
|
|
|
|
|
$ifail = zeroes(5); |
|
2563
|
|
|
|
|
|
|
sygvx($a, 1,1, 0,0, $b, 0, 0, 0, 0, $abstol, $m, $w, $z,$ifail,(my $info=null)); |
|
2564
|
|
|
|
|
|
|
|
|
2565
|
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
|
|
2567
|
|
|
|
|
|
|
=for bad |
|
2568
|
|
|
|
|
|
|
|
|
2569
|
|
|
|
|
|
|
sygvx ignores the bad-value flag of the input piddles. |
|
2570
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2571
|
|
|
|
|
|
|
|
|
2572
|
|
|
|
|
|
|
|
|
2573
|
|
|
|
|
|
|
=cut |
|
2574
|
|
|
|
|
|
|
|
|
2575
|
|
|
|
|
|
|
|
|
2576
|
|
|
|
|
|
|
|
|
2577
|
|
|
|
|
|
|
|
|
2578
|
|
|
|
|
|
|
|
|
2579
|
|
|
|
|
|
|
|
|
2580
|
|
|
|
|
|
|
*sygvx = \&PDL::sygvx; |
|
2581
|
|
|
|
|
|
|
|
|
2582
|
|
|
|
|
|
|
|
|
2583
|
|
|
|
|
|
|
|
|
2584
|
|
|
|
|
|
|
|
|
2585
|
|
|
|
|
|
|
|
|
2586
|
|
|
|
|
|
|
=head2 gesv |
|
2587
|
|
|
|
|
|
|
|
|
2588
|
|
|
|
|
|
|
=for sig |
|
2589
|
|
|
|
|
|
|
|
|
2590
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); [io,phys]B(n,m); int [o,phys]ipiv(n); int [o,phys]info()) |
|
2591
|
|
|
|
|
|
|
|
|
2592
|
|
|
|
|
|
|
|
|
2593
|
|
|
|
|
|
|
|
|
2594
|
|
|
|
|
|
|
=for ref |
|
2595
|
|
|
|
|
|
|
|
|
2596
|
|
|
|
|
|
|
Computes the solution to a real system of linear equations |
|
2597
|
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
A * X = B, |
|
2599
|
|
|
|
|
|
|
where A is an N-by-N matrix and X and B are N-by-NRHS matrices. |
|
2600
|
|
|
|
|
|
|
|
|
2601
|
|
|
|
|
|
|
The LU decomposition with partial pivoting and row interchanges is |
|
2602
|
|
|
|
|
|
|
used to factor A as |
|
2603
|
|
|
|
|
|
|
|
|
2604
|
|
|
|
|
|
|
A = P * L * U, |
|
2605
|
|
|
|
|
|
|
where P is a permutation matrix, L is unit lower triangular, and U is |
|
2606
|
|
|
|
|
|
|
upper triangular. |
|
2607
|
|
|
|
|
|
|
|
|
2608
|
|
|
|
|
|
|
The factored form of A is then used to solve the |
|
2609
|
|
|
|
|
|
|
system of equations A * X = B. |
|
2610
|
|
|
|
|
|
|
|
|
2611
|
|
|
|
|
|
|
Arguments |
|
2612
|
|
|
|
|
|
|
========= |
|
2613
|
|
|
|
|
|
|
|
|
2614
|
|
|
|
|
|
|
A: On entry, the N-by-N coefficient matrix A. |
|
2615
|
|
|
|
|
|
|
On exit, the factors L and U from the factorization |
|
2616
|
|
|
|
|
|
|
A = P*L*U; the unit diagonal elements of L are not stored. |
|
2617
|
|
|
|
|
|
|
|
|
2618
|
|
|
|
|
|
|
ipiv: The pivot indices that define the permutation matrix P; |
|
2619
|
|
|
|
|
|
|
row i of the matrix was interchanged with row ipiv(i). |
|
2620
|
|
|
|
|
|
|
|
|
2621
|
|
|
|
|
|
|
B: On entry, the N-by-NRHS matrix of right hand side matrix B. |
|
2622
|
|
|
|
|
|
|
On exit, if info = 0, the N-by-NRHS solution matrix X. |
|
2623
|
|
|
|
|
|
|
|
|
2624
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2625
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2626
|
|
|
|
|
|
|
> 0: if info = i, U(i,i) is exactly zero. The factorization |
|
2627
|
|
|
|
|
|
|
has been completed, but the factor U is exactly |
|
2628
|
|
|
|
|
|
|
singular, so the solution could not be computed. |
|
2629
|
|
|
|
|
|
|
|
|
2630
|
|
|
|
|
|
|
=for example |
|
2631
|
|
|
|
|
|
|
|
|
2632
|
|
|
|
|
|
|
$a = random (5,5); |
|
2633
|
|
|
|
|
|
|
$a = transpose($a); |
|
2634
|
|
|
|
|
|
|
$b = random (5,5); |
|
2635
|
|
|
|
|
|
|
$b = transpose($b); |
|
2636
|
|
|
|
|
|
|
gesv($a,$b, (my $ipiv=zeroes(5)),(my $info=null)); |
|
2637
|
|
|
|
|
|
|
print "The solution matrix X is :". transpose($b)."\n" unless $info; |
|
2638
|
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
|
|
2640
|
|
|
|
|
|
|
|
|
2641
|
|
|
|
|
|
|
=for bad |
|
2642
|
|
|
|
|
|
|
|
|
2643
|
|
|
|
|
|
|
gesv ignores the bad-value flag of the input piddles. |
|
2644
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2645
|
|
|
|
|
|
|
|
|
2646
|
|
|
|
|
|
|
|
|
2647
|
|
|
|
|
|
|
=cut |
|
2648
|
|
|
|
|
|
|
|
|
2649
|
|
|
|
|
|
|
|
|
2650
|
|
|
|
|
|
|
|
|
2651
|
|
|
|
|
|
|
|
|
2652
|
|
|
|
|
|
|
|
|
2653
|
|
|
|
|
|
|
|
|
2654
|
|
|
|
|
|
|
*gesv = \&PDL::gesv; |
|
2655
|
|
|
|
|
|
|
|
|
2656
|
|
|
|
|
|
|
|
|
2657
|
|
|
|
|
|
|
|
|
2658
|
|
|
|
|
|
|
|
|
2659
|
|
|
|
|
|
|
|
|
2660
|
|
|
|
|
|
|
=head2 gesvx |
|
2661
|
|
|
|
|
|
|
|
|
2662
|
|
|
|
|
|
|
=for sig |
|
2663
|
|
|
|
|
|
|
|
|
2664
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int trans(); int fact(); [io,phys]B(n,m); [io,phys]af(n,n); int [io,phys]ipiv(n); int [io]equed(); [io,phys]r(n); [io,phys]c(n); [o,phys]X(n,m); [o,phys]rcond(); [o,phys]ferr(m); [o,phys]berr(m);[o,phys]rpvgrw();int [o,phys]info()) |
|
2665
|
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
|
|
2667
|
|
|
|
|
|
|
|
|
2668
|
|
|
|
|
|
|
=for ref |
|
2669
|
|
|
|
|
|
|
|
|
2670
|
|
|
|
|
|
|
Uses the LU factorization to compute the solution to a real |
|
2671
|
|
|
|
|
|
|
system of linear equations |
|
2672
|
|
|
|
|
|
|
|
|
2673
|
|
|
|
|
|
|
A * X = B, |
|
2674
|
|
|
|
|
|
|
where A is an N-by-N matrix and X and B are N-by-NRHS matrices. |
|
2675
|
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
Error bounds on the solution and a condition estimate are also |
|
2677
|
|
|
|
|
|
|
provided. |
|
2678
|
|
|
|
|
|
|
|
|
2679
|
|
|
|
|
|
|
=for desc |
|
2680
|
|
|
|
|
|
|
|
|
2681
|
|
|
|
|
|
|
The following steps are performed: |
|
2682
|
|
|
|
|
|
|
|
|
2683
|
|
|
|
|
|
|
=over 3 |
|
2684
|
|
|
|
|
|
|
|
|
2685
|
|
|
|
|
|
|
=item 1 |
|
2686
|
|
|
|
|
|
|
|
|
2687
|
|
|
|
|
|
|
If fact = 2, real scaling factors are computed to equilibrate |
|
2688
|
|
|
|
|
|
|
the system: |
|
2689
|
|
|
|
|
|
|
|
|
2690
|
|
|
|
|
|
|
trans = 0: diag(r)*A*diag(c) *inv(diag(c))*X = diag(c)*B |
|
2691
|
|
|
|
|
|
|
trans = 1: (diag(r)*A*diag(c))' *inv(diag(r))*X = diag(c)*B |
|
2692
|
|
|
|
|
|
|
trans = 2: (diag(r)*A*diag(c))**H *inv(diag(r))*X = diag(c)*B |
|
2693
|
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
Whether or not the system will be equilibrated depends on the |
|
2695
|
|
|
|
|
|
|
scaling of the matrix A, but if equilibration is used, A is |
|
2696
|
|
|
|
|
|
|
overwritten by diag(r)*A*diag(c) and B by diag(r)*B (if trans=0) |
|
2697
|
|
|
|
|
|
|
or diag(c)*B (if trans = 1 or 2). |
|
2698
|
|
|
|
|
|
|
|
|
2699
|
|
|
|
|
|
|
=item 2 |
|
2700
|
|
|
|
|
|
|
|
|
2701
|
|
|
|
|
|
|
If fact = 1 or 2, the LU decomposition is used to factor the |
|
2702
|
|
|
|
|
|
|
matrix A (after equilibration if fact = 2) as |
|
2703
|
|
|
|
|
|
|
|
|
2704
|
|
|
|
|
|
|
A = P * L * U, |
|
2705
|
|
|
|
|
|
|
where P is a permutation matrix, L is a unit lower triangular |
|
2706
|
|
|
|
|
|
|
matrix, and U is upper triangular. |
|
2707
|
|
|
|
|
|
|
|
|
2708
|
|
|
|
|
|
|
=item 3 |
|
2709
|
|
|
|
|
|
|
|
|
2710
|
|
|
|
|
|
|
If some U(i,i)=0, so that U is exactly singular, then the routine |
|
2711
|
|
|
|
|
|
|
returns with info = i. Otherwise, the factored form of A is used |
|
2712
|
|
|
|
|
|
|
to estimate the condition number of the matrix A. If the |
|
2713
|
|
|
|
|
|
|
reciprocal of the condition number is less than machine precision, |
|
2714
|
|
|
|
|
|
|
info = N+1 is returned as a warning, but the routine still goes on |
|
2715
|
|
|
|
|
|
|
to solve for X and compute error bounds as described below. |
|
2716
|
|
|
|
|
|
|
|
|
2717
|
|
|
|
|
|
|
=item 4 |
|
2718
|
|
|
|
|
|
|
|
|
2719
|
|
|
|
|
|
|
The system of equations is solved for X using the factored form |
|
2720
|
|
|
|
|
|
|
of A. |
|
2721
|
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
=item 5 |
|
2723
|
|
|
|
|
|
|
|
|
2724
|
|
|
|
|
|
|
Iterative refinement is applied to improve the computed solution |
|
2725
|
|
|
|
|
|
|
matrix and calculate error bounds and backward error estimates |
|
2726
|
|
|
|
|
|
|
for it. |
|
2727
|
|
|
|
|
|
|
|
|
2728
|
|
|
|
|
|
|
=item 6 |
|
2729
|
|
|
|
|
|
|
|
|
2730
|
|
|
|
|
|
|
If equilibration was used, the matrix X is premultiplied by |
|
2731
|
|
|
|
|
|
|
diag(c) (if trans = 0) or diag(r) (if trans = 1 or 2) so |
|
2732
|
|
|
|
|
|
|
that it solves the original system before equilibration. |
|
2733
|
|
|
|
|
|
|
|
|
2734
|
|
|
|
|
|
|
=back |
|
2735
|
|
|
|
|
|
|
|
|
2736
|
|
|
|
|
|
|
|
|
2737
|
|
|
|
|
|
|
Arguments |
|
2738
|
|
|
|
|
|
|
========= |
|
2739
|
|
|
|
|
|
|
|
|
2740
|
|
|
|
|
|
|
fact: Specifies whether or not the factored form of the matrix A is |
|
2741
|
|
|
|
|
|
|
supplied on entry, and if not, whether the matrix A should be |
|
2742
|
|
|
|
|
|
|
equilibrated before it is factored. |
|
2743
|
|
|
|
|
|
|
= 0: On entry, af and ipiv contain the factored form of A. |
|
2744
|
|
|
|
|
|
|
If equed is not 0, the matrix A has been |
|
2745
|
|
|
|
|
|
|
equilibrated with scaling factors given by r and c. |
|
2746
|
|
|
|
|
|
|
A, af, and ipiv are not modified. |
|
2747
|
|
|
|
|
|
|
= 1: The matrix A will be copied to af and factored. |
|
2748
|
|
|
|
|
|
|
= 2: The matrix A will be equilibrated if necessary, then |
|
2749
|
|
|
|
|
|
|
copied to af and factored. |
|
2750
|
|
|
|
|
|
|
|
|
2751
|
|
|
|
|
|
|
trans: Specifies the form of the system of equations: |
|
2752
|
|
|
|
|
|
|
= 0: A * X = B (No transpose) |
|
2753
|
|
|
|
|
|
|
= 1: A' * X = B (Transpose) |
|
2754
|
|
|
|
|
|
|
= 2: A**H * X = B (Transpose) |
|
2755
|
|
|
|
|
|
|
|
|
2756
|
|
|
|
|
|
|
A: On entry, the N-by-N matrix A. If fact = 0 and equed is |
|
2757
|
|
|
|
|
|
|
not 0, then A must have been equilibrated by the scaling |
|
2758
|
|
|
|
|
|
|
factors in r and/or c. A is not modified if fact = 0 or |
|
2759
|
|
|
|
|
|
|
1, or if fact = 2 and equed = 0 on exit. |
|
2760
|
|
|
|
|
|
|
|
|
2761
|
|
|
|
|
|
|
On exit, if equed != 0, A is scaled as follows: |
|
2762
|
|
|
|
|
|
|
equed = 1: A := diag(r) * A |
|
2763
|
|
|
|
|
|
|
equed = 2: A := A * diag(c) |
|
2764
|
|
|
|
|
|
|
equed = 3: A := diag(r) * A * diag(c). |
|
2765
|
|
|
|
|
|
|
|
|
2766
|
|
|
|
|
|
|
af: If fact = 0, then af is an input argument and on entry |
|
2767
|
|
|
|
|
|
|
contains the factors L and U from the factorization |
|
2768
|
|
|
|
|
|
|
A = P*L*U as computed by getrf. If equed != 0, then |
|
2769
|
|
|
|
|
|
|
af is the factored form of the equilibrated matrix A. |
|
2770
|
|
|
|
|
|
|
|
|
2771
|
|
|
|
|
|
|
If fact = 1, then af is an output argument and on exit |
|
2772
|
|
|
|
|
|
|
returns the factors L and U from the factorization A = P*L*U |
|
2773
|
|
|
|
|
|
|
of the original matrix A. |
|
2774
|
|
|
|
|
|
|
|
|
2775
|
|
|
|
|
|
|
If fact = 2, then af is an output argument and on exit |
|
2776
|
|
|
|
|
|
|
returns the factors L and U from the factorization A = P*L*U |
|
2777
|
|
|
|
|
|
|
of the equilibrated matrix A (see the description of A for |
|
2778
|
|
|
|
|
|
|
the form of the equilibrated matrix). |
|
2779
|
|
|
|
|
|
|
|
|
2780
|
|
|
|
|
|
|
|
|
2781
|
|
|
|
|
|
|
ipiv: If fact = 0, then ipiv is an input argument and on entry |
|
2782
|
|
|
|
|
|
|
contains the pivot indices from the factorization A = P*L*U |
|
2783
|
|
|
|
|
|
|
as computed by getrf; row i of the matrix was interchanged |
|
2784
|
|
|
|
|
|
|
with row ipiv(i). |
|
2785
|
|
|
|
|
|
|
|
|
2786
|
|
|
|
|
|
|
If fact = 1, then ipiv is an output argument and on exit |
|
2787
|
|
|
|
|
|
|
contains the pivot indices from the factorization A = P*L*U |
|
2788
|
|
|
|
|
|
|
of the original matrix A. |
|
2789
|
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
If fact = 2, then ipiv is an output argument and on exit |
|
2791
|
|
|
|
|
|
|
contains the pivot indices from the factorization A = P*L*U |
|
2792
|
|
|
|
|
|
|
of the equilibrated matrix A. |
|
2793
|
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
equed: Specifies the form of equilibration that was done. |
|
2795
|
|
|
|
|
|
|
= 0: No equilibration (always true if fact = 1). |
|
2796
|
|
|
|
|
|
|
= 1: Row equilibration, i.e., A has been premultiplied by |
|
2797
|
|
|
|
|
|
|
diag(r). |
|
2798
|
|
|
|
|
|
|
= 2: Column equilibration, i.e., A has been postmultiplied |
|
2799
|
|
|
|
|
|
|
by diag(c). |
|
2800
|
|
|
|
|
|
|
= 3: Both row and column equilibration, i.e., A has been |
|
2801
|
|
|
|
|
|
|
replaced by diag(r) * A * diag(c). |
|
2802
|
|
|
|
|
|
|
equed is an input argument if fact = 0; otherwise, it is an |
|
2803
|
|
|
|
|
|
|
output argument. |
|
2804
|
|
|
|
|
|
|
|
|
2805
|
|
|
|
|
|
|
r: The row scale factors for A. If equed = 1 or 3, A is |
|
2806
|
|
|
|
|
|
|
multiplied on the left by diag(r); if equed = 0 or 2, r |
|
2807
|
|
|
|
|
|
|
is not accessed. r is an input argument if fact = 0; |
|
2808
|
|
|
|
|
|
|
otherwise, r is an output argument. If fact = 0 and |
|
2809
|
|
|
|
|
|
|
equed = 1 or 3, each element of r must be positive. |
|
2810
|
|
|
|
|
|
|
|
|
2811
|
|
|
|
|
|
|
c: The column scale factors for A. If equed = 2 or 3, A is |
|
2812
|
|
|
|
|
|
|
multiplied on the right by diag(c); if equed = 0 or 1, c |
|
2813
|
|
|
|
|
|
|
is not accessed. c is an input argument if fact = 0; |
|
2814
|
|
|
|
|
|
|
otherwise, c is an output argument. If fact = 0 and |
|
2815
|
|
|
|
|
|
|
equed = 2 or 3, each element of c must be positive. |
|
2816
|
|
|
|
|
|
|
|
|
2817
|
|
|
|
|
|
|
B: On entry, the N-by-NRHS right hand side matrix B. |
|
2818
|
|
|
|
|
|
|
On exit, |
|
2819
|
|
|
|
|
|
|
if equed = 0, B is not modified; |
|
2820
|
|
|
|
|
|
|
if trans = 0 and equed = 1 or 3, B is overwritten by |
|
2821
|
|
|
|
|
|
|
diag(r)*B; |
|
2822
|
|
|
|
|
|
|
if trans = 1 or 2 and equed = 2 or 3, B is |
|
2823
|
|
|
|
|
|
|
overwritten by diag(c)*B. |
|
2824
|
|
|
|
|
|
|
|
|
2825
|
|
|
|
|
|
|
X: If info = 0 or info = N+1, the N-by-NRHS solution matrix X |
|
2826
|
|
|
|
|
|
|
to the original system of equations. Note that A and B are |
|
2827
|
|
|
|
|
|
|
modified on exit if equed != 0, and the solution to the |
|
2828
|
|
|
|
|
|
|
equilibrated system is inv(diag(c))*X if trans = 0 and |
|
2829
|
|
|
|
|
|
|
equed = 2 or 3, or inv(diag(r))*X if trans = 1 or 2 |
|
2830
|
|
|
|
|
|
|
and equed = 1 or 3. |
|
2831
|
|
|
|
|
|
|
|
|
2832
|
|
|
|
|
|
|
rcond: The estimate of the reciprocal condition number of the matrix |
|
2833
|
|
|
|
|
|
|
A after equilibration (if done). If rcond is less than the |
|
2834
|
|
|
|
|
|
|
machine precision (in particular, if rcond = 0), the matrix |
|
2835
|
|
|
|
|
|
|
is singular to working precision. This condition is |
|
2836
|
|
|
|
|
|
|
indicated by a return code of info > 0. |
|
2837
|
|
|
|
|
|
|
|
|
2838
|
|
|
|
|
|
|
ferr: The estimated forward error bound for each solution vector |
|
2839
|
|
|
|
|
|
|
X(j) (the j-th column of the solution matrix X). |
|
2840
|
|
|
|
|
|
|
If XTRUE is the true solution corresponding to X(j), ferr(j) |
|
2841
|
|
|
|
|
|
|
is an estimated upper bound for the magnitude of the largest |
|
2842
|
|
|
|
|
|
|
element in (X(j) - XTRUE) divided by the magnitude of the |
|
2843
|
|
|
|
|
|
|
largest element in X(j). The estimate is as reliable as |
|
2844
|
|
|
|
|
|
|
the estimate for rcond, and is almost always a slight |
|
2845
|
|
|
|
|
|
|
overestimate of the true error. |
|
2846
|
|
|
|
|
|
|
|
|
2847
|
|
|
|
|
|
|
berr: The componentwise relative backward error of each solution |
|
2848
|
|
|
|
|
|
|
vector X(j) (i.e., the smallest relative change in |
|
2849
|
|
|
|
|
|
|
any element of A or B that makes X(j) an exact solution). |
|
2850
|
|
|
|
|
|
|
|
|
2851
|
|
|
|
|
|
|
rpvgrw: Contains the reciprocal pivot growth factor norm(A)/norm(U). |
|
2852
|
|
|
|
|
|
|
The "max absolute element" norm is used. If it is much less |
|
2853
|
|
|
|
|
|
|
than 1, then the stability of the LU factorization of the |
|
2854
|
|
|
|
|
|
|
(equilibrated) matrix A could be poor. This also means that |
|
2855
|
|
|
|
|
|
|
the solution X, condition estimator rcond, and forward error |
|
2856
|
|
|
|
|
|
|
bound ferr could be unreliable. If factorization fails with |
|
2857
|
|
|
|
|
|
|
0
|
|
2858
|
|
|
|
|
|
|
for the leading info columns of A. |
|
2859
|
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2861
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2862
|
|
|
|
|
|
|
> 0: if info = i, and i is |
|
2863
|
|
|
|
|
|
|
<= N: U(i,i) is exactly zero. The factorization has |
|
2864
|
|
|
|
|
|
|
been completed, but the factor U is exactly |
|
2865
|
|
|
|
|
|
|
singular, so the solution and error bounds |
|
2866
|
|
|
|
|
|
|
could not be computed. rcond = 0 is returned. |
|
2867
|
|
|
|
|
|
|
= N+1: U is nonsingular, but rcond is less than machine |
|
2868
|
|
|
|
|
|
|
precision, meaning that the matrix is singular |
|
2869
|
|
|
|
|
|
|
to working precision. Nevertheless, the |
|
2870
|
|
|
|
|
|
|
solution and error bounds are computed because |
|
2871
|
|
|
|
|
|
|
there are a number of situations where the |
|
2872
|
|
|
|
|
|
|
computed solution can be more accurate than the |
|
2873
|
|
|
|
|
|
|
value of rcond would suggest. |
|
2874
|
|
|
|
|
|
|
|
|
2875
|
|
|
|
|
|
|
=for example |
|
2876
|
|
|
|
|
|
|
|
|
2877
|
|
|
|
|
|
|
$a= random(5,5); |
|
2878
|
|
|
|
|
|
|
$b = random(5,5); |
|
2879
|
|
|
|
|
|
|
$a = transpose($a); |
|
2880
|
|
|
|
|
|
|
$b = transpose($b); |
|
2881
|
|
|
|
|
|
|
$rcond = pdl(0); |
|
2882
|
|
|
|
|
|
|
$rpvgrw = pdl(0); |
|
2883
|
|
|
|
|
|
|
$equed = pdl(long,0); |
|
2884
|
|
|
|
|
|
|
$info = pdl(long,0); |
|
2885
|
|
|
|
|
|
|
$berr = zeroes(5); |
|
2886
|
|
|
|
|
|
|
$ipiv = zeroes(5); |
|
2887
|
|
|
|
|
|
|
$ferr = zeroes(5); |
|
2888
|
|
|
|
|
|
|
$r = zeroes(5); |
|
2889
|
|
|
|
|
|
|
$c = zeroes(5); |
|
2890
|
|
|
|
|
|
|
$X = zeroes(5,5); |
|
2891
|
|
|
|
|
|
|
$af = zeroes(5,5); |
|
2892
|
|
|
|
|
|
|
gesvx($a,0, 2, $b, $af, $ipiv, $equed, $r, $c, $X, $rcond, $ferr, $berr, $rpvgrw, $info); |
|
2893
|
|
|
|
|
|
|
print "The solution matrix X is :". transpose($X)."\n" unless $info; |
|
2894
|
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
|
|
2896
|
|
|
|
|
|
|
|
|
2897
|
|
|
|
|
|
|
=for bad |
|
2898
|
|
|
|
|
|
|
|
|
2899
|
|
|
|
|
|
|
gesvx ignores the bad-value flag of the input piddles. |
|
2900
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2901
|
|
|
|
|
|
|
|
|
2902
|
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
=cut |
|
2904
|
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
|
|
2906
|
|
|
|
|
|
|
|
|
2907
|
|
|
|
|
|
|
|
|
2908
|
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
|
|
2910
|
|
|
|
|
|
|
*gesvx = \&PDL::gesvx; |
|
2911
|
|
|
|
|
|
|
|
|
2912
|
|
|
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
|
|
2914
|
|
|
|
|
|
|
|
|
2915
|
|
|
|
|
|
|
|
|
2916
|
|
|
|
|
|
|
=head2 sysv |
|
2917
|
|
|
|
|
|
|
|
|
2918
|
|
|
|
|
|
|
=for sig |
|
2919
|
|
|
|
|
|
|
|
|
2920
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); [io,phys]B(n,m); int [o,phys]ipiv(n); int [o,phys]info()) |
|
2921
|
|
|
|
|
|
|
|
|
2922
|
|
|
|
|
|
|
|
|
2923
|
|
|
|
|
|
|
|
|
2924
|
|
|
|
|
|
|
=for ref |
|
2925
|
|
|
|
|
|
|
|
|
2926
|
|
|
|
|
|
|
Computes the solution to a real system of linear equations |
|
2927
|
|
|
|
|
|
|
|
|
2928
|
|
|
|
|
|
|
A * X = B, |
|
2929
|
|
|
|
|
|
|
where A is an N-by-N symmetric matrix and X and B are N-by-NRHS |
|
2930
|
|
|
|
|
|
|
matrices. |
|
2931
|
|
|
|
|
|
|
|
|
2932
|
|
|
|
|
|
|
The diagonal pivoting method is used to factor A as |
|
2933
|
|
|
|
|
|
|
|
|
2934
|
|
|
|
|
|
|
A = U * D * U', if uplo = 0, or |
|
2935
|
|
|
|
|
|
|
A = L * D * L', if uplo = 1, |
|
2936
|
|
|
|
|
|
|
where U (or L) is a product of permutation and unit upper (lower) |
|
2937
|
|
|
|
|
|
|
triangular matrices, and D is symmetric and block diagonal with |
|
2938
|
|
|
|
|
|
|
1-by-1 and 2-by-2 diagonal blocks. |
|
2939
|
|
|
|
|
|
|
|
|
2940
|
|
|
|
|
|
|
The factored form of A is then |
|
2941
|
|
|
|
|
|
|
used to solve the system of equations A * X = B. |
|
2942
|
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
Arguments |
|
2944
|
|
|
|
|
|
|
========= |
|
2945
|
|
|
|
|
|
|
|
|
2946
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
2947
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
2948
|
|
|
|
|
|
|
|
|
2949
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the leading |
|
2950
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
2951
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
2952
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
2953
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
2954
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
2955
|
|
|
|
|
|
|
triangular part of A is not referenced. |
|
2956
|
|
|
|
|
|
|
|
|
2957
|
|
|
|
|
|
|
On exit, if info = 0, the block diagonal matrix D and the |
|
2958
|
|
|
|
|
|
|
multipliers used to obtain the factor U or L from the |
|
2959
|
|
|
|
|
|
|
factorization A = U*D*U' or A = L*D*L' as computed by |
|
2960
|
|
|
|
|
|
|
sytrf. |
|
2961
|
|
|
|
|
|
|
|
|
2962
|
|
|
|
|
|
|
ipiv: Details of the interchanges and the block structure of D, as |
|
2963
|
|
|
|
|
|
|
determined by sytrf. If ipiv(k) > 0, then rows and columns |
|
2964
|
|
|
|
|
|
|
k and ipiv(k) were interchanged, and D(k,k) is a 1-by-1 |
|
2965
|
|
|
|
|
|
|
diagonal block. If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, |
|
2966
|
|
|
|
|
|
|
then rows and columns k-1 and -ipiv(k) were interchanged and |
|
2967
|
|
|
|
|
|
|
D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If uplo = 1 and |
|
2968
|
|
|
|
|
|
|
ipiv(k) = ipiv(k+1) < 0, then rows and columns k+1 and |
|
2969
|
|
|
|
|
|
|
-ipiv(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2 |
|
2970
|
|
|
|
|
|
|
diagonal block. |
|
2971
|
|
|
|
|
|
|
|
|
2972
|
|
|
|
|
|
|
B: On entry, the N-by-NRHS right hand side matrix B. |
|
2973
|
|
|
|
|
|
|
On exit, if info = 0, the N-by-NRHS solution matrix X. |
|
2974
|
|
|
|
|
|
|
|
|
2975
|
|
|
|
|
|
|
|
|
2976
|
|
|
|
|
|
|
info: = 0: successful exit |
|
2977
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
2978
|
|
|
|
|
|
|
> 0: if info = i, D(i,i) is exactly zero. The factorization |
|
2979
|
|
|
|
|
|
|
has been completed, but the block diagonal matrix D is |
|
2980
|
|
|
|
|
|
|
exactly singular, so the solution could not be computed. |
|
2981
|
|
|
|
|
|
|
|
|
2982
|
|
|
|
|
|
|
=for example |
|
2983
|
|
|
|
|
|
|
|
|
2984
|
|
|
|
|
|
|
# Assume $a is symmetric ;) |
|
2985
|
|
|
|
|
|
|
$a = random (5,5); |
|
2986
|
|
|
|
|
|
|
$a = transpose($a); |
|
2987
|
|
|
|
|
|
|
$b = random(4,5); |
|
2988
|
|
|
|
|
|
|
$b = transpose($b); |
|
2989
|
|
|
|
|
|
|
sysv($a, 1, $b, (my $ipiv=zeroes(5)),(my $info=null)); |
|
2990
|
|
|
|
|
|
|
print "The solution matrix X is :". transpose($b)."\n" unless $info; |
|
2991
|
|
|
|
|
|
|
|
|
2992
|
|
|
|
|
|
|
|
|
2993
|
|
|
|
|
|
|
|
|
2994
|
|
|
|
|
|
|
=for bad |
|
2995
|
|
|
|
|
|
|
|
|
2996
|
|
|
|
|
|
|
sysv ignores the bad-value flag of the input piddles. |
|
2997
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
2998
|
|
|
|
|
|
|
|
|
2999
|
|
|
|
|
|
|
|
|
3000
|
|
|
|
|
|
|
=cut |
|
3001
|
|
|
|
|
|
|
|
|
3002
|
|
|
|
|
|
|
|
|
3003
|
|
|
|
|
|
|
|
|
3004
|
|
|
|
|
|
|
|
|
3005
|
|
|
|
|
|
|
|
|
3006
|
|
|
|
|
|
|
|
|
3007
|
|
|
|
|
|
|
*sysv = \&PDL::sysv; |
|
3008
|
|
|
|
|
|
|
|
|
3009
|
|
|
|
|
|
|
|
|
3010
|
|
|
|
|
|
|
|
|
3011
|
|
|
|
|
|
|
|
|
3012
|
|
|
|
|
|
|
|
|
3013
|
|
|
|
|
|
|
=head2 sysvx |
|
3014
|
|
|
|
|
|
|
|
|
3015
|
|
|
|
|
|
|
=for sig |
|
3016
|
|
|
|
|
|
|
|
|
3017
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); int fact(); [phys]B(n,m); [io,phys]af(n,n); int [io,phys]ipiv(n); [o,phys]X(n,m); [o,phys]rcond(); [o,phys]ferr(m); [o,phys]berr(m); int [o,phys]info()) |
|
3018
|
|
|
|
|
|
|
|
|
3019
|
|
|
|
|
|
|
|
|
3020
|
|
|
|
|
|
|
|
|
3021
|
|
|
|
|
|
|
=for ref |
|
3022
|
|
|
|
|
|
|
|
|
3023
|
|
|
|
|
|
|
Uses the diagonal pivoting factorization to compute the |
|
3024
|
|
|
|
|
|
|
solution to a real system of linear equations A * X = B, |
|
3025
|
|
|
|
|
|
|
where A is an N-by-N symmetric matrix and X and B are N-by-NRHS |
|
3026
|
|
|
|
|
|
|
matrices. |
|
3027
|
|
|
|
|
|
|
|
|
3028
|
|
|
|
|
|
|
Error bounds on the solution and a condition estimate are also |
|
3029
|
|
|
|
|
|
|
provided. |
|
3030
|
|
|
|
|
|
|
|
|
3031
|
|
|
|
|
|
|
The following steps are performed: |
|
3032
|
|
|
|
|
|
|
|
|
3033
|
|
|
|
|
|
|
=over 3 |
|
3034
|
|
|
|
|
|
|
|
|
3035
|
|
|
|
|
|
|
=item 1 |
|
3036
|
|
|
|
|
|
|
|
|
3037
|
|
|
|
|
|
|
If fact = 0, the diagonal pivoting method is used to factor A. |
|
3038
|
|
|
|
|
|
|
The form of the factorization is |
|
3039
|
|
|
|
|
|
|
|
|
3040
|
|
|
|
|
|
|
A = U * D * U', if uplo = 0, or |
|
3041
|
|
|
|
|
|
|
A = L * D * L', if uplo = 1, |
|
3042
|
|
|
|
|
|
|
where U (or L) is a product of permutation and unit upper (lower) |
|
3043
|
|
|
|
|
|
|
triangular matrices, and D is symmetric and block diagonal with |
|
3044
|
|
|
|
|
|
|
1-by-1 and 2-by-2 diagonal blocks. |
|
3045
|
|
|
|
|
|
|
|
|
3046
|
|
|
|
|
|
|
|
|
3047
|
|
|
|
|
|
|
=item 2 |
|
3048
|
|
|
|
|
|
|
|
|
3049
|
|
|
|
|
|
|
If some D(i,i)=0, so that D is exactly singular, then the routine |
|
3050
|
|
|
|
|
|
|
returns with info = i. Otherwise, the factored form of A is used |
|
3051
|
|
|
|
|
|
|
to estimate the condition number of the matrix A. If the |
|
3052
|
|
|
|
|
|
|
reciprocal of the condition number is less than machine precision, |
|
3053
|
|
|
|
|
|
|
info = N+1 is returned as a warning, but the routine still goes on |
|
3054
|
|
|
|
|
|
|
to solve for X and compute error bounds as described below. |
|
3055
|
|
|
|
|
|
|
|
|
3056
|
|
|
|
|
|
|
=item 3 |
|
3057
|
|
|
|
|
|
|
|
|
3058
|
|
|
|
|
|
|
The system of equations is solved for X using the factored form |
|
3059
|
|
|
|
|
|
|
of A. |
|
3060
|
|
|
|
|
|
|
|
|
3061
|
|
|
|
|
|
|
=item 4 |
|
3062
|
|
|
|
|
|
|
|
|
3063
|
|
|
|
|
|
|
Iterative refinement is applied to improve the computed solution |
|
3064
|
|
|
|
|
|
|
matrix and calculate error bounds and backward error estimates |
|
3065
|
|
|
|
|
|
|
for it. |
|
3066
|
|
|
|
|
|
|
|
|
3067
|
|
|
|
|
|
|
=back |
|
3068
|
|
|
|
|
|
|
|
|
3069
|
|
|
|
|
|
|
|
|
3070
|
|
|
|
|
|
|
Arguments |
|
3071
|
|
|
|
|
|
|
========= |
|
3072
|
|
|
|
|
|
|
|
|
3073
|
|
|
|
|
|
|
fact: Specifies whether or not the factored form of A has been |
|
3074
|
|
|
|
|
|
|
supplied on entry. |
|
3075
|
|
|
|
|
|
|
= 0: The matrix A will be copied to af and factored. |
|
3076
|
|
|
|
|
|
|
= 1: On entry, af and ipiv contain the factored form of |
|
3077
|
|
|
|
|
|
|
A. af and ipiv will not be modified. |
|
3078
|
|
|
|
|
|
|
|
|
3079
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
3080
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
3081
|
|
|
|
|
|
|
|
|
3082
|
|
|
|
|
|
|
A: The symmetric matrix A. If uplo = 0, the leading N-by-N |
|
3083
|
|
|
|
|
|
|
upper triangular part of A contains the upper triangular part |
|
3084
|
|
|
|
|
|
|
of the matrix A, and the strictly lower triangular part of A |
|
3085
|
|
|
|
|
|
|
is not referenced. If uplo = 1, the leading N-by-N lower |
|
3086
|
|
|
|
|
|
|
triangular part of A contains the lower triangular part of |
|
3087
|
|
|
|
|
|
|
the matrix A, and the strictly upper triangular part of A is |
|
3088
|
|
|
|
|
|
|
not referenced. |
|
3089
|
|
|
|
|
|
|
|
|
3090
|
|
|
|
|
|
|
af: If fact = 1, then af is an input argument and on entry |
|
3091
|
|
|
|
|
|
|
contains the block diagonal matrix D and the multipliers used |
|
3092
|
|
|
|
|
|
|
to obtain the factor U or L from the factorization |
|
3093
|
|
|
|
|
|
|
A = U*D*U' or A = L*D*L' as computed by sytrf. |
|
3094
|
|
|
|
|
|
|
|
|
3095
|
|
|
|
|
|
|
If fact = 0, then af is an output argument and on exit |
|
3096
|
|
|
|
|
|
|
returns the block diagonal matrix D and the multipliers used |
|
3097
|
|
|
|
|
|
|
to obtain the factor U or L from the factorization |
|
3098
|
|
|
|
|
|
|
A = U*D*U' or A = L*D*L'. |
|
3099
|
|
|
|
|
|
|
|
|
3100
|
|
|
|
|
|
|
ipiv: If fact = 1, then ipiv is an input argument and on entry |
|
3101
|
|
|
|
|
|
|
contains details of the interchanges and the block structure |
|
3102
|
|
|
|
|
|
|
of D, as determined by sytrf. |
|
3103
|
|
|
|
|
|
|
If ipiv(k) > 0, then rows and columns k and ipiv(k) were |
|
3104
|
|
|
|
|
|
|
interchanged and D(k,k) is a 1-by-1 diagonal block. |
|
3105
|
|
|
|
|
|
|
If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, then rows and |
|
3106
|
|
|
|
|
|
|
columns k-1 and -ipiv(k) were interchanged and D(k-1:k,k-1:k) |
|
3107
|
|
|
|
|
|
|
is a 2-by-2 diagonal block. If uplo = 1 and ipiv(k) = |
|
3108
|
|
|
|
|
|
|
ipiv(k+1) < 0, then rows and columns k+1 and -ipiv(k) were |
|
3109
|
|
|
|
|
|
|
interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. |
|
3110
|
|
|
|
|
|
|
|
|
3111
|
|
|
|
|
|
|
If fact = 0, then ipiv is an output argument and on exit |
|
3112
|
|
|
|
|
|
|
contains details of the interchanges and the block structure |
|
3113
|
|
|
|
|
|
|
of D, as determined by sytrf. |
|
3114
|
|
|
|
|
|
|
|
|
3115
|
|
|
|
|
|
|
B: The N-by-NRHS right hand side matrix B. |
|
3116
|
|
|
|
|
|
|
|
|
3117
|
|
|
|
|
|
|
X: If info = 0 or info = N+1, the N-by-NRHS solution matrix X. |
|
3118
|
|
|
|
|
|
|
|
|
3119
|
|
|
|
|
|
|
rcond: The estimate of the reciprocal condition number of the matrix |
|
3120
|
|
|
|
|
|
|
A. If rcond is less than the machine precision (in |
|
3121
|
|
|
|
|
|
|
particular, if rcond = 0), the matrix is singular to working |
|
3122
|
|
|
|
|
|
|
precision. This condition is indicated by a return code of |
|
3123
|
|
|
|
|
|
|
info > 0. |
|
3124
|
|
|
|
|
|
|
|
|
3125
|
|
|
|
|
|
|
ferr: The estimated forward error bound for each solution vector |
|
3126
|
|
|
|
|
|
|
X(j) (the j-th column of the solution matrix X). |
|
3127
|
|
|
|
|
|
|
If XTRUE is the true solution corresponding to X(j), ferr(j) |
|
3128
|
|
|
|
|
|
|
is an estimated upper bound for the magnitude of the largest |
|
3129
|
|
|
|
|
|
|
element in (X(j) - XTRUE) divided by the magnitude of the |
|
3130
|
|
|
|
|
|
|
largest element in X(j). The estimate is as reliable as |
|
3131
|
|
|
|
|
|
|
the estimate for rcond, and is almost always a slight |
|
3132
|
|
|
|
|
|
|
overestimate of the true error. |
|
3133
|
|
|
|
|
|
|
|
|
3134
|
|
|
|
|
|
|
berr: The componentwise relative backward error of each solution |
|
3135
|
|
|
|
|
|
|
vector X(j) (i.e., the smallest relative change in |
|
3136
|
|
|
|
|
|
|
any element of A or B that makes X(j) an exact solution). |
|
3137
|
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3139
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
3140
|
|
|
|
|
|
|
> 0: if info = i, and i is |
|
3141
|
|
|
|
|
|
|
<= N: D(i,i) is exactly zero. The factorization |
|
3142
|
|
|
|
|
|
|
has been completed but the factor D is exactly |
|
3143
|
|
|
|
|
|
|
singular, so the solution and error bounds could |
|
3144
|
|
|
|
|
|
|
not be computed. rcond = 0 is returned. |
|
3145
|
|
|
|
|
|
|
= N+1: D is nonsingular, but rcond is less than machine |
|
3146
|
|
|
|
|
|
|
precision, meaning that the matrix is singular |
|
3147
|
|
|
|
|
|
|
to working precision. Nevertheless, the |
|
3148
|
|
|
|
|
|
|
solution and error bounds are computed because |
|
3149
|
|
|
|
|
|
|
there are a number of situations where the |
|
3150
|
|
|
|
|
|
|
computed solution can be more accurate than the |
|
3151
|
|
|
|
|
|
|
value of rcond would suggest. |
|
3152
|
|
|
|
|
|
|
|
|
3153
|
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
=for example |
|
3155
|
|
|
|
|
|
|
|
|
3156
|
|
|
|
|
|
|
$a= random(5,5); |
|
3157
|
|
|
|
|
|
|
$b = random(10,5); |
|
3158
|
|
|
|
|
|
|
$a = transpose($a); |
|
3159
|
|
|
|
|
|
|
$b = transpose($b); |
|
3160
|
|
|
|
|
|
|
$X = zeroes($b); |
|
3161
|
|
|
|
|
|
|
$af = zeroes($a); |
|
3162
|
|
|
|
|
|
|
$ipiv = zeroes(long, 5); |
|
3163
|
|
|
|
|
|
|
$rcond = pdl(0); |
|
3164
|
|
|
|
|
|
|
$ferr = zeroes(10); |
|
3165
|
|
|
|
|
|
|
$berr = zeroes(10); |
|
3166
|
|
|
|
|
|
|
$info = pdl(long, 0); |
|
3167
|
|
|
|
|
|
|
# Assume $a is symmetric |
|
3168
|
|
|
|
|
|
|
sysvx($a, 0, 0, $b,$af, $ipiv, $X, $rcond, $ferr, $berr,$info); |
|
3169
|
|
|
|
|
|
|
print "The solution matrix X is :". transpose($X)."\n"; |
|
3170
|
|
|
|
|
|
|
|
|
3171
|
|
|
|
|
|
|
|
|
3172
|
|
|
|
|
|
|
|
|
3173
|
|
|
|
|
|
|
=for bad |
|
3174
|
|
|
|
|
|
|
|
|
3175
|
|
|
|
|
|
|
sysvx ignores the bad-value flag of the input piddles. |
|
3176
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3177
|
|
|
|
|
|
|
|
|
3178
|
|
|
|
|
|
|
|
|
3179
|
|
|
|
|
|
|
=cut |
|
3180
|
|
|
|
|
|
|
|
|
3181
|
|
|
|
|
|
|
|
|
3182
|
|
|
|
|
|
|
|
|
3183
|
|
|
|
|
|
|
|
|
3184
|
|
|
|
|
|
|
|
|
3185
|
|
|
|
|
|
|
|
|
3186
|
|
|
|
|
|
|
*sysvx = \&PDL::sysvx; |
|
3187
|
|
|
|
|
|
|
|
|
3188
|
|
|
|
|
|
|
|
|
3189
|
|
|
|
|
|
|
|
|
3190
|
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
|
|
3192
|
|
|
|
|
|
|
=head2 posv |
|
3193
|
|
|
|
|
|
|
|
|
3194
|
|
|
|
|
|
|
=for sig |
|
3195
|
|
|
|
|
|
|
|
|
3196
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); [io,phys]B(n,m); int [o,phys]info()) |
|
3197
|
|
|
|
|
|
|
|
|
3198
|
|
|
|
|
|
|
|
|
3199
|
|
|
|
|
|
|
|
|
3200
|
|
|
|
|
|
|
=for ref |
|
3201
|
|
|
|
|
|
|
|
|
3202
|
|
|
|
|
|
|
Computes the solution to a real system of linear equations |
|
3203
|
|
|
|
|
|
|
|
|
3204
|
|
|
|
|
|
|
A * X = B, |
|
3205
|
|
|
|
|
|
|
where A is an N-by-N symmetric positive definite matrix and X and B |
|
3206
|
|
|
|
|
|
|
are N-by-NRHS matrices. |
|
3207
|
|
|
|
|
|
|
|
|
3208
|
|
|
|
|
|
|
The Cholesky decomposition is used to factor A as |
|
3209
|
|
|
|
|
|
|
|
|
3210
|
|
|
|
|
|
|
A = U'* U, if uplo = 0, or |
|
3211
|
|
|
|
|
|
|
A = L * L', if uplo = 1, |
|
3212
|
|
|
|
|
|
|
where U is an upper triangular matrix and L is a lower triangular |
|
3213
|
|
|
|
|
|
|
matrix. |
|
3214
|
|
|
|
|
|
|
|
|
3215
|
|
|
|
|
|
|
The factored form of A is then used to solve the system of |
|
3216
|
|
|
|
|
|
|
equations A * X = B. |
|
3217
|
|
|
|
|
|
|
|
|
3218
|
|
|
|
|
|
|
Arguments |
|
3219
|
|
|
|
|
|
|
========= |
|
3220
|
|
|
|
|
|
|
|
|
3221
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
3222
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
3223
|
|
|
|
|
|
|
|
|
3224
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the leading |
|
3225
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
3226
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
3227
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
3228
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
3229
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
3230
|
|
|
|
|
|
|
triangular part of A is not referenced. |
|
3231
|
|
|
|
|
|
|
|
|
3232
|
|
|
|
|
|
|
On exit, if info = 0, the factor U or L from the Cholesky |
|
3233
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L'. |
|
3234
|
|
|
|
|
|
|
|
|
3235
|
|
|
|
|
|
|
B: On entry, the N-by-NRHS right hand side matrix B. |
|
3236
|
|
|
|
|
|
|
On exit, if info = 0, the N-by-NRHS solution matrix X. |
|
3237
|
|
|
|
|
|
|
|
|
3238
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3239
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
3240
|
|
|
|
|
|
|
> 0: if info = i, the leading minor of order i of A is not |
|
3241
|
|
|
|
|
|
|
positive definite, so the factorization could not be |
|
3242
|
|
|
|
|
|
|
completed, and the solution has not been computed. |
|
3243
|
|
|
|
|
|
|
|
|
3244
|
|
|
|
|
|
|
=for example |
|
3245
|
|
|
|
|
|
|
|
|
3246
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite ;) |
|
3247
|
|
|
|
|
|
|
$a = random (5,5); |
|
3248
|
|
|
|
|
|
|
$a = transpose($a); |
|
3249
|
|
|
|
|
|
|
$b = random(4,5); |
|
3250
|
|
|
|
|
|
|
$b = transpose($b); |
|
3251
|
|
|
|
|
|
|
posv($a, 1, $b, (my $info=null)); |
|
3252
|
|
|
|
|
|
|
print "The solution matrix X is :". transpose($b)."\n" unless $info; |
|
3253
|
|
|
|
|
|
|
|
|
3254
|
|
|
|
|
|
|
|
|
3255
|
|
|
|
|
|
|
|
|
3256
|
|
|
|
|
|
|
=for bad |
|
3257
|
|
|
|
|
|
|
|
|
3258
|
|
|
|
|
|
|
posv ignores the bad-value flag of the input piddles. |
|
3259
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3260
|
|
|
|
|
|
|
|
|
3261
|
|
|
|
|
|
|
|
|
3262
|
|
|
|
|
|
|
=cut |
|
3263
|
|
|
|
|
|
|
|
|
3264
|
|
|
|
|
|
|
|
|
3265
|
|
|
|
|
|
|
|
|
3266
|
|
|
|
|
|
|
|
|
3267
|
|
|
|
|
|
|
|
|
3268
|
|
|
|
|
|
|
|
|
3269
|
|
|
|
|
|
|
*posv = \&PDL::posv; |
|
3270
|
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
|
|
3272
|
|
|
|
|
|
|
|
|
3273
|
|
|
|
|
|
|
|
|
3274
|
|
|
|
|
|
|
|
|
3275
|
|
|
|
|
|
|
=head2 posvx |
|
3276
|
|
|
|
|
|
|
|
|
3277
|
|
|
|
|
|
|
=for sig |
|
3278
|
|
|
|
|
|
|
|
|
3279
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int fact(); [io,phys]B(n,m); [io,phys]af(n,n); int [io]equed(); [io,phys]s(n); [o,phys]X(n,m); [o,phys]rcond(); [o,phys]ferr(m); [o,phys]berr(m); int [o,phys]info()) |
|
3280
|
|
|
|
|
|
|
|
|
3281
|
|
|
|
|
|
|
|
|
3282
|
|
|
|
|
|
|
|
|
3283
|
|
|
|
|
|
|
=for ref |
|
3284
|
|
|
|
|
|
|
|
|
3285
|
|
|
|
|
|
|
Uses the Cholesky factorization A = U'*U or A = L*L' to |
|
3286
|
|
|
|
|
|
|
compute the solution to a real system of linear equations |
|
3287
|
|
|
|
|
|
|
|
|
3288
|
|
|
|
|
|
|
A * X = B, |
|
3289
|
|
|
|
|
|
|
where A is an N-by-N symmetric positive definite matrix and X and B |
|
3290
|
|
|
|
|
|
|
are N-by-NRHS matrices. |
|
3291
|
|
|
|
|
|
|
|
|
3292
|
|
|
|
|
|
|
Error bounds on the solution and a condition estimate are also |
|
3293
|
|
|
|
|
|
|
provided. |
|
3294
|
|
|
|
|
|
|
|
|
3295
|
|
|
|
|
|
|
The following steps are performed: |
|
3296
|
|
|
|
|
|
|
|
|
3297
|
|
|
|
|
|
|
=over 3 |
|
3298
|
|
|
|
|
|
|
|
|
3299
|
|
|
|
|
|
|
|
|
3300
|
|
|
|
|
|
|
=item 1 |
|
3301
|
|
|
|
|
|
|
|
|
3302
|
|
|
|
|
|
|
If fact = 2, real scaling factors are computed to equilibrate |
|
3303
|
|
|
|
|
|
|
the system: |
|
3304
|
|
|
|
|
|
|
|
|
3305
|
|
|
|
|
|
|
diag(s) * A * diag(s) * inv(diag(s)) * X = diag(s) * B |
|
3306
|
|
|
|
|
|
|
|
|
3307
|
|
|
|
|
|
|
Whether or not the system will be equilibrated depends on the |
|
3308
|
|
|
|
|
|
|
scaling of the matrix A, but if equilibration is used, A is |
|
3309
|
|
|
|
|
|
|
overwritten by diag(s)*A*diag(s) and B by diag(s)*B. |
|
3310
|
|
|
|
|
|
|
|
|
3311
|
|
|
|
|
|
|
=item 2 |
|
3312
|
|
|
|
|
|
|
|
|
3313
|
|
|
|
|
|
|
If fact = 1 or 2, the Cholesky decomposition is used to |
|
3314
|
|
|
|
|
|
|
factor the matrix A (after equilibration if fact = 2) as |
|
3315
|
|
|
|
|
|
|
|
|
3316
|
|
|
|
|
|
|
A = U'* U, if uplo = 0, or |
|
3317
|
|
|
|
|
|
|
A = L * L', if uplo = 1, |
|
3318
|
|
|
|
|
|
|
where U is an upper triangular matrix and L is a lower triangular |
|
3319
|
|
|
|
|
|
|
matrix. |
|
3320
|
|
|
|
|
|
|
|
|
3321
|
|
|
|
|
|
|
=item 3 |
|
3322
|
|
|
|
|
|
|
|
|
3323
|
|
|
|
|
|
|
If the leading i-by-i principal minor is not positive definite, |
|
3324
|
|
|
|
|
|
|
then the routine returns with info = i. Otherwise, the factored |
|
3325
|
|
|
|
|
|
|
form of A is used to estimate the condition number of the matrix |
|
3326
|
|
|
|
|
|
|
A. If the reciprocal of the condition number is less than machine |
|
3327
|
|
|
|
|
|
|
precision, info = N+1 is returned as a warning, but the routine |
|
3328
|
|
|
|
|
|
|
still goes on to solve for X and compute error bounds as |
|
3329
|
|
|
|
|
|
|
described below. |
|
3330
|
|
|
|
|
|
|
|
|
3331
|
|
|
|
|
|
|
=item 4 |
|
3332
|
|
|
|
|
|
|
|
|
3333
|
|
|
|
|
|
|
The system of equations is solved for X using the factored form |
|
3334
|
|
|
|
|
|
|
of A. |
|
3335
|
|
|
|
|
|
|
|
|
3336
|
|
|
|
|
|
|
=item 5 |
|
3337
|
|
|
|
|
|
|
|
|
3338
|
|
|
|
|
|
|
Iterative refinement is applied to improve the computed solution |
|
3339
|
|
|
|
|
|
|
matrix and calculate error bounds and backward error estimates |
|
3340
|
|
|
|
|
|
|
for it. |
|
3341
|
|
|
|
|
|
|
|
|
3342
|
|
|
|
|
|
|
=item 6 |
|
3343
|
|
|
|
|
|
|
|
|
3344
|
|
|
|
|
|
|
If equilibration was used, the matrix X is premultiplied by |
|
3345
|
|
|
|
|
|
|
diag(s) so that it solves the original system before |
|
3346
|
|
|
|
|
|
|
equilibration. |
|
3347
|
|
|
|
|
|
|
|
|
3348
|
|
|
|
|
|
|
=back |
|
3349
|
|
|
|
|
|
|
|
|
3350
|
|
|
|
|
|
|
Arguments |
|
3351
|
|
|
|
|
|
|
========= |
|
3352
|
|
|
|
|
|
|
|
|
3353
|
|
|
|
|
|
|
fact: Specifies whether or not the factored form of the matrix A is |
|
3354
|
|
|
|
|
|
|
supplied on entry, and if not, whether the matrix A should be |
|
3355
|
|
|
|
|
|
|
equilibrated before it is factored. |
|
3356
|
|
|
|
|
|
|
= 0: On entry, af contains the factored form of A. |
|
3357
|
|
|
|
|
|
|
If equed = 1, the matrix A has been equilibrated |
|
3358
|
|
|
|
|
|
|
with scaling factors given by s. A and af will not |
|
3359
|
|
|
|
|
|
|
be modified. |
|
3360
|
|
|
|
|
|
|
= 1: The matrix A will be copied to af and factored. |
|
3361
|
|
|
|
|
|
|
= 2: The matrix A will be equilibrated if necessary, then |
|
3362
|
|
|
|
|
|
|
copied to af and factored. |
|
3363
|
|
|
|
|
|
|
|
|
3364
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
3365
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
3366
|
|
|
|
|
|
|
|
|
3367
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A, except if fact = 0 and |
|
3368
|
|
|
|
|
|
|
equed = 1, then A must contain the equilibrated matrix |
|
3369
|
|
|
|
|
|
|
diag(s)*A*diag(s). If uplo = 0, the leading |
|
3370
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
3371
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
3372
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
3373
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
3374
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
3375
|
|
|
|
|
|
|
triangular part of A is not referenced. A is not modified if |
|
3376
|
|
|
|
|
|
|
fact = 0 or 1, or if fact = 2 and equed = 0 on exit. |
|
3377
|
|
|
|
|
|
|
|
|
3378
|
|
|
|
|
|
|
On exit, if fact = 2 and equed = 1, A is overwritten by |
|
3379
|
|
|
|
|
|
|
diag(s)*A*diag(s). |
|
3380
|
|
|
|
|
|
|
|
|
3381
|
|
|
|
|
|
|
af: If fact = 0, then af is an input argument and on entry |
|
3382
|
|
|
|
|
|
|
contains the triangular factor U or L from the Cholesky |
|
3383
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L', in the same storage |
|
3384
|
|
|
|
|
|
|
format as A. If equed != 0, then af is the factored form |
|
3385
|
|
|
|
|
|
|
of the equilibrated matrix diag(s)*A*diag(s). |
|
3386
|
|
|
|
|
|
|
|
|
3387
|
|
|
|
|
|
|
If fact = 1, then af is an output argument and on exit |
|
3388
|
|
|
|
|
|
|
returns the triangular factor U or L from the Cholesky |
|
3389
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L' of the original |
|
3390
|
|
|
|
|
|
|
matrix A. |
|
3391
|
|
|
|
|
|
|
|
|
3392
|
|
|
|
|
|
|
If fact = 2, then af is an output argument and on exit |
|
3393
|
|
|
|
|
|
|
returns the triangular factor U or L from the Cholesky |
|
3394
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L' of the equilibrated |
|
3395
|
|
|
|
|
|
|
matrix A (see the description of A for the form of the |
|
3396
|
|
|
|
|
|
|
equilibrated matrix). |
|
3397
|
|
|
|
|
|
|
|
|
3398
|
|
|
|
|
|
|
equed: Specifies the form of equilibration that was done. |
|
3399
|
|
|
|
|
|
|
= 0: No equilibration (always true if fact = 1). |
|
3400
|
|
|
|
|
|
|
= 1: Equilibration was done, i.e., A has been replaced by |
|
3401
|
|
|
|
|
|
|
diag(s) * A * diag(s). |
|
3402
|
|
|
|
|
|
|
equed is an input argument if fact = 0; otherwise, it is an |
|
3403
|
|
|
|
|
|
|
output argument. |
|
3404
|
|
|
|
|
|
|
|
|
3405
|
|
|
|
|
|
|
s: The scale factors for A; not accessed if equed = 0. s is |
|
3406
|
|
|
|
|
|
|
an input argument if fact = 0; otherwise, s is an output |
|
3407
|
|
|
|
|
|
|
argument. If fact = 0 and equed = 1, each element of s |
|
3408
|
|
|
|
|
|
|
must be positive. |
|
3409
|
|
|
|
|
|
|
|
|
3410
|
|
|
|
|
|
|
B: On entry, the N-by-NRHS right hand side matrix B. |
|
3411
|
|
|
|
|
|
|
On exit, if equed = 0, B is not modified; if equed = 1, |
|
3412
|
|
|
|
|
|
|
B is overwritten by diag(s) * B. |
|
3413
|
|
|
|
|
|
|
|
|
3414
|
|
|
|
|
|
|
X: If info = 0 or info = N+1, the N-by-NRHS solution matrix X to |
|
3415
|
|
|
|
|
|
|
the original system of equations. Note that if equed = 1, |
|
3416
|
|
|
|
|
|
|
A and B are modified on exit, and the solution to the |
|
3417
|
|
|
|
|
|
|
equilibrated system is inv(diag(s))*X. |
|
3418
|
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
rcond: The estimate of the reciprocal condition number of the matrix |
|
3420
|
|
|
|
|
|
|
A after equilibration (if done). If rcond is less than the |
|
3421
|
|
|
|
|
|
|
machine precision (in particular, if rcond = 0), the matrix |
|
3422
|
|
|
|
|
|
|
is singular to working precision. This condition is |
|
3423
|
|
|
|
|
|
|
indicated by a return code of info > 0. |
|
3424
|
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
ferr: The estimated forward error bound for each solution vector |
|
3426
|
|
|
|
|
|
|
X(j) (the j-th column of the solution matrix X). |
|
3427
|
|
|
|
|
|
|
If XTRUE is the true solution corresponding to X(j), FERR(j) |
|
3428
|
|
|
|
|
|
|
is an estimated upper bound for the magnitude of the largest |
|
3429
|
|
|
|
|
|
|
element in (X(j) - XTRUE) divided by the magnitude of the |
|
3430
|
|
|
|
|
|
|
largest element in X(j). The estimate is as reliable as |
|
3431
|
|
|
|
|
|
|
the estimate for rcond, and is almost always a slight |
|
3432
|
|
|
|
|
|
|
overestimate of the true error. |
|
3433
|
|
|
|
|
|
|
|
|
3434
|
|
|
|
|
|
|
berr: The componentwise relative backward error of each solution |
|
3435
|
|
|
|
|
|
|
vector X(j) (i.e., the smallest relative change in |
|
3436
|
|
|
|
|
|
|
any element of A or B that makes X(j) an exact solution). |
|
3437
|
|
|
|
|
|
|
|
|
3438
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3439
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
3440
|
|
|
|
|
|
|
> 0: if info = i, and i is |
|
3441
|
|
|
|
|
|
|
<= N: the leading minor of order i of A is |
|
3442
|
|
|
|
|
|
|
not positive definite, so the factorization |
|
3443
|
|
|
|
|
|
|
could not be completed, and the solution has not |
|
3444
|
|
|
|
|
|
|
been computed. rcond = 0 is returned. |
|
3445
|
|
|
|
|
|
|
= N+1: U is nonsingular, but rcond is less than machine |
|
3446
|
|
|
|
|
|
|
precision, meaning that the matrix is singular |
|
3447
|
|
|
|
|
|
|
to working precision. Nevertheless, the |
|
3448
|
|
|
|
|
|
|
solution and error bounds are computed because |
|
3449
|
|
|
|
|
|
|
there are a number of situations where the |
|
3450
|
|
|
|
|
|
|
computed solution can be more accurate than the |
|
3451
|
|
|
|
|
|
|
value of rcond would suggest. |
|
3452
|
|
|
|
|
|
|
|
|
3453
|
|
|
|
|
|
|
|
|
3454
|
|
|
|
|
|
|
=for example |
|
3455
|
|
|
|
|
|
|
|
|
3456
|
|
|
|
|
|
|
$a= random(5,5); |
|
3457
|
|
|
|
|
|
|
$b = random(5,5); |
|
3458
|
|
|
|
|
|
|
$a = transpose($a); |
|
3459
|
|
|
|
|
|
|
$b = transpose($b); |
|
3460
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite |
|
3461
|
|
|
|
|
|
|
$rcond = pdl(0); |
|
3462
|
|
|
|
|
|
|
$equed = pdl(long,0); |
|
3463
|
|
|
|
|
|
|
$info = pdl(long,0); |
|
3464
|
|
|
|
|
|
|
$berr = zeroes(5); |
|
3465
|
|
|
|
|
|
|
$ferr = zeroes(5); |
|
3466
|
|
|
|
|
|
|
$s = zeroes(5); |
|
3467
|
|
|
|
|
|
|
$X = zeroes(5,5); |
|
3468
|
|
|
|
|
|
|
$af = zeroes(5,5); |
|
3469
|
|
|
|
|
|
|
posvx($a,0,2,$b,$af, $equed, $s, $X, $rcond, $ferr, $berr,$info); |
|
3470
|
|
|
|
|
|
|
print "The solution matrix X is :". transpose($X)."\n" unless $info; |
|
3471
|
|
|
|
|
|
|
|
|
3472
|
|
|
|
|
|
|
|
|
3473
|
|
|
|
|
|
|
|
|
3474
|
|
|
|
|
|
|
=for bad |
|
3475
|
|
|
|
|
|
|
|
|
3476
|
|
|
|
|
|
|
posvx ignores the bad-value flag of the input piddles. |
|
3477
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3478
|
|
|
|
|
|
|
|
|
3479
|
|
|
|
|
|
|
|
|
3480
|
|
|
|
|
|
|
=cut |
|
3481
|
|
|
|
|
|
|
|
|
3482
|
|
|
|
|
|
|
|
|
3483
|
|
|
|
|
|
|
|
|
3484
|
|
|
|
|
|
|
|
|
3485
|
|
|
|
|
|
|
|
|
3486
|
|
|
|
|
|
|
|
|
3487
|
|
|
|
|
|
|
*posvx = \&PDL::posvx; |
|
3488
|
|
|
|
|
|
|
|
|
3489
|
|
|
|
|
|
|
|
|
3490
|
|
|
|
|
|
|
|
|
3491
|
|
|
|
|
|
|
|
|
3492
|
|
|
|
|
|
|
|
|
3493
|
|
|
|
|
|
|
=head2 gels |
|
3494
|
|
|
|
|
|
|
|
|
3495
|
|
|
|
|
|
|
=for sig |
|
3496
|
|
|
|
|
|
|
|
|
3497
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int trans(); [io,phys]B(p,q);int [o,phys]info()) |
|
3498
|
|
|
|
|
|
|
|
|
3499
|
|
|
|
|
|
|
|
|
3500
|
|
|
|
|
|
|
|
|
3501
|
|
|
|
|
|
|
=for ref |
|
3502
|
|
|
|
|
|
|
|
|
3503
|
|
|
|
|
|
|
Solves overdetermined or underdetermined real linear systems |
|
3504
|
|
|
|
|
|
|
involving an M-by-N matrix A, or its transpose, using a QR or LQ |
|
3505
|
|
|
|
|
|
|
factorization of A. It is assumed that A has full rank. |
|
3506
|
|
|
|
|
|
|
|
|
3507
|
|
|
|
|
|
|
The following options are provided: |
|
3508
|
|
|
|
|
|
|
|
|
3509
|
|
|
|
|
|
|
=over 3 |
|
3510
|
|
|
|
|
|
|
|
|
3511
|
|
|
|
|
|
|
=item 1 |
|
3512
|
|
|
|
|
|
|
|
|
3513
|
|
|
|
|
|
|
If trans = 0 and m >= n: find the least squares solution of |
|
3514
|
|
|
|
|
|
|
an overdetermined system, i.e., solve the least squares problem |
|
3515
|
|
|
|
|
|
|
minimize || B - A*X ||. |
|
3516
|
|
|
|
|
|
|
|
|
3517
|
|
|
|
|
|
|
=item 2 |
|
3518
|
|
|
|
|
|
|
|
|
3519
|
|
|
|
|
|
|
If trans = 0 and m < n: find the minimum norm solution of |
|
3520
|
|
|
|
|
|
|
an underdetermined system A * X = B. |
|
3521
|
|
|
|
|
|
|
|
|
3522
|
|
|
|
|
|
|
=item 3 |
|
3523
|
|
|
|
|
|
|
|
|
3524
|
|
|
|
|
|
|
If trans = 1 and m >= n: find the minimum norm solution of |
|
3525
|
|
|
|
|
|
|
an undetermined system A' * X = B. |
|
3526
|
|
|
|
|
|
|
|
|
3527
|
|
|
|
|
|
|
=item 4 |
|
3528
|
|
|
|
|
|
|
|
|
3529
|
|
|
|
|
|
|
If trans = 1 and m < n: find the least squares solution of |
|
3530
|
|
|
|
|
|
|
an overdetermined system, i.e., solve the least squares problem |
|
3531
|
|
|
|
|
|
|
minimize || B - A' * X ||. |
|
3532
|
|
|
|
|
|
|
|
|
3533
|
|
|
|
|
|
|
=back |
|
3534
|
|
|
|
|
|
|
|
|
3535
|
|
|
|
|
|
|
Several right hand side vectors b and solution vectors x can be |
|
3536
|
|
|
|
|
|
|
handled in a single call; they are stored as the columns of the |
|
3537
|
|
|
|
|
|
|
M-by-NRHS right hand side matrix B and the N-by-NRHS solution |
|
3538
|
|
|
|
|
|
|
matrix X. |
|
3539
|
|
|
|
|
|
|
|
|
3540
|
|
|
|
|
|
|
Arguments |
|
3541
|
|
|
|
|
|
|
========= |
|
3542
|
|
|
|
|
|
|
|
|
3543
|
|
|
|
|
|
|
trans: = 0: the linear system involves A; |
|
3544
|
|
|
|
|
|
|
= 1: the linear system involves A'. |
|
3545
|
|
|
|
|
|
|
|
|
3546
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
3547
|
|
|
|
|
|
|
On exit, |
|
3548
|
|
|
|
|
|
|
if M >= N, A is overwritten by details of its QR |
|
3549
|
|
|
|
|
|
|
factorization as returned by geqrf; |
|
3550
|
|
|
|
|
|
|
if M < N, A is overwritten by details of its LQ |
|
3551
|
|
|
|
|
|
|
factorization as returned by gelqf. |
|
3552
|
|
|
|
|
|
|
|
|
3553
|
|
|
|
|
|
|
B: On entry, the matrix B of right hand side vectors, stored |
|
3554
|
|
|
|
|
|
|
columnwise; B is M-by-NRHS if trans = 0, or N-by-NRHS |
|
3555
|
|
|
|
|
|
|
if trans = 1. |
|
3556
|
|
|
|
|
|
|
On exit, B is overwritten by the solution vectors, stored |
|
3557
|
|
|
|
|
|
|
columnwise: |
|
3558
|
|
|
|
|
|
|
if trans = 0 and m >= n, rows 1 to n of B contain the least |
|
3559
|
|
|
|
|
|
|
squares solution vectors; the residual sum of squares for the |
|
3560
|
|
|
|
|
|
|
solution in each column is given by the sum of squares of |
|
3561
|
|
|
|
|
|
|
elements N+1 to M in that column; |
|
3562
|
|
|
|
|
|
|
if trans = 0 and m < n, rows 1 to N of B contain the |
|
3563
|
|
|
|
|
|
|
minimum norm solution vectors; |
|
3564
|
|
|
|
|
|
|
if trans = 1 and m >= n, rows 1 to M of B contain the |
|
3565
|
|
|
|
|
|
|
minimum norm solution vectors; |
|
3566
|
|
|
|
|
|
|
if trans = 1 and m < n, rows 1 to M of B contain the |
|
3567
|
|
|
|
|
|
|
least squares solution vectors; the residual sum of squares |
|
3568
|
|
|
|
|
|
|
for the solution in each column is given by the sum of |
|
3569
|
|
|
|
|
|
|
squares of elements M+1 to N in that column. |
|
3570
|
|
|
|
|
|
|
The leading dimension of the array B >= max(1,M,N). |
|
3571
|
|
|
|
|
|
|
|
|
3572
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3573
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
3574
|
|
|
|
|
|
|
|
|
3575
|
|
|
|
|
|
|
|
|
3576
|
|
|
|
|
|
|
=for example |
|
3577
|
|
|
|
|
|
|
|
|
3578
|
|
|
|
|
|
|
$a= random(7,5); |
|
3579
|
|
|
|
|
|
|
# $b will contain X |
|
3580
|
|
|
|
|
|
|
# TODO better example with slice |
|
3581
|
|
|
|
|
|
|
$b = random(7,6); |
|
3582
|
|
|
|
|
|
|
gels($a, 1, $b, ($info = null)); |
|
3583
|
|
|
|
|
|
|
|
|
3584
|
|
|
|
|
|
|
|
|
3585
|
|
|
|
|
|
|
|
|
3586
|
|
|
|
|
|
|
=for bad |
|
3587
|
|
|
|
|
|
|
|
|
3588
|
|
|
|
|
|
|
gels ignores the bad-value flag of the input piddles. |
|
3589
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3590
|
|
|
|
|
|
|
|
|
3591
|
|
|
|
|
|
|
|
|
3592
|
|
|
|
|
|
|
=cut |
|
3593
|
|
|
|
|
|
|
|
|
3594
|
|
|
|
|
|
|
|
|
3595
|
|
|
|
|
|
|
|
|
3596
|
|
|
|
|
|
|
|
|
3597
|
|
|
|
|
|
|
|
|
3598
|
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
*gels = \&PDL::gels; |
|
3600
|
|
|
|
|
|
|
|
|
3601
|
|
|
|
|
|
|
|
|
3602
|
|
|
|
|
|
|
|
|
3603
|
|
|
|
|
|
|
|
|
3604
|
|
|
|
|
|
|
|
|
3605
|
|
|
|
|
|
|
=head2 gelsy |
|
3606
|
|
|
|
|
|
|
|
|
3607
|
|
|
|
|
|
|
=for sig |
|
3608
|
|
|
|
|
|
|
|
|
3609
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [io,phys]B(p,q); [phys]rcond(); int [io,phys]jpvt(n); int [o,phys]rank();int [o,phys]info()) |
|
3610
|
|
|
|
|
|
|
|
|
3611
|
|
|
|
|
|
|
|
|
3612
|
|
|
|
|
|
|
|
|
3613
|
|
|
|
|
|
|
=for ref |
|
3614
|
|
|
|
|
|
|
|
|
3615
|
|
|
|
|
|
|
Computes the minimum-norm solution to a real linear least |
|
3616
|
|
|
|
|
|
|
squares problem: |
|
3617
|
|
|
|
|
|
|
|
|
3618
|
|
|
|
|
|
|
minimize || A * X - B || |
|
3619
|
|
|
|
|
|
|
|
|
3620
|
|
|
|
|
|
|
using a complete orthogonal factorization of A. |
|
3621
|
|
|
|
|
|
|
|
|
3622
|
|
|
|
|
|
|
A is an M-by-N matrix which may be rank-deficient. |
|
3623
|
|
|
|
|
|
|
|
|
3624
|
|
|
|
|
|
|
Several right hand side vectors b and solution vectors x can be |
|
3625
|
|
|
|
|
|
|
handled in a single call; they are stored as the columns of the |
|
3626
|
|
|
|
|
|
|
M-by-NRHS right hand side matrix B and the N-by-NRHS solution |
|
3627
|
|
|
|
|
|
|
matrix X. |
|
3628
|
|
|
|
|
|
|
|
|
3629
|
|
|
|
|
|
|
The routine first computes a QR factorization with column pivoting: |
|
3630
|
|
|
|
|
|
|
|
|
3631
|
|
|
|
|
|
|
A * P = Q * [ R11 R12 ] |
|
3632
|
|
|
|
|
|
|
[ 0 R22 ] |
|
3633
|
|
|
|
|
|
|
|
|
3634
|
|
|
|
|
|
|
with R11 defined as the largest leading submatrix whose estimated |
|
3635
|
|
|
|
|
|
|
condition number is less than 1/rcond. The order of R11, rank, |
|
3636
|
|
|
|
|
|
|
is the effective rank of A. |
|
3637
|
|
|
|
|
|
|
|
|
3638
|
|
|
|
|
|
|
Then, R22 is considered to be negligible, and R12 is annihilated |
|
3639
|
|
|
|
|
|
|
by orthogonal transformations from the right, arriving at the |
|
3640
|
|
|
|
|
|
|
complete orthogonal factorization: |
|
3641
|
|
|
|
|
|
|
|
|
3642
|
|
|
|
|
|
|
A * P = Q * [ T11 0 ] * Z |
|
3643
|
|
|
|
|
|
|
[ 0 0 ] |
|
3644
|
|
|
|
|
|
|
|
|
3645
|
|
|
|
|
|
|
The minimum-norm solution is then |
|
3646
|
|
|
|
|
|
|
|
|
3647
|
|
|
|
|
|
|
X = P * Z' [ inv(T11)*Q1'*B ] |
|
3648
|
|
|
|
|
|
|
[ 0 ] |
|
3649
|
|
|
|
|
|
|
where Q1 consists of the first rank columns of Q. |
|
3650
|
|
|
|
|
|
|
|
|
3651
|
|
|
|
|
|
|
|
|
3652
|
|
|
|
|
|
|
Arguments |
|
3653
|
|
|
|
|
|
|
========= |
|
3654
|
|
|
|
|
|
|
|
|
3655
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
3656
|
|
|
|
|
|
|
On exit, A has been overwritten by details of its |
|
3657
|
|
|
|
|
|
|
complete orthogonal factorization. |
|
3658
|
|
|
|
|
|
|
|
|
3659
|
|
|
|
|
|
|
B: On entry, the M-by-NRHS right hand side matrix B. |
|
3660
|
|
|
|
|
|
|
On exit, the N-by-NRHS solution matrix X. |
|
3661
|
|
|
|
|
|
|
The leading dimension of the array B >= max(1,M,N). |
|
3662
|
|
|
|
|
|
|
|
|
3663
|
|
|
|
|
|
|
jpvt: On entry, if jpvt(i) != 0, the i-th column of A is permuted |
|
3664
|
|
|
|
|
|
|
to the front of AP, otherwise column i is a free column. |
|
3665
|
|
|
|
|
|
|
On exit, if jpvt(i) = k, then the i-th column of AP |
|
3666
|
|
|
|
|
|
|
was the k-th column of A. |
|
3667
|
|
|
|
|
|
|
|
|
3668
|
|
|
|
|
|
|
rcond: rcond is used to determine the effective rank of A, which |
|
3669
|
|
|
|
|
|
|
is defined as the order of the largest leading triangular |
|
3670
|
|
|
|
|
|
|
submatrix R11 in the QR factorization with pivoting of A, |
|
3671
|
|
|
|
|
|
|
whose estimated condition number < 1/rcond. |
|
3672
|
|
|
|
|
|
|
|
|
3673
|
|
|
|
|
|
|
rank: The effective rank of A, i.e., the order of the submatrix |
|
3674
|
|
|
|
|
|
|
R11. This is the same as the order of the submatrix T11 |
|
3675
|
|
|
|
|
|
|
in the complete orthogonal factorization of A. |
|
3676
|
|
|
|
|
|
|
|
|
3677
|
|
|
|
|
|
|
|
|
3678
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3679
|
|
|
|
|
|
|
< 0: If info = -i, the i-th argument had an illegal value. |
|
3680
|
|
|
|
|
|
|
|
|
3681
|
|
|
|
|
|
|
|
|
3682
|
|
|
|
|
|
|
=for example |
|
3683
|
|
|
|
|
|
|
|
|
3684
|
|
|
|
|
|
|
$a= random(7,5); |
|
3685
|
|
|
|
|
|
|
# $b will contain X |
|
3686
|
|
|
|
|
|
|
# TODO better example with slice |
|
3687
|
|
|
|
|
|
|
$b = random(7,6); |
|
3688
|
|
|
|
|
|
|
$jpvt = zeroes(long, 5); |
|
3689
|
|
|
|
|
|
|
$eps = lamch(0); |
|
3690
|
|
|
|
|
|
|
#Threshold for rank estimation |
|
3691
|
|
|
|
|
|
|
$rcond = sqrt($eps) - (sqrt($eps) - $eps) / 2; |
|
3692
|
|
|
|
|
|
|
gelsy($a, $b, $rcond, $jpvt,($rank=null),($info = null)); |
|
3693
|
|
|
|
|
|
|
|
|
3694
|
|
|
|
|
|
|
|
|
3695
|
|
|
|
|
|
|
|
|
3696
|
|
|
|
|
|
|
=for bad |
|
3697
|
|
|
|
|
|
|
|
|
3698
|
|
|
|
|
|
|
gelsy ignores the bad-value flag of the input piddles. |
|
3699
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3700
|
|
|
|
|
|
|
|
|
3701
|
|
|
|
|
|
|
|
|
3702
|
|
|
|
|
|
|
=cut |
|
3703
|
|
|
|
|
|
|
|
|
3704
|
|
|
|
|
|
|
|
|
3705
|
|
|
|
|
|
|
|
|
3706
|
|
|
|
|
|
|
|
|
3707
|
|
|
|
|
|
|
|
|
3708
|
|
|
|
|
|
|
|
|
3709
|
|
|
|
|
|
|
*gelsy = \&PDL::gelsy; |
|
3710
|
|
|
|
|
|
|
|
|
3711
|
|
|
|
|
|
|
|
|
3712
|
|
|
|
|
|
|
|
|
3713
|
|
|
|
|
|
|
|
|
3714
|
|
|
|
|
|
|
|
|
3715
|
|
|
|
|
|
|
=head2 gelss |
|
3716
|
|
|
|
|
|
|
|
|
3717
|
|
|
|
|
|
|
=for sig |
|
3718
|
|
|
|
|
|
|
|
|
3719
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [io,phys]B(p,q); [phys]rcond(); [o,phys]s(r); int [o,phys]rank();int [o,phys]info()) |
|
3720
|
|
|
|
|
|
|
|
|
3721
|
|
|
|
|
|
|
|
|
3722
|
|
|
|
|
|
|
|
|
3723
|
|
|
|
|
|
|
=for ref |
|
3724
|
|
|
|
|
|
|
|
|
3725
|
|
|
|
|
|
|
Computes the minimum norm solution to a real linear least |
|
3726
|
|
|
|
|
|
|
squares problem: |
|
3727
|
|
|
|
|
|
|
|
|
3728
|
|
|
|
|
|
|
Minimize 2-norm(| b - A*x |). |
|
3729
|
|
|
|
|
|
|
|
|
3730
|
|
|
|
|
|
|
using the singular value decomposition (SVD) of A. A is an M-by-N |
|
3731
|
|
|
|
|
|
|
matrix which may be rank-deficient. |
|
3732
|
|
|
|
|
|
|
|
|
3733
|
|
|
|
|
|
|
Several right hand side vectors b and solution vectors x can be |
|
3734
|
|
|
|
|
|
|
handled in a single call; they are stored as the columns of the |
|
3735
|
|
|
|
|
|
|
M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix |
|
3736
|
|
|
|
|
|
|
X. |
|
3737
|
|
|
|
|
|
|
|
|
3738
|
|
|
|
|
|
|
The effective rank of A is determined by treating as zero those |
|
3739
|
|
|
|
|
|
|
singular values which are less than rcond times the largest singular |
|
3740
|
|
|
|
|
|
|
value. |
|
3741
|
|
|
|
|
|
|
|
|
3742
|
|
|
|
|
|
|
Arguments |
|
3743
|
|
|
|
|
|
|
========= |
|
3744
|
|
|
|
|
|
|
|
|
3745
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
3746
|
|
|
|
|
|
|
On exit, the first min(m,n) rows of A are overwritten with |
|
3747
|
|
|
|
|
|
|
its right singular vectors, stored rowwise. |
|
3748
|
|
|
|
|
|
|
|
|
3749
|
|
|
|
|
|
|
B: On entry, the M-by-NRHS right hand side matrix B. |
|
3750
|
|
|
|
|
|
|
On exit, B is overwritten by the N-by-NRHS solution |
|
3751
|
|
|
|
|
|
|
matrix X. If m >= n and rank = n, the residual |
|
3752
|
|
|
|
|
|
|
sum-of-squares for the solution in the i-th column is given |
|
3753
|
|
|
|
|
|
|
by the sum of squares of elements n+1:m in that column. |
|
3754
|
|
|
|
|
|
|
The leading dimension of the array B >= max(1,M,N). |
|
3755
|
|
|
|
|
|
|
|
|
3756
|
|
|
|
|
|
|
s: The singular values of A in decreasing order. |
|
3757
|
|
|
|
|
|
|
The condition number of A in the 2-norm = s(1)/s(min(m,n)). |
|
3758
|
|
|
|
|
|
|
|
|
3759
|
|
|
|
|
|
|
rcond: rcond is used to determine the effective rank of A. |
|
3760
|
|
|
|
|
|
|
Singular values s(i) <= rcond*s(1) are treated as zero. |
|
3761
|
|
|
|
|
|
|
If rcond < 0, machine precision is used instead. |
|
3762
|
|
|
|
|
|
|
|
|
3763
|
|
|
|
|
|
|
rank: The effective rank of A, i.e., the number of singular values |
|
3764
|
|
|
|
|
|
|
which are greater than rcond*s(1). |
|
3765
|
|
|
|
|
|
|
|
|
3766
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3767
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
3768
|
|
|
|
|
|
|
> 0: the algorithm for computing the SVD failed to converge; |
|
3769
|
|
|
|
|
|
|
if info = i, i off-diagonal elements of an intermediate |
|
3770
|
|
|
|
|
|
|
bidiagonal form did not converge to zero. |
|
3771
|
|
|
|
|
|
|
|
|
3772
|
|
|
|
|
|
|
|
|
3773
|
|
|
|
|
|
|
=for example |
|
3774
|
|
|
|
|
|
|
|
|
3775
|
|
|
|
|
|
|
$a= random(7,5); |
|
3776
|
|
|
|
|
|
|
# $b will contain X |
|
3777
|
|
|
|
|
|
|
# TODO better example with slice |
|
3778
|
|
|
|
|
|
|
$b = random(7,6); |
|
3779
|
|
|
|
|
|
|
$eps = lamch(0); |
|
3780
|
|
|
|
|
|
|
$s =zeroes(5); |
|
3781
|
|
|
|
|
|
|
#Threshold for rank estimation |
|
3782
|
|
|
|
|
|
|
$rcond = sqrt($eps) - (sqrt($eps) - $eps) / 2; |
|
3783
|
|
|
|
|
|
|
gelss($a, $b, $rcond, $s, ($rank=null),($info = null)); |
|
3784
|
|
|
|
|
|
|
|
|
3785
|
|
|
|
|
|
|
|
|
3786
|
|
|
|
|
|
|
|
|
3787
|
|
|
|
|
|
|
=for bad |
|
3788
|
|
|
|
|
|
|
|
|
3789
|
|
|
|
|
|
|
gelss ignores the bad-value flag of the input piddles. |
|
3790
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3791
|
|
|
|
|
|
|
|
|
3792
|
|
|
|
|
|
|
|
|
3793
|
|
|
|
|
|
|
=cut |
|
3794
|
|
|
|
|
|
|
|
|
3795
|
|
|
|
|
|
|
|
|
3796
|
|
|
|
|
|
|
|
|
3797
|
|
|
|
|
|
|
|
|
3798
|
|
|
|
|
|
|
|
|
3799
|
|
|
|
|
|
|
|
|
3800
|
|
|
|
|
|
|
*gelss = \&PDL::gelss; |
|
3801
|
|
|
|
|
|
|
|
|
3802
|
|
|
|
|
|
|
|
|
3803
|
|
|
|
|
|
|
|
|
3804
|
|
|
|
|
|
|
|
|
3805
|
|
|
|
|
|
|
|
|
3806
|
|
|
|
|
|
|
=head2 gelsd |
|
3807
|
|
|
|
|
|
|
|
|
3808
|
|
|
|
|
|
|
=for sig |
|
3809
|
|
|
|
|
|
|
|
|
3810
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [io,phys]B(p,q); [phys]rcond(); [o,phys]s(r); int [o,phys]rank();int [o,phys]info()) |
|
3811
|
|
|
|
|
|
|
|
|
3812
|
|
|
|
|
|
|
|
|
3813
|
|
|
|
|
|
|
|
|
3814
|
|
|
|
|
|
|
=for ref |
|
3815
|
|
|
|
|
|
|
|
|
3816
|
|
|
|
|
|
|
Computes the minimum-norm solution to a real linear least |
|
3817
|
|
|
|
|
|
|
squares problem: |
|
3818
|
|
|
|
|
|
|
|
|
3819
|
|
|
|
|
|
|
minimize 2-norm(| b - A*x |) |
|
3820
|
|
|
|
|
|
|
|
|
3821
|
|
|
|
|
|
|
using the singular value decomposition (SVD) of A. A is an M-by-N |
|
3822
|
|
|
|
|
|
|
matrix which may be rank-deficient. |
|
3823
|
|
|
|
|
|
|
|
|
3824
|
|
|
|
|
|
|
Several right hand side vectors b and solution vectors x can be |
|
3825
|
|
|
|
|
|
|
handled in a single call; they are stored as the columns of the |
|
3826
|
|
|
|
|
|
|
M-by-NRHS right hand side matrix B and the N-by-NRHS solution |
|
3827
|
|
|
|
|
|
|
matrix X. |
|
3828
|
|
|
|
|
|
|
|
|
3829
|
|
|
|
|
|
|
The problem is solved in three steps: |
|
3830
|
|
|
|
|
|
|
|
|
3831
|
|
|
|
|
|
|
=over 3 |
|
3832
|
|
|
|
|
|
|
|
|
3833
|
|
|
|
|
|
|
=item 1 |
|
3834
|
|
|
|
|
|
|
|
|
3835
|
|
|
|
|
|
|
Reduce the coefficient matrix A to bidiagonal form with |
|
3836
|
|
|
|
|
|
|
Householder transformations, reducing the original problem |
|
3837
|
|
|
|
|
|
|
into a "bidiagonal least squares problem" (BLS) |
|
3838
|
|
|
|
|
|
|
|
|
3839
|
|
|
|
|
|
|
=item 2 |
|
3840
|
|
|
|
|
|
|
|
|
3841
|
|
|
|
|
|
|
Solve the BLS using a divide and conquer approach. |
|
3842
|
|
|
|
|
|
|
|
|
3843
|
|
|
|
|
|
|
=item 3 |
|
3844
|
|
|
|
|
|
|
|
|
3845
|
|
|
|
|
|
|
Apply back all the Householder tranformations to solve |
|
3846
|
|
|
|
|
|
|
the original least squares problem. |
|
3847
|
|
|
|
|
|
|
|
|
3848
|
|
|
|
|
|
|
=back |
|
3849
|
|
|
|
|
|
|
|
|
3850
|
|
|
|
|
|
|
The effective rank of A is determined by treating as zero those |
|
3851
|
|
|
|
|
|
|
singular values which are less than rcond times the largest singular |
|
3852
|
|
|
|
|
|
|
value. |
|
3853
|
|
|
|
|
|
|
|
|
3854
|
|
|
|
|
|
|
The divide and conquer algorithm makes very mild assumptions about |
|
3855
|
|
|
|
|
|
|
floating point arithmetic. It will work on machines with a guard |
|
3856
|
|
|
|
|
|
|
digit in add/subtract, or on those binary machines without guard |
|
3857
|
|
|
|
|
|
|
digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or |
|
3858
|
|
|
|
|
|
|
Cray-2. It could conceivably fail on hexadecimal or decimal machines |
|
3859
|
|
|
|
|
|
|
without guard digits, but we know of none. |
|
3860
|
|
|
|
|
|
|
|
|
3861
|
|
|
|
|
|
|
Arguments |
|
3862
|
|
|
|
|
|
|
========= |
|
3863
|
|
|
|
|
|
|
|
|
3864
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
3865
|
|
|
|
|
|
|
On exit, A has been destroyed. |
|
3866
|
|
|
|
|
|
|
|
|
3867
|
|
|
|
|
|
|
B: On entry, the M-by-NRHS right hand side matrix B. |
|
3868
|
|
|
|
|
|
|
On exit, B is overwritten by the N-by-NRHS solution |
|
3869
|
|
|
|
|
|
|
matrix X. If m >= n and rank = n, the residual |
|
3870
|
|
|
|
|
|
|
sum-of-squares for the solution in the i-th column is given |
|
3871
|
|
|
|
|
|
|
by the sum of squares of elements n+1:m in that column. |
|
3872
|
|
|
|
|
|
|
The leading dimension of the array B >= max(1,M,N). |
|
3873
|
|
|
|
|
|
|
|
|
3874
|
|
|
|
|
|
|
s: The singular values of A in decreasing order. |
|
3875
|
|
|
|
|
|
|
The condition number of A in the 2-norm = s(1)/s(min(m,n)). |
|
3876
|
|
|
|
|
|
|
|
|
3877
|
|
|
|
|
|
|
rcond: rcond is used to determine the effective rank of A. |
|
3878
|
|
|
|
|
|
|
Singular values s(i) <= rcond*s(1) are treated as zero. |
|
3879
|
|
|
|
|
|
|
If rcond < 0, machine precision is used instead. |
|
3880
|
|
|
|
|
|
|
|
|
3881
|
|
|
|
|
|
|
rank: The effective rank of A, i.e., the number of singular values |
|
3882
|
|
|
|
|
|
|
which are greater than rcond*s(1). |
|
3883
|
|
|
|
|
|
|
|
|
3884
|
|
|
|
|
|
|
info: = 0: successful exit |
|
3885
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
3886
|
|
|
|
|
|
|
> 0: the algorithm for computing the SVD failed to converge; |
|
3887
|
|
|
|
|
|
|
if info = i, i off-diagonal elements of an intermediate |
|
3888
|
|
|
|
|
|
|
bidiagonal form did not converge to zero. |
|
3889
|
|
|
|
|
|
|
|
|
3890
|
|
|
|
|
|
|
|
|
3891
|
|
|
|
|
|
|
=for example |
|
3892
|
|
|
|
|
|
|
|
|
3893
|
|
|
|
|
|
|
$a= random(7,5); |
|
3894
|
|
|
|
|
|
|
# $b will contain X |
|
3895
|
|
|
|
|
|
|
# TODO better example with slice |
|
3896
|
|
|
|
|
|
|
$b = random(7,6); |
|
3897
|
|
|
|
|
|
|
$eps = lamch(0); |
|
3898
|
|
|
|
|
|
|
$s =zeroes(5); |
|
3899
|
|
|
|
|
|
|
#Threshold for rank estimation |
|
3900
|
|
|
|
|
|
|
$rcond = sqrt($eps) - (sqrt($eps) - $eps) / 2; |
|
3901
|
|
|
|
|
|
|
gelsd($a, $b, $rcond, $s, ($rank=null),($info = null)); |
|
3902
|
|
|
|
|
|
|
|
|
3903
|
|
|
|
|
|
|
|
|
3904
|
|
|
|
|
|
|
|
|
3905
|
|
|
|
|
|
|
=for bad |
|
3906
|
|
|
|
|
|
|
|
|
3907
|
|
|
|
|
|
|
gelsd ignores the bad-value flag of the input piddles. |
|
3908
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3909
|
|
|
|
|
|
|
|
|
3910
|
|
|
|
|
|
|
|
|
3911
|
|
|
|
|
|
|
=cut |
|
3912
|
|
|
|
|
|
|
|
|
3913
|
|
|
|
|
|
|
|
|
3914
|
|
|
|
|
|
|
|
|
3915
|
|
|
|
|
|
|
|
|
3916
|
|
|
|
|
|
|
|
|
3917
|
|
|
|
|
|
|
|
|
3918
|
|
|
|
|
|
|
*gelsd = \&PDL::gelsd; |
|
3919
|
|
|
|
|
|
|
|
|
3920
|
|
|
|
|
|
|
|
|
3921
|
|
|
|
|
|
|
|
|
3922
|
|
|
|
|
|
|
|
|
3923
|
|
|
|
|
|
|
|
|
3924
|
|
|
|
|
|
|
=head2 gglse |
|
3925
|
|
|
|
|
|
|
|
|
3926
|
|
|
|
|
|
|
=for sig |
|
3927
|
|
|
|
|
|
|
|
|
3928
|
|
|
|
|
|
|
Signature: ([phys]A(m,n); [phys]B(p,n);[io,phys]c(m);[phys]d(p);[o,phys]x(n);int [o,phys]info()) |
|
3929
|
|
|
|
|
|
|
|
|
3930
|
|
|
|
|
|
|
|
|
3931
|
|
|
|
|
|
|
|
|
3932
|
|
|
|
|
|
|
=for ref |
|
3933
|
|
|
|
|
|
|
|
|
3934
|
|
|
|
|
|
|
Solves the linear equality-constrained least squares (LSE) |
|
3935
|
|
|
|
|
|
|
problem: |
|
3936
|
|
|
|
|
|
|
|
|
3937
|
|
|
|
|
|
|
minimize || c - A*x ||_2 subject to B*x = d |
|
3938
|
|
|
|
|
|
|
|
|
3939
|
|
|
|
|
|
|
where A is an M-by-N matrix, B is a P-by-N matrix, c is a given |
|
3940
|
|
|
|
|
|
|
M-vector, and d is a given P-vector. It is assumed that |
|
3941
|
|
|
|
|
|
|
P <= N <= M+P, and |
|
3942
|
|
|
|
|
|
|
|
|
3943
|
|
|
|
|
|
|
rank(B) = P and rank( ( A ) ) = N. |
|
3944
|
|
|
|
|
|
|
( ( B ) ) |
|
3945
|
|
|
|
|
|
|
|
|
3946
|
|
|
|
|
|
|
These conditions ensure that the LSE problem has a unique solution, |
|
3947
|
|
|
|
|
|
|
which is obtained using a GRQ factorization of the matrices B and A. |
|
3948
|
|
|
|
|
|
|
|
|
3949
|
|
|
|
|
|
|
Arguments |
|
3950
|
|
|
|
|
|
|
========= |
|
3951
|
|
|
|
|
|
|
|
|
3952
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
3953
|
|
|
|
|
|
|
On exit, A is destroyed. |
|
3954
|
|
|
|
|
|
|
|
|
3955
|
|
|
|
|
|
|
B: On entry, the P-by-N matrix B. |
|
3956
|
|
|
|
|
|
|
On exit, B is destroyed. |
|
3957
|
|
|
|
|
|
|
|
|
3958
|
|
|
|
|
|
|
c: On entry, c contains the right hand side vector for the |
|
3959
|
|
|
|
|
|
|
least squares part of the LSE problem. |
|
3960
|
|
|
|
|
|
|
On exit, the residual sum of squares for the solution |
|
3961
|
|
|
|
|
|
|
is given by the sum of squares of elements N-P+1 to M of |
|
3962
|
|
|
|
|
|
|
vector c. |
|
3963
|
|
|
|
|
|
|
|
|
3964
|
|
|
|
|
|
|
d: On entry, d contains the right hand side vector for the |
|
3965
|
|
|
|
|
|
|
constrained equation. |
|
3966
|
|
|
|
|
|
|
On exit, d is destroyed. |
|
3967
|
|
|
|
|
|
|
|
|
3968
|
|
|
|
|
|
|
x: On exit, x is the solution of the LSE problem. |
|
3969
|
|
|
|
|
|
|
|
|
3970
|
|
|
|
|
|
|
|
|
3971
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
3972
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
3973
|
|
|
|
|
|
|
|
|
3974
|
|
|
|
|
|
|
|
|
3975
|
|
|
|
|
|
|
=for example |
|
3976
|
|
|
|
|
|
|
|
|
3977
|
|
|
|
|
|
|
$a = random(7,5); |
|
3978
|
|
|
|
|
|
|
$b = random(4,5); |
|
3979
|
|
|
|
|
|
|
$c = random(7); |
|
3980
|
|
|
|
|
|
|
$d = random(4); |
|
3981
|
|
|
|
|
|
|
$x = zeroes(5); |
|
3982
|
|
|
|
|
|
|
gglse($a, $b, $c, $d, $x, ($info=null)); |
|
3983
|
|
|
|
|
|
|
|
|
3984
|
|
|
|
|
|
|
|
|
3985
|
|
|
|
|
|
|
|
|
3986
|
|
|
|
|
|
|
|
|
3987
|
|
|
|
|
|
|
=for bad |
|
3988
|
|
|
|
|
|
|
|
|
3989
|
|
|
|
|
|
|
gglse ignores the bad-value flag of the input piddles. |
|
3990
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
3991
|
|
|
|
|
|
|
|
|
3992
|
|
|
|
|
|
|
|
|
3993
|
|
|
|
|
|
|
=cut |
|
3994
|
|
|
|
|
|
|
|
|
3995
|
|
|
|
|
|
|
|
|
3996
|
|
|
|
|
|
|
|
|
3997
|
|
|
|
|
|
|
|
|
3998
|
|
|
|
|
|
|
|
|
3999
|
|
|
|
|
|
|
|
|
4000
|
|
|
|
|
|
|
*gglse = \&PDL::gglse; |
|
4001
|
|
|
|
|
|
|
|
|
4002
|
|
|
|
|
|
|
|
|
4003
|
|
|
|
|
|
|
|
|
4004
|
|
|
|
|
|
|
|
|
4005
|
|
|
|
|
|
|
|
|
4006
|
|
|
|
|
|
|
=head2 ggglm |
|
4007
|
|
|
|
|
|
|
|
|
4008
|
|
|
|
|
|
|
=for sig |
|
4009
|
|
|
|
|
|
|
|
|
4010
|
|
|
|
|
|
|
Signature: ([phys]A(n,m); [phys]B(n,p);[phys]d(n);[o,phys]x(m);[o,phys]y(p);int [o,phys]info()) |
|
4011
|
|
|
|
|
|
|
|
|
4012
|
|
|
|
|
|
|
|
|
4013
|
|
|
|
|
|
|
|
|
4014
|
|
|
|
|
|
|
=for ref |
|
4015
|
|
|
|
|
|
|
|
|
4016
|
|
|
|
|
|
|
Solves a general Gauss-Markov linear model (GLM) problem: |
|
4017
|
|
|
|
|
|
|
|
|
4018
|
|
|
|
|
|
|
minimize || y ||_2 subject to d = A*x + B*y |
|
4019
|
|
|
|
|
|
|
x |
|
4020
|
|
|
|
|
|
|
|
|
4021
|
|
|
|
|
|
|
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a |
|
4022
|
|
|
|
|
|
|
given N-vector. It is assumed that M <= N <= M+P, and |
|
4023
|
|
|
|
|
|
|
|
|
4024
|
|
|
|
|
|
|
rank(A) = M and rank( A B ) = N. |
|
4025
|
|
|
|
|
|
|
|
|
4026
|
|
|
|
|
|
|
Under these assumptions, the constrained equation is always |
|
4027
|
|
|
|
|
|
|
consistent, and there is a unique solution x and a minimal 2-norm |
|
4028
|
|
|
|
|
|
|
solution y, which is obtained using a generalized QR factorization |
|
4029
|
|
|
|
|
|
|
of A and B. |
|
4030
|
|
|
|
|
|
|
|
|
4031
|
|
|
|
|
|
|
In particular, if matrix B is square nonsingular, then the problem |
|
4032
|
|
|
|
|
|
|
GLM is equivalent to the following weighted linear least squares |
|
4033
|
|
|
|
|
|
|
problem |
|
4034
|
|
|
|
|
|
|
|
|
4035
|
|
|
|
|
|
|
minimize || inv(B)*(d-A*x) ||_2 |
|
4036
|
|
|
|
|
|
|
x |
|
4037
|
|
|
|
|
|
|
|
|
4038
|
|
|
|
|
|
|
where inv(B) denotes the inverse of B. |
|
4039
|
|
|
|
|
|
|
|
|
4040
|
|
|
|
|
|
|
Arguments |
|
4041
|
|
|
|
|
|
|
========= |
|
4042
|
|
|
|
|
|
|
|
|
4043
|
|
|
|
|
|
|
A: On entry, the N-by-M matrix A. |
|
4044
|
|
|
|
|
|
|
On exit, A is destroyed. |
|
4045
|
|
|
|
|
|
|
|
|
4046
|
|
|
|
|
|
|
B: On entry, the N-by-P matrix B. |
|
4047
|
|
|
|
|
|
|
On exit, B is destroyed. |
|
4048
|
|
|
|
|
|
|
|
|
4049
|
|
|
|
|
|
|
d: On entry, d is the left hand side of the GLM equation. |
|
4050
|
|
|
|
|
|
|
On exit, d is destroyed. |
|
4051
|
|
|
|
|
|
|
|
|
4052
|
|
|
|
|
|
|
x: |
|
4053
|
|
|
|
|
|
|
y: On exit, x and y are the solutions of the GLM problem. |
|
4054
|
|
|
|
|
|
|
|
|
4055
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
4056
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
4057
|
|
|
|
|
|
|
|
|
4058
|
|
|
|
|
|
|
|
|
4059
|
|
|
|
|
|
|
=for example |
|
4060
|
|
|
|
|
|
|
|
|
4061
|
|
|
|
|
|
|
$a = random(7,5); |
|
4062
|
|
|
|
|
|
|
$b = random(7,4); |
|
4063
|
|
|
|
|
|
|
$d = random(7); |
|
4064
|
|
|
|
|
|
|
$x = zeroes(5); |
|
4065
|
|
|
|
|
|
|
$y = zeroes(4); |
|
4066
|
|
|
|
|
|
|
ggglm($a, $b, $d, $x, $y,($info=null)); |
|
4067
|
|
|
|
|
|
|
|
|
4068
|
|
|
|
|
|
|
|
|
4069
|
|
|
|
|
|
|
|
|
4070
|
|
|
|
|
|
|
=for bad |
|
4071
|
|
|
|
|
|
|
|
|
4072
|
|
|
|
|
|
|
ggglm ignores the bad-value flag of the input piddles. |
|
4073
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4074
|
|
|
|
|
|
|
|
|
4075
|
|
|
|
|
|
|
|
|
4076
|
|
|
|
|
|
|
=cut |
|
4077
|
|
|
|
|
|
|
|
|
4078
|
|
|
|
|
|
|
|
|
4079
|
|
|
|
|
|
|
|
|
4080
|
|
|
|
|
|
|
|
|
4081
|
|
|
|
|
|
|
|
|
4082
|
|
|
|
|
|
|
|
|
4083
|
|
|
|
|
|
|
*ggglm = \&PDL::ggglm; |
|
4084
|
|
|
|
|
|
|
|
|
4085
|
|
|
|
|
|
|
|
|
4086
|
|
|
|
|
|
|
|
|
4087
|
|
|
|
|
|
|
|
|
4088
|
|
|
|
|
|
|
|
|
4089
|
|
|
|
|
|
|
=head2 getrf |
|
4090
|
|
|
|
|
|
|
|
|
4091
|
|
|
|
|
|
|
=for sig |
|
4092
|
|
|
|
|
|
|
|
|
4093
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int [o,phys]ipiv(p); int [o,phys]info()) |
|
4094
|
|
|
|
|
|
|
|
|
4095
|
|
|
|
|
|
|
|
|
4096
|
|
|
|
|
|
|
|
|
4097
|
|
|
|
|
|
|
=for ref |
|
4098
|
|
|
|
|
|
|
|
|
4099
|
|
|
|
|
|
|
Computes an LU factorization of a general M-by-N matrix A |
|
4100
|
|
|
|
|
|
|
using partial pivoting with row interchanges. |
|
4101
|
|
|
|
|
|
|
|
|
4102
|
|
|
|
|
|
|
The factorization has the form |
|
4103
|
|
|
|
|
|
|
|
|
4104
|
|
|
|
|
|
|
A = P * L * U |
|
4105
|
|
|
|
|
|
|
|
|
4106
|
|
|
|
|
|
|
where P is a permutation matrix, L is lower triangular with unit |
|
4107
|
|
|
|
|
|
|
diagonal elements (lower trapezoidal if m > n), and U is upper |
|
4108
|
|
|
|
|
|
|
triangular (upper trapezoidal if m < n). |
|
4109
|
|
|
|
|
|
|
|
|
4110
|
|
|
|
|
|
|
This is the right-looking Level 3 BLAS version of the algorithm. |
|
4111
|
|
|
|
|
|
|
|
|
4112
|
|
|
|
|
|
|
Arguments |
|
4113
|
|
|
|
|
|
|
========= |
|
4114
|
|
|
|
|
|
|
|
|
4115
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix to be factored. |
|
4116
|
|
|
|
|
|
|
On exit, the factors L and U from the factorization |
|
4117
|
|
|
|
|
|
|
A = P*L*U; the unit diagonal elements of L are not stored. |
|
4118
|
|
|
|
|
|
|
|
|
4119
|
|
|
|
|
|
|
ipiv: The pivot indices; for 1 <= i <= min(M,N), row i of the |
|
4120
|
|
|
|
|
|
|
matrix was interchanged with row ipiv(i). |
|
4121
|
|
|
|
|
|
|
|
|
4122
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4123
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4124
|
|
|
|
|
|
|
> 0: if info = i, U(i,i) is exactly zero. The factorization |
|
4125
|
|
|
|
|
|
|
has been completed, but the factor U is exactly |
|
4126
|
|
|
|
|
|
|
singular, and division by zero will occur if it is used |
|
4127
|
|
|
|
|
|
|
to solve a system of equations. |
|
4128
|
|
|
|
|
|
|
|
|
4129
|
|
|
|
|
|
|
=for example |
|
4130
|
|
|
|
|
|
|
|
|
4131
|
|
|
|
|
|
|
$a = random (float, 100,50); |
|
4132
|
|
|
|
|
|
|
$ipiv = zeroes(long, 50); |
|
4133
|
|
|
|
|
|
|
$info = null; |
|
4134
|
|
|
|
|
|
|
getrf($a, $ipiv, $info); |
|
4135
|
|
|
|
|
|
|
|
|
4136
|
|
|
|
|
|
|
|
|
4137
|
|
|
|
|
|
|
|
|
4138
|
|
|
|
|
|
|
=for bad |
|
4139
|
|
|
|
|
|
|
|
|
4140
|
|
|
|
|
|
|
getrf ignores the bad-value flag of the input piddles. |
|
4141
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4142
|
|
|
|
|
|
|
|
|
4143
|
|
|
|
|
|
|
|
|
4144
|
|
|
|
|
|
|
=cut |
|
4145
|
|
|
|
|
|
|
|
|
4146
|
|
|
|
|
|
|
|
|
4147
|
|
|
|
|
|
|
|
|
4148
|
|
|
|
|
|
|
|
|
4149
|
|
|
|
|
|
|
|
|
4150
|
|
|
|
|
|
|
|
|
4151
|
|
|
|
|
|
|
*getrf = \&PDL::getrf; |
|
4152
|
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
|
|
4154
|
|
|
|
|
|
|
|
|
4155
|
|
|
|
|
|
|
|
|
4156
|
|
|
|
|
|
|
|
|
4157
|
|
|
|
|
|
|
=head2 getf2 |
|
4158
|
|
|
|
|
|
|
|
|
4159
|
|
|
|
|
|
|
=for sig |
|
4160
|
|
|
|
|
|
|
|
|
4161
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int [o,phys]ipiv(p); int [o,phys]info()) |
|
4162
|
|
|
|
|
|
|
|
|
4163
|
|
|
|
|
|
|
|
|
4164
|
|
|
|
|
|
|
|
|
4165
|
|
|
|
|
|
|
=for ref |
|
4166
|
|
|
|
|
|
|
|
|
4167
|
|
|
|
|
|
|
Computes an LU factorization of a general M-by-N matrix A |
|
4168
|
|
|
|
|
|
|
using partial pivoting with row interchanges. |
|
4169
|
|
|
|
|
|
|
|
|
4170
|
|
|
|
|
|
|
The factorization has the form |
|
4171
|
|
|
|
|
|
|
|
|
4172
|
|
|
|
|
|
|
A = P * L * U |
|
4173
|
|
|
|
|
|
|
|
|
4174
|
|
|
|
|
|
|
where P is a permutation matrix, L is lower triangular with unit |
|
4175
|
|
|
|
|
|
|
diagonal elements (lower trapezoidal if m > n), and U is upper |
|
4176
|
|
|
|
|
|
|
triangular (upper trapezoidal if m < n). |
|
4177
|
|
|
|
|
|
|
|
|
4178
|
|
|
|
|
|
|
This is the right-looking Level 2 BLAS version of the algorithm. |
|
4179
|
|
|
|
|
|
|
|
|
4180
|
|
|
|
|
|
|
Arguments |
|
4181
|
|
|
|
|
|
|
========= |
|
4182
|
|
|
|
|
|
|
|
|
4183
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix to be factored. |
|
4184
|
|
|
|
|
|
|
On exit, the factors L and U from the factorization |
|
4185
|
|
|
|
|
|
|
A = P*L*U; the unit diagonal elements of L are not stored. |
|
4186
|
|
|
|
|
|
|
|
|
4187
|
|
|
|
|
|
|
ipiv: The pivot indices; for 1 <= i <= min(M,N), row i of the |
|
4188
|
|
|
|
|
|
|
matrix was interchanged with row ipiv(i). |
|
4189
|
|
|
|
|
|
|
|
|
4190
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4191
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4192
|
|
|
|
|
|
|
> 0: if info = i, U(i,i) is exactly zero. The factorization |
|
4193
|
|
|
|
|
|
|
has been completed, but the factor U is exactly |
|
4194
|
|
|
|
|
|
|
singular, and division by zero will occur if it is used |
|
4195
|
|
|
|
|
|
|
to solve a system of equations. |
|
4196
|
|
|
|
|
|
|
|
|
4197
|
|
|
|
|
|
|
=for example |
|
4198
|
|
|
|
|
|
|
|
|
4199
|
|
|
|
|
|
|
$a = random (float, 100,50); |
|
4200
|
|
|
|
|
|
|
$ipiv = zeroes(long, 50); |
|
4201
|
|
|
|
|
|
|
$info = null; |
|
4202
|
|
|
|
|
|
|
getf2($a, $ipiv, $info); |
|
4203
|
|
|
|
|
|
|
|
|
4204
|
|
|
|
|
|
|
|
|
4205
|
|
|
|
|
|
|
|
|
4206
|
|
|
|
|
|
|
=for bad |
|
4207
|
|
|
|
|
|
|
|
|
4208
|
|
|
|
|
|
|
getf2 ignores the bad-value flag of the input piddles. |
|
4209
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4210
|
|
|
|
|
|
|
|
|
4211
|
|
|
|
|
|
|
|
|
4212
|
|
|
|
|
|
|
=cut |
|
4213
|
|
|
|
|
|
|
|
|
4214
|
|
|
|
|
|
|
|
|
4215
|
|
|
|
|
|
|
|
|
4216
|
|
|
|
|
|
|
|
|
4217
|
|
|
|
|
|
|
|
|
4218
|
|
|
|
|
|
|
|
|
4219
|
|
|
|
|
|
|
*getf2 = \&PDL::getf2; |
|
4220
|
|
|
|
|
|
|
|
|
4221
|
|
|
|
|
|
|
|
|
4222
|
|
|
|
|
|
|
|
|
4223
|
|
|
|
|
|
|
|
|
4224
|
|
|
|
|
|
|
|
|
4225
|
|
|
|
|
|
|
=head2 sytrf |
|
4226
|
|
|
|
|
|
|
|
|
4227
|
|
|
|
|
|
|
=for sig |
|
4228
|
|
|
|
|
|
|
|
|
4229
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int [o,phys]ipiv(n); int [o,phys]info()) |
|
4230
|
|
|
|
|
|
|
|
|
4231
|
|
|
|
|
|
|
|
|
4232
|
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
=for ref |
|
4234
|
|
|
|
|
|
|
|
|
4235
|
|
|
|
|
|
|
Computes the factorization of a real symmetric matrix A using |
|
4236
|
|
|
|
|
|
|
the Bunch-Kaufman diagonal pivoting method. The form of the |
|
4237
|
|
|
|
|
|
|
factorization is |
|
4238
|
|
|
|
|
|
|
|
|
4239
|
|
|
|
|
|
|
A = U*D*U' or A = L*D*L' |
|
4240
|
|
|
|
|
|
|
where U (or L) is a product of permutation and unit upper (lower) |
|
4241
|
|
|
|
|
|
|
triangular matrices, and D is symmetric and block diagonal with |
|
4242
|
|
|
|
|
|
|
1-by-1 and 2-by-2 diagonal blocks. |
|
4243
|
|
|
|
|
|
|
|
|
4244
|
|
|
|
|
|
|
This is the blocked version of the algorithm, calling Level 3 BLAS. |
|
4245
|
|
|
|
|
|
|
|
|
4246
|
|
|
|
|
|
|
Arguments |
|
4247
|
|
|
|
|
|
|
========= |
|
4248
|
|
|
|
|
|
|
|
|
4249
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
4250
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
4251
|
|
|
|
|
|
|
|
|
4252
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the leading |
|
4253
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
4254
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
4255
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
4256
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
4257
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
4258
|
|
|
|
|
|
|
triangular part of A is not referenced. |
|
4259
|
|
|
|
|
|
|
|
|
4260
|
|
|
|
|
|
|
On exit, the block diagonal matrix D and the multipliers used |
|
4261
|
|
|
|
|
|
|
to obtain the factor U or L (see below for further details). |
|
4262
|
|
|
|
|
|
|
|
|
4263
|
|
|
|
|
|
|
ipiv: Details of the interchanges and the block structure of D. |
|
4264
|
|
|
|
|
|
|
If ipiv(k) > 0, then rows and columns k and ipiv(k) were |
|
4265
|
|
|
|
|
|
|
interchanged and D(k,k) is a 1-by-1 diagonal block. |
|
4266
|
|
|
|
|
|
|
If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, then rows and |
|
4267
|
|
|
|
|
|
|
columns k-1 and -ipiv(k) were interchanged and D(k-1:k,k-1:k) |
|
4268
|
|
|
|
|
|
|
is a 2-by-2 diagonal block. If uplo = 1 and ipiv(k) = |
|
4269
|
|
|
|
|
|
|
ipiv(k+1) < 0, then rows and columns k+1 and -ipiv(k) were |
|
4270
|
|
|
|
|
|
|
interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. |
|
4271
|
|
|
|
|
|
|
|
|
4272
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4273
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4274
|
|
|
|
|
|
|
> 0: if info = i, D(i,i) is exactly zero. The factorization |
|
4275
|
|
|
|
|
|
|
has been completed, but the block diagonal matrix D is |
|
4276
|
|
|
|
|
|
|
exactly singular, and division by zero will occur if it |
|
4277
|
|
|
|
|
|
|
is used to solve a system of equations. |
|
4278
|
|
|
|
|
|
|
|
|
4279
|
|
|
|
|
|
|
Further Details |
|
4280
|
|
|
|
|
|
|
=============== |
|
4281
|
|
|
|
|
|
|
|
|
4282
|
|
|
|
|
|
|
If uplo = 0, then A = U*D*U', where |
|
4283
|
|
|
|
|
|
|
U = P(n)*U(n)* ... *P(k)U(k)* ..., |
|
4284
|
|
|
|
|
|
|
i.e., U is a product of terms P(k)*U(k), where k decreases from n to |
|
4285
|
|
|
|
|
|
|
1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1 |
|
4286
|
|
|
|
|
|
|
and 2-by-2 diagonal blocks D(k). P(k) is a permutation matrix as |
|
4287
|
|
|
|
|
|
|
defined by ipiv(k), and U(k) is a unit upper triangular matrix, such |
|
4288
|
|
|
|
|
|
|
that if the diagonal block D(k) is of order s (s = 1 or 2), then |
|
4289
|
|
|
|
|
|
|
|
|
4290
|
|
|
|
|
|
|
( I v 0 ) k-s |
|
4291
|
|
|
|
|
|
|
U(k) = ( 0 I 0 ) s |
|
4292
|
|
|
|
|
|
|
( 0 0 I ) n-k |
|
4293
|
|
|
|
|
|
|
k-s s n-k |
|
4294
|
|
|
|
|
|
|
|
|
4295
|
|
|
|
|
|
|
If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k). |
|
4296
|
|
|
|
|
|
|
If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k), |
|
4297
|
|
|
|
|
|
|
and A(k,k), and v overwrites A(1:k-2,k-1:k). |
|
4298
|
|
|
|
|
|
|
|
|
4299
|
|
|
|
|
|
|
If uplo = 1, then A = L*D*L', where |
|
4300
|
|
|
|
|
|
|
L = P(1)*L(1)* ... *P(k)*L(k)* ..., |
|
4301
|
|
|
|
|
|
|
i.e., L is a product of terms P(k)*L(k), where k increases from 1 to |
|
4302
|
|
|
|
|
|
|
n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1 |
|
4303
|
|
|
|
|
|
|
and 2-by-2 diagonal blocks D(k). P(k) is a permutation matrix as |
|
4304
|
|
|
|
|
|
|
defined by ipiv(k), and L(k) is a unit lower triangular matrix, such |
|
4305
|
|
|
|
|
|
|
that if the diagonal block D(k) is of order s (s = 1 or 2), then |
|
4306
|
|
|
|
|
|
|
|
|
4307
|
|
|
|
|
|
|
( I 0 0 ) k-1 |
|
4308
|
|
|
|
|
|
|
L(k) = ( 0 I 0 ) s |
|
4309
|
|
|
|
|
|
|
( 0 v I ) n-k-s+1 |
|
4310
|
|
|
|
|
|
|
k-1 s n-k-s+1 |
|
4311
|
|
|
|
|
|
|
|
|
4312
|
|
|
|
|
|
|
If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k). |
|
4313
|
|
|
|
|
|
|
If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k), |
|
4314
|
|
|
|
|
|
|
and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1). |
|
4315
|
|
|
|
|
|
|
|
|
4316
|
|
|
|
|
|
|
=for example |
|
4317
|
|
|
|
|
|
|
|
|
4318
|
|
|
|
|
|
|
$a = random(100,100); |
|
4319
|
|
|
|
|
|
|
$ipiv = zeroes(100); |
|
4320
|
|
|
|
|
|
|
$info = null; |
|
4321
|
|
|
|
|
|
|
# Assume $a is symmetric |
|
4322
|
|
|
|
|
|
|
sytrf($a, 0, $ipiv, $info); |
|
4323
|
|
|
|
|
|
|
|
|
4324
|
|
|
|
|
|
|
|
|
4325
|
|
|
|
|
|
|
|
|
4326
|
|
|
|
|
|
|
=for bad |
|
4327
|
|
|
|
|
|
|
|
|
4328
|
|
|
|
|
|
|
sytrf ignores the bad-value flag of the input piddles. |
|
4329
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4330
|
|
|
|
|
|
|
|
|
4331
|
|
|
|
|
|
|
|
|
4332
|
|
|
|
|
|
|
=cut |
|
4333
|
|
|
|
|
|
|
|
|
4334
|
|
|
|
|
|
|
|
|
4335
|
|
|
|
|
|
|
|
|
4336
|
|
|
|
|
|
|
|
|
4337
|
|
|
|
|
|
|
|
|
4338
|
|
|
|
|
|
|
|
|
4339
|
|
|
|
|
|
|
*sytrf = \&PDL::sytrf; |
|
4340
|
|
|
|
|
|
|
|
|
4341
|
|
|
|
|
|
|
|
|
4342
|
|
|
|
|
|
|
|
|
4343
|
|
|
|
|
|
|
|
|
4344
|
|
|
|
|
|
|
|
|
4345
|
|
|
|
|
|
|
=head2 sytf2 |
|
4346
|
|
|
|
|
|
|
|
|
4347
|
|
|
|
|
|
|
=for sig |
|
4348
|
|
|
|
|
|
|
|
|
4349
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int [o,phys]ipiv(n); int [o,phys]info()) |
|
4350
|
|
|
|
|
|
|
|
|
4351
|
|
|
|
|
|
|
|
|
4352
|
|
|
|
|
|
|
|
|
4353
|
|
|
|
|
|
|
=for ref |
|
4354
|
|
|
|
|
|
|
|
|
4355
|
|
|
|
|
|
|
Computes the factorization of a real symmetric matrix A using |
|
4356
|
|
|
|
|
|
|
the Bunch-Kaufman diagonal pivoting method. The form of the |
|
4357
|
|
|
|
|
|
|
factorization is |
|
4358
|
|
|
|
|
|
|
|
|
4359
|
|
|
|
|
|
|
A = U*D*U' or A = L*D*L' |
|
4360
|
|
|
|
|
|
|
where U (or L) is a product of permutation and unit upper (lower) |
|
4361
|
|
|
|
|
|
|
triangular matrices, and D is symmetric and block diagonal with |
|
4362
|
|
|
|
|
|
|
1-by-1 and 2-by-2 diagonal blocks. |
|
4363
|
|
|
|
|
|
|
|
|
4364
|
|
|
|
|
|
|
This is the unblocked version of the algorithm, calling Level 2 BLAS. |
|
4365
|
|
|
|
|
|
|
|
|
4366
|
|
|
|
|
|
|
Arguments |
|
4367
|
|
|
|
|
|
|
========= |
|
4368
|
|
|
|
|
|
|
|
|
4369
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
4370
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
4371
|
|
|
|
|
|
|
|
|
4372
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the leading |
|
4373
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
4374
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
4375
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
4376
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
4377
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
4378
|
|
|
|
|
|
|
triangular part of A is not referenced. |
|
4379
|
|
|
|
|
|
|
|
|
4380
|
|
|
|
|
|
|
On exit, the block diagonal matrix D and the multipliers used |
|
4381
|
|
|
|
|
|
|
to obtain the factor U or L (see below for further details). |
|
4382
|
|
|
|
|
|
|
|
|
4383
|
|
|
|
|
|
|
ipiv: Details of the interchanges and the block structure of D. |
|
4384
|
|
|
|
|
|
|
If ipiv(k) > 0, then rows and columns k and ipiv(k) were |
|
4385
|
|
|
|
|
|
|
interchanged and D(k,k) is a 1-by-1 diagonal block. |
|
4386
|
|
|
|
|
|
|
If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, then rows and |
|
4387
|
|
|
|
|
|
|
columns k-1 and -ipiv(k) were interchanged and D(k-1:k,k-1:k) |
|
4388
|
|
|
|
|
|
|
is a 2-by-2 diagonal block. If uplo = 1 and ipiv(k) = |
|
4389
|
|
|
|
|
|
|
ipiv(k+1) < 0, then rows and columns k+1 and -ipiv(k) were |
|
4390
|
|
|
|
|
|
|
interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. |
|
4391
|
|
|
|
|
|
|
|
|
4392
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4393
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4394
|
|
|
|
|
|
|
> 0: if info = i, D(i,i) is exactly zero. The factorization |
|
4395
|
|
|
|
|
|
|
has been completed, but the block diagonal matrix D is |
|
4396
|
|
|
|
|
|
|
exactly singular, and division by zero will occur if it |
|
4397
|
|
|
|
|
|
|
is used to solve a system of equations. |
|
4398
|
|
|
|
|
|
|
|
|
4399
|
|
|
|
|
|
|
For further details see sytrf |
|
4400
|
|
|
|
|
|
|
|
|
4401
|
|
|
|
|
|
|
=for example |
|
4402
|
|
|
|
|
|
|
|
|
4403
|
|
|
|
|
|
|
$a = random(100,100); |
|
4404
|
|
|
|
|
|
|
$ipiv = zeroes(100); |
|
4405
|
|
|
|
|
|
|
$info = null; |
|
4406
|
|
|
|
|
|
|
# Assume $a is symmetric |
|
4407
|
|
|
|
|
|
|
sytf2($a, 0, $ipiv, $info); |
|
4408
|
|
|
|
|
|
|
|
|
4409
|
|
|
|
|
|
|
|
|
4410
|
|
|
|
|
|
|
|
|
4411
|
|
|
|
|
|
|
=for bad |
|
4412
|
|
|
|
|
|
|
|
|
4413
|
|
|
|
|
|
|
sytf2 ignores the bad-value flag of the input piddles. |
|
4414
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4415
|
|
|
|
|
|
|
|
|
4416
|
|
|
|
|
|
|
|
|
4417
|
|
|
|
|
|
|
=cut |
|
4418
|
|
|
|
|
|
|
|
|
4419
|
|
|
|
|
|
|
|
|
4420
|
|
|
|
|
|
|
|
|
4421
|
|
|
|
|
|
|
|
|
4422
|
|
|
|
|
|
|
|
|
4423
|
|
|
|
|
|
|
|
|
4424
|
|
|
|
|
|
|
*sytf2 = \&PDL::sytf2; |
|
4425
|
|
|
|
|
|
|
|
|
4426
|
|
|
|
|
|
|
|
|
4427
|
|
|
|
|
|
|
|
|
4428
|
|
|
|
|
|
|
|
|
4429
|
|
|
|
|
|
|
|
|
4430
|
|
|
|
|
|
|
=head2 potrf |
|
4431
|
|
|
|
|
|
|
|
|
4432
|
|
|
|
|
|
|
=for sig |
|
4433
|
|
|
|
|
|
|
|
|
4434
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int [o,phys]info()) |
|
4435
|
|
|
|
|
|
|
|
|
4436
|
|
|
|
|
|
|
|
|
4437
|
|
|
|
|
|
|
|
|
4438
|
|
|
|
|
|
|
=for ref |
|
4439
|
|
|
|
|
|
|
|
|
4440
|
|
|
|
|
|
|
Computes the Cholesky factorization of a real symmetric |
|
4441
|
|
|
|
|
|
|
positive definite matrix A. |
|
4442
|
|
|
|
|
|
|
|
|
4443
|
|
|
|
|
|
|
The factorization has the form |
|
4444
|
|
|
|
|
|
|
|
|
4445
|
|
|
|
|
|
|
A = U' * U, if uplo = 0, or |
|
4446
|
|
|
|
|
|
|
A = L * L', if uplo = 1, |
|
4447
|
|
|
|
|
|
|
where U is an upper triangular matrix and L is lower triangular. |
|
4448
|
|
|
|
|
|
|
|
|
4449
|
|
|
|
|
|
|
This is the block version of the algorithm, calling Level 3 BLAS. |
|
4450
|
|
|
|
|
|
|
|
|
4451
|
|
|
|
|
|
|
Arguments |
|
4452
|
|
|
|
|
|
|
========= |
|
4453
|
|
|
|
|
|
|
|
|
4454
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
4455
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
4456
|
|
|
|
|
|
|
|
|
4457
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the leading |
|
4458
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
4459
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
4460
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
4461
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
4462
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
4463
|
|
|
|
|
|
|
triangular part of A is not referenced. |
|
4464
|
|
|
|
|
|
|
|
|
4465
|
|
|
|
|
|
|
On exit, if info = 0, the factor U or L from the Cholesky |
|
4466
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L'. |
|
4467
|
|
|
|
|
|
|
|
|
4468
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4469
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4470
|
|
|
|
|
|
|
> 0: if info = i, the leading minor of order i is not |
|
4471
|
|
|
|
|
|
|
positive definite, and the factorization could not be |
|
4472
|
|
|
|
|
|
|
completed. |
|
4473
|
|
|
|
|
|
|
|
|
4474
|
|
|
|
|
|
|
=for example |
|
4475
|
|
|
|
|
|
|
|
|
4476
|
|
|
|
|
|
|
$a = random(100,100); |
|
4477
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite |
|
4478
|
|
|
|
|
|
|
potrf($a, 0, ($info = null)); |
|
4479
|
|
|
|
|
|
|
|
|
4480
|
|
|
|
|
|
|
|
|
4481
|
|
|
|
|
|
|
|
|
4482
|
|
|
|
|
|
|
=for bad |
|
4483
|
|
|
|
|
|
|
|
|
4484
|
|
|
|
|
|
|
potrf ignores the bad-value flag of the input piddles. |
|
4485
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4486
|
|
|
|
|
|
|
|
|
4487
|
|
|
|
|
|
|
|
|
4488
|
|
|
|
|
|
|
=cut |
|
4489
|
|
|
|
|
|
|
|
|
4490
|
|
|
|
|
|
|
|
|
4491
|
|
|
|
|
|
|
|
|
4492
|
|
|
|
|
|
|
|
|
4493
|
|
|
|
|
|
|
|
|
4494
|
|
|
|
|
|
|
|
|
4495
|
|
|
|
|
|
|
*potrf = \&PDL::potrf; |
|
4496
|
|
|
|
|
|
|
|
|
4497
|
|
|
|
|
|
|
|
|
4498
|
|
|
|
|
|
|
|
|
4499
|
|
|
|
|
|
|
|
|
4500
|
|
|
|
|
|
|
|
|
4501
|
|
|
|
|
|
|
=head2 potf2 |
|
4502
|
|
|
|
|
|
|
|
|
4503
|
|
|
|
|
|
|
=for sig |
|
4504
|
|
|
|
|
|
|
|
|
4505
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int [o,phys]info()) |
|
4506
|
|
|
|
|
|
|
|
|
4507
|
|
|
|
|
|
|
|
|
4508
|
|
|
|
|
|
|
|
|
4509
|
|
|
|
|
|
|
=for ref |
|
4510
|
|
|
|
|
|
|
|
|
4511
|
|
|
|
|
|
|
Computes the Cholesky factorization of a real symmetric |
|
4512
|
|
|
|
|
|
|
positive definite matrix A. |
|
4513
|
|
|
|
|
|
|
|
|
4514
|
|
|
|
|
|
|
The factorization has the form |
|
4515
|
|
|
|
|
|
|
|
|
4516
|
|
|
|
|
|
|
A = U' * U, if uplo = 0, or |
|
4517
|
|
|
|
|
|
|
A = L * L', if uplo = 1, |
|
4518
|
|
|
|
|
|
|
where U is an upper triangular matrix and L is lower triangular. |
|
4519
|
|
|
|
|
|
|
|
|
4520
|
|
|
|
|
|
|
This is the unblocked version of the algorithm, calling Level 2 BLAS. |
|
4521
|
|
|
|
|
|
|
|
|
4522
|
|
|
|
|
|
|
Arguments |
|
4523
|
|
|
|
|
|
|
========= |
|
4524
|
|
|
|
|
|
|
|
|
4525
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
4526
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
4527
|
|
|
|
|
|
|
|
|
4528
|
|
|
|
|
|
|
A: On entry, the symmetric matrix A. If uplo = 0, the leading |
|
4529
|
|
|
|
|
|
|
N-by-N upper triangular part of A contains the upper |
|
4530
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly lower |
|
4531
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
4532
|
|
|
|
|
|
|
leading N-by-N lower triangular part of A contains the lower |
|
4533
|
|
|
|
|
|
|
triangular part of the matrix A, and the strictly upper |
|
4534
|
|
|
|
|
|
|
triangular part of A is not referenced. |
|
4535
|
|
|
|
|
|
|
|
|
4536
|
|
|
|
|
|
|
On exit, if info = 0, the factor U or L from the Cholesky |
|
4537
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L'. |
|
4538
|
|
|
|
|
|
|
|
|
4539
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4540
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4541
|
|
|
|
|
|
|
> 0: if info = i, the leading minor of order i is not |
|
4542
|
|
|
|
|
|
|
positive definite, and the factorization could not be |
|
4543
|
|
|
|
|
|
|
completed. |
|
4544
|
|
|
|
|
|
|
|
|
4545
|
|
|
|
|
|
|
=for example |
|
4546
|
|
|
|
|
|
|
|
|
4547
|
|
|
|
|
|
|
$a = random(100,100); |
|
4548
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite |
|
4549
|
|
|
|
|
|
|
potf2($a, 0, ($info = null)); |
|
4550
|
|
|
|
|
|
|
|
|
4551
|
|
|
|
|
|
|
|
|
4552
|
|
|
|
|
|
|
|
|
4553
|
|
|
|
|
|
|
=for bad |
|
4554
|
|
|
|
|
|
|
|
|
4555
|
|
|
|
|
|
|
potf2 ignores the bad-value flag of the input piddles. |
|
4556
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4557
|
|
|
|
|
|
|
|
|
4558
|
|
|
|
|
|
|
|
|
4559
|
|
|
|
|
|
|
=cut |
|
4560
|
|
|
|
|
|
|
|
|
4561
|
|
|
|
|
|
|
|
|
4562
|
|
|
|
|
|
|
|
|
4563
|
|
|
|
|
|
|
|
|
4564
|
|
|
|
|
|
|
|
|
4565
|
|
|
|
|
|
|
|
|
4566
|
|
|
|
|
|
|
*potf2 = \&PDL::potf2; |
|
4567
|
|
|
|
|
|
|
|
|
4568
|
|
|
|
|
|
|
|
|
4569
|
|
|
|
|
|
|
|
|
4570
|
|
|
|
|
|
|
|
|
4571
|
|
|
|
|
|
|
|
|
4572
|
|
|
|
|
|
|
=head2 getri |
|
4573
|
|
|
|
|
|
|
|
|
4574
|
|
|
|
|
|
|
=for sig |
|
4575
|
|
|
|
|
|
|
|
|
4576
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int [phys]ipiv(n); int [o,phys]info()) |
|
4577
|
|
|
|
|
|
|
|
|
4578
|
|
|
|
|
|
|
|
|
4579
|
|
|
|
|
|
|
|
|
4580
|
|
|
|
|
|
|
=for ref |
|
4581
|
|
|
|
|
|
|
|
|
4582
|
|
|
|
|
|
|
Computes the inverse of a matrix using the LU factorization |
|
4583
|
|
|
|
|
|
|
computed by C. |
|
4584
|
|
|
|
|
|
|
|
|
4585
|
|
|
|
|
|
|
This method inverts U and then computes inv(A) by solving the system |
|
4586
|
|
|
|
|
|
|
|
|
4587
|
|
|
|
|
|
|
inv(A)*L = inv(U) for inv(A). |
|
4588
|
|
|
|
|
|
|
|
|
4589
|
|
|
|
|
|
|
Arguments |
|
4590
|
|
|
|
|
|
|
========= |
|
4591
|
|
|
|
|
|
|
|
|
4592
|
|
|
|
|
|
|
A: On entry, the factors L and U from the factorization |
|
4593
|
|
|
|
|
|
|
A = P*L*U as computed by getrf. |
|
4594
|
|
|
|
|
|
|
On exit, if info = 0, the inverse of the original matrix A. |
|
4595
|
|
|
|
|
|
|
|
|
4596
|
|
|
|
|
|
|
ipiv: The pivot indices from getrf; for 1<=i<=N, row i of the |
|
4597
|
|
|
|
|
|
|
matrix was interchanged with row ipiv(i). |
|
4598
|
|
|
|
|
|
|
|
|
4599
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4600
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4601
|
|
|
|
|
|
|
> 0: if info = i, U(i,i) is exactly zero; the matrix is |
|
4602
|
|
|
|
|
|
|
singular and its inverse could not be computed. |
|
4603
|
|
|
|
|
|
|
|
|
4604
|
|
|
|
|
|
|
|
|
4605
|
|
|
|
|
|
|
|
|
4606
|
|
|
|
|
|
|
=for example |
|
4607
|
|
|
|
|
|
|
|
|
4608
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
4609
|
|
|
|
|
|
|
$ipiv = zeroes(long, 100); |
|
4610
|
|
|
|
|
|
|
$info = null; |
|
4611
|
|
|
|
|
|
|
getrf($a, $ipiv, $info); |
|
4612
|
|
|
|
|
|
|
if ($info == 0){ |
|
4613
|
|
|
|
|
|
|
getri($a, $ipiv, $info); |
|
4614
|
|
|
|
|
|
|
} |
|
4615
|
|
|
|
|
|
|
print "Inverse of \$a is :\n $a" unless $info; |
|
4616
|
|
|
|
|
|
|
|
|
4617
|
|
|
|
|
|
|
|
|
4618
|
|
|
|
|
|
|
|
|
4619
|
|
|
|
|
|
|
=for bad |
|
4620
|
|
|
|
|
|
|
|
|
4621
|
|
|
|
|
|
|
getri ignores the bad-value flag of the input piddles. |
|
4622
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4623
|
|
|
|
|
|
|
|
|
4624
|
|
|
|
|
|
|
|
|
4625
|
|
|
|
|
|
|
=cut |
|
4626
|
|
|
|
|
|
|
|
|
4627
|
|
|
|
|
|
|
|
|
4628
|
|
|
|
|
|
|
|
|
4629
|
|
|
|
|
|
|
|
|
4630
|
|
|
|
|
|
|
|
|
4631
|
|
|
|
|
|
|
|
|
4632
|
|
|
|
|
|
|
*getri = \&PDL::getri; |
|
4633
|
|
|
|
|
|
|
|
|
4634
|
|
|
|
|
|
|
|
|
4635
|
|
|
|
|
|
|
|
|
4636
|
|
|
|
|
|
|
|
|
4637
|
|
|
|
|
|
|
|
|
4638
|
|
|
|
|
|
|
=head2 sytri |
|
4639
|
|
|
|
|
|
|
|
|
4640
|
|
|
|
|
|
|
=for sig |
|
4641
|
|
|
|
|
|
|
|
|
4642
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int [phys]ipiv(n); int [o,phys]info()) |
|
4643
|
|
|
|
|
|
|
|
|
4644
|
|
|
|
|
|
|
|
|
4645
|
|
|
|
|
|
|
|
|
4646
|
|
|
|
|
|
|
=for ref |
|
4647
|
|
|
|
|
|
|
|
|
4648
|
|
|
|
|
|
|
Computes the inverse of a real symmetric indefinite matrix |
|
4649
|
|
|
|
|
|
|
A using the factorization A = U*D*U' or A = L*D*L' computed by |
|
4650
|
|
|
|
|
|
|
C. |
|
4651
|
|
|
|
|
|
|
|
|
4652
|
|
|
|
|
|
|
Arguments |
|
4653
|
|
|
|
|
|
|
========= |
|
4654
|
|
|
|
|
|
|
|
|
4655
|
|
|
|
|
|
|
uplo: Specifies whether the details of the factorization are stored |
|
4656
|
|
|
|
|
|
|
as an upper or lower triangular matrix. |
|
4657
|
|
|
|
|
|
|
= 0: Upper triangular, form is A = U*D*U'; |
|
4658
|
|
|
|
|
|
|
= 1: Lower triangular, form is A = L*D*L'. |
|
4659
|
|
|
|
|
|
|
|
|
4660
|
|
|
|
|
|
|
A: On entry, the block diagonal matrix D and the multipliers |
|
4661
|
|
|
|
|
|
|
used to obtain the factor U or L as computed by sytrf. |
|
4662
|
|
|
|
|
|
|
|
|
4663
|
|
|
|
|
|
|
On exit, if info = 0, the (symmetric) inverse of the original |
|
4664
|
|
|
|
|
|
|
matrix. If uplo = 0, the upper triangular part of the |
|
4665
|
|
|
|
|
|
|
inverse is formed and the part of A below the diagonal is not |
|
4666
|
|
|
|
|
|
|
referenced; if uplo = 1 the lower triangular part of the |
|
4667
|
|
|
|
|
|
|
inverse is formed and the part of A above the diagonal is |
|
4668
|
|
|
|
|
|
|
not referenced. |
|
4669
|
|
|
|
|
|
|
|
|
4670
|
|
|
|
|
|
|
ipiv: Details of the interchanges and the block structure of D |
|
4671
|
|
|
|
|
|
|
as determined by sytrf. |
|
4672
|
|
|
|
|
|
|
|
|
4673
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4674
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4675
|
|
|
|
|
|
|
> 0: if info = i, D(i,i) = 0; the matrix is singular and its |
|
4676
|
|
|
|
|
|
|
inverse could not be computed. |
|
4677
|
|
|
|
|
|
|
|
|
4678
|
|
|
|
|
|
|
|
|
4679
|
|
|
|
|
|
|
|
|
4680
|
|
|
|
|
|
|
=for example |
|
4681
|
|
|
|
|
|
|
|
|
4682
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
4683
|
|
|
|
|
|
|
# assume $a is symmetric |
|
4684
|
|
|
|
|
|
|
$ipiv = zeroes(long, 100); |
|
4685
|
|
|
|
|
|
|
sytrf($a, 0, $ipiv, ($info=null)); |
|
4686
|
|
|
|
|
|
|
if ($info == 0){ |
|
4687
|
|
|
|
|
|
|
sytri($a, 0, $ipiv, $info); |
|
4688
|
|
|
|
|
|
|
} |
|
4689
|
|
|
|
|
|
|
print "Inverse of \$a is :\n $a" unless $info; |
|
4690
|
|
|
|
|
|
|
|
|
4691
|
|
|
|
|
|
|
|
|
4692
|
|
|
|
|
|
|
|
|
4693
|
|
|
|
|
|
|
=for bad |
|
4694
|
|
|
|
|
|
|
|
|
4695
|
|
|
|
|
|
|
sytri ignores the bad-value flag of the input piddles. |
|
4696
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4697
|
|
|
|
|
|
|
|
|
4698
|
|
|
|
|
|
|
|
|
4699
|
|
|
|
|
|
|
=cut |
|
4700
|
|
|
|
|
|
|
|
|
4701
|
|
|
|
|
|
|
|
|
4702
|
|
|
|
|
|
|
|
|
4703
|
|
|
|
|
|
|
|
|
4704
|
|
|
|
|
|
|
|
|
4705
|
|
|
|
|
|
|
|
|
4706
|
|
|
|
|
|
|
*sytri = \&PDL::sytri; |
|
4707
|
|
|
|
|
|
|
|
|
4708
|
|
|
|
|
|
|
|
|
4709
|
|
|
|
|
|
|
|
|
4710
|
|
|
|
|
|
|
|
|
4711
|
|
|
|
|
|
|
|
|
4712
|
|
|
|
|
|
|
=head2 potri |
|
4713
|
|
|
|
|
|
|
|
|
4714
|
|
|
|
|
|
|
=for sig |
|
4715
|
|
|
|
|
|
|
|
|
4716
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int [o,phys]info()) |
|
4717
|
|
|
|
|
|
|
|
|
4718
|
|
|
|
|
|
|
|
|
4719
|
|
|
|
|
|
|
|
|
4720
|
|
|
|
|
|
|
=for ref |
|
4721
|
|
|
|
|
|
|
|
|
4722
|
|
|
|
|
|
|
Computes the inverse of a real symmetric positive definite |
|
4723
|
|
|
|
|
|
|
matrix A using the Cholesky factorization A = U'*U or A = L*L' |
|
4724
|
|
|
|
|
|
|
computed by C. |
|
4725
|
|
|
|
|
|
|
|
|
4726
|
|
|
|
|
|
|
Arguments |
|
4727
|
|
|
|
|
|
|
========= |
|
4728
|
|
|
|
|
|
|
|
|
4729
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
4730
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
4731
|
|
|
|
|
|
|
|
|
4732
|
|
|
|
|
|
|
A: On entry, the triangular factor U or L from the Cholesky |
|
4733
|
|
|
|
|
|
|
factorization A = U'*U or A = L*L', as computed by |
|
4734
|
|
|
|
|
|
|
potrf. |
|
4735
|
|
|
|
|
|
|
On exit, the upper or lower triangle of the (symmetric) |
|
4736
|
|
|
|
|
|
|
inverse of A, overwriting the input factor U or L. |
|
4737
|
|
|
|
|
|
|
|
|
4738
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4739
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4740
|
|
|
|
|
|
|
> 0: if info = i, the (i,i) element of the factor U or L is |
|
4741
|
|
|
|
|
|
|
zero, and the inverse could not be computed. |
|
4742
|
|
|
|
|
|
|
|
|
4743
|
|
|
|
|
|
|
|
|
4744
|
|
|
|
|
|
|
|
|
4745
|
|
|
|
|
|
|
=for example |
|
4746
|
|
|
|
|
|
|
|
|
4747
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
4748
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite |
|
4749
|
|
|
|
|
|
|
potrf($a, 0, ($info = null)); |
|
4750
|
|
|
|
|
|
|
if ($info == 0){ # Hum... is it positive definite???? |
|
4751
|
|
|
|
|
|
|
potri($a, 0,$info); |
|
4752
|
|
|
|
|
|
|
} |
|
4753
|
|
|
|
|
|
|
print "Inverse of \$a is :\n $a" unless $info; |
|
4754
|
|
|
|
|
|
|
|
|
4755
|
|
|
|
|
|
|
|
|
4756
|
|
|
|
|
|
|
|
|
4757
|
|
|
|
|
|
|
=for bad |
|
4758
|
|
|
|
|
|
|
|
|
4759
|
|
|
|
|
|
|
potri ignores the bad-value flag of the input piddles. |
|
4760
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4761
|
|
|
|
|
|
|
|
|
4762
|
|
|
|
|
|
|
|
|
4763
|
|
|
|
|
|
|
=cut |
|
4764
|
|
|
|
|
|
|
|
|
4765
|
|
|
|
|
|
|
|
|
4766
|
|
|
|
|
|
|
|
|
4767
|
|
|
|
|
|
|
|
|
4768
|
|
|
|
|
|
|
|
|
4769
|
|
|
|
|
|
|
|
|
4770
|
|
|
|
|
|
|
*potri = \&PDL::potri; |
|
4771
|
|
|
|
|
|
|
|
|
4772
|
|
|
|
|
|
|
|
|
4773
|
|
|
|
|
|
|
|
|
4774
|
|
|
|
|
|
|
|
|
4775
|
|
|
|
|
|
|
|
|
4776
|
|
|
|
|
|
|
=head2 trtri |
|
4777
|
|
|
|
|
|
|
|
|
4778
|
|
|
|
|
|
|
=for sig |
|
4779
|
|
|
|
|
|
|
|
|
4780
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int diag(); int [o,phys]info()) |
|
4781
|
|
|
|
|
|
|
|
|
4782
|
|
|
|
|
|
|
|
|
4783
|
|
|
|
|
|
|
|
|
4784
|
|
|
|
|
|
|
=for ref |
|
4785
|
|
|
|
|
|
|
|
|
4786
|
|
|
|
|
|
|
Computes the inverse of a real upper or lower triangular |
|
4787
|
|
|
|
|
|
|
matrix A. |
|
4788
|
|
|
|
|
|
|
|
|
4789
|
|
|
|
|
|
|
This is the Level 3 BLAS version of the algorithm. |
|
4790
|
|
|
|
|
|
|
|
|
4791
|
|
|
|
|
|
|
Arguments |
|
4792
|
|
|
|
|
|
|
========= |
|
4793
|
|
|
|
|
|
|
|
|
4794
|
|
|
|
|
|
|
uplo: = 0: A is upper triangular; |
|
4795
|
|
|
|
|
|
|
= 1: A is lower triangular. |
|
4796
|
|
|
|
|
|
|
|
|
4797
|
|
|
|
|
|
|
diag: = 0: A is non-unit triangular; |
|
4798
|
|
|
|
|
|
|
= 1: A is unit triangular. |
|
4799
|
|
|
|
|
|
|
|
|
4800
|
|
|
|
|
|
|
A: On entry, the triangular matrix A. If uplo = 0, the |
|
4801
|
|
|
|
|
|
|
leading N-by-N upper triangular part of the array A contains |
|
4802
|
|
|
|
|
|
|
the upper triangular matrix, and the strictly lower |
|
4803
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
4804
|
|
|
|
|
|
|
leading N-by-N lower triangular part of the array A contains |
|
4805
|
|
|
|
|
|
|
the lower triangular matrix, and the strictly upper |
|
4806
|
|
|
|
|
|
|
triangular part of A is not referenced. If diag = 1, the |
|
4807
|
|
|
|
|
|
|
diagonal elements of A are also not referenced and are |
|
4808
|
|
|
|
|
|
|
assumed to be 1. |
|
4809
|
|
|
|
|
|
|
On exit, the (triangular) inverse of the original matrix, in |
|
4810
|
|
|
|
|
|
|
the same storage format. |
|
4811
|
|
|
|
|
|
|
|
|
4812
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4813
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4814
|
|
|
|
|
|
|
> 0: if info = i, A(i,i) is exactly zero. The triangular |
|
4815
|
|
|
|
|
|
|
matrix is singular and its inverse can not be computed. |
|
4816
|
|
|
|
|
|
|
|
|
4817
|
|
|
|
|
|
|
|
|
4818
|
|
|
|
|
|
|
|
|
4819
|
|
|
|
|
|
|
=for example |
|
4820
|
|
|
|
|
|
|
|
|
4821
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
4822
|
|
|
|
|
|
|
# assume $a is upper triangular |
|
4823
|
|
|
|
|
|
|
trtri($a, 1, ($info=null)); |
|
4824
|
|
|
|
|
|
|
print "Inverse of \$a is :\n transpose($a)" unless $info; |
|
4825
|
|
|
|
|
|
|
|
|
4826
|
|
|
|
|
|
|
|
|
4827
|
|
|
|
|
|
|
|
|
4828
|
|
|
|
|
|
|
=for bad |
|
4829
|
|
|
|
|
|
|
|
|
4830
|
|
|
|
|
|
|
trtri ignores the bad-value flag of the input piddles. |
|
4831
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4832
|
|
|
|
|
|
|
|
|
4833
|
|
|
|
|
|
|
|
|
4834
|
|
|
|
|
|
|
=cut |
|
4835
|
|
|
|
|
|
|
|
|
4836
|
|
|
|
|
|
|
|
|
4837
|
|
|
|
|
|
|
|
|
4838
|
|
|
|
|
|
|
|
|
4839
|
|
|
|
|
|
|
|
|
4840
|
|
|
|
|
|
|
|
|
4841
|
|
|
|
|
|
|
*trtri = \&PDL::trtri; |
|
4842
|
|
|
|
|
|
|
|
|
4843
|
|
|
|
|
|
|
|
|
4844
|
|
|
|
|
|
|
|
|
4845
|
|
|
|
|
|
|
|
|
4846
|
|
|
|
|
|
|
|
|
4847
|
|
|
|
|
|
|
=head2 trti2 |
|
4848
|
|
|
|
|
|
|
|
|
4849
|
|
|
|
|
|
|
=for sig |
|
4850
|
|
|
|
|
|
|
|
|
4851
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int uplo(); int diag(); int [o,phys]info()) |
|
4852
|
|
|
|
|
|
|
|
|
4853
|
|
|
|
|
|
|
|
|
4854
|
|
|
|
|
|
|
|
|
4855
|
|
|
|
|
|
|
=for ref |
|
4856
|
|
|
|
|
|
|
|
|
4857
|
|
|
|
|
|
|
Computes the inverse of a real upper or lower triangular |
|
4858
|
|
|
|
|
|
|
matrix A. |
|
4859
|
|
|
|
|
|
|
|
|
4860
|
|
|
|
|
|
|
This is the Level 2 BLAS version of the algorithm. |
|
4861
|
|
|
|
|
|
|
|
|
4862
|
|
|
|
|
|
|
Arguments |
|
4863
|
|
|
|
|
|
|
========= |
|
4864
|
|
|
|
|
|
|
|
|
4865
|
|
|
|
|
|
|
uplo: = 0: A is upper triangular; |
|
4866
|
|
|
|
|
|
|
= 1: A is lower triangular. |
|
4867
|
|
|
|
|
|
|
|
|
4868
|
|
|
|
|
|
|
diag: = 0: A is non-unit triangular; |
|
4869
|
|
|
|
|
|
|
= 1: A is unit triangular. |
|
4870
|
|
|
|
|
|
|
|
|
4871
|
|
|
|
|
|
|
A: On entry, the triangular matrix A. If uplo = 0, the |
|
4872
|
|
|
|
|
|
|
leading N-by-N upper triangular part of the array A contains |
|
4873
|
|
|
|
|
|
|
the upper triangular matrix, and the strictly lower |
|
4874
|
|
|
|
|
|
|
triangular part of A is not referenced. If uplo = 1, the |
|
4875
|
|
|
|
|
|
|
leading N-by-N lower triangular part of the array A contains |
|
4876
|
|
|
|
|
|
|
the lower triangular matrix, and the strictly upper |
|
4877
|
|
|
|
|
|
|
triangular part of A is not referenced. If diag = 1, the |
|
4878
|
|
|
|
|
|
|
diagonal elements of A are also not referenced and are |
|
4879
|
|
|
|
|
|
|
assumed to be 1. |
|
4880
|
|
|
|
|
|
|
On exit, the (triangular) inverse of the original matrix, in |
|
4881
|
|
|
|
|
|
|
the same storage format. |
|
4882
|
|
|
|
|
|
|
|
|
4883
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4884
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4885
|
|
|
|
|
|
|
|
|
4886
|
|
|
|
|
|
|
=for example |
|
4887
|
|
|
|
|
|
|
|
|
4888
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
4889
|
|
|
|
|
|
|
# assume $a is upper triangular |
|
4890
|
|
|
|
|
|
|
trtri2($a, 1, ($info=null)); |
|
4891
|
|
|
|
|
|
|
print "Inverse of \$a is :\n transpose($a)" unless $info; |
|
4892
|
|
|
|
|
|
|
|
|
4893
|
|
|
|
|
|
|
|
|
4894
|
|
|
|
|
|
|
|
|
4895
|
|
|
|
|
|
|
=for bad |
|
4896
|
|
|
|
|
|
|
|
|
4897
|
|
|
|
|
|
|
trti2 ignores the bad-value flag of the input piddles. |
|
4898
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4899
|
|
|
|
|
|
|
|
|
4900
|
|
|
|
|
|
|
|
|
4901
|
|
|
|
|
|
|
=cut |
|
4902
|
|
|
|
|
|
|
|
|
4903
|
|
|
|
|
|
|
|
|
4904
|
|
|
|
|
|
|
|
|
4905
|
|
|
|
|
|
|
|
|
4906
|
|
|
|
|
|
|
|
|
4907
|
|
|
|
|
|
|
|
|
4908
|
|
|
|
|
|
|
*trti2 = \&PDL::trti2; |
|
4909
|
|
|
|
|
|
|
|
|
4910
|
|
|
|
|
|
|
|
|
4911
|
|
|
|
|
|
|
|
|
4912
|
|
|
|
|
|
|
|
|
4913
|
|
|
|
|
|
|
|
|
4914
|
|
|
|
|
|
|
=head2 getrs |
|
4915
|
|
|
|
|
|
|
|
|
4916
|
|
|
|
|
|
|
=for sig |
|
4917
|
|
|
|
|
|
|
|
|
4918
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int trans(); [io,phys]B(n,m); int [phys]ipiv(n); int [o,phys]info()) |
|
4919
|
|
|
|
|
|
|
|
|
4920
|
|
|
|
|
|
|
|
|
4921
|
|
|
|
|
|
|
|
|
4922
|
|
|
|
|
|
|
=for ref |
|
4923
|
|
|
|
|
|
|
|
|
4924
|
|
|
|
|
|
|
Solves a system of linear equations |
|
4925
|
|
|
|
|
|
|
|
|
4926
|
|
|
|
|
|
|
A * X = B or A' * X = B |
|
4927
|
|
|
|
|
|
|
|
|
4928
|
|
|
|
|
|
|
with a general N-by-N matrix A using the LU factorization computed |
|
4929
|
|
|
|
|
|
|
by getrf. |
|
4930
|
|
|
|
|
|
|
|
|
4931
|
|
|
|
|
|
|
Arguments |
|
4932
|
|
|
|
|
|
|
========= |
|
4933
|
|
|
|
|
|
|
|
|
4934
|
|
|
|
|
|
|
trans: Specifies the form of the system of equations: |
|
4935
|
|
|
|
|
|
|
= 0: A * X = B (No transpose) |
|
4936
|
|
|
|
|
|
|
= 1: A'* X = B (Transpose) |
|
4937
|
|
|
|
|
|
|
|
|
4938
|
|
|
|
|
|
|
A: The factors L and U from the factorization A = P*L*U |
|
4939
|
|
|
|
|
|
|
as computed by getrf. |
|
4940
|
|
|
|
|
|
|
|
|
4941
|
|
|
|
|
|
|
ipiv: The pivot indices from getrf; for 1<=i<=N, row i of the |
|
4942
|
|
|
|
|
|
|
matrix was interchanged with row ipiv(i). |
|
4943
|
|
|
|
|
|
|
|
|
4944
|
|
|
|
|
|
|
B: On entry, the right hand side matrix B. |
|
4945
|
|
|
|
|
|
|
On exit, the solution matrix X. |
|
4946
|
|
|
|
|
|
|
|
|
4947
|
|
|
|
|
|
|
info: = 0: successful exit |
|
4948
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
4949
|
|
|
|
|
|
|
|
|
4950
|
|
|
|
|
|
|
=for example |
|
4951
|
|
|
|
|
|
|
|
|
4952
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
4953
|
|
|
|
|
|
|
$ipiv = zeroes(long, 100); |
|
4954
|
|
|
|
|
|
|
$b = random(100,50); |
|
4955
|
|
|
|
|
|
|
getrf($a, $ipiv, ($info=null)); |
|
4956
|
|
|
|
|
|
|
if ($info == 0){ |
|
4957
|
|
|
|
|
|
|
getrs($a, 0, $b, $ipiv, $info); |
|
4958
|
|
|
|
|
|
|
} |
|
4959
|
|
|
|
|
|
|
print "X is :\n $b" unless $info; |
|
4960
|
|
|
|
|
|
|
|
|
4961
|
|
|
|
|
|
|
|
|
4962
|
|
|
|
|
|
|
|
|
4963
|
|
|
|
|
|
|
=for bad |
|
4964
|
|
|
|
|
|
|
|
|
4965
|
|
|
|
|
|
|
getrs ignores the bad-value flag of the input piddles. |
|
4966
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
4967
|
|
|
|
|
|
|
|
|
4968
|
|
|
|
|
|
|
|
|
4969
|
|
|
|
|
|
|
=cut |
|
4970
|
|
|
|
|
|
|
|
|
4971
|
|
|
|
|
|
|
|
|
4972
|
|
|
|
|
|
|
|
|
4973
|
|
|
|
|
|
|
|
|
4974
|
|
|
|
|
|
|
|
|
4975
|
|
|
|
|
|
|
|
|
4976
|
|
|
|
|
|
|
*getrs = \&PDL::getrs; |
|
4977
|
|
|
|
|
|
|
|
|
4978
|
|
|
|
|
|
|
|
|
4979
|
|
|
|
|
|
|
|
|
4980
|
|
|
|
|
|
|
|
|
4981
|
|
|
|
|
|
|
|
|
4982
|
|
|
|
|
|
|
=head2 sytrs |
|
4983
|
|
|
|
|
|
|
|
|
4984
|
|
|
|
|
|
|
=for sig |
|
4985
|
|
|
|
|
|
|
|
|
4986
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo();[io,phys]B(n,m); int [phys]ipiv(n); int [o,phys]info()) |
|
4987
|
|
|
|
|
|
|
|
|
4988
|
|
|
|
|
|
|
|
|
4989
|
|
|
|
|
|
|
|
|
4990
|
|
|
|
|
|
|
=for ref |
|
4991
|
|
|
|
|
|
|
|
|
4992
|
|
|
|
|
|
|
Solves a system of linear equations A*X = B with a real |
|
4993
|
|
|
|
|
|
|
symmetric matrix A using the factorization A = U*D*U' or |
|
4994
|
|
|
|
|
|
|
A = L*D*L' computed by C. |
|
4995
|
|
|
|
|
|
|
|
|
4996
|
|
|
|
|
|
|
Arguments |
|
4997
|
|
|
|
|
|
|
========= |
|
4998
|
|
|
|
|
|
|
|
|
4999
|
|
|
|
|
|
|
uplo: Specifies whether the details of the factorization are stored |
|
5000
|
|
|
|
|
|
|
as an upper or lower triangular matrix. |
|
5001
|
|
|
|
|
|
|
= 0: Upper triangular, form is A = U*D*U'; |
|
5002
|
|
|
|
|
|
|
= 1: Lower triangular, form is A = L*D*L'. |
|
5003
|
|
|
|
|
|
|
|
|
5004
|
|
|
|
|
|
|
A: The block diagonal matrix D and the multipliers used to |
|
5005
|
|
|
|
|
|
|
obtain the factor U or L as computed by sytrf. |
|
5006
|
|
|
|
|
|
|
|
|
5007
|
|
|
|
|
|
|
ipiv: Details of the interchanges and the block structure of D |
|
5008
|
|
|
|
|
|
|
as determined by sytrf. |
|
5009
|
|
|
|
|
|
|
|
|
5010
|
|
|
|
|
|
|
B: On entry, the right hand side matrix B. |
|
5011
|
|
|
|
|
|
|
On exit, the solution matrix X. |
|
5012
|
|
|
|
|
|
|
|
|
5013
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5014
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5015
|
|
|
|
|
|
|
|
|
5016
|
|
|
|
|
|
|
=for example |
|
5017
|
|
|
|
|
|
|
|
|
5018
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5019
|
|
|
|
|
|
|
$b = random(50,100); |
|
5020
|
|
|
|
|
|
|
$a = transpose($a); |
|
5021
|
|
|
|
|
|
|
$b = transpose($b); |
|
5022
|
|
|
|
|
|
|
# Assume $a is symmetric |
|
5023
|
|
|
|
|
|
|
sytrf($a, 0, ($ipiv=zeroes(100)), ($info=null)); |
|
5024
|
|
|
|
|
|
|
if ($info == 0){ |
|
5025
|
|
|
|
|
|
|
sytrs($a, 0, $b, $ipiv, $info); |
|
5026
|
|
|
|
|
|
|
} |
|
5027
|
|
|
|
|
|
|
print("X is :\n".transpose($b))unless $info; |
|
5028
|
|
|
|
|
|
|
|
|
5029
|
|
|
|
|
|
|
|
|
5030
|
|
|
|
|
|
|
|
|
5031
|
|
|
|
|
|
|
=for bad |
|
5032
|
|
|
|
|
|
|
|
|
5033
|
|
|
|
|
|
|
sytrs ignores the bad-value flag of the input piddles. |
|
5034
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5035
|
|
|
|
|
|
|
|
|
5036
|
|
|
|
|
|
|
|
|
5037
|
|
|
|
|
|
|
=cut |
|
5038
|
|
|
|
|
|
|
|
|
5039
|
|
|
|
|
|
|
|
|
5040
|
|
|
|
|
|
|
|
|
5041
|
|
|
|
|
|
|
|
|
5042
|
|
|
|
|
|
|
|
|
5043
|
|
|
|
|
|
|
|
|
5044
|
|
|
|
|
|
|
*sytrs = \&PDL::sytrs; |
|
5045
|
|
|
|
|
|
|
|
|
5046
|
|
|
|
|
|
|
|
|
5047
|
|
|
|
|
|
|
|
|
5048
|
|
|
|
|
|
|
|
|
5049
|
|
|
|
|
|
|
|
|
5050
|
|
|
|
|
|
|
=head2 potrs |
|
5051
|
|
|
|
|
|
|
|
|
5052
|
|
|
|
|
|
|
=for sig |
|
5053
|
|
|
|
|
|
|
|
|
5054
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); [io,phys]B(n,m); int [o,phys]info()) |
|
5055
|
|
|
|
|
|
|
|
|
5056
|
|
|
|
|
|
|
|
|
5057
|
|
|
|
|
|
|
|
|
5058
|
|
|
|
|
|
|
=for ref |
|
5059
|
|
|
|
|
|
|
|
|
5060
|
|
|
|
|
|
|
Solves a system of linear equations A*X = B with a symmetric |
|
5061
|
|
|
|
|
|
|
positive definite matrix A using the Cholesky factorization |
|
5062
|
|
|
|
|
|
|
A = U'*U or A = L*L' computed by C. |
|
5063
|
|
|
|
|
|
|
|
|
5064
|
|
|
|
|
|
|
Arguments |
|
5065
|
|
|
|
|
|
|
========= |
|
5066
|
|
|
|
|
|
|
|
|
5067
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
5068
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
5069
|
|
|
|
|
|
|
|
|
5070
|
|
|
|
|
|
|
A: The triangular factor U or L from the Cholesky factorization |
|
5071
|
|
|
|
|
|
|
A = U'*U or A = L*L', as computed by potrf. |
|
5072
|
|
|
|
|
|
|
|
|
5073
|
|
|
|
|
|
|
B: On entry, the right hand side matrix B. |
|
5074
|
|
|
|
|
|
|
On exit, the solution matrix X. |
|
5075
|
|
|
|
|
|
|
|
|
5076
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5077
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5078
|
|
|
|
|
|
|
|
|
5079
|
|
|
|
|
|
|
=for example |
|
5080
|
|
|
|
|
|
|
|
|
5081
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5082
|
|
|
|
|
|
|
$b = random(50,100); |
|
5083
|
|
|
|
|
|
|
$a = transpose($a); |
|
5084
|
|
|
|
|
|
|
$b = transpose($b); |
|
5085
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite |
|
5086
|
|
|
|
|
|
|
potrf($a, 0, ($info=null)); |
|
5087
|
|
|
|
|
|
|
if ($info == 0){ |
|
5088
|
|
|
|
|
|
|
potrs($a, 0, $b, $info); |
|
5089
|
|
|
|
|
|
|
} |
|
5090
|
|
|
|
|
|
|
print("X is :\n".transpose($b))unless $info; |
|
5091
|
|
|
|
|
|
|
|
|
5092
|
|
|
|
|
|
|
|
|
5093
|
|
|
|
|
|
|
|
|
5094
|
|
|
|
|
|
|
=for bad |
|
5095
|
|
|
|
|
|
|
|
|
5096
|
|
|
|
|
|
|
potrs ignores the bad-value flag of the input piddles. |
|
5097
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5098
|
|
|
|
|
|
|
|
|
5099
|
|
|
|
|
|
|
|
|
5100
|
|
|
|
|
|
|
=cut |
|
5101
|
|
|
|
|
|
|
|
|
5102
|
|
|
|
|
|
|
|
|
5103
|
|
|
|
|
|
|
|
|
5104
|
|
|
|
|
|
|
|
|
5105
|
|
|
|
|
|
|
|
|
5106
|
|
|
|
|
|
|
|
|
5107
|
|
|
|
|
|
|
*potrs = \&PDL::potrs; |
|
5108
|
|
|
|
|
|
|
|
|
5109
|
|
|
|
|
|
|
|
|
5110
|
|
|
|
|
|
|
|
|
5111
|
|
|
|
|
|
|
|
|
5112
|
|
|
|
|
|
|
|
|
5113
|
|
|
|
|
|
|
=head2 trtrs |
|
5114
|
|
|
|
|
|
|
|
|
5115
|
|
|
|
|
|
|
=for sig |
|
5116
|
|
|
|
|
|
|
|
|
5117
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); int trans(); int diag();[io,phys]B(n,m); int [o,phys]info()) |
|
5118
|
|
|
|
|
|
|
|
|
5119
|
|
|
|
|
|
|
|
|
5120
|
|
|
|
|
|
|
|
|
5121
|
|
|
|
|
|
|
=for ref |
|
5122
|
|
|
|
|
|
|
|
|
5123
|
|
|
|
|
|
|
Solves a triangular system of the form |
|
5124
|
|
|
|
|
|
|
|
|
5125
|
|
|
|
|
|
|
A * X = B or A' * X = B, |
|
5126
|
|
|
|
|
|
|
|
|
5127
|
|
|
|
|
|
|
where A is a triangular matrix of order N, and B is an N-by-NRHS |
|
5128
|
|
|
|
|
|
|
matrix. |
|
5129
|
|
|
|
|
|
|
|
|
5130
|
|
|
|
|
|
|
A check is made to verify that A is nonsingular. |
|
5131
|
|
|
|
|
|
|
|
|
5132
|
|
|
|
|
|
|
Arguments |
|
5133
|
|
|
|
|
|
|
========= |
|
5134
|
|
|
|
|
|
|
|
|
5135
|
|
|
|
|
|
|
uplo: = 0: A is upper triangular; |
|
5136
|
|
|
|
|
|
|
= 1: A is lower triangular. |
|
5137
|
|
|
|
|
|
|
|
|
5138
|
|
|
|
|
|
|
trans: Specifies the form of the system of equations: |
|
5139
|
|
|
|
|
|
|
= 0: A * X = B (No transpose) |
|
5140
|
|
|
|
|
|
|
= 1: A**T * X = B (Transpose) |
|
5141
|
|
|
|
|
|
|
|
|
5142
|
|
|
|
|
|
|
diag: = 0: A is non-unit triangular; |
|
5143
|
|
|
|
|
|
|
= 1: A is unit triangular. |
|
5144
|
|
|
|
|
|
|
|
|
5145
|
|
|
|
|
|
|
A: The triangular matrix A. If uplo = 0, the leading N-by-N |
|
5146
|
|
|
|
|
|
|
upper triangular part of the array A contains the upper |
|
5147
|
|
|
|
|
|
|
triangular matrix, and the strictly lower triangular part of |
|
5148
|
|
|
|
|
|
|
A is not referenced. If uplo = 1, the leading N-by-N lower |
|
5149
|
|
|
|
|
|
|
triangular part of the array A contains the lower triangular |
|
5150
|
|
|
|
|
|
|
matrix, and the strictly upper triangular part of A is not |
|
5151
|
|
|
|
|
|
|
referenced. If diag = 1, the diagonal elements of A are |
|
5152
|
|
|
|
|
|
|
also not referenced and are assumed to be 1. |
|
5153
|
|
|
|
|
|
|
|
|
5154
|
|
|
|
|
|
|
B: On entry, the right hand side matrix B. |
|
5155
|
|
|
|
|
|
|
On exit, if info = 0, the solution matrix X. |
|
5156
|
|
|
|
|
|
|
|
|
5157
|
|
|
|
|
|
|
info = 0: successful exit |
|
5158
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5159
|
|
|
|
|
|
|
> 0: if info = i, the i-th diagonal element of A is zero, |
|
5160
|
|
|
|
|
|
|
indicating that the matrix is singular and the solutions |
|
5161
|
|
|
|
|
|
|
X have not been computed. |
|
5162
|
|
|
|
|
|
|
|
|
5163
|
|
|
|
|
|
|
=for example |
|
5164
|
|
|
|
|
|
|
|
|
5165
|
|
|
|
|
|
|
# Assume $a is upper triangular |
|
5166
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5167
|
|
|
|
|
|
|
$b = random(50,100); |
|
5168
|
|
|
|
|
|
|
$a = transpose($a); |
|
5169
|
|
|
|
|
|
|
$b = transpose($b); |
|
5170
|
|
|
|
|
|
|
$info = null; |
|
5171
|
|
|
|
|
|
|
trtrs($a, 0, 0, 0, $b, $info); |
|
5172
|
|
|
|
|
|
|
print("X is :\n".transpose($b))unless $info; |
|
5173
|
|
|
|
|
|
|
|
|
5174
|
|
|
|
|
|
|
|
|
5175
|
|
|
|
|
|
|
|
|
5176
|
|
|
|
|
|
|
=for bad |
|
5177
|
|
|
|
|
|
|
|
|
5178
|
|
|
|
|
|
|
trtrs ignores the bad-value flag of the input piddles. |
|
5179
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5180
|
|
|
|
|
|
|
|
|
5181
|
|
|
|
|
|
|
|
|
5182
|
|
|
|
|
|
|
=cut |
|
5183
|
|
|
|
|
|
|
|
|
5184
|
|
|
|
|
|
|
|
|
5185
|
|
|
|
|
|
|
|
|
5186
|
|
|
|
|
|
|
|
|
5187
|
|
|
|
|
|
|
|
|
5188
|
|
|
|
|
|
|
|
|
5189
|
|
|
|
|
|
|
*trtrs = \&PDL::trtrs; |
|
5190
|
|
|
|
|
|
|
|
|
5191
|
|
|
|
|
|
|
|
|
5192
|
|
|
|
|
|
|
|
|
5193
|
|
|
|
|
|
|
|
|
5194
|
|
|
|
|
|
|
|
|
5195
|
|
|
|
|
|
|
=head2 latrs |
|
5196
|
|
|
|
|
|
|
|
|
5197
|
|
|
|
|
|
|
=for sig |
|
5198
|
|
|
|
|
|
|
|
|
5199
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); int trans(); int diag(); int normin();[io,phys]x(n); [o,phys]scale();[io,phys]cnorm(n);int [o,phys]info()) |
|
5200
|
|
|
|
|
|
|
|
|
5201
|
|
|
|
|
|
|
|
|
5202
|
|
|
|
|
|
|
|
|
5203
|
|
|
|
|
|
|
=for ref |
|
5204
|
|
|
|
|
|
|
|
|
5205
|
|
|
|
|
|
|
Solves one of the triangular systems |
|
5206
|
|
|
|
|
|
|
|
|
5207
|
|
|
|
|
|
|
A *x = s*b or A'*x = s*b |
|
5208
|
|
|
|
|
|
|
|
|
5209
|
|
|
|
|
|
|
with scaling to prevent overflow. Here A is an upper or lower |
|
5210
|
|
|
|
|
|
|
triangular matrix, A' denotes the transpose of A, x and b are |
|
5211
|
|
|
|
|
|
|
n-element vectors, and s is a scaling factor, usually less than |
|
5212
|
|
|
|
|
|
|
or equal to 1, chosen so that the components of x will be less than |
|
5213
|
|
|
|
|
|
|
the overflow threshold. If the unscaled problem will not cause |
|
5214
|
|
|
|
|
|
|
overflow, the Level 2 BLAS routine C is called. If the matrix A |
|
5215
|
|
|
|
|
|
|
is singular (A(j,j) = 0 for some j), then s is set to 0 and a |
|
5216
|
|
|
|
|
|
|
non-trivial solution to A*x = 0 is returned. |
|
5217
|
|
|
|
|
|
|
|
|
5218
|
|
|
|
|
|
|
Further Details |
|
5219
|
|
|
|
|
|
|
======= ======= |
|
5220
|
|
|
|
|
|
|
|
|
5221
|
|
|
|
|
|
|
A rough bound on x is computed; if that is less than overflow, trsv |
|
5222
|
|
|
|
|
|
|
is called, otherwise, specific code is used which checks for possible |
|
5223
|
|
|
|
|
|
|
overflow or divide-by-zero at every operation. |
|
5224
|
|
|
|
|
|
|
|
|
5225
|
|
|
|
|
|
|
A columnwise scheme is used for solving A*x = b. The basic algorithm |
|
5226
|
|
|
|
|
|
|
if A is lower triangular is |
|
5227
|
|
|
|
|
|
|
|
|
5228
|
|
|
|
|
|
|
x[1:n] := b[1:n] |
|
5229
|
|
|
|
|
|
|
for j = 1, ..., n |
|
5230
|
|
|
|
|
|
|
x(j) := x(j) / A(j,j) |
|
5231
|
|
|
|
|
|
|
x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j] |
|
5232
|
|
|
|
|
|
|
end |
|
5233
|
|
|
|
|
|
|
|
|
5234
|
|
|
|
|
|
|
Define bounds on the components of x after j iterations of the loop: |
|
5235
|
|
|
|
|
|
|
|
|
5236
|
|
|
|
|
|
|
M(j) = bound on x[1:j] |
|
5237
|
|
|
|
|
|
|
G(j) = bound on x[j+1:n] |
|
5238
|
|
|
|
|
|
|
|
|
5239
|
|
|
|
|
|
|
Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}. |
|
5240
|
|
|
|
|
|
|
|
|
5241
|
|
|
|
|
|
|
Then for iteration j+1 we have |
|
5242
|
|
|
|
|
|
|
M(j+1) <= G(j) / | A(j+1,j+1) | |
|
5243
|
|
|
|
|
|
|
G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] | |
|
5244
|
|
|
|
|
|
|
<= G(j) ( 1 + cnorm(j+1) / | A(j+1,j+1) | ) |
|
5245
|
|
|
|
|
|
|
|
|
5246
|
|
|
|
|
|
|
where cnorm(j+1) is greater than or equal to the infinity-norm of |
|
5247
|
|
|
|
|
|
|
column j+1 of A, not counting the diagonal. |
|
5248
|
|
|
|
|
|
|
|
|
5249
|
|
|
|
|
|
|
Hence |
|
5250
|
|
|
|
|
|
|
|
|
5251
|
|
|
|
|
|
|
G(j) <= G(0) product ( 1 + cnorm(i) / | A(i,i) | ) |
|
5252
|
|
|
|
|
|
|
1<=i<=j |
|
5253
|
|
|
|
|
|
|
and |
|
5254
|
|
|
|
|
|
|
|
|
5255
|
|
|
|
|
|
|
|x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + cnorm(i) / |A(i,i)| ) |
|
5256
|
|
|
|
|
|
|
1<=i< j |
|
5257
|
|
|
|
|
|
|
|
|
5258
|
|
|
|
|
|
|
Since |x(j)| <= M(j), we use the Level 2 BLAS routine DTRSV if the |
|
5259
|
|
|
|
|
|
|
reciprocal of the largest M(j), j=1,..,n, is larger than |
|
5260
|
|
|
|
|
|
|
max(underflow, 1/overflow). |
|
5261
|
|
|
|
|
|
|
|
|
5262
|
|
|
|
|
|
|
The bound on x(j) is also used to determine when a step in the |
|
5263
|
|
|
|
|
|
|
columnwise method can be performed without fear of overflow. If |
|
5264
|
|
|
|
|
|
|
the computed bound is greater than a large constant, x is scaled to |
|
5265
|
|
|
|
|
|
|
prevent overflow, but if the bound overflows, x is set to 0, x(j) to |
|
5266
|
|
|
|
|
|
|
1, and scale to 0, and a non-trivial solution to A*x = 0 is found. |
|
5267
|
|
|
|
|
|
|
|
|
5268
|
|
|
|
|
|
|
Similarly, a row-wise scheme is used to solve A'*x = b. The basic |
|
5269
|
|
|
|
|
|
|
algorithm for A upper triangular is |
|
5270
|
|
|
|
|
|
|
|
|
5271
|
|
|
|
|
|
|
for j = 1, ..., n |
|
5272
|
|
|
|
|
|
|
x(j) := ( b(j) - A[1:j-1,j]' * x[1:j-1] ) / A(j,j) |
|
5273
|
|
|
|
|
|
|
end |
|
5274
|
|
|
|
|
|
|
|
|
5275
|
|
|
|
|
|
|
We simultaneously compute two bounds |
|
5276
|
|
|
|
|
|
|
|
|
5277
|
|
|
|
|
|
|
G(j) = bound on ( b(i) - A[1:i-1,i]' * x[1:i-1] ), 1<=i<=j |
|
5278
|
|
|
|
|
|
|
M(j) = bound on x(i), 1<=i<=j |
|
5279
|
|
|
|
|
|
|
|
|
5280
|
|
|
|
|
|
|
The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we |
|
5281
|
|
|
|
|
|
|
add the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1. |
|
5282
|
|
|
|
|
|
|
Then the bound on x(j) is |
|
5283
|
|
|
|
|
|
|
|
|
5284
|
|
|
|
|
|
|
M(j) <= M(j-1) * ( 1 + cnorm(j) ) / | A(j,j) | |
|
5285
|
|
|
|
|
|
|
|
|
5286
|
|
|
|
|
|
|
<= M(0) * product ( ( 1 + cnorm(i) ) / |A(i,i)| ) |
|
5287
|
|
|
|
|
|
|
1<=i<=j |
|
5288
|
|
|
|
|
|
|
|
|
5289
|
|
|
|
|
|
|
and we can safely call trsv if 1/M(n) and 1/G(n) are both greater |
|
5290
|
|
|
|
|
|
|
than max(underflow, 1/overflow). |
|
5291
|
|
|
|
|
|
|
|
|
5292
|
|
|
|
|
|
|
Arguments |
|
5293
|
|
|
|
|
|
|
========= |
|
5294
|
|
|
|
|
|
|
|
|
5295
|
|
|
|
|
|
|
uplo: Specifies whether the matrix A is upper or lower triangular. |
|
5296
|
|
|
|
|
|
|
= 0: Upper triangular |
|
5297
|
|
|
|
|
|
|
= 1: Lower triangular |
|
5298
|
|
|
|
|
|
|
|
|
5299
|
|
|
|
|
|
|
trans: Specifies the operation applied to A. |
|
5300
|
|
|
|
|
|
|
= 0: Solve A * x = s*b (No transpose) |
|
5301
|
|
|
|
|
|
|
= 1: Solve A'* x = s*b (Transpose) |
|
5302
|
|
|
|
|
|
|
|
|
5303
|
|
|
|
|
|
|
diag: Specifies whether or not the matrix A is unit triangular. |
|
5304
|
|
|
|
|
|
|
= 0: Non-unit triangular |
|
5305
|
|
|
|
|
|
|
= 1: Unit triangular |
|
5306
|
|
|
|
|
|
|
|
|
5307
|
|
|
|
|
|
|
normin: Specifies whether cnorm has been set or not. |
|
5308
|
|
|
|
|
|
|
= 1: cnorm contains the column norms on entry |
|
5309
|
|
|
|
|
|
|
= 0: cnorm is not set on entry. On exit, the norms will |
|
5310
|
|
|
|
|
|
|
be computed and stored in cnorm. |
|
5311
|
|
|
|
|
|
|
|
|
5312
|
|
|
|
|
|
|
A: The triangular matrix A. If uplo = 0, the leading n by n |
|
5313
|
|
|
|
|
|
|
upper triangular part of the array A contains the upper |
|
5314
|
|
|
|
|
|
|
triangular matrix, and the strictly lower triangular part of |
|
5315
|
|
|
|
|
|
|
A is not referenced. If uplo = 1, the leading n by n lower |
|
5316
|
|
|
|
|
|
|
triangular part of the array A contains the lower triangular |
|
5317
|
|
|
|
|
|
|
matrix, and the strictly upper triangular part of A is not |
|
5318
|
|
|
|
|
|
|
referenced. If diag = 1, the diagonal elements of A are |
|
5319
|
|
|
|
|
|
|
also not referenced and are assumed to be 1. |
|
5320
|
|
|
|
|
|
|
|
|
5321
|
|
|
|
|
|
|
x: On entry, the right hand side b of the triangular system. |
|
5322
|
|
|
|
|
|
|
On exit, x is overwritten by the solution vector x. |
|
5323
|
|
|
|
|
|
|
|
|
5324
|
|
|
|
|
|
|
scale: The scaling factor s for the triangular system |
|
5325
|
|
|
|
|
|
|
A * x = s*b or A'* x = s*b. |
|
5326
|
|
|
|
|
|
|
If scale = 0, the matrix A is singular or badly scaled, and |
|
5327
|
|
|
|
|
|
|
the vector x is an exact or approximate solution to A*x = 0. |
|
5328
|
|
|
|
|
|
|
|
|
5329
|
|
|
|
|
|
|
cnorm: If normin = 0, cnorm is an output argument and cnorm(j) |
|
5330
|
|
|
|
|
|
|
returns the 1-norm of the offdiagonal part of the j-th column |
|
5331
|
|
|
|
|
|
|
of A. |
|
5332
|
|
|
|
|
|
|
If normin = 1, cnorm is an input argument and cnorm(j) |
|
5333
|
|
|
|
|
|
|
contains the norm of the off-diagonal part of the j-th column |
|
5334
|
|
|
|
|
|
|
of A. If trans = 0, cnorm(j) must be greater than or equal |
|
5335
|
|
|
|
|
|
|
to the infinity-norm, and if trans = 1, cnorm(j) |
|
5336
|
|
|
|
|
|
|
must be greater than or equal to the 1-norm. |
|
5337
|
|
|
|
|
|
|
|
|
5338
|
|
|
|
|
|
|
|
|
5339
|
|
|
|
|
|
|
|
|
5340
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5341
|
|
|
|
|
|
|
< 0: if info = -k, the k-th argument had an illegal value |
|
5342
|
|
|
|
|
|
|
|
|
5343
|
|
|
|
|
|
|
|
|
5344
|
|
|
|
|
|
|
=for example |
|
5345
|
|
|
|
|
|
|
|
|
5346
|
|
|
|
|
|
|
# Assume $a is upper triangular |
|
5347
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5348
|
|
|
|
|
|
|
$b = random(100); |
|
5349
|
|
|
|
|
|
|
$a = transpose($a); |
|
5350
|
|
|
|
|
|
|
$info = null; |
|
5351
|
|
|
|
|
|
|
$scale= null; |
|
5352
|
|
|
|
|
|
|
$cnorm = zeroes(100); |
|
5353
|
|
|
|
|
|
|
latrs($a, 0, 0, 0, 0,$b, $scale, $cnorm,$info); |
|
5354
|
|
|
|
|
|
|
|
|
5355
|
|
|
|
|
|
|
|
|
5356
|
|
|
|
|
|
|
|
|
5357
|
|
|
|
|
|
|
=for bad |
|
5358
|
|
|
|
|
|
|
|
|
5359
|
|
|
|
|
|
|
latrs ignores the bad-value flag of the input piddles. |
|
5360
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5361
|
|
|
|
|
|
|
|
|
5362
|
|
|
|
|
|
|
|
|
5363
|
|
|
|
|
|
|
=cut |
|
5364
|
|
|
|
|
|
|
|
|
5365
|
|
|
|
|
|
|
|
|
5366
|
|
|
|
|
|
|
|
|
5367
|
|
|
|
|
|
|
|
|
5368
|
|
|
|
|
|
|
|
|
5369
|
|
|
|
|
|
|
|
|
5370
|
|
|
|
|
|
|
*latrs = \&PDL::latrs; |
|
5371
|
|
|
|
|
|
|
|
|
5372
|
|
|
|
|
|
|
|
|
5373
|
|
|
|
|
|
|
|
|
5374
|
|
|
|
|
|
|
|
|
5375
|
|
|
|
|
|
|
|
|
5376
|
|
|
|
|
|
|
=head2 gecon |
|
5377
|
|
|
|
|
|
|
|
|
5378
|
|
|
|
|
|
|
=for sig |
|
5379
|
|
|
|
|
|
|
|
|
5380
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int norm(); [phys]anorm(); [o,phys]rcond();int [o,phys]info()) |
|
5381
|
|
|
|
|
|
|
|
|
5382
|
|
|
|
|
|
|
|
|
5383
|
|
|
|
|
|
|
|
|
5384
|
|
|
|
|
|
|
=for ref |
|
5385
|
|
|
|
|
|
|
|
|
5386
|
|
|
|
|
|
|
Estimates the reciprocal of the condition number of a general |
|
5387
|
|
|
|
|
|
|
real matrix A, in either the 1-norm or the infinity-norm, using |
|
5388
|
|
|
|
|
|
|
the LU factorization computed by C. |
|
5389
|
|
|
|
|
|
|
|
|
5390
|
|
|
|
|
|
|
An estimate is obtained for norm(inv(A)), and the reciprocal of the |
|
5391
|
|
|
|
|
|
|
condition number is computed as |
|
5392
|
|
|
|
|
|
|
|
|
5393
|
|
|
|
|
|
|
rcond = 1 / ( norm(A) * norm(inv(A)) ). |
|
5394
|
|
|
|
|
|
|
|
|
5395
|
|
|
|
|
|
|
Arguments |
|
5396
|
|
|
|
|
|
|
========= |
|
5397
|
|
|
|
|
|
|
|
|
5398
|
|
|
|
|
|
|
norm: Specifies whether the 1-norm condition number or the |
|
5399
|
|
|
|
|
|
|
infinity-norm condition number is required: |
|
5400
|
|
|
|
|
|
|
= 0: Infinity-norm. |
|
5401
|
|
|
|
|
|
|
= 1: 1-norm; |
|
5402
|
|
|
|
|
|
|
|
|
5403
|
|
|
|
|
|
|
A: The factors L and U from the factorization A = P*L*U |
|
5404
|
|
|
|
|
|
|
as computed by getrf. |
|
5405
|
|
|
|
|
|
|
|
|
5406
|
|
|
|
|
|
|
anorm: If norm = 0, the infinity-norm of the original matrix A. |
|
5407
|
|
|
|
|
|
|
If norm = 1, the 1-norm of the original matrix A. |
|
5408
|
|
|
|
|
|
|
|
|
5409
|
|
|
|
|
|
|
|
|
5410
|
|
|
|
|
|
|
rcond: The reciprocal of the condition number of the matrix A, |
|
5411
|
|
|
|
|
|
|
computed as rcond = 1/(norm(A) * norm(inv(A))). |
|
5412
|
|
|
|
|
|
|
|
|
5413
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5414
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5415
|
|
|
|
|
|
|
|
|
5416
|
|
|
|
|
|
|
|
|
5417
|
|
|
|
|
|
|
=for example |
|
5418
|
|
|
|
|
|
|
|
|
5419
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5420
|
|
|
|
|
|
|
$anorm = $a->lange(1); |
|
5421
|
|
|
|
|
|
|
$ipiv = zeroes(long, 100); |
|
5422
|
|
|
|
|
|
|
$info = null; |
|
5423
|
|
|
|
|
|
|
getrf($a, $ipiv, $info); |
|
5424
|
|
|
|
|
|
|
($rcond, $info) = gecon($a, 1, $anorm) unless $info != 0; |
|
5425
|
|
|
|
|
|
|
|
|
5426
|
|
|
|
|
|
|
|
|
5427
|
|
|
|
|
|
|
=for bad |
|
5428
|
|
|
|
|
|
|
|
|
5429
|
|
|
|
|
|
|
gecon ignores the bad-value flag of the input piddles. |
|
5430
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5431
|
|
|
|
|
|
|
|
|
5432
|
|
|
|
|
|
|
|
|
5433
|
|
|
|
|
|
|
=cut |
|
5434
|
|
|
|
|
|
|
|
|
5435
|
|
|
|
|
|
|
|
|
5436
|
|
|
|
|
|
|
|
|
5437
|
|
|
|
|
|
|
|
|
5438
|
|
|
|
|
|
|
|
|
5439
|
|
|
|
|
|
|
|
|
5440
|
|
|
|
|
|
|
*gecon = \&PDL::gecon; |
|
5441
|
|
|
|
|
|
|
|
|
5442
|
|
|
|
|
|
|
|
|
5443
|
|
|
|
|
|
|
|
|
5444
|
|
|
|
|
|
|
|
|
5445
|
|
|
|
|
|
|
|
|
5446
|
|
|
|
|
|
|
=head2 sycon |
|
5447
|
|
|
|
|
|
|
|
|
5448
|
|
|
|
|
|
|
=for sig |
|
5449
|
|
|
|
|
|
|
|
|
5450
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); int ipiv(n); [phys]anorm(); [o,phys]rcond();int [o,phys]info()) |
|
5451
|
|
|
|
|
|
|
|
|
5452
|
|
|
|
|
|
|
|
|
5453
|
|
|
|
|
|
|
|
|
5454
|
|
|
|
|
|
|
=for ref |
|
5455
|
|
|
|
|
|
|
|
|
5456
|
|
|
|
|
|
|
Estimates the reciprocal of the condition number (in the |
|
5457
|
|
|
|
|
|
|
1-norm) of a real symmetric matrix A using the factorization |
|
5458
|
|
|
|
|
|
|
A = U*D*U' or A = L*D*L' computed by C. |
|
5459
|
|
|
|
|
|
|
|
|
5460
|
|
|
|
|
|
|
An estimate is obtained for norm(inv(A)), and the reciprocal of the |
|
5461
|
|
|
|
|
|
|
condition number is computed as rcond = 1 / (anorm * norm(inv(A))). |
|
5462
|
|
|
|
|
|
|
|
|
5463
|
|
|
|
|
|
|
Arguments |
|
5464
|
|
|
|
|
|
|
========= |
|
5465
|
|
|
|
|
|
|
|
|
5466
|
|
|
|
|
|
|
uplo: Specifies whether the details of the factorization are stored |
|
5467
|
|
|
|
|
|
|
as an upper or lower triangular matrix. |
|
5468
|
|
|
|
|
|
|
= 0: Upper triangular, form is A = U*D*U'; |
|
5469
|
|
|
|
|
|
|
= 1: Lower triangular, form is A = L*D*L'. |
|
5470
|
|
|
|
|
|
|
|
|
5471
|
|
|
|
|
|
|
A: The block diagonal matrix D and the multipliers used to |
|
5472
|
|
|
|
|
|
|
obtain the factor U or L as computed by sytrf. |
|
5473
|
|
|
|
|
|
|
|
|
5474
|
|
|
|
|
|
|
ipiv: Details of the interchanges and the block structure of D |
|
5475
|
|
|
|
|
|
|
as determined by sytrf. |
|
5476
|
|
|
|
|
|
|
|
|
5477
|
|
|
|
|
|
|
anorm: The 1-norm of the original matrix A. |
|
5478
|
|
|
|
|
|
|
|
|
5479
|
|
|
|
|
|
|
rcond: The reciprocal of the condition number of the matrix A, |
|
5480
|
|
|
|
|
|
|
computed as rcond = 1/(anorm * aimvnm), where ainvnm is an |
|
5481
|
|
|
|
|
|
|
estimate of the 1-norm of inv(A) computed in this routine. |
|
5482
|
|
|
|
|
|
|
|
|
5483
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5484
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
5485
|
|
|
|
|
|
|
|
|
5486
|
|
|
|
|
|
|
|
|
5487
|
|
|
|
|
|
|
=for example |
|
5488
|
|
|
|
|
|
|
|
|
5489
|
|
|
|
|
|
|
# Assume $a is symmetric |
|
5490
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5491
|
|
|
|
|
|
|
$anorm = $a->lansy(1,1); |
|
5492
|
|
|
|
|
|
|
$ipiv = zeroes(long, 100); |
|
5493
|
|
|
|
|
|
|
$info = null; |
|
5494
|
|
|
|
|
|
|
sytrf($a, 1,$ipiv, $info); |
|
5495
|
|
|
|
|
|
|
($rcond, $info) = sycon($a, 1, $anorm) unless $info != 0; |
|
5496
|
|
|
|
|
|
|
|
|
5497
|
|
|
|
|
|
|
|
|
5498
|
|
|
|
|
|
|
=for bad |
|
5499
|
|
|
|
|
|
|
|
|
5500
|
|
|
|
|
|
|
sycon ignores the bad-value flag of the input piddles. |
|
5501
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5502
|
|
|
|
|
|
|
|
|
5503
|
|
|
|
|
|
|
|
|
5504
|
|
|
|
|
|
|
=cut |
|
5505
|
|
|
|
|
|
|
|
|
5506
|
|
|
|
|
|
|
|
|
5507
|
|
|
|
|
|
|
|
|
5508
|
|
|
|
|
|
|
|
|
5509
|
|
|
|
|
|
|
|
|
5510
|
|
|
|
|
|
|
|
|
5511
|
|
|
|
|
|
|
*sycon = \&PDL::sycon; |
|
5512
|
|
|
|
|
|
|
|
|
5513
|
|
|
|
|
|
|
|
|
5514
|
|
|
|
|
|
|
|
|
5515
|
|
|
|
|
|
|
|
|
5516
|
|
|
|
|
|
|
|
|
5517
|
|
|
|
|
|
|
=head2 pocon |
|
5518
|
|
|
|
|
|
|
|
|
5519
|
|
|
|
|
|
|
=for sig |
|
5520
|
|
|
|
|
|
|
|
|
5521
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); [phys]anorm(); [o,phys]rcond();int [o,phys]info()) |
|
5522
|
|
|
|
|
|
|
|
|
5523
|
|
|
|
|
|
|
|
|
5524
|
|
|
|
|
|
|
|
|
5525
|
|
|
|
|
|
|
=for ref |
|
5526
|
|
|
|
|
|
|
|
|
5527
|
|
|
|
|
|
|
Estimates the reciprocal of the condition number (in the |
|
5528
|
|
|
|
|
|
|
1-norm) of a real symmetric positive definite matrix using the |
|
5529
|
|
|
|
|
|
|
Cholesky factorization A = U'*U or A = L*L' computed by C. |
|
5530
|
|
|
|
|
|
|
|
|
5531
|
|
|
|
|
|
|
An estimate is obtained for norm(inv(A)), and the reciprocal of the |
|
5532
|
|
|
|
|
|
|
condition number is computed as rcond = 1 / (anorm * norm(inv(A))). |
|
5533
|
|
|
|
|
|
|
|
|
5534
|
|
|
|
|
|
|
Arguments |
|
5535
|
|
|
|
|
|
|
========= |
|
5536
|
|
|
|
|
|
|
|
|
5537
|
|
|
|
|
|
|
uplo: = 0: Upper triangle of A is stored; |
|
5538
|
|
|
|
|
|
|
= 1: Lower triangle of A is stored. |
|
5539
|
|
|
|
|
|
|
|
|
5540
|
|
|
|
|
|
|
A: The triangular factor U or L from the Cholesky factorization |
|
5541
|
|
|
|
|
|
|
A = U'*U or A = L*L', as computed by potrf. |
|
5542
|
|
|
|
|
|
|
|
|
5543
|
|
|
|
|
|
|
anorm: The 1-norm of the matrix A. |
|
5544
|
|
|
|
|
|
|
|
|
5545
|
|
|
|
|
|
|
rcond: The reciprocal of the condition number of the matrix A, |
|
5546
|
|
|
|
|
|
|
computed as rcond = 1/(anorm * ainvnm), where ainvnm is an |
|
5547
|
|
|
|
|
|
|
estimate of the 1-norm of inv(A) computed in this routine. |
|
5548
|
|
|
|
|
|
|
|
|
5549
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5550
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5551
|
|
|
|
|
|
|
|
|
5552
|
|
|
|
|
|
|
|
|
5553
|
|
|
|
|
|
|
=for example |
|
5554
|
|
|
|
|
|
|
|
|
5555
|
|
|
|
|
|
|
# Assume $a is symmetric positive definite |
|
5556
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5557
|
|
|
|
|
|
|
$anorm = $a->lansy(1,1); |
|
5558
|
|
|
|
|
|
|
$info = null; |
|
5559
|
|
|
|
|
|
|
potrf($a, 0, $info); |
|
5560
|
|
|
|
|
|
|
($rcond, $info) = pocon($a, 1, $anorm) unless $info != 0; |
|
5561
|
|
|
|
|
|
|
|
|
5562
|
|
|
|
|
|
|
|
|
5563
|
|
|
|
|
|
|
=for bad |
|
5564
|
|
|
|
|
|
|
|
|
5565
|
|
|
|
|
|
|
pocon ignores the bad-value flag of the input piddles. |
|
5566
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5567
|
|
|
|
|
|
|
|
|
5568
|
|
|
|
|
|
|
|
|
5569
|
|
|
|
|
|
|
=cut |
|
5570
|
|
|
|
|
|
|
|
|
5571
|
|
|
|
|
|
|
|
|
5572
|
|
|
|
|
|
|
|
|
5573
|
|
|
|
|
|
|
|
|
5574
|
|
|
|
|
|
|
|
|
5575
|
|
|
|
|
|
|
|
|
5576
|
|
|
|
|
|
|
*pocon = \&PDL::pocon; |
|
5577
|
|
|
|
|
|
|
|
|
5578
|
|
|
|
|
|
|
|
|
5579
|
|
|
|
|
|
|
|
|
5580
|
|
|
|
|
|
|
|
|
5581
|
|
|
|
|
|
|
|
|
5582
|
|
|
|
|
|
|
=head2 trcon |
|
5583
|
|
|
|
|
|
|
|
|
5584
|
|
|
|
|
|
|
=for sig |
|
5585
|
|
|
|
|
|
|
|
|
5586
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int norm();int uplo();int diag(); [o,phys]rcond();int [o,phys]info()) |
|
5587
|
|
|
|
|
|
|
|
|
5588
|
|
|
|
|
|
|
|
|
5589
|
|
|
|
|
|
|
|
|
5590
|
|
|
|
|
|
|
=for ref |
|
5591
|
|
|
|
|
|
|
|
|
5592
|
|
|
|
|
|
|
Estimates the reciprocal of the condition number of a |
|
5593
|
|
|
|
|
|
|
triangular matrix A, in either the 1-norm or the infinity-norm. |
|
5594
|
|
|
|
|
|
|
|
|
5595
|
|
|
|
|
|
|
The norm of A is computed and an estimate is obtained for |
|
5596
|
|
|
|
|
|
|
norm(inv(A)), then the reciprocal of the condition number is |
|
5597
|
|
|
|
|
|
|
computed as |
|
5598
|
|
|
|
|
|
|
|
|
5599
|
|
|
|
|
|
|
rcond = 1 / ( norm(A) * norm(inv(A)) ). |
|
5600
|
|
|
|
|
|
|
|
|
5601
|
|
|
|
|
|
|
Arguments |
|
5602
|
|
|
|
|
|
|
========= |
|
5603
|
|
|
|
|
|
|
|
|
5604
|
|
|
|
|
|
|
norm: Specifies whether the 1-norm condition number or the |
|
5605
|
|
|
|
|
|
|
infinity-norm condition number is required: |
|
5606
|
|
|
|
|
|
|
= 0: Infinity-norm. |
|
5607
|
|
|
|
|
|
|
= 1: 1-norm; |
|
5608
|
|
|
|
|
|
|
|
|
5609
|
|
|
|
|
|
|
|
|
5610
|
|
|
|
|
|
|
uplo: = 0: A is upper triangular; |
|
5611
|
|
|
|
|
|
|
= 1: A is lower triangular. |
|
5612
|
|
|
|
|
|
|
|
|
5613
|
|
|
|
|
|
|
diag: = 0: A is non-unit triangular; |
|
5614
|
|
|
|
|
|
|
= 1: A is unit triangular. |
|
5615
|
|
|
|
|
|
|
|
|
5616
|
|
|
|
|
|
|
A: The triangular matrix A. If uplo = 0, the leading N-by-N |
|
5617
|
|
|
|
|
|
|
upper triangular part of the array A contains the upper |
|
5618
|
|
|
|
|
|
|
triangular matrix, and the strictly lower triangular part of |
|
5619
|
|
|
|
|
|
|
A is not referenced. If uplo = 1, the leading N-by-N lower |
|
5620
|
|
|
|
|
|
|
triangular part of the array A contains the lower triangular |
|
5621
|
|
|
|
|
|
|
matrix, and the strictly upper triangular part of A is not |
|
5622
|
|
|
|
|
|
|
referenced. If diag = 1, the diagonal elements of A are |
|
5623
|
|
|
|
|
|
|
also not referenced and are assumed to be 1. |
|
5624
|
|
|
|
|
|
|
|
|
5625
|
|
|
|
|
|
|
rcond: The reciprocal of the condition number of the matrix A, |
|
5626
|
|
|
|
|
|
|
computed as rcond = 1/(norm(A) * norm(inv(A))). |
|
5627
|
|
|
|
|
|
|
|
|
5628
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5629
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5630
|
|
|
|
|
|
|
|
|
5631
|
|
|
|
|
|
|
|
|
5632
|
|
|
|
|
|
|
=for example |
|
5633
|
|
|
|
|
|
|
|
|
5634
|
|
|
|
|
|
|
# Assume $a is upper triangular |
|
5635
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
5636
|
|
|
|
|
|
|
$info = null; |
|
5637
|
|
|
|
|
|
|
($rcond, $info) = trcon($a, 1, 1, 0) unless $info != 0; |
|
5638
|
|
|
|
|
|
|
|
|
5639
|
|
|
|
|
|
|
|
|
5640
|
|
|
|
|
|
|
=for bad |
|
5641
|
|
|
|
|
|
|
|
|
5642
|
|
|
|
|
|
|
trcon ignores the bad-value flag of the input piddles. |
|
5643
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5644
|
|
|
|
|
|
|
|
|
5645
|
|
|
|
|
|
|
|
|
5646
|
|
|
|
|
|
|
=cut |
|
5647
|
|
|
|
|
|
|
|
|
5648
|
|
|
|
|
|
|
|
|
5649
|
|
|
|
|
|
|
|
|
5650
|
|
|
|
|
|
|
|
|
5651
|
|
|
|
|
|
|
|
|
5652
|
|
|
|
|
|
|
|
|
5653
|
|
|
|
|
|
|
*trcon = \&PDL::trcon; |
|
5654
|
|
|
|
|
|
|
|
|
5655
|
|
|
|
|
|
|
|
|
5656
|
|
|
|
|
|
|
|
|
5657
|
|
|
|
|
|
|
|
|
5658
|
|
|
|
|
|
|
|
|
5659
|
|
|
|
|
|
|
=head2 geqp3 |
|
5660
|
|
|
|
|
|
|
|
|
5661
|
|
|
|
|
|
|
=for sig |
|
5662
|
|
|
|
|
|
|
|
|
5663
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); int [io,phys]jpvt(n); [o,phys]tau(k); int [o,phys]info()) |
|
5664
|
|
|
|
|
|
|
|
|
5665
|
|
|
|
|
|
|
|
|
5666
|
|
|
|
|
|
|
|
|
5667
|
|
|
|
|
|
|
=for ref |
|
5668
|
|
|
|
|
|
|
|
|
5669
|
|
|
|
|
|
|
geqp3 computes a QR factorization using Level 3 BLAS with column pivoting of a |
|
5670
|
|
|
|
|
|
|
matrix A: |
|
5671
|
|
|
|
|
|
|
|
|
5672
|
|
|
|
|
|
|
A*P = Q*R |
|
5673
|
|
|
|
|
|
|
|
|
5674
|
|
|
|
|
|
|
The matrix Q is represented as a product of elementary reflectors |
|
5675
|
|
|
|
|
|
|
|
|
5676
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k), where k = min(m,n). |
|
5677
|
|
|
|
|
|
|
|
|
5678
|
|
|
|
|
|
|
Each H(i) has the form |
|
5679
|
|
|
|
|
|
|
|
|
5680
|
|
|
|
|
|
|
H(i) = I - tau * v * v' |
|
5681
|
|
|
|
|
|
|
|
|
5682
|
|
|
|
|
|
|
where tau is a real/complex scalar, and v is a real/complex vector |
|
5683
|
|
|
|
|
|
|
with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in |
|
5684
|
|
|
|
|
|
|
A(i+1:m,i), and tau in tau(i). |
|
5685
|
|
|
|
|
|
|
|
|
5686
|
|
|
|
|
|
|
Arguments |
|
5687
|
|
|
|
|
|
|
========= |
|
5688
|
|
|
|
|
|
|
|
|
5689
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
5690
|
|
|
|
|
|
|
On exit, the upper triangle of the array contains the |
|
5691
|
|
|
|
|
|
|
min(M,N)-by-N upper trapezoidal matrix R; the elements below |
|
5692
|
|
|
|
|
|
|
the diagonal, together with the array tau, represent the |
|
5693
|
|
|
|
|
|
|
orthogonal matrix Q as a product of min(M,N) elementary |
|
5694
|
|
|
|
|
|
|
reflectors. |
|
5695
|
|
|
|
|
|
|
|
|
5696
|
|
|
|
|
|
|
jpvt: On entry, if jpvt(J)!=0, the J-th column of A is permuted |
|
5697
|
|
|
|
|
|
|
to the front of A*P (a leading column); if jpvt(J)=0, |
|
5698
|
|
|
|
|
|
|
the J-th column of A is a free column. |
|
5699
|
|
|
|
|
|
|
On exit, if jpvt(J)=K, then the J-th column of A*P was the |
|
5700
|
|
|
|
|
|
|
the K-th column of A. |
|
5701
|
|
|
|
|
|
|
|
|
5702
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors. |
|
5703
|
|
|
|
|
|
|
|
|
5704
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
5705
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
5706
|
|
|
|
|
|
|
|
|
5707
|
|
|
|
|
|
|
=for example |
|
5708
|
|
|
|
|
|
|
|
|
5709
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
5710
|
|
|
|
|
|
|
$info = null; |
|
5711
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
5712
|
|
|
|
|
|
|
$jpvt = zeroes(long, 50); |
|
5713
|
|
|
|
|
|
|
geqp3($a, $jpvt, $tau, $info); |
|
5714
|
|
|
|
|
|
|
|
|
5715
|
|
|
|
|
|
|
|
|
5716
|
|
|
|
|
|
|
=for bad |
|
5717
|
|
|
|
|
|
|
|
|
5718
|
|
|
|
|
|
|
geqp3 ignores the bad-value flag of the input piddles. |
|
5719
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5720
|
|
|
|
|
|
|
|
|
5721
|
|
|
|
|
|
|
|
|
5722
|
|
|
|
|
|
|
=cut |
|
5723
|
|
|
|
|
|
|
|
|
5724
|
|
|
|
|
|
|
|
|
5725
|
|
|
|
|
|
|
|
|
5726
|
|
|
|
|
|
|
|
|
5727
|
|
|
|
|
|
|
|
|
5728
|
|
|
|
|
|
|
|
|
5729
|
|
|
|
|
|
|
*geqp3 = \&PDL::geqp3; |
|
5730
|
|
|
|
|
|
|
|
|
5731
|
|
|
|
|
|
|
|
|
5732
|
|
|
|
|
|
|
|
|
5733
|
|
|
|
|
|
|
|
|
5734
|
|
|
|
|
|
|
|
|
5735
|
|
|
|
|
|
|
=head2 geqrf |
|
5736
|
|
|
|
|
|
|
|
|
5737
|
|
|
|
|
|
|
=for sig |
|
5738
|
|
|
|
|
|
|
|
|
5739
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [o,phys]tau(k); int [o,phys]info()) |
|
5740
|
|
|
|
|
|
|
|
|
5741
|
|
|
|
|
|
|
|
|
5742
|
|
|
|
|
|
|
|
|
5743
|
|
|
|
|
|
|
=for ref |
|
5744
|
|
|
|
|
|
|
|
|
5745
|
|
|
|
|
|
|
geqrf computes a QR factorization of a |
|
5746
|
|
|
|
|
|
|
matrix A: |
|
5747
|
|
|
|
|
|
|
|
|
5748
|
|
|
|
|
|
|
A = Q * R |
|
5749
|
|
|
|
|
|
|
|
|
5750
|
|
|
|
|
|
|
The matrix Q is represented as a product of elementary reflectors |
|
5751
|
|
|
|
|
|
|
|
|
5752
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k), where k = min(m,n). |
|
5753
|
|
|
|
|
|
|
|
|
5754
|
|
|
|
|
|
|
Each H(i) has the form |
|
5755
|
|
|
|
|
|
|
|
|
5756
|
|
|
|
|
|
|
H(i) = I - tau * v * v' |
|
5757
|
|
|
|
|
|
|
|
|
5758
|
|
|
|
|
|
|
where tau is a real/complex scalar, and v is a real/complex vector |
|
5759
|
|
|
|
|
|
|
with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in |
|
5760
|
|
|
|
|
|
|
A(i+1:m,i), and tau in tau(i). |
|
5761
|
|
|
|
|
|
|
|
|
5762
|
|
|
|
|
|
|
Arguments |
|
5763
|
|
|
|
|
|
|
========= |
|
5764
|
|
|
|
|
|
|
|
|
5765
|
|
|
|
|
|
|
A: On exit, the elements on and above the diagonal of the array |
|
5766
|
|
|
|
|
|
|
contain the min(M,N)-by-N upper trapezoidal matrix R (R is |
|
5767
|
|
|
|
|
|
|
upper triangular if m >= n); the elements below the diagonal, |
|
5768
|
|
|
|
|
|
|
with the array TAU, represent the orthogonal matrix Q as a |
|
5769
|
|
|
|
|
|
|
product of min(m,n) elementary reflectors. |
|
5770
|
|
|
|
|
|
|
|
|
5771
|
|
|
|
|
|
|
|
|
5772
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors. |
|
5773
|
|
|
|
|
|
|
|
|
5774
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
5775
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
5776
|
|
|
|
|
|
|
|
|
5777
|
|
|
|
|
|
|
=for example |
|
5778
|
|
|
|
|
|
|
|
|
5779
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
5780
|
|
|
|
|
|
|
$info = null; |
|
5781
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
5782
|
|
|
|
|
|
|
geqrf($a, $tau, $info); |
|
5783
|
|
|
|
|
|
|
|
|
5784
|
|
|
|
|
|
|
|
|
5785
|
|
|
|
|
|
|
=for bad |
|
5786
|
|
|
|
|
|
|
|
|
5787
|
|
|
|
|
|
|
geqrf ignores the bad-value flag of the input piddles. |
|
5788
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5789
|
|
|
|
|
|
|
|
|
5790
|
|
|
|
|
|
|
|
|
5791
|
|
|
|
|
|
|
=cut |
|
5792
|
|
|
|
|
|
|
|
|
5793
|
|
|
|
|
|
|
|
|
5794
|
|
|
|
|
|
|
|
|
5795
|
|
|
|
|
|
|
|
|
5796
|
|
|
|
|
|
|
|
|
5797
|
|
|
|
|
|
|
|
|
5798
|
|
|
|
|
|
|
*geqrf = \&PDL::geqrf; |
|
5799
|
|
|
|
|
|
|
|
|
5800
|
|
|
|
|
|
|
|
|
5801
|
|
|
|
|
|
|
|
|
5802
|
|
|
|
|
|
|
|
|
5803
|
|
|
|
|
|
|
|
|
5804
|
|
|
|
|
|
|
=head2 orgqr |
|
5805
|
|
|
|
|
|
|
|
|
5806
|
|
|
|
|
|
|
=for sig |
|
5807
|
|
|
|
|
|
|
|
|
5808
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [phys]tau(k); int [o,phys]info()) |
|
5809
|
|
|
|
|
|
|
|
|
5810
|
|
|
|
|
|
|
|
|
5811
|
|
|
|
|
|
|
|
|
5812
|
|
|
|
|
|
|
=for ref |
|
5813
|
|
|
|
|
|
|
|
|
5814
|
|
|
|
|
|
|
Generates an M-by-N real matrix Q with orthonormal columns, |
|
5815
|
|
|
|
|
|
|
which is defined as the first N columns of a product of K elementary |
|
5816
|
|
|
|
|
|
|
reflectors of order M |
|
5817
|
|
|
|
|
|
|
|
|
5818
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k) |
|
5819
|
|
|
|
|
|
|
|
|
5820
|
|
|
|
|
|
|
as returned by geqrf or geqp3. |
|
5821
|
|
|
|
|
|
|
|
|
5822
|
|
|
|
|
|
|
Arguments |
|
5823
|
|
|
|
|
|
|
========= |
|
5824
|
|
|
|
|
|
|
|
|
5825
|
|
|
|
|
|
|
A: On entry, the i-th column must contain the vector which |
|
5826
|
|
|
|
|
|
|
defines the elementary reflector H(i), for i = 1,2,...,k, as |
|
5827
|
|
|
|
|
|
|
returned by geqrf or geqp3 in the first k columns of its array |
|
5828
|
|
|
|
|
|
|
argument A. |
|
5829
|
|
|
|
|
|
|
On exit, the M-by-N matrix Q. |
|
5830
|
|
|
|
|
|
|
|
|
5831
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
5832
|
|
|
|
|
|
|
reflector H(i), as returned by geqrf or geqp3. |
|
5833
|
|
|
|
|
|
|
|
|
5834
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5835
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument has an illegal value |
|
5836
|
|
|
|
|
|
|
|
|
5837
|
|
|
|
|
|
|
|
|
5838
|
|
|
|
|
|
|
=for example |
|
5839
|
|
|
|
|
|
|
|
|
5840
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
5841
|
|
|
|
|
|
|
$info = null; |
|
5842
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
5843
|
|
|
|
|
|
|
geqrf($a, $tau, $info); |
|
5844
|
|
|
|
|
|
|
orgqr($a, $tau, $info) unless $info != 0; |
|
5845
|
|
|
|
|
|
|
|
|
5846
|
|
|
|
|
|
|
|
|
5847
|
|
|
|
|
|
|
=for bad |
|
5848
|
|
|
|
|
|
|
|
|
5849
|
|
|
|
|
|
|
orgqr ignores the bad-value flag of the input piddles. |
|
5850
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5851
|
|
|
|
|
|
|
|
|
5852
|
|
|
|
|
|
|
|
|
5853
|
|
|
|
|
|
|
=cut |
|
5854
|
|
|
|
|
|
|
|
|
5855
|
|
|
|
|
|
|
|
|
5856
|
|
|
|
|
|
|
|
|
5857
|
|
|
|
|
|
|
|
|
5858
|
|
|
|
|
|
|
|
|
5859
|
|
|
|
|
|
|
|
|
5860
|
|
|
|
|
|
|
*orgqr = \&PDL::orgqr; |
|
5861
|
|
|
|
|
|
|
|
|
5862
|
|
|
|
|
|
|
|
|
5863
|
|
|
|
|
|
|
|
|
5864
|
|
|
|
|
|
|
|
|
5865
|
|
|
|
|
|
|
|
|
5866
|
|
|
|
|
|
|
=head2 ormqr |
|
5867
|
|
|
|
|
|
|
|
|
5868
|
|
|
|
|
|
|
=for sig |
|
5869
|
|
|
|
|
|
|
|
|
5870
|
|
|
|
|
|
|
Signature: ([phys]A(p,k); int side(); int trans(); [phys]tau(k); [io,phys]C(m,n);int [o,phys]info()) |
|
5871
|
|
|
|
|
|
|
|
|
5872
|
|
|
|
|
|
|
|
|
5873
|
|
|
|
|
|
|
|
|
5874
|
|
|
|
|
|
|
=for ref |
|
5875
|
|
|
|
|
|
|
|
|
5876
|
|
|
|
|
|
|
Overwrites the general real M-by-N matrix C with |
|
5877
|
|
|
|
|
|
|
|
|
5878
|
|
|
|
|
|
|
side = 0 side = 1 |
|
5879
|
|
|
|
|
|
|
trans = 0: Q * C C * Q |
|
5880
|
|
|
|
|
|
|
trans = 1: Q' * C C * Q' |
|
5881
|
|
|
|
|
|
|
|
|
5882
|
|
|
|
|
|
|
where Q is a real orthogonal matrix defined as the product of k |
|
5883
|
|
|
|
|
|
|
elementary reflectors |
|
5884
|
|
|
|
|
|
|
|
|
5885
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k) |
|
5886
|
|
|
|
|
|
|
|
|
5887
|
|
|
|
|
|
|
as returned by geqrf or geqp3. |
|
5888
|
|
|
|
|
|
|
|
|
5889
|
|
|
|
|
|
|
Q is of order M if C = 0 and of order N |
|
5890
|
|
|
|
|
|
|
if C = 1. |
|
5891
|
|
|
|
|
|
|
|
|
5892
|
|
|
|
|
|
|
Arguments |
|
5893
|
|
|
|
|
|
|
========= |
|
5894
|
|
|
|
|
|
|
|
|
5895
|
|
|
|
|
|
|
side: = 0: apply Q or Q' from the Left; |
|
5896
|
|
|
|
|
|
|
= 1: apply Q or Q' from the Right. |
|
5897
|
|
|
|
|
|
|
|
|
5898
|
|
|
|
|
|
|
trans: = 0: No transpose, apply Q; |
|
5899
|
|
|
|
|
|
|
= 1: Transpose, apply Q'. |
|
5900
|
|
|
|
|
|
|
|
|
5901
|
|
|
|
|
|
|
A: The i-th column must contain the vector which defines the |
|
5902
|
|
|
|
|
|
|
elementary reflector H(i), for i = 1,2,...,k, as returned by |
|
5903
|
|
|
|
|
|
|
geqrf or geqp3 in the first k columns of its array argument A. |
|
5904
|
|
|
|
|
|
|
A is modified by the routine but restored on exit. |
|
5905
|
|
|
|
|
|
|
|
|
5906
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
5907
|
|
|
|
|
|
|
reflector H(i), as returned by geqrf or geqp3. |
|
5908
|
|
|
|
|
|
|
|
|
5909
|
|
|
|
|
|
|
C: On entry, the M-by-N matrix C. |
|
5910
|
|
|
|
|
|
|
On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. |
|
5911
|
|
|
|
|
|
|
|
|
5912
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5913
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5914
|
|
|
|
|
|
|
|
|
5915
|
|
|
|
|
|
|
|
|
5916
|
|
|
|
|
|
|
=for example |
|
5917
|
|
|
|
|
|
|
|
|
5918
|
|
|
|
|
|
|
$a = random (float, 50, 100); |
|
5919
|
|
|
|
|
|
|
$a = transpose($a); |
|
5920
|
|
|
|
|
|
|
$info = null; |
|
5921
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
5922
|
|
|
|
|
|
|
geqrf($a, $tau, $info); |
|
5923
|
|
|
|
|
|
|
$c = random(70,50); |
|
5924
|
|
|
|
|
|
|
# $c will contain the result |
|
5925
|
|
|
|
|
|
|
$c->reshape(70,100); |
|
5926
|
|
|
|
|
|
|
$c = transpose($c); |
|
5927
|
|
|
|
|
|
|
ormqr($a, $tau, $c, $info); |
|
5928
|
|
|
|
|
|
|
|
|
5929
|
|
|
|
|
|
|
|
|
5930
|
|
|
|
|
|
|
=for bad |
|
5931
|
|
|
|
|
|
|
|
|
5932
|
|
|
|
|
|
|
ormqr ignores the bad-value flag of the input piddles. |
|
5933
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
5934
|
|
|
|
|
|
|
|
|
5935
|
|
|
|
|
|
|
|
|
5936
|
|
|
|
|
|
|
=cut |
|
5937
|
|
|
|
|
|
|
|
|
5938
|
|
|
|
|
|
|
|
|
5939
|
|
|
|
|
|
|
|
|
5940
|
|
|
|
|
|
|
|
|
5941
|
|
|
|
|
|
|
|
|
5942
|
|
|
|
|
|
|
|
|
5943
|
|
|
|
|
|
|
*ormqr = \&PDL::ormqr; |
|
5944
|
|
|
|
|
|
|
|
|
5945
|
|
|
|
|
|
|
|
|
5946
|
|
|
|
|
|
|
|
|
5947
|
|
|
|
|
|
|
|
|
5948
|
|
|
|
|
|
|
|
|
5949
|
|
|
|
|
|
|
=head2 gelqf |
|
5950
|
|
|
|
|
|
|
|
|
5951
|
|
|
|
|
|
|
=for sig |
|
5952
|
|
|
|
|
|
|
|
|
5953
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [o,phys]tau(k); int [o,phys]info()) |
|
5954
|
|
|
|
|
|
|
|
|
5955
|
|
|
|
|
|
|
|
|
5956
|
|
|
|
|
|
|
|
|
5957
|
|
|
|
|
|
|
=for ref |
|
5958
|
|
|
|
|
|
|
|
|
5959
|
|
|
|
|
|
|
Computes an LQ factorization of a real M-by-N matrix A: |
|
5960
|
|
|
|
|
|
|
|
|
5961
|
|
|
|
|
|
|
A = L * Q. |
|
5962
|
|
|
|
|
|
|
|
|
5963
|
|
|
|
|
|
|
The matrix Q is represented as a product of elementary reflectors |
|
5964
|
|
|
|
|
|
|
|
|
5965
|
|
|
|
|
|
|
Q = H(k) . . . H(2) H(1), where k = min(m,n). |
|
5966
|
|
|
|
|
|
|
|
|
5967
|
|
|
|
|
|
|
Each H(i) has the form |
|
5968
|
|
|
|
|
|
|
|
|
5969
|
|
|
|
|
|
|
H(i) = I - tau * v * v' |
|
5970
|
|
|
|
|
|
|
|
|
5971
|
|
|
|
|
|
|
where tau is a real scalar, and v is a real vector with |
|
5972
|
|
|
|
|
|
|
v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n), |
|
5973
|
|
|
|
|
|
|
and tau in tau(i). |
|
5974
|
|
|
|
|
|
|
|
|
5975
|
|
|
|
|
|
|
Arguments |
|
5976
|
|
|
|
|
|
|
========= |
|
5977
|
|
|
|
|
|
|
|
|
5978
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
5979
|
|
|
|
|
|
|
On exit, the elements on and below the diagonal of the array |
|
5980
|
|
|
|
|
|
|
contain the m-by-min(m,n) lower trapezoidal matrix L (L is |
|
5981
|
|
|
|
|
|
|
lower triangular if m <= n); the elements above the diagonal, |
|
5982
|
|
|
|
|
|
|
with the array tau, represent the orthogonal matrix Q as a |
|
5983
|
|
|
|
|
|
|
product of elementary reflectors. |
|
5984
|
|
|
|
|
|
|
|
|
5985
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors. |
|
5986
|
|
|
|
|
|
|
|
|
5987
|
|
|
|
|
|
|
info: = 0: successful exit |
|
5988
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
5989
|
|
|
|
|
|
|
|
|
5990
|
|
|
|
|
|
|
=for example |
|
5991
|
|
|
|
|
|
|
|
|
5992
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
5993
|
|
|
|
|
|
|
$info = null; |
|
5994
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
5995
|
|
|
|
|
|
|
gelqf($a, $tau, $info); |
|
5996
|
|
|
|
|
|
|
|
|
5997
|
|
|
|
|
|
|
|
|
5998
|
|
|
|
|
|
|
=for bad |
|
5999
|
|
|
|
|
|
|
|
|
6000
|
|
|
|
|
|
|
gelqf ignores the bad-value flag of the input piddles. |
|
6001
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6002
|
|
|
|
|
|
|
|
|
6003
|
|
|
|
|
|
|
|
|
6004
|
|
|
|
|
|
|
=cut |
|
6005
|
|
|
|
|
|
|
|
|
6006
|
|
|
|
|
|
|
|
|
6007
|
|
|
|
|
|
|
|
|
6008
|
|
|
|
|
|
|
|
|
6009
|
|
|
|
|
|
|
|
|
6010
|
|
|
|
|
|
|
|
|
6011
|
|
|
|
|
|
|
*gelqf = \&PDL::gelqf; |
|
6012
|
|
|
|
|
|
|
|
|
6013
|
|
|
|
|
|
|
|
|
6014
|
|
|
|
|
|
|
|
|
6015
|
|
|
|
|
|
|
|
|
6016
|
|
|
|
|
|
|
|
|
6017
|
|
|
|
|
|
|
=head2 orglq |
|
6018
|
|
|
|
|
|
|
|
|
6019
|
|
|
|
|
|
|
=for sig |
|
6020
|
|
|
|
|
|
|
|
|
6021
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [phys]tau(k); int [o,phys]info()) |
|
6022
|
|
|
|
|
|
|
|
|
6023
|
|
|
|
|
|
|
|
|
6024
|
|
|
|
|
|
|
|
|
6025
|
|
|
|
|
|
|
=for ref |
|
6026
|
|
|
|
|
|
|
|
|
6027
|
|
|
|
|
|
|
Generates an M-by-N real matrix Q with orthonormal rows, |
|
6028
|
|
|
|
|
|
|
which is defined as the first M rows of a product of K elementary |
|
6029
|
|
|
|
|
|
|
reflectors of order N |
|
6030
|
|
|
|
|
|
|
|
|
6031
|
|
|
|
|
|
|
Q = H(k) . . . H(2) H(1) |
|
6032
|
|
|
|
|
|
|
|
|
6033
|
|
|
|
|
|
|
as returned by gelqf. |
|
6034
|
|
|
|
|
|
|
|
|
6035
|
|
|
|
|
|
|
Arguments |
|
6036
|
|
|
|
|
|
|
========= |
|
6037
|
|
|
|
|
|
|
|
|
6038
|
|
|
|
|
|
|
A: On entry, the i-th row must contain the vector which defines |
|
6039
|
|
|
|
|
|
|
the elementary reflector H(i), for i = 1,2,...,k, as returned |
|
6040
|
|
|
|
|
|
|
by gelqf in the first k rows of its array argument A. |
|
6041
|
|
|
|
|
|
|
On exit, the M-by-N matrix Q. |
|
6042
|
|
|
|
|
|
|
|
|
6043
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6044
|
|
|
|
|
|
|
reflector H(i), as returned by gelqf. |
|
6045
|
|
|
|
|
|
|
|
|
6046
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6047
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument has an illegal value |
|
6048
|
|
|
|
|
|
|
|
|
6049
|
|
|
|
|
|
|
|
|
6050
|
|
|
|
|
|
|
=for example |
|
6051
|
|
|
|
|
|
|
|
|
6052
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
6053
|
|
|
|
|
|
|
$info = null; |
|
6054
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6055
|
|
|
|
|
|
|
gelqf($a, $tau, $info); |
|
6056
|
|
|
|
|
|
|
orglq($a, $tau, $info) unless $info != 0; |
|
6057
|
|
|
|
|
|
|
|
|
6058
|
|
|
|
|
|
|
|
|
6059
|
|
|
|
|
|
|
=for bad |
|
6060
|
|
|
|
|
|
|
|
|
6061
|
|
|
|
|
|
|
orglq ignores the bad-value flag of the input piddles. |
|
6062
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6063
|
|
|
|
|
|
|
|
|
6064
|
|
|
|
|
|
|
|
|
6065
|
|
|
|
|
|
|
=cut |
|
6066
|
|
|
|
|
|
|
|
|
6067
|
|
|
|
|
|
|
|
|
6068
|
|
|
|
|
|
|
|
|
6069
|
|
|
|
|
|
|
|
|
6070
|
|
|
|
|
|
|
|
|
6071
|
|
|
|
|
|
|
|
|
6072
|
|
|
|
|
|
|
*orglq = \&PDL::orglq; |
|
6073
|
|
|
|
|
|
|
|
|
6074
|
|
|
|
|
|
|
|
|
6075
|
|
|
|
|
|
|
|
|
6076
|
|
|
|
|
|
|
|
|
6077
|
|
|
|
|
|
|
|
|
6078
|
|
|
|
|
|
|
=head2 ormlq |
|
6079
|
|
|
|
|
|
|
|
|
6080
|
|
|
|
|
|
|
=for sig |
|
6081
|
|
|
|
|
|
|
|
|
6082
|
|
|
|
|
|
|
Signature: ([phys]A(k,p); int side(); int trans(); [phys]tau(k); [io,phys]C(m,n);int [o,phys]info()) |
|
6083
|
|
|
|
|
|
|
|
|
6084
|
|
|
|
|
|
|
|
|
6085
|
|
|
|
|
|
|
|
|
6086
|
|
|
|
|
|
|
=for ref |
|
6087
|
|
|
|
|
|
|
|
|
6088
|
|
|
|
|
|
|
Overwrites the general real M-by-N matrix C with |
|
6089
|
|
|
|
|
|
|
|
|
6090
|
|
|
|
|
|
|
side = 0 side = 1 |
|
6091
|
|
|
|
|
|
|
trans = 0: Q * C C * Q |
|
6092
|
|
|
|
|
|
|
trans = 1: Q' * C C * Q' |
|
6093
|
|
|
|
|
|
|
|
|
6094
|
|
|
|
|
|
|
where Q is a real orthogonal matrix defined as the product of k |
|
6095
|
|
|
|
|
|
|
elementary reflectors |
|
6096
|
|
|
|
|
|
|
|
|
6097
|
|
|
|
|
|
|
Q = H(k) . . . H(2) H(1) |
|
6098
|
|
|
|
|
|
|
|
|
6099
|
|
|
|
|
|
|
as returned by gelqf. |
|
6100
|
|
|
|
|
|
|
|
|
6101
|
|
|
|
|
|
|
Q is of order M if C = 0 and of order N |
|
6102
|
|
|
|
|
|
|
if C = 1. |
|
6103
|
|
|
|
|
|
|
|
|
6104
|
|
|
|
|
|
|
Arguments |
|
6105
|
|
|
|
|
|
|
========= |
|
6106
|
|
|
|
|
|
|
|
|
6107
|
|
|
|
|
|
|
side: = 0: apply Q or Q' from the Left; |
|
6108
|
|
|
|
|
|
|
= 1: apply Q or Q' from the Right. |
|
6109
|
|
|
|
|
|
|
|
|
6110
|
|
|
|
|
|
|
trans: = 0: No transpose, apply Q; |
|
6111
|
|
|
|
|
|
|
= 1: Transpose, apply Q'. |
|
6112
|
|
|
|
|
|
|
|
|
6113
|
|
|
|
|
|
|
A: The i-th row must contain the vector which defines the |
|
6114
|
|
|
|
|
|
|
elementary reflector H(i), for i = 1,2,...,k, as returned by |
|
6115
|
|
|
|
|
|
|
gelqf in the first k rows of its array argument A. |
|
6116
|
|
|
|
|
|
|
A is modified by the routine but restored on exit. |
|
6117
|
|
|
|
|
|
|
|
|
6118
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6119
|
|
|
|
|
|
|
reflector H(i), as returned by gelqf. |
|
6120
|
|
|
|
|
|
|
|
|
6121
|
|
|
|
|
|
|
C: On entry, the M-by-N matrix C. |
|
6122
|
|
|
|
|
|
|
On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. |
|
6123
|
|
|
|
|
|
|
|
|
6124
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6125
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6126
|
|
|
|
|
|
|
|
|
6127
|
|
|
|
|
|
|
|
|
6128
|
|
|
|
|
|
|
=for example |
|
6129
|
|
|
|
|
|
|
|
|
6130
|
|
|
|
|
|
|
$a = random (float, 50, 100); |
|
6131
|
|
|
|
|
|
|
$a = transpose($a); |
|
6132
|
|
|
|
|
|
|
$info = null; |
|
6133
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6134
|
|
|
|
|
|
|
gelqf($a, $tau, $info); |
|
6135
|
|
|
|
|
|
|
$c = random(70,50); |
|
6136
|
|
|
|
|
|
|
# $c will contain the result |
|
6137
|
|
|
|
|
|
|
$c->reshape(70,100); |
|
6138
|
|
|
|
|
|
|
$c = transpose($c); |
|
6139
|
|
|
|
|
|
|
ormlq($a, $tau, $c, $info); |
|
6140
|
|
|
|
|
|
|
|
|
6141
|
|
|
|
|
|
|
|
|
6142
|
|
|
|
|
|
|
=for bad |
|
6143
|
|
|
|
|
|
|
|
|
6144
|
|
|
|
|
|
|
ormlq ignores the bad-value flag of the input piddles. |
|
6145
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6146
|
|
|
|
|
|
|
|
|
6147
|
|
|
|
|
|
|
|
|
6148
|
|
|
|
|
|
|
=cut |
|
6149
|
|
|
|
|
|
|
|
|
6150
|
|
|
|
|
|
|
|
|
6151
|
|
|
|
|
|
|
|
|
6152
|
|
|
|
|
|
|
|
|
6153
|
|
|
|
|
|
|
|
|
6154
|
|
|
|
|
|
|
|
|
6155
|
|
|
|
|
|
|
*ormlq = \&PDL::ormlq; |
|
6156
|
|
|
|
|
|
|
|
|
6157
|
|
|
|
|
|
|
|
|
6158
|
|
|
|
|
|
|
|
|
6159
|
|
|
|
|
|
|
|
|
6160
|
|
|
|
|
|
|
|
|
6161
|
|
|
|
|
|
|
=head2 geqlf |
|
6162
|
|
|
|
|
|
|
|
|
6163
|
|
|
|
|
|
|
=for sig |
|
6164
|
|
|
|
|
|
|
|
|
6165
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [o,phys]tau(k); int [o,phys]info()) |
|
6166
|
|
|
|
|
|
|
|
|
6167
|
|
|
|
|
|
|
|
|
6168
|
|
|
|
|
|
|
|
|
6169
|
|
|
|
|
|
|
=for ref |
|
6170
|
|
|
|
|
|
|
|
|
6171
|
|
|
|
|
|
|
Computes a QL factorization of a real M-by-N matrix A: |
|
6172
|
|
|
|
|
|
|
|
|
6173
|
|
|
|
|
|
|
A = Q * L |
|
6174
|
|
|
|
|
|
|
|
|
6175
|
|
|
|
|
|
|
The matrix Q is represented as a product of elementary reflectors |
|
6176
|
|
|
|
|
|
|
|
|
6177
|
|
|
|
|
|
|
Q = H(k) . . . H(2) H(1), where k = min(m,n). |
|
6178
|
|
|
|
|
|
|
|
|
6179
|
|
|
|
|
|
|
Each H(i) has the form |
|
6180
|
|
|
|
|
|
|
|
|
6181
|
|
|
|
|
|
|
H(i) = I - tau * v * v' |
|
6182
|
|
|
|
|
|
|
|
|
6183
|
|
|
|
|
|
|
where tau is a real scalar, and v is a real vector with |
|
6184
|
|
|
|
|
|
|
v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in |
|
6185
|
|
|
|
|
|
|
A(1:m-k+i-1,n-k+i), and tau in TAU(i). |
|
6186
|
|
|
|
|
|
|
|
|
6187
|
|
|
|
|
|
|
Arguments |
|
6188
|
|
|
|
|
|
|
========= |
|
6189
|
|
|
|
|
|
|
|
|
6190
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
6191
|
|
|
|
|
|
|
On exit, |
|
6192
|
|
|
|
|
|
|
if m >= n, the lower triangle of the subarray |
|
6193
|
|
|
|
|
|
|
A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L; |
|
6194
|
|
|
|
|
|
|
if m <= n, the elements on and below the (n-m)-th |
|
6195
|
|
|
|
|
|
|
superdiagonal contain the M-by-N lower trapezoidal matrix L; |
|
6196
|
|
|
|
|
|
|
the remaining elements, with the array tau, represent the |
|
6197
|
|
|
|
|
|
|
orthogonal matrix Q as a product of elementary reflectors. |
|
6198
|
|
|
|
|
|
|
|
|
6199
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors. |
|
6200
|
|
|
|
|
|
|
|
|
6201
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6202
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6203
|
|
|
|
|
|
|
|
|
6204
|
|
|
|
|
|
|
=for example |
|
6205
|
|
|
|
|
|
|
|
|
6206
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
6207
|
|
|
|
|
|
|
$info = null; |
|
6208
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6209
|
|
|
|
|
|
|
geqlf($a, $tau, $info); |
|
6210
|
|
|
|
|
|
|
|
|
6211
|
|
|
|
|
|
|
|
|
6212
|
|
|
|
|
|
|
=for bad |
|
6213
|
|
|
|
|
|
|
|
|
6214
|
|
|
|
|
|
|
geqlf ignores the bad-value flag of the input piddles. |
|
6215
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6216
|
|
|
|
|
|
|
|
|
6217
|
|
|
|
|
|
|
|
|
6218
|
|
|
|
|
|
|
=cut |
|
6219
|
|
|
|
|
|
|
|
|
6220
|
|
|
|
|
|
|
|
|
6221
|
|
|
|
|
|
|
|
|
6222
|
|
|
|
|
|
|
|
|
6223
|
|
|
|
|
|
|
|
|
6224
|
|
|
|
|
|
|
|
|
6225
|
|
|
|
|
|
|
*geqlf = \&PDL::geqlf; |
|
6226
|
|
|
|
|
|
|
|
|
6227
|
|
|
|
|
|
|
|
|
6228
|
|
|
|
|
|
|
|
|
6229
|
|
|
|
|
|
|
|
|
6230
|
|
|
|
|
|
|
|
|
6231
|
|
|
|
|
|
|
=head2 orgql |
|
6232
|
|
|
|
|
|
|
|
|
6233
|
|
|
|
|
|
|
=for sig |
|
6234
|
|
|
|
|
|
|
|
|
6235
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [phys]tau(k); int [o,phys]info()) |
|
6236
|
|
|
|
|
|
|
|
|
6237
|
|
|
|
|
|
|
|
|
6238
|
|
|
|
|
|
|
|
|
6239
|
|
|
|
|
|
|
=for ref |
|
6240
|
|
|
|
|
|
|
|
|
6241
|
|
|
|
|
|
|
Generates an M-by-N real matrix Q with orthonormal columns, |
|
6242
|
|
|
|
|
|
|
which is defined as the last N columns of a product of K elementary |
|
6243
|
|
|
|
|
|
|
reflectors of order M |
|
6244
|
|
|
|
|
|
|
|
|
6245
|
|
|
|
|
|
|
Q = H(k) . . . H(2) H(1) |
|
6246
|
|
|
|
|
|
|
|
|
6247
|
|
|
|
|
|
|
as returned by geqlf. |
|
6248
|
|
|
|
|
|
|
|
|
6249
|
|
|
|
|
|
|
Arguments |
|
6250
|
|
|
|
|
|
|
========= |
|
6251
|
|
|
|
|
|
|
|
|
6252
|
|
|
|
|
|
|
A: On entry, the (n-k+i)-th column must contain the vector which |
|
6253
|
|
|
|
|
|
|
defines the elementary reflector H(i), for i = 1,2,...,k, as |
|
6254
|
|
|
|
|
|
|
returned by geqlf in the last k columns of its array |
|
6255
|
|
|
|
|
|
|
argument A. |
|
6256
|
|
|
|
|
|
|
On exit, the M-by-N matrix Q. |
|
6257
|
|
|
|
|
|
|
|
|
6258
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6259
|
|
|
|
|
|
|
reflector H(i), as returned by geqlf. |
|
6260
|
|
|
|
|
|
|
|
|
6261
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6262
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument has an illegal value |
|
6263
|
|
|
|
|
|
|
|
|
6264
|
|
|
|
|
|
|
|
|
6265
|
|
|
|
|
|
|
=for example |
|
6266
|
|
|
|
|
|
|
|
|
6267
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
6268
|
|
|
|
|
|
|
$info = null; |
|
6269
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6270
|
|
|
|
|
|
|
geqlf($a, $tau, $info); |
|
6271
|
|
|
|
|
|
|
orgql($a, $tau, $info) unless $info != 0; |
|
6272
|
|
|
|
|
|
|
|
|
6273
|
|
|
|
|
|
|
|
|
6274
|
|
|
|
|
|
|
=for bad |
|
6275
|
|
|
|
|
|
|
|
|
6276
|
|
|
|
|
|
|
orgql ignores the bad-value flag of the input piddles. |
|
6277
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6278
|
|
|
|
|
|
|
|
|
6279
|
|
|
|
|
|
|
|
|
6280
|
|
|
|
|
|
|
=cut |
|
6281
|
|
|
|
|
|
|
|
|
6282
|
|
|
|
|
|
|
|
|
6283
|
|
|
|
|
|
|
|
|
6284
|
|
|
|
|
|
|
|
|
6285
|
|
|
|
|
|
|
|
|
6286
|
|
|
|
|
|
|
|
|
6287
|
|
|
|
|
|
|
*orgql = \&PDL::orgql; |
|
6288
|
|
|
|
|
|
|
|
|
6289
|
|
|
|
|
|
|
|
|
6290
|
|
|
|
|
|
|
|
|
6291
|
|
|
|
|
|
|
|
|
6292
|
|
|
|
|
|
|
|
|
6293
|
|
|
|
|
|
|
=head2 ormql |
|
6294
|
|
|
|
|
|
|
|
|
6295
|
|
|
|
|
|
|
=for sig |
|
6296
|
|
|
|
|
|
|
|
|
6297
|
|
|
|
|
|
|
Signature: ([phys]A(p,k); int side(); int trans(); [phys]tau(k); [io,phys]C(m,n);int [o,phys]info()) |
|
6298
|
|
|
|
|
|
|
|
|
6299
|
|
|
|
|
|
|
|
|
6300
|
|
|
|
|
|
|
|
|
6301
|
|
|
|
|
|
|
=for ref |
|
6302
|
|
|
|
|
|
|
|
|
6303
|
|
|
|
|
|
|
Overwrites the general real M-by-N matrix C with |
|
6304
|
|
|
|
|
|
|
|
|
6305
|
|
|
|
|
|
|
side = 0 side = 1 |
|
6306
|
|
|
|
|
|
|
trans = 0: Q * C C * Q |
|
6307
|
|
|
|
|
|
|
trans = 1: Q' * C C * Q' |
|
6308
|
|
|
|
|
|
|
|
|
6309
|
|
|
|
|
|
|
where Q is a real orthogonal matrix defined as the product of k |
|
6310
|
|
|
|
|
|
|
elementary reflectors |
|
6311
|
|
|
|
|
|
|
|
|
6312
|
|
|
|
|
|
|
Q = H(k) . . . H(2) H(1) |
|
6313
|
|
|
|
|
|
|
|
|
6314
|
|
|
|
|
|
|
as returned by geqlf. |
|
6315
|
|
|
|
|
|
|
|
|
6316
|
|
|
|
|
|
|
Q is of order M if C = 0 and of order N |
|
6317
|
|
|
|
|
|
|
if C = 1. |
|
6318
|
|
|
|
|
|
|
|
|
6319
|
|
|
|
|
|
|
Arguments |
|
6320
|
|
|
|
|
|
|
========= |
|
6321
|
|
|
|
|
|
|
|
|
6322
|
|
|
|
|
|
|
side: = 0: apply Q or Q' from the Left; |
|
6323
|
|
|
|
|
|
|
= 1: apply Q or Q' from the Right. |
|
6324
|
|
|
|
|
|
|
|
|
6325
|
|
|
|
|
|
|
trans: = 0: No transpose, apply Q; |
|
6326
|
|
|
|
|
|
|
= 1: Transpose, apply Q'. |
|
6327
|
|
|
|
|
|
|
|
|
6328
|
|
|
|
|
|
|
A: The i-th row must contain the vector which defines the |
|
6329
|
|
|
|
|
|
|
elementary reflector H(i), for i = 1,2,...,k, as returned by |
|
6330
|
|
|
|
|
|
|
geqlf in the last k rows of its array argument A. |
|
6331
|
|
|
|
|
|
|
A is modified by the routine but restored on exit. |
|
6332
|
|
|
|
|
|
|
|
|
6333
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6334
|
|
|
|
|
|
|
reflector H(i), as returned by geqlf. |
|
6335
|
|
|
|
|
|
|
|
|
6336
|
|
|
|
|
|
|
C: On entry, the M-by-N matrix C. |
|
6337
|
|
|
|
|
|
|
On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. |
|
6338
|
|
|
|
|
|
|
|
|
6339
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6340
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6341
|
|
|
|
|
|
|
|
|
6342
|
|
|
|
|
|
|
|
|
6343
|
|
|
|
|
|
|
=for example |
|
6344
|
|
|
|
|
|
|
|
|
6345
|
|
|
|
|
|
|
$a = random (float, 50, 100); |
|
6346
|
|
|
|
|
|
|
$a = transpose($a); |
|
6347
|
|
|
|
|
|
|
$info = null; |
|
6348
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6349
|
|
|
|
|
|
|
geqlf($a, $tau, $info); |
|
6350
|
|
|
|
|
|
|
$c = random(70,50); |
|
6351
|
|
|
|
|
|
|
# $c will contain the result |
|
6352
|
|
|
|
|
|
|
$c->reshape(70,100); |
|
6353
|
|
|
|
|
|
|
$c = transpose($c); |
|
6354
|
|
|
|
|
|
|
ormql($a, $tau, $c, $info); |
|
6355
|
|
|
|
|
|
|
|
|
6356
|
|
|
|
|
|
|
|
|
6357
|
|
|
|
|
|
|
=for bad |
|
6358
|
|
|
|
|
|
|
|
|
6359
|
|
|
|
|
|
|
ormql ignores the bad-value flag of the input piddles. |
|
6360
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6361
|
|
|
|
|
|
|
|
|
6362
|
|
|
|
|
|
|
|
|
6363
|
|
|
|
|
|
|
=cut |
|
6364
|
|
|
|
|
|
|
|
|
6365
|
|
|
|
|
|
|
|
|
6366
|
|
|
|
|
|
|
|
|
6367
|
|
|
|
|
|
|
|
|
6368
|
|
|
|
|
|
|
|
|
6369
|
|
|
|
|
|
|
|
|
6370
|
|
|
|
|
|
|
*ormql = \&PDL::ormql; |
|
6371
|
|
|
|
|
|
|
|
|
6372
|
|
|
|
|
|
|
|
|
6373
|
|
|
|
|
|
|
|
|
6374
|
|
|
|
|
|
|
|
|
6375
|
|
|
|
|
|
|
|
|
6376
|
|
|
|
|
|
|
=head2 gerqf |
|
6377
|
|
|
|
|
|
|
|
|
6378
|
|
|
|
|
|
|
=for sig |
|
6379
|
|
|
|
|
|
|
|
|
6380
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [o,phys]tau(k); int [o,phys]info()) |
|
6381
|
|
|
|
|
|
|
|
|
6382
|
|
|
|
|
|
|
|
|
6383
|
|
|
|
|
|
|
|
|
6384
|
|
|
|
|
|
|
=for ref |
|
6385
|
|
|
|
|
|
|
|
|
6386
|
|
|
|
|
|
|
Computes an RQ factorization of a real M-by-N matrix A: |
|
6387
|
|
|
|
|
|
|
|
|
6388
|
|
|
|
|
|
|
A = R * Q. |
|
6389
|
|
|
|
|
|
|
|
|
6390
|
|
|
|
|
|
|
The matrix Q is represented as a product of elementary reflectors |
|
6391
|
|
|
|
|
|
|
|
|
6392
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k), where k = min(m,n). |
|
6393
|
|
|
|
|
|
|
|
|
6394
|
|
|
|
|
|
|
Each H(i) has the form |
|
6395
|
|
|
|
|
|
|
|
|
6396
|
|
|
|
|
|
|
H(i) = I - tau * v * v' |
|
6397
|
|
|
|
|
|
|
|
|
6398
|
|
|
|
|
|
|
where tau is a real scalar, and v is a real vector with |
|
6399
|
|
|
|
|
|
|
v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in |
|
6400
|
|
|
|
|
|
|
A(m-k+i,1:n-k+i-1), and tau in TAU(i). |
|
6401
|
|
|
|
|
|
|
|
|
6402
|
|
|
|
|
|
|
Arguments |
|
6403
|
|
|
|
|
|
|
========= |
|
6404
|
|
|
|
|
|
|
|
|
6405
|
|
|
|
|
|
|
A: On entry, the M-by-N matrix A. |
|
6406
|
|
|
|
|
|
|
On exit, |
|
6407
|
|
|
|
|
|
|
if m <= n, the upper triangle of the subarray |
|
6408
|
|
|
|
|
|
|
A(1:m,n-m+1:n) contains the M-by-M upper triangular matrix R; |
|
6409
|
|
|
|
|
|
|
if m >= n, the elements on and above the (m-n)-th subdiagonal |
|
6410
|
|
|
|
|
|
|
contain the M-by-N upper trapezoidal matrix R; |
|
6411
|
|
|
|
|
|
|
the remaining elements, with the array tau, represent the |
|
6412
|
|
|
|
|
|
|
orthogonal matrix Q as a product of min(m,n) elementary |
|
6413
|
|
|
|
|
|
|
reflectors (see Further Details). |
|
6414
|
|
|
|
|
|
|
|
|
6415
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors. |
|
6416
|
|
|
|
|
|
|
|
|
6417
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6418
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6419
|
|
|
|
|
|
|
|
|
6420
|
|
|
|
|
|
|
=for example |
|
6421
|
|
|
|
|
|
|
|
|
6422
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
6423
|
|
|
|
|
|
|
$info = null; |
|
6424
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6425
|
|
|
|
|
|
|
gerqf($a, $tau, $info); |
|
6426
|
|
|
|
|
|
|
|
|
6427
|
|
|
|
|
|
|
|
|
6428
|
|
|
|
|
|
|
=for bad |
|
6429
|
|
|
|
|
|
|
|
|
6430
|
|
|
|
|
|
|
gerqf ignores the bad-value flag of the input piddles. |
|
6431
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6432
|
|
|
|
|
|
|
|
|
6433
|
|
|
|
|
|
|
|
|
6434
|
|
|
|
|
|
|
=cut |
|
6435
|
|
|
|
|
|
|
|
|
6436
|
|
|
|
|
|
|
|
|
6437
|
|
|
|
|
|
|
|
|
6438
|
|
|
|
|
|
|
|
|
6439
|
|
|
|
|
|
|
|
|
6440
|
|
|
|
|
|
|
|
|
6441
|
|
|
|
|
|
|
*gerqf = \&PDL::gerqf; |
|
6442
|
|
|
|
|
|
|
|
|
6443
|
|
|
|
|
|
|
|
|
6444
|
|
|
|
|
|
|
|
|
6445
|
|
|
|
|
|
|
|
|
6446
|
|
|
|
|
|
|
|
|
6447
|
|
|
|
|
|
|
=head2 orgrq |
|
6448
|
|
|
|
|
|
|
|
|
6449
|
|
|
|
|
|
|
=for sig |
|
6450
|
|
|
|
|
|
|
|
|
6451
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [phys]tau(k); int [o,phys]info()) |
|
6452
|
|
|
|
|
|
|
|
|
6453
|
|
|
|
|
|
|
|
|
6454
|
|
|
|
|
|
|
|
|
6455
|
|
|
|
|
|
|
=for ref |
|
6456
|
|
|
|
|
|
|
|
|
6457
|
|
|
|
|
|
|
Generates an M-by-N real matrix Q with orthonormal rows, |
|
6458
|
|
|
|
|
|
|
which is defined as the last M rows of a product of K elementary |
|
6459
|
|
|
|
|
|
|
reflectors of order N |
|
6460
|
|
|
|
|
|
|
|
|
6461
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k) |
|
6462
|
|
|
|
|
|
|
|
|
6463
|
|
|
|
|
|
|
as returned by gerqf. |
|
6464
|
|
|
|
|
|
|
|
|
6465
|
|
|
|
|
|
|
Arguments |
|
6466
|
|
|
|
|
|
|
========= |
|
6467
|
|
|
|
|
|
|
|
|
6468
|
|
|
|
|
|
|
A: On entry, the (m-k+i)-th row must contain the vector which |
|
6469
|
|
|
|
|
|
|
defines the elementary reflector H(i), for i = 1,2,...,k, as |
|
6470
|
|
|
|
|
|
|
returned by gerqf in the last k rows of its array argument |
|
6471
|
|
|
|
|
|
|
A. |
|
6472
|
|
|
|
|
|
|
On exit, the M-by-N matrix Q. |
|
6473
|
|
|
|
|
|
|
|
|
6474
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6475
|
|
|
|
|
|
|
reflector H(i), as returned by gerqf. |
|
6476
|
|
|
|
|
|
|
|
|
6477
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6478
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument has an illegal value |
|
6479
|
|
|
|
|
|
|
|
|
6480
|
|
|
|
|
|
|
|
|
6481
|
|
|
|
|
|
|
=for example |
|
6482
|
|
|
|
|
|
|
|
|
6483
|
|
|
|
|
|
|
$a = random (float, 100, 50); |
|
6484
|
|
|
|
|
|
|
$info = null; |
|
6485
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6486
|
|
|
|
|
|
|
gerqf($a, $tau, $info); |
|
6487
|
|
|
|
|
|
|
orgrq($a, $tau, $info) unless $info != 0; |
|
6488
|
|
|
|
|
|
|
|
|
6489
|
|
|
|
|
|
|
|
|
6490
|
|
|
|
|
|
|
=for bad |
|
6491
|
|
|
|
|
|
|
|
|
6492
|
|
|
|
|
|
|
orgrq ignores the bad-value flag of the input piddles. |
|
6493
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6494
|
|
|
|
|
|
|
|
|
6495
|
|
|
|
|
|
|
|
|
6496
|
|
|
|
|
|
|
=cut |
|
6497
|
|
|
|
|
|
|
|
|
6498
|
|
|
|
|
|
|
|
|
6499
|
|
|
|
|
|
|
|
|
6500
|
|
|
|
|
|
|
|
|
6501
|
|
|
|
|
|
|
|
|
6502
|
|
|
|
|
|
|
|
|
6503
|
|
|
|
|
|
|
*orgrq = \&PDL::orgrq; |
|
6504
|
|
|
|
|
|
|
|
|
6505
|
|
|
|
|
|
|
|
|
6506
|
|
|
|
|
|
|
|
|
6507
|
|
|
|
|
|
|
|
|
6508
|
|
|
|
|
|
|
|
|
6509
|
|
|
|
|
|
|
=head2 ormrq |
|
6510
|
|
|
|
|
|
|
|
|
6511
|
|
|
|
|
|
|
=for sig |
|
6512
|
|
|
|
|
|
|
|
|
6513
|
|
|
|
|
|
|
Signature: ([phys]A(k,p); int side(); int trans(); [phys]tau(k); [io,phys]C(m,n);int [o,phys]info()) |
|
6514
|
|
|
|
|
|
|
|
|
6515
|
|
|
|
|
|
|
|
|
6516
|
|
|
|
|
|
|
|
|
6517
|
|
|
|
|
|
|
=for ref |
|
6518
|
|
|
|
|
|
|
|
|
6519
|
|
|
|
|
|
|
Overwrites the general real M-by-N matrix C with |
|
6520
|
|
|
|
|
|
|
|
|
6521
|
|
|
|
|
|
|
side = 0 side = 1 |
|
6522
|
|
|
|
|
|
|
trans = 0: Q * C C * Q |
|
6523
|
|
|
|
|
|
|
trans = 1: Q' * C C * Q' |
|
6524
|
|
|
|
|
|
|
|
|
6525
|
|
|
|
|
|
|
where Q is a real orthogonal matrix defined as the product of k |
|
6526
|
|
|
|
|
|
|
elementary reflectors |
|
6527
|
|
|
|
|
|
|
|
|
6528
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k) |
|
6529
|
|
|
|
|
|
|
|
|
6530
|
|
|
|
|
|
|
as returned by gerqf. |
|
6531
|
|
|
|
|
|
|
|
|
6532
|
|
|
|
|
|
|
Q is of order M if C = 0 and of order N |
|
6533
|
|
|
|
|
|
|
if C = 1. |
|
6534
|
|
|
|
|
|
|
|
|
6535
|
|
|
|
|
|
|
Arguments |
|
6536
|
|
|
|
|
|
|
========= |
|
6537
|
|
|
|
|
|
|
|
|
6538
|
|
|
|
|
|
|
side: = 0: apply Q or Q' from the Left; |
|
6539
|
|
|
|
|
|
|
= 1: apply Q or Q' from the Right. |
|
6540
|
|
|
|
|
|
|
|
|
6541
|
|
|
|
|
|
|
trans: = 0: No transpose, apply Q; |
|
6542
|
|
|
|
|
|
|
= 1: Transpose, apply Q'. |
|
6543
|
|
|
|
|
|
|
|
|
6544
|
|
|
|
|
|
|
A: The i-th row must contain the vector which defines the |
|
6545
|
|
|
|
|
|
|
elementary reflector H(i), for i = 1,2,...,k, as returned by |
|
6546
|
|
|
|
|
|
|
gerqf in the last k rows of its array argument A. |
|
6547
|
|
|
|
|
|
|
A is modified by the routine but restored on exit. |
|
6548
|
|
|
|
|
|
|
|
|
6549
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6550
|
|
|
|
|
|
|
reflector H(i), as returned by gerqf. |
|
6551
|
|
|
|
|
|
|
|
|
6552
|
|
|
|
|
|
|
C: On entry, the M-by-N matrix C. |
|
6553
|
|
|
|
|
|
|
On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. |
|
6554
|
|
|
|
|
|
|
|
|
6555
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6556
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6557
|
|
|
|
|
|
|
|
|
6558
|
|
|
|
|
|
|
|
|
6559
|
|
|
|
|
|
|
=for example |
|
6560
|
|
|
|
|
|
|
|
|
6561
|
|
|
|
|
|
|
$a = random (float, 50, 100); |
|
6562
|
|
|
|
|
|
|
$a = transpose($a); |
|
6563
|
|
|
|
|
|
|
$info = null; |
|
6564
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6565
|
|
|
|
|
|
|
gerqf($a, $tau, $info); |
|
6566
|
|
|
|
|
|
|
$c = random(70,50); |
|
6567
|
|
|
|
|
|
|
# $c will contain the result |
|
6568
|
|
|
|
|
|
|
$c->reshape(70,100); |
|
6569
|
|
|
|
|
|
|
$c = transpose($c); |
|
6570
|
|
|
|
|
|
|
ormrq($a, $tau, $c, $info); |
|
6571
|
|
|
|
|
|
|
|
|
6572
|
|
|
|
|
|
|
|
|
6573
|
|
|
|
|
|
|
=for bad |
|
6574
|
|
|
|
|
|
|
|
|
6575
|
|
|
|
|
|
|
ormrq ignores the bad-value flag of the input piddles. |
|
6576
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6577
|
|
|
|
|
|
|
|
|
6578
|
|
|
|
|
|
|
|
|
6579
|
|
|
|
|
|
|
=cut |
|
6580
|
|
|
|
|
|
|
|
|
6581
|
|
|
|
|
|
|
|
|
6582
|
|
|
|
|
|
|
|
|
6583
|
|
|
|
|
|
|
|
|
6584
|
|
|
|
|
|
|
|
|
6585
|
|
|
|
|
|
|
|
|
6586
|
|
|
|
|
|
|
*ormrq = \&PDL::ormrq; |
|
6587
|
|
|
|
|
|
|
|
|
6588
|
|
|
|
|
|
|
|
|
6589
|
|
|
|
|
|
|
|
|
6590
|
|
|
|
|
|
|
|
|
6591
|
|
|
|
|
|
|
|
|
6592
|
|
|
|
|
|
|
=head2 tzrzf |
|
6593
|
|
|
|
|
|
|
|
|
6594
|
|
|
|
|
|
|
=for sig |
|
6595
|
|
|
|
|
|
|
|
|
6596
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n); [o,phys]tau(k); int [o,phys]info()) |
|
6597
|
|
|
|
|
|
|
|
|
6598
|
|
|
|
|
|
|
|
|
6599
|
|
|
|
|
|
|
|
|
6600
|
|
|
|
|
|
|
=for ref |
|
6601
|
|
|
|
|
|
|
|
|
6602
|
|
|
|
|
|
|
Reduces the M-by-N ( M <= N ) real upper trapezoidal matrix A |
|
6603
|
|
|
|
|
|
|
to upper triangular form by means of orthogonal transformations. |
|
6604
|
|
|
|
|
|
|
|
|
6605
|
|
|
|
|
|
|
The upper trapezoidal matrix A is factored as |
|
6606
|
|
|
|
|
|
|
|
|
6607
|
|
|
|
|
|
|
A = ( R 0 ) * Z, |
|
6608
|
|
|
|
|
|
|
|
|
6609
|
|
|
|
|
|
|
where Z is an N-by-N orthogonal matrix and R is an M-by-M upper |
|
6610
|
|
|
|
|
|
|
triangular matrix. |
|
6611
|
|
|
|
|
|
|
|
|
6612
|
|
|
|
|
|
|
The factorization is obtained by Householder's method. The kth |
|
6613
|
|
|
|
|
|
|
transformation matrix, Z( k ), which is used to introduce zeros into |
|
6614
|
|
|
|
|
|
|
the ( m - k + 1 )th row of A, is given in the form |
|
6615
|
|
|
|
|
|
|
|
|
6616
|
|
|
|
|
|
|
Z( k ) = ( I 0 ), |
|
6617
|
|
|
|
|
|
|
( 0 T( k ) ) |
|
6618
|
|
|
|
|
|
|
|
|
6619
|
|
|
|
|
|
|
where |
|
6620
|
|
|
|
|
|
|
|
|
6621
|
|
|
|
|
|
|
T( k ) = I - tau*u( k )*u( k )', u( k ) = ( 1 ), |
|
6622
|
|
|
|
|
|
|
( 0 ) |
|
6623
|
|
|
|
|
|
|
( z( k ) ) |
|
6624
|
|
|
|
|
|
|
|
|
6625
|
|
|
|
|
|
|
tau is a scalar and z( k ) is an ( n - m ) element vector. |
|
6626
|
|
|
|
|
|
|
tau and z( k ) are chosen to annihilate the elements of the kth row |
|
6627
|
|
|
|
|
|
|
of X. |
|
6628
|
|
|
|
|
|
|
|
|
6629
|
|
|
|
|
|
|
The scalar tau is returned in the kth element of C and the vector |
|
6630
|
|
|
|
|
|
|
u( k ) in the kth row of A, such that the elements of z( k ) are |
|
6631
|
|
|
|
|
|
|
in a( k, m + 1 ), ..., a( k, n ). The elements of R are returned in |
|
6632
|
|
|
|
|
|
|
the upper triangular part of A. |
|
6633
|
|
|
|
|
|
|
|
|
6634
|
|
|
|
|
|
|
Z is given by |
|
6635
|
|
|
|
|
|
|
|
|
6636
|
|
|
|
|
|
|
Z = Z( 1 ) * Z( 2 ) * ... * Z( m ). |
|
6637
|
|
|
|
|
|
|
|
|
6638
|
|
|
|
|
|
|
Arguments |
|
6639
|
|
|
|
|
|
|
========= |
|
6640
|
|
|
|
|
|
|
|
|
6641
|
|
|
|
|
|
|
A: On entry, the leading M-by-N upper trapezoidal part of the |
|
6642
|
|
|
|
|
|
|
array A must contain the matrix to be factorized. |
|
6643
|
|
|
|
|
|
|
On exit, the leading M-by-M upper triangular part of A |
|
6644
|
|
|
|
|
|
|
contains the upper triangular matrix R, and elements M+1 to |
|
6645
|
|
|
|
|
|
|
N of the first M rows of A, with the array tau, represent the |
|
6646
|
|
|
|
|
|
|
orthogonal matrix Z as a product of M elementary reflectors. |
|
6647
|
|
|
|
|
|
|
|
|
6648
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors. |
|
6649
|
|
|
|
|
|
|
|
|
6650
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6651
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6652
|
|
|
|
|
|
|
|
|
6653
|
|
|
|
|
|
|
|
|
6654
|
|
|
|
|
|
|
=for example |
|
6655
|
|
|
|
|
|
|
|
|
6656
|
|
|
|
|
|
|
$a = random (float, 50, 100); |
|
6657
|
|
|
|
|
|
|
$info = null; |
|
6658
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6659
|
|
|
|
|
|
|
tzrzf($a, $tau, $info); |
|
6660
|
|
|
|
|
|
|
|
|
6661
|
|
|
|
|
|
|
|
|
6662
|
|
|
|
|
|
|
=for bad |
|
6663
|
|
|
|
|
|
|
|
|
6664
|
|
|
|
|
|
|
tzrzf ignores the bad-value flag of the input piddles. |
|
6665
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6666
|
|
|
|
|
|
|
|
|
6667
|
|
|
|
|
|
|
|
|
6668
|
|
|
|
|
|
|
=cut |
|
6669
|
|
|
|
|
|
|
|
|
6670
|
|
|
|
|
|
|
|
|
6671
|
|
|
|
|
|
|
|
|
6672
|
|
|
|
|
|
|
|
|
6673
|
|
|
|
|
|
|
|
|
6674
|
|
|
|
|
|
|
|
|
6675
|
|
|
|
|
|
|
*tzrzf = \&PDL::tzrzf; |
|
6676
|
|
|
|
|
|
|
|
|
6677
|
|
|
|
|
|
|
|
|
6678
|
|
|
|
|
|
|
|
|
6679
|
|
|
|
|
|
|
|
|
6680
|
|
|
|
|
|
|
|
|
6681
|
|
|
|
|
|
|
=head2 ormrz |
|
6682
|
|
|
|
|
|
|
|
|
6683
|
|
|
|
|
|
|
=for sig |
|
6684
|
|
|
|
|
|
|
|
|
6685
|
|
|
|
|
|
|
Signature: ([phys]A(k,p); int side(); int trans(); [phys]tau(k); [io,phys]C(m,n);int [o,phys]info()) |
|
6686
|
|
|
|
|
|
|
|
|
6687
|
|
|
|
|
|
|
|
|
6688
|
|
|
|
|
|
|
|
|
6689
|
|
|
|
|
|
|
=for ref |
|
6690
|
|
|
|
|
|
|
|
|
6691
|
|
|
|
|
|
|
Overwrites the general real M-by-N matrix C with |
|
6692
|
|
|
|
|
|
|
|
|
6693
|
|
|
|
|
|
|
side = 0 side = 1 |
|
6694
|
|
|
|
|
|
|
trans = 0: Q * C C * Q |
|
6695
|
|
|
|
|
|
|
trans = 1: Q' * C C * Q' |
|
6696
|
|
|
|
|
|
|
|
|
6697
|
|
|
|
|
|
|
where Q is a real orthogonal matrix defined as the product of k |
|
6698
|
|
|
|
|
|
|
elementary reflectors |
|
6699
|
|
|
|
|
|
|
|
|
6700
|
|
|
|
|
|
|
Q = H(1) H(2) . . . H(k) |
|
6701
|
|
|
|
|
|
|
|
|
6702
|
|
|
|
|
|
|
as returned by tzrzf. |
|
6703
|
|
|
|
|
|
|
|
|
6704
|
|
|
|
|
|
|
Q is of order M if C = 0 and of order N |
|
6705
|
|
|
|
|
|
|
if C = 1. |
|
6706
|
|
|
|
|
|
|
|
|
6707
|
|
|
|
|
|
|
Arguments |
|
6708
|
|
|
|
|
|
|
========= |
|
6709
|
|
|
|
|
|
|
|
|
6710
|
|
|
|
|
|
|
side: = 0: apply Q or Q' from the Left; |
|
6711
|
|
|
|
|
|
|
= 1: apply Q or Q' from the Right. |
|
6712
|
|
|
|
|
|
|
|
|
6713
|
|
|
|
|
|
|
trans: = 0: No transpose, apply Q; |
|
6714
|
|
|
|
|
|
|
= 1: Transpose, apply Q'. |
|
6715
|
|
|
|
|
|
|
|
|
6716
|
|
|
|
|
|
|
A: The i-th row must contain the vector which defines the |
|
6717
|
|
|
|
|
|
|
elementary reflector H(i), for i = 1,2,...,k, as returned by |
|
6718
|
|
|
|
|
|
|
tzrzf in the last k rows of its array argument A. |
|
6719
|
|
|
|
|
|
|
A is modified by the routine but restored on exit. |
|
6720
|
|
|
|
|
|
|
|
|
6721
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6722
|
|
|
|
|
|
|
reflector H(i), as returned by tzrzf. |
|
6723
|
|
|
|
|
|
|
|
|
6724
|
|
|
|
|
|
|
C: On entry, the M-by-N matrix C. |
|
6725
|
|
|
|
|
|
|
On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q. |
|
6726
|
|
|
|
|
|
|
|
|
6727
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6728
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6729
|
|
|
|
|
|
|
|
|
6730
|
|
|
|
|
|
|
|
|
6731
|
|
|
|
|
|
|
=for example |
|
6732
|
|
|
|
|
|
|
|
|
6733
|
|
|
|
|
|
|
$a = random (float, 50, 100); |
|
6734
|
|
|
|
|
|
|
$a = transpose($a); |
|
6735
|
|
|
|
|
|
|
$info = null; |
|
6736
|
|
|
|
|
|
|
$tau = zeroes(float, 50); |
|
6737
|
|
|
|
|
|
|
tzrzf($a, $tau, $info); |
|
6738
|
|
|
|
|
|
|
$c = random(70,50); |
|
6739
|
|
|
|
|
|
|
# $c will contain the result |
|
6740
|
|
|
|
|
|
|
$c->reshape(70,100); |
|
6741
|
|
|
|
|
|
|
$c = transpose($c); |
|
6742
|
|
|
|
|
|
|
ormrz($a, $tau, $c, $info); |
|
6743
|
|
|
|
|
|
|
|
|
6744
|
|
|
|
|
|
|
|
|
6745
|
|
|
|
|
|
|
=for bad |
|
6746
|
|
|
|
|
|
|
|
|
6747
|
|
|
|
|
|
|
ormrz ignores the bad-value flag of the input piddles. |
|
6748
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6749
|
|
|
|
|
|
|
|
|
6750
|
|
|
|
|
|
|
|
|
6751
|
|
|
|
|
|
|
=cut |
|
6752
|
|
|
|
|
|
|
|
|
6753
|
|
|
|
|
|
|
|
|
6754
|
|
|
|
|
|
|
|
|
6755
|
|
|
|
|
|
|
|
|
6756
|
|
|
|
|
|
|
|
|
6757
|
|
|
|
|
|
|
|
|
6758
|
|
|
|
|
|
|
*ormrz = \&PDL::ormrz; |
|
6759
|
|
|
|
|
|
|
|
|
6760
|
|
|
|
|
|
|
|
|
6761
|
|
|
|
|
|
|
|
|
6762
|
|
|
|
|
|
|
|
|
6763
|
|
|
|
|
|
|
|
|
6764
|
|
|
|
|
|
|
=head2 gehrd |
|
6765
|
|
|
|
|
|
|
|
|
6766
|
|
|
|
|
|
|
=for sig |
|
6767
|
|
|
|
|
|
|
|
|
6768
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int [phys]ilo();int [phys]ihi();[o,phys]tau(k); int [o,phys]info()) |
|
6769
|
|
|
|
|
|
|
|
|
6770
|
|
|
|
|
|
|
|
|
6771
|
|
|
|
|
|
|
|
|
6772
|
|
|
|
|
|
|
=for ref |
|
6773
|
|
|
|
|
|
|
|
|
6774
|
|
|
|
|
|
|
Reduces a real general matrix A to upper Hessenberg form H by |
|
6775
|
|
|
|
|
|
|
an orthogonal similarity transformation: Q' * A * Q = H . |
|
6776
|
|
|
|
|
|
|
|
|
6777
|
|
|
|
|
|
|
Further Details |
|
6778
|
|
|
|
|
|
|
=============== |
|
6779
|
|
|
|
|
|
|
|
|
6780
|
|
|
|
|
|
|
The matrix Q is represented as a product of (ihi-ilo) elementary |
|
6781
|
|
|
|
|
|
|
reflectors |
|
6782
|
|
|
|
|
|
|
|
|
6783
|
|
|
|
|
|
|
Q = H(ilo) H(ilo+1) . . . H(ihi-1). |
|
6784
|
|
|
|
|
|
|
|
|
6785
|
|
|
|
|
|
|
Each H(i) has the form |
|
6786
|
|
|
|
|
|
|
|
|
6787
|
|
|
|
|
|
|
H(i) = I - tau * v * v' |
|
6788
|
|
|
|
|
|
|
where tau is a real scalar, and v is a real vector with |
|
6789
|
|
|
|
|
|
|
v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on |
|
6790
|
|
|
|
|
|
|
exit in A(i+2:ihi,i), and tau in tau(i). |
|
6791
|
|
|
|
|
|
|
|
|
6792
|
|
|
|
|
|
|
The contents of A are illustrated by the following example, with |
|
6793
|
|
|
|
|
|
|
n = 7, ilo = 2 and ihi = 6: |
|
6794
|
|
|
|
|
|
|
|
|
6795
|
|
|
|
|
|
|
on entry, on exit, |
|
6796
|
|
|
|
|
|
|
|
|
6797
|
|
|
|
|
|
|
( a a a a a a a ) ( a a h h h h a ) |
|
6798
|
|
|
|
|
|
|
( a a a a a a ) ( a h h h h a ) |
|
6799
|
|
|
|
|
|
|
( a a a a a a ) ( h h h h h h ) |
|
6800
|
|
|
|
|
|
|
( a a a a a a ) ( v2 h h h h h ) |
|
6801
|
|
|
|
|
|
|
( a a a a a a ) ( v2 v3 h h h h ) |
|
6802
|
|
|
|
|
|
|
( a a a a a a ) ( v2 v3 v4 h h h ) |
|
6803
|
|
|
|
|
|
|
( a ) ( a ) |
|
6804
|
|
|
|
|
|
|
|
|
6805
|
|
|
|
|
|
|
where a denotes an element of the original matrix A, h denotes a |
|
6806
|
|
|
|
|
|
|
modified element of the upper Hessenberg matrix H, and vi denotes an |
|
6807
|
|
|
|
|
|
|
element of the vector defining H(i). |
|
6808
|
|
|
|
|
|
|
|
|
6809
|
|
|
|
|
|
|
|
|
6810
|
|
|
|
|
|
|
Arguments |
|
6811
|
|
|
|
|
|
|
========= |
|
6812
|
|
|
|
|
|
|
|
|
6813
|
|
|
|
|
|
|
ilo: |
|
6814
|
|
|
|
|
|
|
ihi: It is assumed that A is already upper triangular in rows |
|
6815
|
|
|
|
|
|
|
and columns 1:ilo-1 and ihi+1:N. ilo and ihi are normally |
|
6816
|
|
|
|
|
|
|
set by a previous call to gebal; otherwise they should be |
|
6817
|
|
|
|
|
|
|
set to 1 and N respectively. See Further Details. |
|
6818
|
|
|
|
|
|
|
1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0. |
|
6819
|
|
|
|
|
|
|
|
|
6820
|
|
|
|
|
|
|
A: On entry, the N-by-N general matrix to be reduced. |
|
6821
|
|
|
|
|
|
|
On exit, the upper triangle and the first subdiagonal of A |
|
6822
|
|
|
|
|
|
|
are overwritten with the upper Hessenberg matrix H, and the |
|
6823
|
|
|
|
|
|
|
elements below the first subdiagonal, with the array tau, |
|
6824
|
|
|
|
|
|
|
represent the orthogonal matrix Q as a product of elementary |
|
6825
|
|
|
|
|
|
|
reflectors. See Further Details. |
|
6826
|
|
|
|
|
|
|
|
|
6827
|
|
|
|
|
|
|
tau: The scalar factors of the elementary reflectors (see Further |
|
6828
|
|
|
|
|
|
|
Details). Elements 1:ilo-1 and ihi:N-1 of tau are set to |
|
6829
|
|
|
|
|
|
|
zero. (dimension (N-1)) |
|
6830
|
|
|
|
|
|
|
|
|
6831
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6832
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
6833
|
|
|
|
|
|
|
|
|
6834
|
|
|
|
|
|
|
|
|
6835
|
|
|
|
|
|
|
=for example |
|
6836
|
|
|
|
|
|
|
|
|
6837
|
|
|
|
|
|
|
$a = random (50, 50); |
|
6838
|
|
|
|
|
|
|
$info = null; |
|
6839
|
|
|
|
|
|
|
$tau = zeroes(50); |
|
6840
|
|
|
|
|
|
|
gehrd($a, 1, 50, $tau, $info); |
|
6841
|
|
|
|
|
|
|
|
|
6842
|
|
|
|
|
|
|
|
|
6843
|
|
|
|
|
|
|
=for bad |
|
6844
|
|
|
|
|
|
|
|
|
6845
|
|
|
|
|
|
|
gehrd ignores the bad-value flag of the input piddles. |
|
6846
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6847
|
|
|
|
|
|
|
|
|
6848
|
|
|
|
|
|
|
|
|
6849
|
|
|
|
|
|
|
=cut |
|
6850
|
|
|
|
|
|
|
|
|
6851
|
|
|
|
|
|
|
|
|
6852
|
|
|
|
|
|
|
|
|
6853
|
|
|
|
|
|
|
|
|
6854
|
|
|
|
|
|
|
|
|
6855
|
|
|
|
|
|
|
|
|
6856
|
|
|
|
|
|
|
*gehrd = \&PDL::gehrd; |
|
6857
|
|
|
|
|
|
|
|
|
6858
|
|
|
|
|
|
|
|
|
6859
|
|
|
|
|
|
|
|
|
6860
|
|
|
|
|
|
|
|
|
6861
|
|
|
|
|
|
|
|
|
6862
|
|
|
|
|
|
|
=head2 orghr |
|
6863
|
|
|
|
|
|
|
|
|
6864
|
|
|
|
|
|
|
=for sig |
|
6865
|
|
|
|
|
|
|
|
|
6866
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int [phys]ilo();int [phys]ihi();[phys]tau(k); int [o,phys]info()) |
|
6867
|
|
|
|
|
|
|
|
|
6868
|
|
|
|
|
|
|
|
|
6869
|
|
|
|
|
|
|
|
|
6870
|
|
|
|
|
|
|
=for ref |
|
6871
|
|
|
|
|
|
|
|
|
6872
|
|
|
|
|
|
|
Generates a real orthogonal matrix Q which is defined as the |
|
6873
|
|
|
|
|
|
|
product of ihi-ilo elementary reflectors of order N, as returned by |
|
6874
|
|
|
|
|
|
|
C: |
|
6875
|
|
|
|
|
|
|
|
|
6876
|
|
|
|
|
|
|
Q = H(ilo) H(ilo+1) . . . H(ihi-1). |
|
6877
|
|
|
|
|
|
|
|
|
6878
|
|
|
|
|
|
|
|
|
6879
|
|
|
|
|
|
|
Arguments |
|
6880
|
|
|
|
|
|
|
========= |
|
6881
|
|
|
|
|
|
|
|
|
6882
|
|
|
|
|
|
|
ilo: |
|
6883
|
|
|
|
|
|
|
ihi: ilo and ihi must have the same values as in the previous call |
|
6884
|
|
|
|
|
|
|
of gehrd. Q is equal to the unit matrix except in the |
|
6885
|
|
|
|
|
|
|
submatrix Q(ilo+1:ihi,ilo+1:ihi). |
|
6886
|
|
|
|
|
|
|
1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0. |
|
6887
|
|
|
|
|
|
|
|
|
6888
|
|
|
|
|
|
|
A: On entry, the vectors which define the elementary reflectors, |
|
6889
|
|
|
|
|
|
|
as returned by gehrd. |
|
6890
|
|
|
|
|
|
|
On exit, the N-by-N orthogonal matrix Q. |
|
6891
|
|
|
|
|
|
|
|
|
6892
|
|
|
|
|
|
|
tau: tau(i) must contain the scalar factor of the elementary |
|
6893
|
|
|
|
|
|
|
reflector H(i), as returned by gehrd.(dimension (N-1)) |
|
6894
|
|
|
|
|
|
|
|
|
6895
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6896
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6897
|
|
|
|
|
|
|
|
|
6898
|
|
|
|
|
|
|
|
|
6899
|
|
|
|
|
|
|
=for example |
|
6900
|
|
|
|
|
|
|
|
|
6901
|
|
|
|
|
|
|
$a = random (50, 50); |
|
6902
|
|
|
|
|
|
|
$info = null; |
|
6903
|
|
|
|
|
|
|
$tau = zeroes(50); |
|
6904
|
|
|
|
|
|
|
gehrd($a, 1, 50, $tau, $info); |
|
6905
|
|
|
|
|
|
|
orghr($a, 1, 50, $tau, $info); |
|
6906
|
|
|
|
|
|
|
|
|
6907
|
|
|
|
|
|
|
|
|
6908
|
|
|
|
|
|
|
|
|
6909
|
|
|
|
|
|
|
=for bad |
|
6910
|
|
|
|
|
|
|
|
|
6911
|
|
|
|
|
|
|
orghr ignores the bad-value flag of the input piddles. |
|
6912
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
6913
|
|
|
|
|
|
|
|
|
6914
|
|
|
|
|
|
|
|
|
6915
|
|
|
|
|
|
|
=cut |
|
6916
|
|
|
|
|
|
|
|
|
6917
|
|
|
|
|
|
|
|
|
6918
|
|
|
|
|
|
|
|
|
6919
|
|
|
|
|
|
|
|
|
6920
|
|
|
|
|
|
|
|
|
6921
|
|
|
|
|
|
|
|
|
6922
|
|
|
|
|
|
|
*orghr = \&PDL::orghr; |
|
6923
|
|
|
|
|
|
|
|
|
6924
|
|
|
|
|
|
|
|
|
6925
|
|
|
|
|
|
|
|
|
6926
|
|
|
|
|
|
|
|
|
6927
|
|
|
|
|
|
|
|
|
6928
|
|
|
|
|
|
|
=head2 hseqr |
|
6929
|
|
|
|
|
|
|
|
|
6930
|
|
|
|
|
|
|
=for sig |
|
6931
|
|
|
|
|
|
|
|
|
6932
|
|
|
|
|
|
|
Signature: ([io,phys]H(n,n); int job();int compz();int [phys]ilo();int [phys]ihi();[o,phys]wr(n); [o,phys]wi(n);[o,phys]Z(m,m); int [o,phys]info()) |
|
6933
|
|
|
|
|
|
|
|
|
6934
|
|
|
|
|
|
|
|
|
6935
|
|
|
|
|
|
|
|
|
6936
|
|
|
|
|
|
|
=for ref |
|
6937
|
|
|
|
|
|
|
|
|
6938
|
|
|
|
|
|
|
Computes the eigenvalues of a real upper Hessenberg matrix H |
|
6939
|
|
|
|
|
|
|
and, optionally, the matrices T and Z from the Schur decomposition |
|
6940
|
|
|
|
|
|
|
H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur |
|
6941
|
|
|
|
|
|
|
form), and Z is the orthogonal matrix of Schur vectors. |
|
6942
|
|
|
|
|
|
|
|
|
6943
|
|
|
|
|
|
|
Optionally Z may be postmultiplied into an input orthogonal matrix Q, |
|
6944
|
|
|
|
|
|
|
so that this routine can give the Schur factorization of a matrix A |
|
6945
|
|
|
|
|
|
|
which has been reduced to the Hessenberg form H by the orthogonal |
|
6946
|
|
|
|
|
|
|
matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T. |
|
6947
|
|
|
|
|
|
|
|
|
6948
|
|
|
|
|
|
|
Arguments |
|
6949
|
|
|
|
|
|
|
========= |
|
6950
|
|
|
|
|
|
|
|
|
6951
|
|
|
|
|
|
|
job: = 0: compute eigenvalues only; |
|
6952
|
|
|
|
|
|
|
= 1: compute eigenvalues and the Schur form T. |
|
6953
|
|
|
|
|
|
|
|
|
6954
|
|
|
|
|
|
|
compz: = 0: no Schur vectors are computed; |
|
6955
|
|
|
|
|
|
|
= 1: Z is initialized to the unit matrix and the matrix Z |
|
6956
|
|
|
|
|
|
|
of Schur vectors of H is returned; |
|
6957
|
|
|
|
|
|
|
= 2: Z must contain an orthogonal matrix Q on entry, and |
|
6958
|
|
|
|
|
|
|
the product Q*Z is returned. |
|
6959
|
|
|
|
|
|
|
|
|
6960
|
|
|
|
|
|
|
ilo: |
|
6961
|
|
|
|
|
|
|
ihi: It is assumed that H is already upper triangular in rows |
|
6962
|
|
|
|
|
|
|
and columns 1:ilo-1 and ihi+1:N. ilo and ihi are normally |
|
6963
|
|
|
|
|
|
|
set by a previous call to gebal, and then passed to gehrd |
|
6964
|
|
|
|
|
|
|
when the matrix output by gebal is reduced to Hessenberg |
|
6965
|
|
|
|
|
|
|
form. Otherwise ilo and ihi should be set to 1 and N |
|
6966
|
|
|
|
|
|
|
respectively. |
|
6967
|
|
|
|
|
|
|
1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0. |
|
6968
|
|
|
|
|
|
|
|
|
6969
|
|
|
|
|
|
|
H: On entry, the upper Hessenberg matrix H. |
|
6970
|
|
|
|
|
|
|
On exit, if job = 1, H contains the upper quasi-triangular |
|
6971
|
|
|
|
|
|
|
matrix T from the Schur decomposition (the Schur form); |
|
6972
|
|
|
|
|
|
|
2-by-2 diagonal blocks (corresponding to complex conjugate |
|
6973
|
|
|
|
|
|
|
pairs of eigenvalues) are returned in standard form, with |
|
6974
|
|
|
|
|
|
|
H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0. If job = 0, |
|
6975
|
|
|
|
|
|
|
the contents of H are unspecified on exit. |
|
6976
|
|
|
|
|
|
|
|
|
6977
|
|
|
|
|
|
|
wr: |
|
6978
|
|
|
|
|
|
|
wi: The real and imaginary parts, respectively, of the computed |
|
6979
|
|
|
|
|
|
|
eigenvalues. If two eigenvalues are computed as a complex |
|
6980
|
|
|
|
|
|
|
conjugate pair, they are stored in consecutive elements of |
|
6981
|
|
|
|
|
|
|
wr and wi, say the i-th and (i+1)th, with wi(i) > 0 and |
|
6982
|
|
|
|
|
|
|
wi(i+1) < 0. If job = 1, the eigenvalues are stored in the |
|
6983
|
|
|
|
|
|
|
same order as on the diagonal of the Schur form returned in |
|
6984
|
|
|
|
|
|
|
H, with wr(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2 |
|
6985
|
|
|
|
|
|
|
diagonal block, wi(i) = sqrt(H(i+1,i)*H(i,i+1)) and |
|
6986
|
|
|
|
|
|
|
wi(i+1) = -wi(i). |
|
6987
|
|
|
|
|
|
|
|
|
6988
|
|
|
|
|
|
|
Z: If compz = 0: Z is not referenced. |
|
6989
|
|
|
|
|
|
|
If compz = 1: on entry, Z need not be set, and on exit, Z |
|
6990
|
|
|
|
|
|
|
contains the orthogonal matrix Z of the Schur vectors of H. |
|
6991
|
|
|
|
|
|
|
If compz = 2: on entry Z must contain an N-by-N matrix Q, |
|
6992
|
|
|
|
|
|
|
which is assumed to be equal to the unit matrix except for |
|
6993
|
|
|
|
|
|
|
the submatrix Z(ilo:ihi,ilo:ihi); on exit Z contains Q*Z. |
|
6994
|
|
|
|
|
|
|
Normally Q is the orthogonal matrix generated by orghr after |
|
6995
|
|
|
|
|
|
|
the call to gehrd which formed the Hessenberg matrix H. |
|
6996
|
|
|
|
|
|
|
|
|
6997
|
|
|
|
|
|
|
info: = 0: successful exit |
|
6998
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
6999
|
|
|
|
|
|
|
> 0: if info = i, hseqr failed to compute all of the |
|
7000
|
|
|
|
|
|
|
eigenvalues in a total of 30*(ihi-ilo+1) iterations; |
|
7001
|
|
|
|
|
|
|
elements 1:ilo-1 and i+1:n of wr and wi contain those |
|
7002
|
|
|
|
|
|
|
eigenvalues which have been successfully computed. |
|
7003
|
|
|
|
|
|
|
|
|
7004
|
|
|
|
|
|
|
|
|
7005
|
|
|
|
|
|
|
=for example |
|
7006
|
|
|
|
|
|
|
|
|
7007
|
|
|
|
|
|
|
$a = random (50, 50); |
|
7008
|
|
|
|
|
|
|
$info = null; |
|
7009
|
|
|
|
|
|
|
$tau = zeroes(50); |
|
7010
|
|
|
|
|
|
|
$z= zeroes(1,1); |
|
7011
|
|
|
|
|
|
|
gehrd($a, 1, 50, $tau, $info); |
|
7012
|
|
|
|
|
|
|
hseqr($a,0,0,1,50,($wr=null),($wi=null),$z,$info); |
|
7013
|
|
|
|
|
|
|
|
|
7014
|
|
|
|
|
|
|
|
|
7015
|
|
|
|
|
|
|
|
|
7016
|
|
|
|
|
|
|
=for bad |
|
7017
|
|
|
|
|
|
|
|
|
7018
|
|
|
|
|
|
|
hseqr ignores the bad-value flag of the input piddles. |
|
7019
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7020
|
|
|
|
|
|
|
|
|
7021
|
|
|
|
|
|
|
|
|
7022
|
|
|
|
|
|
|
=cut |
|
7023
|
|
|
|
|
|
|
|
|
7024
|
|
|
|
|
|
|
|
|
7025
|
|
|
|
|
|
|
|
|
7026
|
|
|
|
|
|
|
|
|
7027
|
|
|
|
|
|
|
|
|
7028
|
|
|
|
|
|
|
|
|
7029
|
|
|
|
|
|
|
*hseqr = \&PDL::hseqr; |
|
7030
|
|
|
|
|
|
|
|
|
7031
|
|
|
|
|
|
|
|
|
7032
|
|
|
|
|
|
|
|
|
7033
|
|
|
|
|
|
|
|
|
7034
|
|
|
|
|
|
|
|
|
7035
|
|
|
|
|
|
|
=head2 trevc |
|
7036
|
|
|
|
|
|
|
|
|
7037
|
|
|
|
|
|
|
=for sig |
|
7038
|
|
|
|
|
|
|
|
|
7039
|
|
|
|
|
|
|
Signature: ([io,phys]T(n,n); int side();int howmny();int [phys]select(q);[io,phys]VL(m,r); [io,phys]VR(p,s);int [o,phys]m(); int [o,phys]info()) |
|
7040
|
|
|
|
|
|
|
|
|
7041
|
|
|
|
|
|
|
|
|
7042
|
|
|
|
|
|
|
|
|
7043
|
|
|
|
|
|
|
=for ref |
|
7044
|
|
|
|
|
|
|
|
|
7045
|
|
|
|
|
|
|
Computes some or all of the right and/or left eigenvectors of |
|
7046
|
|
|
|
|
|
|
a real upper quasi-triangular matrix T. |
|
7047
|
|
|
|
|
|
|
|
|
7048
|
|
|
|
|
|
|
The right eigenvector x and the left eigenvector y of T corresponding |
|
7049
|
|
|
|
|
|
|
to an eigenvalue w are defined by: |
|
7050
|
|
|
|
|
|
|
|
|
7051
|
|
|
|
|
|
|
T*x = w*x, y'*T = w*y' |
|
7052
|
|
|
|
|
|
|
where y' denotes the conjugate transpose of the vector y. |
|
7053
|
|
|
|
|
|
|
|
|
7054
|
|
|
|
|
|
|
If all eigenvectors are requested, the routine may either return the |
|
7055
|
|
|
|
|
|
|
matrices X and/or Y of right or left eigenvectors of T, or the |
|
7056
|
|
|
|
|
|
|
products Q*X and/or Q*Y, where Q is an input orthogonal |
|
7057
|
|
|
|
|
|
|
matrix. If T was obtained from the real-Schur factorization of an |
|
7058
|
|
|
|
|
|
|
original matrix A = Q*T*Q', then Q*X and Q*Y are the matrices of |
|
7059
|
|
|
|
|
|
|
right or left eigenvectors of A. |
|
7060
|
|
|
|
|
|
|
|
|
7061
|
|
|
|
|
|
|
T must be in Schur canonical form (as returned by hseqr), that is, |
|
7062
|
|
|
|
|
|
|
block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each |
|
7063
|
|
|
|
|
|
|
2-by-2 diagonal block has its diagonal elements equal and its |
|
7064
|
|
|
|
|
|
|
off-diagonal elements of opposite sign. Corresponding to each 2-by-2 |
|
7065
|
|
|
|
|
|
|
diagonal block is a complex conjugate pair of eigenvalues and |
|
7066
|
|
|
|
|
|
|
eigenvectors; only one eigenvector of the pair is computed, namely |
|
7067
|
|
|
|
|
|
|
the one corresponding to the eigenvalue with positive imaginary part. |
|
7068
|
|
|
|
|
|
|
|
|
7069
|
|
|
|
|
|
|
Further Details |
|
7070
|
|
|
|
|
|
|
=============== |
|
7071
|
|
|
|
|
|
|
|
|
7072
|
|
|
|
|
|
|
The algorithm used in this program is basically backward (forward) |
|
7073
|
|
|
|
|
|
|
substitution, with scaling to make the the code robust against |
|
7074
|
|
|
|
|
|
|
possible overflow. |
|
7075
|
|
|
|
|
|
|
|
|
7076
|
|
|
|
|
|
|
Each eigenvector is normalized so that the element of largest |
|
7077
|
|
|
|
|
|
|
magnitude has magnitude 1; here the magnitude of a complex number |
|
7078
|
|
|
|
|
|
|
(x,y) is taken to be |x| + |y|. |
|
7079
|
|
|
|
|
|
|
|
|
7080
|
|
|
|
|
|
|
|
|
7081
|
|
|
|
|
|
|
Arguments |
|
7082
|
|
|
|
|
|
|
========= |
|
7083
|
|
|
|
|
|
|
|
|
7084
|
|
|
|
|
|
|
|
|
7085
|
|
|
|
|
|
|
side: = 0 : compute both right and left eigenvectors; |
|
7086
|
|
|
|
|
|
|
= 1 : compute right eigenvectors only; |
|
7087
|
|
|
|
|
|
|
= 2 : compute left eigenvectors only. |
|
7088
|
|
|
|
|
|
|
|
|
7089
|
|
|
|
|
|
|
howmny: = 0: compute all right and/or left eigenvectors; |
|
7090
|
|
|
|
|
|
|
= 1: compute all right and/or left eigenvectors, |
|
7091
|
|
|
|
|
|
|
and backtransform them using the input matrices |
|
7092
|
|
|
|
|
|
|
supplied in VR and/or VL; |
|
7093
|
|
|
|
|
|
|
= 2: compute selected right and/or left eigenvectors, |
|
7094
|
|
|
|
|
|
|
specified by the logical array select. |
|
7095
|
|
|
|
|
|
|
|
|
7096
|
|
|
|
|
|
|
select: If howmny = 2, select specifies the eigenvectors to be |
|
7097
|
|
|
|
|
|
|
computed. |
|
7098
|
|
|
|
|
|
|
If howmny = 0 or 1, select is not referenced. |
|
7099
|
|
|
|
|
|
|
To select the real eigenvector corresponding to a real |
|
7100
|
|
|
|
|
|
|
eigenvalue w(j), select(j) must be set to TRUE. To select |
|
7101
|
|
|
|
|
|
|
the complex eigenvector corresponding to a complex conjugate |
|
7102
|
|
|
|
|
|
|
pair w(j) and w(j+1), either select(j) or select(j+1) must be |
|
7103
|
|
|
|
|
|
|
set to TRUE; then on exit select(j) is TRUE and |
|
7104
|
|
|
|
|
|
|
select(j+1) is FALSE. |
|
7105
|
|
|
|
|
|
|
|
|
7106
|
|
|
|
|
|
|
T: The upper quasi-triangular matrix T in Schur canonical form. |
|
7107
|
|
|
|
|
|
|
|
|
7108
|
|
|
|
|
|
|
VL: On entry, if side = 2 or 0 and howmny = 1, VL must |
|
7109
|
|
|
|
|
|
|
contain an N-by-N matrix Q (usually the orthogonal matrix Q |
|
7110
|
|
|
|
|
|
|
of Schur vectors returned by hseqr). |
|
7111
|
|
|
|
|
|
|
On exit, if side = 2 or 0, VL contains: |
|
7112
|
|
|
|
|
|
|
if howmny = 0, the matrix Y of left eigenvectors of T; |
|
7113
|
|
|
|
|
|
|
VL has the same quasi-lower triangular form |
|
7114
|
|
|
|
|
|
|
as T'. If T(i,i) is a real eigenvalue, then |
|
7115
|
|
|
|
|
|
|
the i-th column VL(i) of VL is its |
|
7116
|
|
|
|
|
|
|
corresponding eigenvector. If T(i:i+1,i:i+1) |
|
7117
|
|
|
|
|
|
|
is a 2-by-2 block whose eigenvalues are |
|
7118
|
|
|
|
|
|
|
complex-conjugate eigenvalues of T, then |
|
7119
|
|
|
|
|
|
|
VL(i)+sqrt(-1)*VL(i+1) is the complex |
|
7120
|
|
|
|
|
|
|
eigenvector corresponding to the eigenvalue |
|
7121
|
|
|
|
|
|
|
with positive real part. |
|
7122
|
|
|
|
|
|
|
if howmny = 1, the matrix Q*Y; |
|
7123
|
|
|
|
|
|
|
if howmny = 2, the left eigenvectors of T specified by |
|
7124
|
|
|
|
|
|
|
select, stored consecutively in the columns |
|
7125
|
|
|
|
|
|
|
of VL, in the same order as their |
|
7126
|
|
|
|
|
|
|
eigenvalues. |
|
7127
|
|
|
|
|
|
|
A complex eigenvector corresponding to a complex eigenvalue |
|
7128
|
|
|
|
|
|
|
is stored in two consecutive columns, the first holding the |
|
7129
|
|
|
|
|
|
|
real part, and the second the imaginary part. |
|
7130
|
|
|
|
|
|
|
If side = 1, VL is not referenced. |
|
7131
|
|
|
|
|
|
|
|
|
7132
|
|
|
|
|
|
|
VR: On entry, if side = 1 or 0 and howmny = 1, VR must |
|
7133
|
|
|
|
|
|
|
contain an N-by-N matrix Q (usually the orthogonal matrix Q |
|
7134
|
|
|
|
|
|
|
of Schur vectors returned by hseqr). |
|
7135
|
|
|
|
|
|
|
On exit, if side = 1 or 0, VR contains: |
|
7136
|
|
|
|
|
|
|
if howmny = 0, the matrix X of right eigenvectors of T; |
|
7137
|
|
|
|
|
|
|
VR has the same quasi-upper triangular form |
|
7138
|
|
|
|
|
|
|
as T. If T(i,i) is a real eigenvalue, then |
|
7139
|
|
|
|
|
|
|
the i-th column VR(i) of VR is its |
|
7140
|
|
|
|
|
|
|
corresponding eigenvector. If T(i:i+1,i:i+1) |
|
7141
|
|
|
|
|
|
|
is a 2-by-2 block whose eigenvalues are |
|
7142
|
|
|
|
|
|
|
complex-conjugate eigenvalues of T, then |
|
7143
|
|
|
|
|
|
|
VR(i)+sqrt(-1)*VR(i+1) is the complex |
|
7144
|
|
|
|
|
|
|
eigenvector corresponding to the eigenvalue |
|
7145
|
|
|
|
|
|
|
with positive real part. |
|
7146
|
|
|
|
|
|
|
if howmny = 1, the matrix Q*X; |
|
7147
|
|
|
|
|
|
|
if howmny = 2, the right eigenvectors of T specified by |
|
7148
|
|
|
|
|
|
|
select, stored consecutively in the columns |
|
7149
|
|
|
|
|
|
|
of VR, in the same order as their |
|
7150
|
|
|
|
|
|
|
eigenvalues. |
|
7151
|
|
|
|
|
|
|
A complex eigenvector corresponding to a complex eigenvalue |
|
7152
|
|
|
|
|
|
|
is stored in two consecutive columns, the first holding the |
|
7153
|
|
|
|
|
|
|
real part and the second the imaginary part. |
|
7154
|
|
|
|
|
|
|
If side = 2, VR is not referenced. |
|
7155
|
|
|
|
|
|
|
|
|
7156
|
|
|
|
|
|
|
m: The number of columns in the arrays VL and/or VR actually |
|
7157
|
|
|
|
|
|
|
used to store the eigenvectors. |
|
7158
|
|
|
|
|
|
|
If howmny = 0 or 1, m is set to N. |
|
7159
|
|
|
|
|
|
|
Each selected real eigenvector occupies one column and each |
|
7160
|
|
|
|
|
|
|
selected complex eigenvector occupies two columns. |
|
7161
|
|
|
|
|
|
|
|
|
7162
|
|
|
|
|
|
|
info: = 0: successful exit |
|
7163
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
7164
|
|
|
|
|
|
|
|
|
7165
|
|
|
|
|
|
|
|
|
7166
|
|
|
|
|
|
|
=for example |
|
7167
|
|
|
|
|
|
|
|
|
7168
|
|
|
|
|
|
|
$a = random (50, 50); |
|
7169
|
|
|
|
|
|
|
$info = null; |
|
7170
|
|
|
|
|
|
|
$tau = zeroes(50); |
|
7171
|
|
|
|
|
|
|
$z= zeroes(1,1); |
|
7172
|
|
|
|
|
|
|
gehrd($a, 1, 50, $tau, $info); |
|
7173
|
|
|
|
|
|
|
hseqr($a,0,0,1,50,($wr=null),($wi=null),$z,$info); |
|
7174
|
|
|
|
|
|
|
|
|
7175
|
|
|
|
|
|
|
|
|
7176
|
|
|
|
|
|
|
|
|
7177
|
|
|
|
|
|
|
=for bad |
|
7178
|
|
|
|
|
|
|
|
|
7179
|
|
|
|
|
|
|
trevc ignores the bad-value flag of the input piddles. |
|
7180
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7181
|
|
|
|
|
|
|
|
|
7182
|
|
|
|
|
|
|
|
|
7183
|
|
|
|
|
|
|
=cut |
|
7184
|
|
|
|
|
|
|
|
|
7185
|
|
|
|
|
|
|
|
|
7186
|
|
|
|
|
|
|
|
|
7187
|
|
|
|
|
|
|
|
|
7188
|
|
|
|
|
|
|
|
|
7189
|
|
|
|
|
|
|
|
|
7190
|
|
|
|
|
|
|
*trevc = \&PDL::trevc; |
|
7191
|
|
|
|
|
|
|
|
|
7192
|
|
|
|
|
|
|
|
|
7193
|
|
|
|
|
|
|
|
|
7194
|
|
|
|
|
|
|
|
|
7195
|
|
|
|
|
|
|
|
|
7196
|
|
|
|
|
|
|
=head2 tgevc |
|
7197
|
|
|
|
|
|
|
|
|
7198
|
|
|
|
|
|
|
=for sig |
|
7199
|
|
|
|
|
|
|
|
|
7200
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int side();int howmny();[io,phys]B(n,n);int [phys]select(q);[io,phys]VL(m,r); [io,phys]VR(p,s);int [o,phys]m(); int [o,phys]info()) |
|
7201
|
|
|
|
|
|
|
|
|
7202
|
|
|
|
|
|
|
|
|
7203
|
|
|
|
|
|
|
|
|
7204
|
|
|
|
|
|
|
=for ref |
|
7205
|
|
|
|
|
|
|
|
|
7206
|
|
|
|
|
|
|
Computes some or all of the right and/or left generalized |
|
7207
|
|
|
|
|
|
|
eigenvectors of a pair of real upper triangular matrices (A,B). |
|
7208
|
|
|
|
|
|
|
|
|
7209
|
|
|
|
|
|
|
The right generalized eigenvector x and the left generalized |
|
7210
|
|
|
|
|
|
|
eigenvector y of (A,B) corresponding to a generalized eigenvalue |
|
7211
|
|
|
|
|
|
|
w are defined by: |
|
7212
|
|
|
|
|
|
|
|
|
7213
|
|
|
|
|
|
|
(A - wB) * x = 0 and y**H * (A - wB) = 0 |
|
7214
|
|
|
|
|
|
|
where y**H denotes the conjugate tranpose of y. |
|
7215
|
|
|
|
|
|
|
|
|
7216
|
|
|
|
|
|
|
If an eigenvalue w is determined by zero diagonal elements of both A |
|
7217
|
|
|
|
|
|
|
and B, a unit vector is returned as the corresponding eigenvector. |
|
7218
|
|
|
|
|
|
|
|
|
7219
|
|
|
|
|
|
|
If all eigenvectors are requested, the routine may either return |
|
7220
|
|
|
|
|
|
|
the matrices X and/or Y of right or left eigenvectors of (A,B), or |
|
7221
|
|
|
|
|
|
|
the products Z*X and/or Q*Y, where Z and Q are input orthogonal |
|
7222
|
|
|
|
|
|
|
matrices. If (A,B) was obtained from the generalized real-Schur |
|
7223
|
|
|
|
|
|
|
factorization of an original pair of matrices |
|
7224
|
|
|
|
|
|
|
|
|
7225
|
|
|
|
|
|
|
(A0,B0) = (Q*A*Z**H,Q*B*Z**H), |
|
7226
|
|
|
|
|
|
|
|
|
7227
|
|
|
|
|
|
|
then Z*X and Q*Y are the matrices of right or left eigenvectors of |
|
7228
|
|
|
|
|
|
|
A. |
|
7229
|
|
|
|
|
|
|
|
|
7230
|
|
|
|
|
|
|
A must be block upper triangular, with 1-by-1 and 2-by-2 diagonal |
|
7231
|
|
|
|
|
|
|
blocks. Corresponding to each 2-by-2 diagonal block is a complex |
|
7232
|
|
|
|
|
|
|
conjugate pair of eigenvalues and eigenvectors; only one |
|
7233
|
|
|
|
|
|
|
eigenvector of the pair is computed, namely the one corresponding |
|
7234
|
|
|
|
|
|
|
to the eigenvalue with positive imaginary part. |
|
7235
|
|
|
|
|
|
|
|
|
7236
|
|
|
|
|
|
|
Arguments |
|
7237
|
|
|
|
|
|
|
========= |
|
7238
|
|
|
|
|
|
|
|
|
7239
|
|
|
|
|
|
|
|
|
7240
|
|
|
|
|
|
|
side: = 0 : compute both right and left eigenvectors; |
|
7241
|
|
|
|
|
|
|
= 1 : compute right eigenvectors only; |
|
7242
|
|
|
|
|
|
|
= 2 : compute left eigenvectors only. |
|
7243
|
|
|
|
|
|
|
|
|
7244
|
|
|
|
|
|
|
howmny: = 0 : compute all right and/or left eigenvectors; |
|
7245
|
|
|
|
|
|
|
= 1 : compute all right and/or left eigenvectors, and |
|
7246
|
|
|
|
|
|
|
backtransform them using the input matrices supplied |
|
7247
|
|
|
|
|
|
|
in VR and/or VL; |
|
7248
|
|
|
|
|
|
|
= 2 : compute selected right and/or left eigenvectors, |
|
7249
|
|
|
|
|
|
|
specified by the logical array select. |
|
7250
|
|
|
|
|
|
|
|
|
7251
|
|
|
|
|
|
|
select: If howmny=2, select specifies the eigenvectors to be |
|
7252
|
|
|
|
|
|
|
computed. |
|
7253
|
|
|
|
|
|
|
If howmny=0 or 1, select is not referenced. |
|
7254
|
|
|
|
|
|
|
To select the real eigenvector corresponding to the real |
|
7255
|
|
|
|
|
|
|
eigenvalue w(j), select(j) must be set to TRUE To select |
|
7256
|
|
|
|
|
|
|
the complex eigenvector corresponding to a complex conjugate |
|
7257
|
|
|
|
|
|
|
pair w(j) and w(j+1), either select(j) or select(j+1) must |
|
7258
|
|
|
|
|
|
|
be set to TRUE. |
|
7259
|
|
|
|
|
|
|
|
|
7260
|
|
|
|
|
|
|
A: The upper quasi-triangular matrix A. |
|
7261
|
|
|
|
|
|
|
|
|
7262
|
|
|
|
|
|
|
B: The upper triangular matrix B. If A has a 2-by-2 diagonal |
|
7263
|
|
|
|
|
|
|
block, then the corresponding 2-by-2 block of B must be |
|
7264
|
|
|
|
|
|
|
diagonal with positive elements. |
|
7265
|
|
|
|
|
|
|
|
|
7266
|
|
|
|
|
|
|
VL: On entry, if side = 2 or 0 and howmny = 1, VL must |
|
7267
|
|
|
|
|
|
|
contain an N-by-N matrix Q (usually the orthogonal matrix Q |
|
7268
|
|
|
|
|
|
|
of left Schur vectors returned by hgqez). |
|
7269
|
|
|
|
|
|
|
On exit, if side = 2 or 0, VL contains: |
|
7270
|
|
|
|
|
|
|
if howmny = 0, the matrix Y of left eigenvectors of (A,B); |
|
7271
|
|
|
|
|
|
|
if howmny = 1, the matrix Q*Y; |
|
7272
|
|
|
|
|
|
|
if howmny = 2, the left eigenvectors of (A,B) specified by |
|
7273
|
|
|
|
|
|
|
select, stored consecutively in the columns of |
|
7274
|
|
|
|
|
|
|
VL, in the same order as their eigenvalues. |
|
7275
|
|
|
|
|
|
|
If side = 1, VL is not referenced. |
|
7276
|
|
|
|
|
|
|
|
|
7277
|
|
|
|
|
|
|
A complex eigenvector corresponding to a complex eigenvalue |
|
7278
|
|
|
|
|
|
|
is stored in two consecutive columns, the first holding the |
|
7279
|
|
|
|
|
|
|
real part, and the second the imaginary part. |
|
7280
|
|
|
|
|
|
|
|
|
7281
|
|
|
|
|
|
|
VR: On entry, if side = 1 or 0 and howmny = 1, VR must |
|
7282
|
|
|
|
|
|
|
contain an N-by-N matrix Q (usually the orthogonal matrix Z |
|
7283
|
|
|
|
|
|
|
of right Schur vectors returned by hgeqz). |
|
7284
|
|
|
|
|
|
|
On exit, if side = 1 or 0, VR contains: |
|
7285
|
|
|
|
|
|
|
if howmny = 0, the matrix X of right eigenvectors of (A,B); |
|
7286
|
|
|
|
|
|
|
if howmny = 1, the matrix Z*X; |
|
7287
|
|
|
|
|
|
|
if howmny = 2, the right eigenvectors of (A,B) specified by |
|
7288
|
|
|
|
|
|
|
select, stored consecutively in the columns of |
|
7289
|
|
|
|
|
|
|
VR, in the same order as their eigenvalues. |
|
7290
|
|
|
|
|
|
|
If side = 2, VR is not referenced. |
|
7291
|
|
|
|
|
|
|
|
|
7292
|
|
|
|
|
|
|
A complex eigenvector corresponding to a complex eigenvalue |
|
7293
|
|
|
|
|
|
|
is stored in two consecutive columns, the first holding the |
|
7294
|
|
|
|
|
|
|
real part and the second the imaginary part. |
|
7295
|
|
|
|
|
|
|
|
|
7296
|
|
|
|
|
|
|
M: The number of columns in the arrays VL and/or VR actually |
|
7297
|
|
|
|
|
|
|
used to store the eigenvectors. If howmny = 0 or 1, M |
|
7298
|
|
|
|
|
|
|
is set to N. Each selected real eigenvector occupies one |
|
7299
|
|
|
|
|
|
|
column and each selected complex eigenvector occupies two |
|
7300
|
|
|
|
|
|
|
columns. |
|
7301
|
|
|
|
|
|
|
|
|
7302
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
7303
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
7304
|
|
|
|
|
|
|
> 0: the 2-by-2 block (info:info+1) does not have a complex |
|
7305
|
|
|
|
|
|
|
eigenvalue. |
|
7306
|
|
|
|
|
|
|
=for example |
|
7307
|
|
|
|
|
|
|
|
|
7308
|
|
|
|
|
|
|
$a = random (50, 50); |
|
7309
|
|
|
|
|
|
|
$info = null; |
|
7310
|
|
|
|
|
|
|
$tau = zeroes(50); |
|
7311
|
|
|
|
|
|
|
$z= zeroes(1,1); |
|
7312
|
|
|
|
|
|
|
gehrd($a, 1, 50, $tau, $info); |
|
7313
|
|
|
|
|
|
|
hseqr($a,0,0,1,50,($wr=null),($wi=null),$z,$info); |
|
7314
|
|
|
|
|
|
|
|
|
7315
|
|
|
|
|
|
|
|
|
7316
|
|
|
|
|
|
|
|
|
7317
|
|
|
|
|
|
|
=for bad |
|
7318
|
|
|
|
|
|
|
|
|
7319
|
|
|
|
|
|
|
tgevc ignores the bad-value flag of the input piddles. |
|
7320
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7321
|
|
|
|
|
|
|
|
|
7322
|
|
|
|
|
|
|
|
|
7323
|
|
|
|
|
|
|
=cut |
|
7324
|
|
|
|
|
|
|
|
|
7325
|
|
|
|
|
|
|
|
|
7326
|
|
|
|
|
|
|
|
|
7327
|
|
|
|
|
|
|
|
|
7328
|
|
|
|
|
|
|
|
|
7329
|
|
|
|
|
|
|
|
|
7330
|
|
|
|
|
|
|
*tgevc = \&PDL::tgevc; |
|
7331
|
|
|
|
|
|
|
|
|
7332
|
|
|
|
|
|
|
|
|
7333
|
|
|
|
|
|
|
|
|
7334
|
|
|
|
|
|
|
|
|
7335
|
|
|
|
|
|
|
|
|
7336
|
|
|
|
|
|
|
=head2 gebal |
|
7337
|
|
|
|
|
|
|
|
|
7338
|
|
|
|
|
|
|
=for sig |
|
7339
|
|
|
|
|
|
|
|
|
7340
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,n); int job(); int [o,phys]ilo();int [o,phys]ihi();[o,phys]scale(n); int [o,phys]info()) |
|
7341
|
|
|
|
|
|
|
|
|
7342
|
|
|
|
|
|
|
|
|
7343
|
|
|
|
|
|
|
|
|
7344
|
|
|
|
|
|
|
=for ref |
|
7345
|
|
|
|
|
|
|
|
|
7346
|
|
|
|
|
|
|
Balances a general real matrix A. This involves, first, |
|
7347
|
|
|
|
|
|
|
permuting A by a similarity transformation to isolate eigenvalues |
|
7348
|
|
|
|
|
|
|
in the first 1 to ilo-1 and last ihi+1 to N elements on the |
|
7349
|
|
|
|
|
|
|
diagonal; and second, applying a diagonal similarity transformation |
|
7350
|
|
|
|
|
|
|
to rows and columns ilo to ihi to make the rows and columns as |
|
7351
|
|
|
|
|
|
|
close in norm as possible. Both steps are optional. |
|
7352
|
|
|
|
|
|
|
|
|
7353
|
|
|
|
|
|
|
Balancing may reduce the 1-norm of the matrix, and improve the |
|
7354
|
|
|
|
|
|
|
accuracy of the computed eigenvalues and/or eigenvectors. |
|
7355
|
|
|
|
|
|
|
|
|
7356
|
|
|
|
|
|
|
Further Details |
|
7357
|
|
|
|
|
|
|
=============== |
|
7358
|
|
|
|
|
|
|
|
|
7359
|
|
|
|
|
|
|
The permutations consist of row and column interchanges which put |
|
7360
|
|
|
|
|
|
|
the matrix in the form |
|
7361
|
|
|
|
|
|
|
|
|
7362
|
|
|
|
|
|
|
( T1 X Y ) |
|
7363
|
|
|
|
|
|
|
P A P = ( 0 B Z ) |
|
7364
|
|
|
|
|
|
|
( 0 0 T2 ) |
|
7365
|
|
|
|
|
|
|
|
|
7366
|
|
|
|
|
|
|
where T1 and T2 are upper triangular matrices whose eigenvalues lie |
|
7367
|
|
|
|
|
|
|
along the diagonal. The column indices ilo and ihi mark the starting |
|
7368
|
|
|
|
|
|
|
and ending columns of the submatrix B. Balancing consists of applying |
|
7369
|
|
|
|
|
|
|
a diagonal similarity transformation inv(D) * B * D to make the |
|
7370
|
|
|
|
|
|
|
1-norms of each row of B and its corresponding column nearly equal. |
|
7371
|
|
|
|
|
|
|
|
|
7372
|
|
|
|
|
|
|
The output matrix is |
|
7373
|
|
|
|
|
|
|
|
|
7374
|
|
|
|
|
|
|
( T1 X*D Y ) |
|
7375
|
|
|
|
|
|
|
( 0 inv(D)*B*D inv(D)*Z ). |
|
7376
|
|
|
|
|
|
|
( 0 0 T2 ) |
|
7377
|
|
|
|
|
|
|
|
|
7378
|
|
|
|
|
|
|
|
|
7379
|
|
|
|
|
|
|
Information about the permutations P and the diagonal matrix D is |
|
7380
|
|
|
|
|
|
|
returned in the vector C. |
|
7381
|
|
|
|
|
|
|
|
|
7382
|
|
|
|
|
|
|
|
|
7383
|
|
|
|
|
|
|
Arguments |
|
7384
|
|
|
|
|
|
|
========= |
|
7385
|
|
|
|
|
|
|
|
|
7386
|
|
|
|
|
|
|
job: Specifies the operations to be performed on A: |
|
7387
|
|
|
|
|
|
|
= 0: none: simply set ilo = 1, ihi = N, scale(I) = 1.0 |
|
7388
|
|
|
|
|
|
|
for i = 1,...,N; |
|
7389
|
|
|
|
|
|
|
= 1: permute only; |
|
7390
|
|
|
|
|
|
|
= 2: scale only; |
|
7391
|
|
|
|
|
|
|
= 3: both permute and scale. |
|
7392
|
|
|
|
|
|
|
|
|
7393
|
|
|
|
|
|
|
A: On entry, the input matrix A. |
|
7394
|
|
|
|
|
|
|
On exit, A is overwritten by the balanced matrix. |
|
7395
|
|
|
|
|
|
|
If job = 0, A is not referenced. |
|
7396
|
|
|
|
|
|
|
See Further Details. |
|
7397
|
|
|
|
|
|
|
|
|
7398
|
|
|
|
|
|
|
ilo: |
|
7399
|
|
|
|
|
|
|
ihi: ilo and ihi are set to integers such that on exit |
|
7400
|
|
|
|
|
|
|
A(i,j) = 0 if i > j and j = 1,...,ilo-1 or I = ihi+1,...,N. |
|
7401
|
|
|
|
|
|
|
If job = 0 or 2, ilo = 1 and ihi = N. |
|
7402
|
|
|
|
|
|
|
|
|
7403
|
|
|
|
|
|
|
scale: Details of the permutations and scaling factors applied to |
|
7404
|
|
|
|
|
|
|
A. If P(j) is the index of the row and column interchanged |
|
7405
|
|
|
|
|
|
|
with row and column j and D(j) is the scaling factor |
|
7406
|
|
|
|
|
|
|
applied to row and column j, then |
|
7407
|
|
|
|
|
|
|
scale(j) = P(j) for j = 1,...,ilo-1 |
|
7408
|
|
|
|
|
|
|
= D(j) for j = ilo,...,ihi |
|
7409
|
|
|
|
|
|
|
= P(j) for j = ihi+1,...,N. |
|
7410
|
|
|
|
|
|
|
The order in which the interchanges are made is N to ihi+1, |
|
7411
|
|
|
|
|
|
|
then 1 to ilo-1. |
|
7412
|
|
|
|
|
|
|
|
|
7413
|
|
|
|
|
|
|
info: = 0: successful exit. |
|
7414
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
7415
|
|
|
|
|
|
|
|
|
7416
|
|
|
|
|
|
|
|
|
7417
|
|
|
|
|
|
|
|
|
7418
|
|
|
|
|
|
|
|
|
7419
|
|
|
|
|
|
|
=for example |
|
7420
|
|
|
|
|
|
|
|
|
7421
|
|
|
|
|
|
|
$a = random (50, 50); |
|
7422
|
|
|
|
|
|
|
$scale = zeroes(50); |
|
7423
|
|
|
|
|
|
|
$info = null; |
|
7424
|
|
|
|
|
|
|
$ilo = null; |
|
7425
|
|
|
|
|
|
|
$ihi = null; |
|
7426
|
|
|
|
|
|
|
gebal($a, $ilo, $ihi, $scale, $info); |
|
7427
|
|
|
|
|
|
|
|
|
7428
|
|
|
|
|
|
|
|
|
7429
|
|
|
|
|
|
|
|
|
7430
|
|
|
|
|
|
|
=for bad |
|
7431
|
|
|
|
|
|
|
|
|
7432
|
|
|
|
|
|
|
gebal ignores the bad-value flag of the input piddles. |
|
7433
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7434
|
|
|
|
|
|
|
|
|
7435
|
|
|
|
|
|
|
|
|
7436
|
|
|
|
|
|
|
=cut |
|
7437
|
|
|
|
|
|
|
|
|
7438
|
|
|
|
|
|
|
|
|
7439
|
|
|
|
|
|
|
|
|
7440
|
|
|
|
|
|
|
|
|
7441
|
|
|
|
|
|
|
|
|
7442
|
|
|
|
|
|
|
|
|
7443
|
|
|
|
|
|
|
*gebal = \&PDL::gebal; |
|
7444
|
|
|
|
|
|
|
|
|
7445
|
|
|
|
|
|
|
|
|
7446
|
|
|
|
|
|
|
|
|
7447
|
|
|
|
|
|
|
|
|
7448
|
|
|
|
|
|
|
|
|
7449
|
|
|
|
|
|
|
=head2 gebak |
|
7450
|
|
|
|
|
|
|
|
|
7451
|
|
|
|
|
|
|
=for sig |
|
7452
|
|
|
|
|
|
|
|
|
7453
|
|
|
|
|
|
|
Signature: ([io,phys]A(n,m); int job(); int side();int [phys]ilo();int [phys]ihi();[phys]scale(n); int [o,phys]info()) |
|
7454
|
|
|
|
|
|
|
|
|
7455
|
|
|
|
|
|
|
|
|
7456
|
|
|
|
|
|
|
|
|
7457
|
|
|
|
|
|
|
=for ref |
|
7458
|
|
|
|
|
|
|
|
|
7459
|
|
|
|
|
|
|
gebak forms the right or left eigenvectors of a real general matrix |
|
7460
|
|
|
|
|
|
|
by backward transformation on the computed eigenvectors of the |
|
7461
|
|
|
|
|
|
|
balanced matrix output by gebal. |
|
7462
|
|
|
|
|
|
|
|
|
7463
|
|
|
|
|
|
|
Arguments |
|
7464
|
|
|
|
|
|
|
========= |
|
7465
|
|
|
|
|
|
|
|
|
7466
|
|
|
|
|
|
|
A: On entry, the matrix of right or left eigenvectors to be |
|
7467
|
|
|
|
|
|
|
transformed, as returned by hsein or trevc. |
|
7468
|
|
|
|
|
|
|
On exit, A is overwritten by the transformed eigenvectors. |
|
7469
|
|
|
|
|
|
|
|
|
7470
|
|
|
|
|
|
|
job: Specifies the type of backward transformation required: |
|
7471
|
|
|
|
|
|
|
= 0 , do nothing, return immediately; |
|
7472
|
|
|
|
|
|
|
= 1, do backward transformation for permutation only; |
|
7473
|
|
|
|
|
|
|
= 2, do backward transformation for scaling only; |
|
7474
|
|
|
|
|
|
|
= 3, do backward transformations for both permutation and |
|
7475
|
|
|
|
|
|
|
scaling. |
|
7476
|
|
|
|
|
|
|
job must be the same as the argument job supplied to gebal. |
|
7477
|
|
|
|
|
|
|
|
|
7478
|
|
|
|
|
|
|
side: = 0: V contains left eigenvectors. |
|
7479
|
|
|
|
|
|
|
= 1: V contains right eigenvectors; |
|
7480
|
|
|
|
|
|
|
|
|
7481
|
|
|
|
|
|
|
ilo: |
|
7482
|
|
|
|
|
|
|
ihi: The integers ilo and ihi determined by gebal. |
|
7483
|
|
|
|
|
|
|
1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0. |
|
7484
|
|
|
|
|
|
|
Here N is the the number of rows of the matrix A. |
|
7485
|
|
|
|
|
|
|
|
|
7486
|
|
|
|
|
|
|
scale: Details of the permutation and scaling factors, as returned |
|
7487
|
|
|
|
|
|
|
by gebal. |
|
7488
|
|
|
|
|
|
|
|
|
7489
|
|
|
|
|
|
|
info: = 0: successful exit |
|
7490
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value. |
|
7491
|
|
|
|
|
|
|
|
|
7492
|
|
|
|
|
|
|
|
|
7493
|
|
|
|
|
|
|
|
|
7494
|
|
|
|
|
|
|
|
|
7495
|
|
|
|
|
|
|
=for example |
|
7496
|
|
|
|
|
|
|
|
|
7497
|
|
|
|
|
|
|
$a = random (50, 50); |
|
7498
|
|
|
|
|
|
|
$scale = zeroes(50); |
|
7499
|
|
|
|
|
|
|
$info = null; |
|
7500
|
|
|
|
|
|
|
$ilo = null; |
|
7501
|
|
|
|
|
|
|
$ihi = null; |
|
7502
|
|
|
|
|
|
|
gebal($a, $ilo, $ihi, $scale, $info); |
|
7503
|
|
|
|
|
|
|
# Compute eigenvectors ($ev) |
|
7504
|
|
|
|
|
|
|
gebak($ev, $ilo, $ihi, $scale, $info); |
|
7505
|
|
|
|
|
|
|
|
|
7506
|
|
|
|
|
|
|
|
|
7507
|
|
|
|
|
|
|
|
|
7508
|
|
|
|
|
|
|
=for bad |
|
7509
|
|
|
|
|
|
|
|
|
7510
|
|
|
|
|
|
|
gebak ignores the bad-value flag of the input piddles. |
|
7511
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7512
|
|
|
|
|
|
|
|
|
7513
|
|
|
|
|
|
|
|
|
7514
|
|
|
|
|
|
|
=cut |
|
7515
|
|
|
|
|
|
|
|
|
7516
|
|
|
|
|
|
|
|
|
7517
|
|
|
|
|
|
|
|
|
7518
|
|
|
|
|
|
|
|
|
7519
|
|
|
|
|
|
|
|
|
7520
|
|
|
|
|
|
|
|
|
7521
|
|
|
|
|
|
|
*gebak = \&PDL::gebak; |
|
7522
|
|
|
|
|
|
|
|
|
7523
|
|
|
|
|
|
|
|
|
7524
|
|
|
|
|
|
|
|
|
7525
|
|
|
|
|
|
|
|
|
7526
|
|
|
|
|
|
|
|
|
7527
|
|
|
|
|
|
|
=head2 lange |
|
7528
|
|
|
|
|
|
|
|
|
7529
|
|
|
|
|
|
|
=for sig |
|
7530
|
|
|
|
|
|
|
|
|
7531
|
|
|
|
|
|
|
Signature: ([phys]A(n,m); int norm(); [o]b()) |
|
7532
|
|
|
|
|
|
|
|
|
7533
|
|
|
|
|
|
|
|
|
7534
|
|
|
|
|
|
|
|
|
7535
|
|
|
|
|
|
|
=for ref |
|
7536
|
|
|
|
|
|
|
|
|
7537
|
|
|
|
|
|
|
Computes the value of the one norm, or the Frobenius norm, or |
|
7538
|
|
|
|
|
|
|
the infinity norm, or the element of largest absolute value of a |
|
7539
|
|
|
|
|
|
|
real matrix A. |
|
7540
|
|
|
|
|
|
|
|
|
7541
|
|
|
|
|
|
|
Description |
|
7542
|
|
|
|
|
|
|
=========== |
|
7543
|
|
|
|
|
|
|
|
|
7544
|
|
|
|
|
|
|
returns the value |
|
7545
|
|
|
|
|
|
|
|
|
7546
|
|
|
|
|
|
|
lange = ( max(abs(A(i,j))), norm = 0 |
|
7547
|
|
|
|
|
|
|
( |
|
7548
|
|
|
|
|
|
|
( norm1(A), norm = 1 |
|
7549
|
|
|
|
|
|
|
( |
|
7550
|
|
|
|
|
|
|
( normI(A), norm = 2 |
|
7551
|
|
|
|
|
|
|
( |
|
7552
|
|
|
|
|
|
|
( normF(A), norm = 3 |
|
7553
|
|
|
|
|
|
|
|
|
7554
|
|
|
|
|
|
|
where norm1 denotes the one norm of a matrix (maximum column sum), |
|
7555
|
|
|
|
|
|
|
normI denotes the infinity norm of a matrix (maximum row sum) and |
|
7556
|
|
|
|
|
|
|
normF denotes the Frobenius norm of a matrix (square root of sum of |
|
7557
|
|
|
|
|
|
|
squares). Note that max(abs(A(i,j))) is not a matrix norm. |
|
7558
|
|
|
|
|
|
|
|
|
7559
|
|
|
|
|
|
|
Arguments |
|
7560
|
|
|
|
|
|
|
========= |
|
7561
|
|
|
|
|
|
|
|
|
7562
|
|
|
|
|
|
|
norm: Specifies the value to be returned in lange as described |
|
7563
|
|
|
|
|
|
|
above. |
|
7564
|
|
|
|
|
|
|
|
|
7565
|
|
|
|
|
|
|
A: The n by m matrix A. |
|
7566
|
|
|
|
|
|
|
|
|
7567
|
|
|
|
|
|
|
|
|
7568
|
|
|
|
|
|
|
=for example |
|
7569
|
|
|
|
|
|
|
|
|
7570
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
7571
|
|
|
|
|
|
|
$norm = $a->lange(1); |
|
7572
|
|
|
|
|
|
|
|
|
7573
|
|
|
|
|
|
|
|
|
7574
|
|
|
|
|
|
|
|
|
7575
|
|
|
|
|
|
|
=for bad |
|
7576
|
|
|
|
|
|
|
|
|
7577
|
|
|
|
|
|
|
lange ignores the bad-value flag of the input piddles. |
|
7578
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7579
|
|
|
|
|
|
|
|
|
7580
|
|
|
|
|
|
|
|
|
7581
|
|
|
|
|
|
|
=cut |
|
7582
|
|
|
|
|
|
|
|
|
7583
|
|
|
|
|
|
|
|
|
7584
|
|
|
|
|
|
|
|
|
7585
|
|
|
|
|
|
|
|
|
7586
|
|
|
|
|
|
|
|
|
7587
|
|
|
|
|
|
|
|
|
7588
|
|
|
|
|
|
|
*lange = \&PDL::lange; |
|
7589
|
|
|
|
|
|
|
|
|
7590
|
|
|
|
|
|
|
|
|
7591
|
|
|
|
|
|
|
|
|
7592
|
|
|
|
|
|
|
|
|
7593
|
|
|
|
|
|
|
|
|
7594
|
|
|
|
|
|
|
=head2 lansy |
|
7595
|
|
|
|
|
|
|
|
|
7596
|
|
|
|
|
|
|
=for sig |
|
7597
|
|
|
|
|
|
|
|
|
7598
|
|
|
|
|
|
|
Signature: ([phys]A(n,n); int uplo(); int norm(); [o]b()) |
|
7599
|
|
|
|
|
|
|
|
|
7600
|
|
|
|
|
|
|
|
|
7601
|
|
|
|
|
|
|
|
|
7602
|
|
|
|
|
|
|
=for ref |
|
7603
|
|
|
|
|
|
|
|
|
7604
|
|
|
|
|
|
|
Computes the value of the one norm, or the Frobenius norm, or |
|
7605
|
|
|
|
|
|
|
the infinity norm, or the element of largest absolute value of a |
|
7606
|
|
|
|
|
|
|
real symmetric matrix A. |
|
7607
|
|
|
|
|
|
|
|
|
7608
|
|
|
|
|
|
|
Description |
|
7609
|
|
|
|
|
|
|
=========== |
|
7610
|
|
|
|
|
|
|
|
|
7611
|
|
|
|
|
|
|
returns the value |
|
7612
|
|
|
|
|
|
|
|
|
7613
|
|
|
|
|
|
|
lansy = ( max(abs(A(i,j))), norm = 0 |
|
7614
|
|
|
|
|
|
|
( |
|
7615
|
|
|
|
|
|
|
( norm1(A), norm = 1 |
|
7616
|
|
|
|
|
|
|
( |
|
7617
|
|
|
|
|
|
|
( normI(A), norm = 2 |
|
7618
|
|
|
|
|
|
|
( |
|
7619
|
|
|
|
|
|
|
( normF(A), norm = 3 |
|
7620
|
|
|
|
|
|
|
|
|
7621
|
|
|
|
|
|
|
where norm1 denotes the one norm of a matrix (maximum column sum), |
|
7622
|
|
|
|
|
|
|
normI denotes the infinity norm of a matrix (maximum row sum) and |
|
7623
|
|
|
|
|
|
|
normF denotes the Frobenius norm of a matrix (square root of sum of |
|
7624
|
|
|
|
|
|
|
squares). Note that max(abs(A(i,j))) is not a matrix norm. |
|
7625
|
|
|
|
|
|
|
|
|
7626
|
|
|
|
|
|
|
norm: Specifies the value to be returned in lansy as described |
|
7627
|
|
|
|
|
|
|
above. |
|
7628
|
|
|
|
|
|
|
|
|
7629
|
|
|
|
|
|
|
uplo: Specifies whether the upper or lower triangular part of the |
|
7630
|
|
|
|
|
|
|
symmetric matrix A is to be referenced. |
|
7631
|
|
|
|
|
|
|
= 0: Upper triangular part of A is referenced |
|
7632
|
|
|
|
|
|
|
= 1: Lower triangular part of A is referenced |
|
7633
|
|
|
|
|
|
|
|
|
7634
|
|
|
|
|
|
|
A: The symmetric matrix A. If uplo = 0, the leading n by n |
|
7635
|
|
|
|
|
|
|
upper triangular part of A contains the upper triangular part |
|
7636
|
|
|
|
|
|
|
of the matrix A, and the strictly lower triangular part of A |
|
7637
|
|
|
|
|
|
|
is not referenced. If uplo = 1, the leading n by n lower |
|
7638
|
|
|
|
|
|
|
triangular part of A contains the lower triangular part of |
|
7639
|
|
|
|
|
|
|
the matrix A, and the strictly upper triangular part of A is |
|
7640
|
|
|
|
|
|
|
not referenced. |
|
7641
|
|
|
|
|
|
|
|
|
7642
|
|
|
|
|
|
|
|
|
7643
|
|
|
|
|
|
|
=for example |
|
7644
|
|
|
|
|
|
|
|
|
7645
|
|
|
|
|
|
|
# Assume $a is symmetric |
|
7646
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
7647
|
|
|
|
|
|
|
$norm = $a->lansy(1, 1); |
|
7648
|
|
|
|
|
|
|
|
|
7649
|
|
|
|
|
|
|
|
|
7650
|
|
|
|
|
|
|
|
|
7651
|
|
|
|
|
|
|
=for bad |
|
7652
|
|
|
|
|
|
|
|
|
7653
|
|
|
|
|
|
|
lansy ignores the bad-value flag of the input piddles. |
|
7654
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7655
|
|
|
|
|
|
|
|
|
7656
|
|
|
|
|
|
|
|
|
7657
|
|
|
|
|
|
|
=cut |
|
7658
|
|
|
|
|
|
|
|
|
7659
|
|
|
|
|
|
|
|
|
7660
|
|
|
|
|
|
|
|
|
7661
|
|
|
|
|
|
|
|
|
7662
|
|
|
|
|
|
|
|
|
7663
|
|
|
|
|
|
|
|
|
7664
|
|
|
|
|
|
|
*lansy = \&PDL::lansy; |
|
7665
|
|
|
|
|
|
|
|
|
7666
|
|
|
|
|
|
|
|
|
7667
|
|
|
|
|
|
|
|
|
7668
|
|
|
|
|
|
|
|
|
7669
|
|
|
|
|
|
|
|
|
7670
|
|
|
|
|
|
|
=head2 lantr |
|
7671
|
|
|
|
|
|
|
|
|
7672
|
|
|
|
|
|
|
=for sig |
|
7673
|
|
|
|
|
|
|
|
|
7674
|
|
|
|
|
|
|
Signature: ([phys]A(m,n);int uplo();int norm();int diag();[o]b()) |
|
7675
|
|
|
|
|
|
|
|
|
7676
|
|
|
|
|
|
|
|
|
7677
|
|
|
|
|
|
|
|
|
7678
|
|
|
|
|
|
|
=for ref |
|
7679
|
|
|
|
|
|
|
|
|
7680
|
|
|
|
|
|
|
Computes the value of the one norm, or the Frobenius norm, or |
|
7681
|
|
|
|
|
|
|
the infinity norm, or the element of largest absolute value of a |
|
7682
|
|
|
|
|
|
|
trapezoidal or triangular matrix A. |
|
7683
|
|
|
|
|
|
|
|
|
7684
|
|
|
|
|
|
|
Description |
|
7685
|
|
|
|
|
|
|
=========== |
|
7686
|
|
|
|
|
|
|
|
|
7687
|
|
|
|
|
|
|
returns the value |
|
7688
|
|
|
|
|
|
|
|
|
7689
|
|
|
|
|
|
|
lantr = ( max(abs(A(i,j))), norm = 0 |
|
7690
|
|
|
|
|
|
|
( |
|
7691
|
|
|
|
|
|
|
( norm1(A), norm = 1 |
|
7692
|
|
|
|
|
|
|
( |
|
7693
|
|
|
|
|
|
|
( normI(A), norm = 2 |
|
7694
|
|
|
|
|
|
|
( |
|
7695
|
|
|
|
|
|
|
( normF(A), norm = 3 |
|
7696
|
|
|
|
|
|
|
|
|
7697
|
|
|
|
|
|
|
where norm1 denotes the one norm of a matrix (maximum column sum), |
|
7698
|
|
|
|
|
|
|
normI denotes the infinity norm of a matrix (maximum row sum) and |
|
7699
|
|
|
|
|
|
|
normF denotes the Frobenius norm of a matrix (square root of sum of |
|
7700
|
|
|
|
|
|
|
squares). Note that max(abs(A(i,j))) is not a matrix norm. |
|
7701
|
|
|
|
|
|
|
|
|
7702
|
|
|
|
|
|
|
norm: Specifies the value to be returned in lantr as described |
|
7703
|
|
|
|
|
|
|
above. |
|
7704
|
|
|
|
|
|
|
|
|
7705
|
|
|
|
|
|
|
uplo: Specifies whether the matrix A is upper or lower trapezoidal. |
|
7706
|
|
|
|
|
|
|
= 0: Upper triangular part of A is referenced |
|
7707
|
|
|
|
|
|
|
= 1: Lower triangular part of A is referenced |
|
7708
|
|
|
|
|
|
|
Note that A is triangular instead of trapezoidal if M = N. |
|
7709
|
|
|
|
|
|
|
|
|
7710
|
|
|
|
|
|
|
diag: Specifies whether or not the matrix A has unit diagonal. |
|
7711
|
|
|
|
|
|
|
= 0: Non-unit diagonal |
|
7712
|
|
|
|
|
|
|
= 1: Unit diagonal |
|
7713
|
|
|
|
|
|
|
|
|
7714
|
|
|
|
|
|
|
A: The trapezoidal matrix A (A is triangular if m = n). |
|
7715
|
|
|
|
|
|
|
If uplo = 0, the leading m by n upper trapezoidal part of |
|
7716
|
|
|
|
|
|
|
the array A contains the upper trapezoidal matrix, and the |
|
7717
|
|
|
|
|
|
|
strictly lower triangular part of A is not referenced. |
|
7718
|
|
|
|
|
|
|
If uplo = 1, the leading m by n lower trapezoidal part of |
|
7719
|
|
|
|
|
|
|
the array A contains the lower trapezoidal matrix, and the |
|
7720
|
|
|
|
|
|
|
strictly upper triangular part of A is not referenced. Note |
|
7721
|
|
|
|
|
|
|
that when diag = 1, the diagonal elements of A are not |
|
7722
|
|
|
|
|
|
|
referenced and are assumed to be one. |
|
7723
|
|
|
|
|
|
|
|
|
7724
|
|
|
|
|
|
|
|
|
7725
|
|
|
|
|
|
|
=for example |
|
7726
|
|
|
|
|
|
|
|
|
7727
|
|
|
|
|
|
|
# Assume $a is upper triangular |
|
7728
|
|
|
|
|
|
|
$a = random (float, 100, 100); |
|
7729
|
|
|
|
|
|
|
$norm = $a->lantr(1, 1, 0); |
|
7730
|
|
|
|
|
|
|
|
|
7731
|
|
|
|
|
|
|
|
|
7732
|
|
|
|
|
|
|
|
|
7733
|
|
|
|
|
|
|
=for bad |
|
7734
|
|
|
|
|
|
|
|
|
7735
|
|
|
|
|
|
|
lantr ignores the bad-value flag of the input piddles. |
|
7736
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7737
|
|
|
|
|
|
|
|
|
7738
|
|
|
|
|
|
|
|
|
7739
|
|
|
|
|
|
|
=cut |
|
7740
|
|
|
|
|
|
|
|
|
7741
|
|
|
|
|
|
|
|
|
7742
|
|
|
|
|
|
|
|
|
7743
|
|
|
|
|
|
|
|
|
7744
|
|
|
|
|
|
|
|
|
7745
|
|
|
|
|
|
|
|
|
7746
|
|
|
|
|
|
|
*lantr = \&PDL::lantr; |
|
7747
|
|
|
|
|
|
|
|
|
7748
|
|
|
|
|
|
|
|
|
7749
|
|
|
|
|
|
|
|
|
7750
|
|
|
|
|
|
|
|
|
7751
|
|
|
|
|
|
|
|
|
7752
|
|
|
|
|
|
|
=head2 gemm |
|
7753
|
|
|
|
|
|
|
|
|
7754
|
|
|
|
|
|
|
=for sig |
|
7755
|
|
|
|
|
|
|
|
|
7756
|
|
|
|
|
|
|
Signature: ([phys]A(m,n); int transa(); int transb(); [phys]B(p,q);[phys]alpha(); [phys]beta(); [io,phys]C(r,s)) |
|
7757
|
|
|
|
|
|
|
|
|
7758
|
|
|
|
|
|
|
|
|
7759
|
|
|
|
|
|
|
|
|
7760
|
|
|
|
|
|
|
=for ref |
|
7761
|
|
|
|
|
|
|
|
|
7762
|
|
|
|
|
|
|
Performs one of the matrix-matrix operations |
|
7763
|
|
|
|
|
|
|
|
|
7764
|
|
|
|
|
|
|
C := alpha*op( A )*op( B ) + beta*C, |
|
7765
|
|
|
|
|
|
|
where op( X ) is one of p( X ) = X or op( X ) = X', |
|
7766
|
|
|
|
|
|
|
alpha and beta are scalars, and A, B and C are matrices, with op( A ) |
|
7767
|
|
|
|
|
|
|
an m by k matrix, op( B ) a k by n matrix and C an m by n matrix. |
|
7768
|
|
|
|
|
|
|
|
|
7769
|
|
|
|
|
|
|
Parameters |
|
7770
|
|
|
|
|
|
|
========== |
|
7771
|
|
|
|
|
|
|
transa: On entry, transa specifies the form of op( A ) to be used in |
|
7772
|
|
|
|
|
|
|
the matrix multiplication as follows: |
|
7773
|
|
|
|
|
|
|
transa = 0, op( A ) = A. |
|
7774
|
|
|
|
|
|
|
transa = 1, op( A ) = A'. |
|
7775
|
|
|
|
|
|
|
|
|
7776
|
|
|
|
|
|
|
transb: On entry, transb specifies the form of op( B ) to be used in |
|
7777
|
|
|
|
|
|
|
the matrix multiplication as follows: |
|
7778
|
|
|
|
|
|
|
transb = 0, op( B ) = B. |
|
7779
|
|
|
|
|
|
|
transb = 1, op( B ) = B'. |
|
7780
|
|
|
|
|
|
|
|
|
7781
|
|
|
|
|
|
|
alpha: On entry, alpha specifies the scalar alpha. |
|
7782
|
|
|
|
|
|
|
|
|
7783
|
|
|
|
|
|
|
A: Before entry with transa = 0, the leading m by k |
|
7784
|
|
|
|
|
|
|
part of the array A must contain the matrix A, otherwise |
|
7785
|
|
|
|
|
|
|
the leading k by m part of the array A must contain the |
|
7786
|
|
|
|
|
|
|
matrix A. |
|
7787
|
|
|
|
|
|
|
|
|
7788
|
|
|
|
|
|
|
B: Before entry with transb = 0, the leading k by n |
|
7789
|
|
|
|
|
|
|
part of the array B must contain the matrix B, otherwise |
|
7790
|
|
|
|
|
|
|
the leading n by k part of the array B must contain the |
|
7791
|
|
|
|
|
|
|
matrix B. |
|
7792
|
|
|
|
|
|
|
|
|
7793
|
|
|
|
|
|
|
beta: On entry, beta specifies the scalar beta. When beta is |
|
7794
|
|
|
|
|
|
|
supplied as zero then C need not be set on input. |
|
7795
|
|
|
|
|
|
|
|
|
7796
|
|
|
|
|
|
|
C: Before entry, the leading m by n part of the array C must |
|
7797
|
|
|
|
|
|
|
contain the matrix C, except when beta is zero, in which |
|
7798
|
|
|
|
|
|
|
case C need not be set on entry. |
|
7799
|
|
|
|
|
|
|
On exit, the array C is overwritten by the m by n matrix |
|
7800
|
|
|
|
|
|
|
( alpha*op( A )*op( B ) + beta*C ). |
|
7801
|
|
|
|
|
|
|
|
|
7802
|
|
|
|
|
|
|
=for example |
|
7803
|
|
|
|
|
|
|
|
|
7804
|
|
|
|
|
|
|
$a = random(5,4); |
|
7805
|
|
|
|
|
|
|
$b = random(5,4); |
|
7806
|
|
|
|
|
|
|
$alpha = pdl(0.5); |
|
7807
|
|
|
|
|
|
|
$beta = pdl(0); |
|
7808
|
|
|
|
|
|
|
$c = zeroes(5,5); |
|
7809
|
|
|
|
|
|
|
gemm($a, 0, 1,$b, $alpha, $beta, $c); |
|
7810
|
|
|
|
|
|
|
|
|
7811
|
|
|
|
|
|
|
|
|
7812
|
|
|
|
|
|
|
=for bad |
|
7813
|
|
|
|
|
|
|
|
|
7814
|
|
|
|
|
|
|
gemm ignores the bad-value flag of the input piddles. |
|
7815
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7816
|
|
|
|
|
|
|
|
|
7817
|
|
|
|
|
|
|
|
|
7818
|
|
|
|
|
|
|
=cut |
|
7819
|
|
|
|
|
|
|
|
|
7820
|
|
|
|
|
|
|
|
|
7821
|
|
|
|
|
|
|
|
|
7822
|
|
|
|
|
|
|
|
|
7823
|
|
|
|
|
|
|
|
|
7824
|
|
|
|
|
|
|
|
|
7825
|
|
|
|
|
|
|
*gemm = \&PDL::gemm; |
|
7826
|
|
|
|
|
|
|
|
|
7827
|
|
|
|
|
|
|
|
|
7828
|
|
|
|
|
|
|
|
|
7829
|
|
|
|
|
|
|
|
|
7830
|
|
|
|
|
|
|
|
|
7831
|
|
|
|
|
|
|
=head2 mmult |
|
7832
|
|
|
|
|
|
|
|
|
7833
|
|
|
|
|
|
|
=for sig |
|
7834
|
|
|
|
|
|
|
|
|
7835
|
|
|
|
|
|
|
Signature: ([phys]A(m,n); [phys]B(p,m); [o,phys]C(p,n)) |
|
7836
|
|
|
|
|
|
|
|
|
7837
|
|
|
|
|
|
|
|
|
7838
|
|
|
|
|
|
|
|
|
7839
|
|
|
|
|
|
|
=for ref |
|
7840
|
|
|
|
|
|
|
|
|
7841
|
|
|
|
|
|
|
Blas matrix multiplication based on gemm |
|
7842
|
|
|
|
|
|
|
|
|
7843
|
|
|
|
|
|
|
|
|
7844
|
|
|
|
|
|
|
|
|
7845
|
|
|
|
|
|
|
=for bad |
|
7846
|
|
|
|
|
|
|
|
|
7847
|
|
|
|
|
|
|
mmult ignores the bad-value flag of the input piddles. |
|
7848
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7849
|
|
|
|
|
|
|
|
|
7850
|
|
|
|
|
|
|
|
|
7851
|
|
|
|
|
|
|
=cut |
|
7852
|
|
|
|
|
|
|
|
|
7853
|
|
|
|
|
|
|
|
|
7854
|
|
|
|
|
|
|
|
|
7855
|
|
|
|
|
|
|
|
|
7856
|
|
|
|
|
|
|
|
|
7857
|
|
|
|
|
|
|
|
|
7858
|
|
|
|
|
|
|
*mmult = \&PDL::mmult; |
|
7859
|
|
|
|
|
|
|
|
|
7860
|
|
|
|
|
|
|
|
|
7861
|
|
|
|
|
|
|
|
|
7862
|
|
|
|
|
|
|
|
|
7863
|
|
|
|
|
|
|
|
|
7864
|
|
|
|
|
|
|
=head2 crossprod |
|
7865
|
|
|
|
|
|
|
|
|
7866
|
|
|
|
|
|
|
=for sig |
|
7867
|
|
|
|
|
|
|
|
|
7868
|
|
|
|
|
|
|
Signature: ([phys]A(n,m); [phys]B(p,m); [o,phys]C(p,n)) |
|
7869
|
|
|
|
|
|
|
|
|
7870
|
|
|
|
|
|
|
|
|
7871
|
|
|
|
|
|
|
|
|
7872
|
|
|
|
|
|
|
=for ref |
|
7873
|
|
|
|
|
|
|
|
|
7874
|
|
|
|
|
|
|
Blas matrix cross product based on gemm |
|
7875
|
|
|
|
|
|
|
|
|
7876
|
|
|
|
|
|
|
|
|
7877
|
|
|
|
|
|
|
|
|
7878
|
|
|
|
|
|
|
=for bad |
|
7879
|
|
|
|
|
|
|
|
|
7880
|
|
|
|
|
|
|
crossprod ignores the bad-value flag of the input piddles. |
|
7881
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7882
|
|
|
|
|
|
|
|
|
7883
|
|
|
|
|
|
|
|
|
7884
|
|
|
|
|
|
|
=cut |
|
7885
|
|
|
|
|
|
|
|
|
7886
|
|
|
|
|
|
|
|
|
7887
|
|
|
|
|
|
|
|
|
7888
|
|
|
|
|
|
|
|
|
7889
|
|
|
|
|
|
|
|
|
7890
|
|
|
|
|
|
|
|
|
7891
|
|
|
|
|
|
|
*crossprod = \&PDL::crossprod; |
|
7892
|
|
|
|
|
|
|
|
|
7893
|
|
|
|
|
|
|
|
|
7894
|
|
|
|
|
|
|
|
|
7895
|
|
|
|
|
|
|
|
|
7896
|
|
|
|
|
|
|
|
|
7897
|
|
|
|
|
|
|
=head2 syrk |
|
7898
|
|
|
|
|
|
|
|
|
7899
|
|
|
|
|
|
|
=for sig |
|
7900
|
|
|
|
|
|
|
|
|
7901
|
|
|
|
|
|
|
Signature: ([phys]A(m,n); int uplo(); int trans(); [phys]alpha(); [phys]beta(); [io,phys]C(p,p)) |
|
7902
|
|
|
|
|
|
|
|
|
7903
|
|
|
|
|
|
|
|
|
7904
|
|
|
|
|
|
|
|
|
7905
|
|
|
|
|
|
|
=for ref |
|
7906
|
|
|
|
|
|
|
|
|
7907
|
|
|
|
|
|
|
Performs one of the symmetric rank k operations |
|
7908
|
|
|
|
|
|
|
|
|
7909
|
|
|
|
|
|
|
C := alpha*A*A' + beta*C, |
|
7910
|
|
|
|
|
|
|
|
|
7911
|
|
|
|
|
|
|
or |
|
7912
|
|
|
|
|
|
|
|
|
7913
|
|
|
|
|
|
|
C := alpha*A'*A + beta*C, |
|
7914
|
|
|
|
|
|
|
|
|
7915
|
|
|
|
|
|
|
where alpha and beta are scalars, C is an n by n symmetric matrix |
|
7916
|
|
|
|
|
|
|
and A is an n by k matrix in the first case and a k by n matrix |
|
7917
|
|
|
|
|
|
|
in the second case. |
|
7918
|
|
|
|
|
|
|
|
|
7919
|
|
|
|
|
|
|
Parameters |
|
7920
|
|
|
|
|
|
|
========== |
|
7921
|
|
|
|
|
|
|
uplo: On entry, uplo specifies whether the upper or lower |
|
7922
|
|
|
|
|
|
|
triangular part of the array C is to be referenced as |
|
7923
|
|
|
|
|
|
|
follows: |
|
7924
|
|
|
|
|
|
|
uplo = 0 Only the upper triangular part of C |
|
7925
|
|
|
|
|
|
|
is to be referenced. |
|
7926
|
|
|
|
|
|
|
uplo = 1 Only the lower triangular part of C |
|
7927
|
|
|
|
|
|
|
is to be referenced. |
|
7928
|
|
|
|
|
|
|
Unchanged on exit. |
|
7929
|
|
|
|
|
|
|
|
|
7930
|
|
|
|
|
|
|
trans: On entry, trans specifies the operation to be performed as |
|
7931
|
|
|
|
|
|
|
follows: |
|
7932
|
|
|
|
|
|
|
trans = 0 C := alpha*A*A' + beta*C. |
|
7933
|
|
|
|
|
|
|
trans = 1 C := alpha*A'*A + beta*C. |
|
7934
|
|
|
|
|
|
|
|
|
7935
|
|
|
|
|
|
|
alpha: On entry, alpha specifies the scalar alpha. |
|
7936
|
|
|
|
|
|
|
Unchanged on exit. |
|
7937
|
|
|
|
|
|
|
|
|
7938
|
|
|
|
|
|
|
A: Before entry with trans = 0, the leading n by k |
|
7939
|
|
|
|
|
|
|
part of the array A must contain the matrix A, otherwise |
|
7940
|
|
|
|
|
|
|
the leading k by n part of the array A must contain the |
|
7941
|
|
|
|
|
|
|
matrix A. |
|
7942
|
|
|
|
|
|
|
|
|
7943
|
|
|
|
|
|
|
beta: On entry, beta specifies the scalar beta. |
|
7944
|
|
|
|
|
|
|
|
|
7945
|
|
|
|
|
|
|
C: Before entry with uplo = 0, the leading n by n |
|
7946
|
|
|
|
|
|
|
upper triangular part of the array C must contain the upper |
|
7947
|
|
|
|
|
|
|
triangular part of the symmetric matrix and the strictly |
|
7948
|
|
|
|
|
|
|
lower triangular part of C is not referenced. On exit, the |
|
7949
|
|
|
|
|
|
|
upper triangular part of the array C is overwritten by the |
|
7950
|
|
|
|
|
|
|
upper triangular part of the updated matrix. |
|
7951
|
|
|
|
|
|
|
Before entry with uplo = 1, the leading n by n |
|
7952
|
|
|
|
|
|
|
lower triangular part of the array C must contain the lower |
|
7953
|
|
|
|
|
|
|
triangular part of the symmetric matrix and the strictly |
|
7954
|
|
|
|
|
|
|
upper triangular part of C is not referenced. On exit, the |
|
7955
|
|
|
|
|
|
|
lower triangular part of the array C is overwritten by the |
|
7956
|
|
|
|
|
|
|
lower triangular part of the updated matrix. |
|
7957
|
|
|
|
|
|
|
|
|
7958
|
|
|
|
|
|
|
=for example |
|
7959
|
|
|
|
|
|
|
|
|
7960
|
|
|
|
|
|
|
$a = random(5,4); |
|
7961
|
|
|
|
|
|
|
$b = zeroes(5,5); |
|
7962
|
|
|
|
|
|
|
$alpha = 1; |
|
7963
|
|
|
|
|
|
|
$beta = 0; |
|
7964
|
|
|
|
|
|
|
syrk ($a, 1,0,$alpha, $beta , $b); |
|
7965
|
|
|
|
|
|
|
|
|
7966
|
|
|
|
|
|
|
|
|
7967
|
|
|
|
|
|
|
|
|
7968
|
|
|
|
|
|
|
=for bad |
|
7969
|
|
|
|
|
|
|
|
|
7970
|
|
|
|
|
|
|
syrk ignores the bad-value flag of the input piddles. |
|
7971
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
7972
|
|
|
|
|
|
|
|
|
7973
|
|
|
|
|
|
|
|
|
7974
|
|
|
|
|
|
|
=cut |
|
7975
|
|
|
|
|
|
|
|
|
7976
|
|
|
|
|
|
|
|
|
7977
|
|
|
|
|
|
|
|
|
7978
|
|
|
|
|
|
|
|
|
7979
|
|
|
|
|
|
|
|
|
7980
|
|
|
|
|
|
|
|
|
7981
|
|
|
|
|
|
|
*syrk = \&PDL::syrk; |
|
7982
|
|
|
|
|
|
|
|
|
7983
|
|
|
|
|
|
|
|
|
7984
|
|
|
|
|
|
|
|
|
7985
|
|
|
|
|
|
|
|
|
7986
|
|
|
|
|
|
|
|
|
7987
|
|
|
|
|
|
|
=head2 dot |
|
7988
|
|
|
|
|
|
|
|
|
7989
|
|
|
|
|
|
|
=for sig |
|
7990
|
|
|
|
|
|
|
|
|
7991
|
|
|
|
|
|
|
Signature: ([phys]a(n);int [phys]inca();[phys]b(m);int [phys]incb();[o,phys]c()) |
|
7992
|
|
|
|
|
|
|
|
|
7993
|
|
|
|
|
|
|
|
|
7994
|
|
|
|
|
|
|
|
|
7995
|
|
|
|
|
|
|
=for ref |
|
7996
|
|
|
|
|
|
|
|
|
7997
|
|
|
|
|
|
|
Dot product of two vectors using Blas. |
|
7998
|
|
|
|
|
|
|
|
|
7999
|
|
|
|
|
|
|
=for example |
|
8000
|
|
|
|
|
|
|
|
|
8001
|
|
|
|
|
|
|
$a = random(5); |
|
8002
|
|
|
|
|
|
|
$b = random(5); |
|
8003
|
|
|
|
|
|
|
$c = dot($a, 1, $b, 1) |
|
8004
|
|
|
|
|
|
|
|
|
8005
|
|
|
|
|
|
|
|
|
8006
|
|
|
|
|
|
|
|
|
8007
|
|
|
|
|
|
|
=for bad |
|
8008
|
|
|
|
|
|
|
|
|
8009
|
|
|
|
|
|
|
dot ignores the bad-value flag of the input piddles. |
|
8010
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8011
|
|
|
|
|
|
|
|
|
8012
|
|
|
|
|
|
|
|
|
8013
|
|
|
|
|
|
|
=cut |
|
8014
|
|
|
|
|
|
|
|
|
8015
|
|
|
|
|
|
|
|
|
8016
|
|
|
|
|
|
|
|
|
8017
|
|
|
|
|
|
|
|
|
8018
|
|
|
|
|
|
|
|
|
8019
|
|
|
|
|
|
|
|
|
8020
|
|
|
|
|
|
|
*dot = \&PDL::dot; |
|
8021
|
|
|
|
|
|
|
|
|
8022
|
|
|
|
|
|
|
|
|
8023
|
|
|
|
|
|
|
|
|
8024
|
|
|
|
|
|
|
|
|
8025
|
|
|
|
|
|
|
|
|
8026
|
|
|
|
|
|
|
=head2 axpy |
|
8027
|
|
|
|
|
|
|
|
|
8028
|
|
|
|
|
|
|
=for sig |
|
8029
|
|
|
|
|
|
|
|
|
8030
|
|
|
|
|
|
|
Signature: ([phys]a(n);int [phys]inca();[phys] alpha();[io,phys]b(m);int [phys]incb()) |
|
8031
|
|
|
|
|
|
|
|
|
8032
|
|
|
|
|
|
|
|
|
8033
|
|
|
|
|
|
|
|
|
8034
|
|
|
|
|
|
|
=for ref |
|
8035
|
|
|
|
|
|
|
|
|
8036
|
|
|
|
|
|
|
Linear combination of vectors ax + b using Blas. |
|
8037
|
|
|
|
|
|
|
Returns result in b. |
|
8038
|
|
|
|
|
|
|
|
|
8039
|
|
|
|
|
|
|
|
|
8040
|
|
|
|
|
|
|
=for example |
|
8041
|
|
|
|
|
|
|
|
|
8042
|
|
|
|
|
|
|
$a = random(5); |
|
8043
|
|
|
|
|
|
|
$b = random(5); |
|
8044
|
|
|
|
|
|
|
axpy($a, 1, 12, $b, 1) |
|
8045
|
|
|
|
|
|
|
|
|
8046
|
|
|
|
|
|
|
|
|
8047
|
|
|
|
|
|
|
|
|
8048
|
|
|
|
|
|
|
=for bad |
|
8049
|
|
|
|
|
|
|
|
|
8050
|
|
|
|
|
|
|
axpy ignores the bad-value flag of the input piddles. |
|
8051
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8052
|
|
|
|
|
|
|
|
|
8053
|
|
|
|
|
|
|
|
|
8054
|
|
|
|
|
|
|
=cut |
|
8055
|
|
|
|
|
|
|
|
|
8056
|
|
|
|
|
|
|
|
|
8057
|
|
|
|
|
|
|
|
|
8058
|
|
|
|
|
|
|
|
|
8059
|
|
|
|
|
|
|
|
|
8060
|
|
|
|
|
|
|
|
|
8061
|
|
|
|
|
|
|
*axpy = \&PDL::axpy; |
|
8062
|
|
|
|
|
|
|
|
|
8063
|
|
|
|
|
|
|
|
|
8064
|
|
|
|
|
|
|
|
|
8065
|
|
|
|
|
|
|
|
|
8066
|
|
|
|
|
|
|
|
|
8067
|
|
|
|
|
|
|
=head2 nrm2 |
|
8068
|
|
|
|
|
|
|
|
|
8069
|
|
|
|
|
|
|
=for sig |
|
8070
|
|
|
|
|
|
|
|
|
8071
|
|
|
|
|
|
|
Signature: ([phys]a(n);int [phys]inca();[o,phys]b()) |
|
8072
|
|
|
|
|
|
|
|
|
8073
|
|
|
|
|
|
|
|
|
8074
|
|
|
|
|
|
|
|
|
8075
|
|
|
|
|
|
|
=for ref |
|
8076
|
|
|
|
|
|
|
|
|
8077
|
|
|
|
|
|
|
Euclidean norm of a vector using Blas. |
|
8078
|
|
|
|
|
|
|
|
|
8079
|
|
|
|
|
|
|
=for example |
|
8080
|
|
|
|
|
|
|
|
|
8081
|
|
|
|
|
|
|
$a = random(5); |
|
8082
|
|
|
|
|
|
|
$norm2 = norm2($a,1) |
|
8083
|
|
|
|
|
|
|
|
|
8084
|
|
|
|
|
|
|
|
|
8085
|
|
|
|
|
|
|
|
|
8086
|
|
|
|
|
|
|
=for bad |
|
8087
|
|
|
|
|
|
|
|
|
8088
|
|
|
|
|
|
|
nrm2 ignores the bad-value flag of the input piddles. |
|
8089
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8090
|
|
|
|
|
|
|
|
|
8091
|
|
|
|
|
|
|
|
|
8092
|
|
|
|
|
|
|
=cut |
|
8093
|
|
|
|
|
|
|
|
|
8094
|
|
|
|
|
|
|
|
|
8095
|
|
|
|
|
|
|
|
|
8096
|
|
|
|
|
|
|
|
|
8097
|
|
|
|
|
|
|
|
|
8098
|
|
|
|
|
|
|
|
|
8099
|
|
|
|
|
|
|
*nrm2 = \&PDL::nrm2; |
|
8100
|
|
|
|
|
|
|
|
|
8101
|
|
|
|
|
|
|
|
|
8102
|
|
|
|
|
|
|
|
|
8103
|
|
|
|
|
|
|
|
|
8104
|
|
|
|
|
|
|
|
|
8105
|
|
|
|
|
|
|
=head2 asum |
|
8106
|
|
|
|
|
|
|
|
|
8107
|
|
|
|
|
|
|
=for sig |
|
8108
|
|
|
|
|
|
|
|
|
8109
|
|
|
|
|
|
|
Signature: ([phys]a(n);int [phys]inca();[o,phys]b()) |
|
8110
|
|
|
|
|
|
|
|
|
8111
|
|
|
|
|
|
|
|
|
8112
|
|
|
|
|
|
|
|
|
8113
|
|
|
|
|
|
|
=for ref |
|
8114
|
|
|
|
|
|
|
|
|
8115
|
|
|
|
|
|
|
Sum of absolute values of a vector using Blas. |
|
8116
|
|
|
|
|
|
|
|
|
8117
|
|
|
|
|
|
|
=for example |
|
8118
|
|
|
|
|
|
|
|
|
8119
|
|
|
|
|
|
|
$a = random(5); |
|
8120
|
|
|
|
|
|
|
$absum = asum($a,1) |
|
8121
|
|
|
|
|
|
|
|
|
8122
|
|
|
|
|
|
|
|
|
8123
|
|
|
|
|
|
|
|
|
8124
|
|
|
|
|
|
|
=for bad |
|
8125
|
|
|
|
|
|
|
|
|
8126
|
|
|
|
|
|
|
asum ignores the bad-value flag of the input piddles. |
|
8127
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8128
|
|
|
|
|
|
|
|
|
8129
|
|
|
|
|
|
|
|
|
8130
|
|
|
|
|
|
|
=cut |
|
8131
|
|
|
|
|
|
|
|
|
8132
|
|
|
|
|
|
|
|
|
8133
|
|
|
|
|
|
|
|
|
8134
|
|
|
|
|
|
|
|
|
8135
|
|
|
|
|
|
|
|
|
8136
|
|
|
|
|
|
|
|
|
8137
|
|
|
|
|
|
|
*asum = \&PDL::asum; |
|
8138
|
|
|
|
|
|
|
|
|
8139
|
|
|
|
|
|
|
|
|
8140
|
|
|
|
|
|
|
|
|
8141
|
|
|
|
|
|
|
|
|
8142
|
|
|
|
|
|
|
|
|
8143
|
|
|
|
|
|
|
=head2 scal |
|
8144
|
|
|
|
|
|
|
|
|
8145
|
|
|
|
|
|
|
=for sig |
|
8146
|
|
|
|
|
|
|
|
|
8147
|
|
|
|
|
|
|
Signature: ([io,phys]a(n);int [phys]inca();[phys]scale()) |
|
8148
|
|
|
|
|
|
|
|
|
8149
|
|
|
|
|
|
|
|
|
8150
|
|
|
|
|
|
|
|
|
8151
|
|
|
|
|
|
|
=for ref |
|
8152
|
|
|
|
|
|
|
|
|
8153
|
|
|
|
|
|
|
Scale a vector by a constant using Blas. |
|
8154
|
|
|
|
|
|
|
|
|
8155
|
|
|
|
|
|
|
=for example |
|
8156
|
|
|
|
|
|
|
|
|
8157
|
|
|
|
|
|
|
$a = random(5); |
|
8158
|
|
|
|
|
|
|
$a->scal(1, 0.5) |
|
8159
|
|
|
|
|
|
|
|
|
8160
|
|
|
|
|
|
|
|
|
8161
|
|
|
|
|
|
|
|
|
8162
|
|
|
|
|
|
|
=for bad |
|
8163
|
|
|
|
|
|
|
|
|
8164
|
|
|
|
|
|
|
scal ignores the bad-value flag of the input piddles. |
|
8165
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8166
|
|
|
|
|
|
|
|
|
8167
|
|
|
|
|
|
|
|
|
8168
|
|
|
|
|
|
|
=cut |
|
8169
|
|
|
|
|
|
|
|
|
8170
|
|
|
|
|
|
|
|
|
8171
|
|
|
|
|
|
|
|
|
8172
|
|
|
|
|
|
|
|
|
8173
|
|
|
|
|
|
|
|
|
8174
|
|
|
|
|
|
|
|
|
8175
|
|
|
|
|
|
|
*scal = \&PDL::scal; |
|
8176
|
|
|
|
|
|
|
|
|
8177
|
|
|
|
|
|
|
|
|
8178
|
|
|
|
|
|
|
|
|
8179
|
|
|
|
|
|
|
|
|
8180
|
|
|
|
|
|
|
|
|
8181
|
|
|
|
|
|
|
=head2 rot |
|
8182
|
|
|
|
|
|
|
|
|
8183
|
|
|
|
|
|
|
=for sig |
|
8184
|
|
|
|
|
|
|
|
|
8185
|
|
|
|
|
|
|
Signature: ([io,phys]a(n);int [phys]inca();[phys]c(); [phys]s();[io,phys]b(n);int [phys]incb()) |
|
8186
|
|
|
|
|
|
|
|
|
8187
|
|
|
|
|
|
|
|
|
8188
|
|
|
|
|
|
|
|
|
8189
|
|
|
|
|
|
|
=for ref |
|
8190
|
|
|
|
|
|
|
|
|
8191
|
|
|
|
|
|
|
Applies plane rotation using Blas. |
|
8192
|
|
|
|
|
|
|
|
|
8193
|
|
|
|
|
|
|
=for example |
|
8194
|
|
|
|
|
|
|
|
|
8195
|
|
|
|
|
|
|
$a = random(5); |
|
8196
|
|
|
|
|
|
|
$b = random(5); |
|
8197
|
|
|
|
|
|
|
rot($a, 1, 0.5, 0.7, $b, 1) |
|
8198
|
|
|
|
|
|
|
|
|
8199
|
|
|
|
|
|
|
|
|
8200
|
|
|
|
|
|
|
|
|
8201
|
|
|
|
|
|
|
=for bad |
|
8202
|
|
|
|
|
|
|
|
|
8203
|
|
|
|
|
|
|
rot ignores the bad-value flag of the input piddles. |
|
8204
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8205
|
|
|
|
|
|
|
|
|
8206
|
|
|
|
|
|
|
|
|
8207
|
|
|
|
|
|
|
=cut |
|
8208
|
|
|
|
|
|
|
|
|
8209
|
|
|
|
|
|
|
|
|
8210
|
|
|
|
|
|
|
|
|
8211
|
|
|
|
|
|
|
|
|
8212
|
|
|
|
|
|
|
|
|
8213
|
|
|
|
|
|
|
|
|
8214
|
|
|
|
|
|
|
*rot = \&PDL::rot; |
|
8215
|
|
|
|
|
|
|
|
|
8216
|
|
|
|
|
|
|
|
|
8217
|
|
|
|
|
|
|
|
|
8218
|
|
|
|
|
|
|
|
|
8219
|
|
|
|
|
|
|
|
|
8220
|
|
|
|
|
|
|
=head2 rotg |
|
8221
|
|
|
|
|
|
|
|
|
8222
|
|
|
|
|
|
|
=for sig |
|
8223
|
|
|
|
|
|
|
|
|
8224
|
|
|
|
|
|
|
Signature: ([io,phys]a();[io,phys]b();[o,phys]c(); [o,phys]s()) |
|
8225
|
|
|
|
|
|
|
|
|
8226
|
|
|
|
|
|
|
|
|
8227
|
|
|
|
|
|
|
|
|
8228
|
|
|
|
|
|
|
=for ref |
|
8229
|
|
|
|
|
|
|
|
|
8230
|
|
|
|
|
|
|
Generates plane rotation using Blas. |
|
8231
|
|
|
|
|
|
|
|
|
8232
|
|
|
|
|
|
|
=for example |
|
8233
|
|
|
|
|
|
|
|
|
8234
|
|
|
|
|
|
|
$a = sequence(4); |
|
8235
|
|
|
|
|
|
|
rotg($a(0), $a(1),$a(2),$a(3)) |
|
8236
|
|
|
|
|
|
|
|
|
8237
|
|
|
|
|
|
|
|
|
8238
|
|
|
|
|
|
|
|
|
8239
|
|
|
|
|
|
|
=for bad |
|
8240
|
|
|
|
|
|
|
|
|
8241
|
|
|
|
|
|
|
rotg ignores the bad-value flag of the input piddles. |
|
8242
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8243
|
|
|
|
|
|
|
|
|
8244
|
|
|
|
|
|
|
|
|
8245
|
|
|
|
|
|
|
=cut |
|
8246
|
|
|
|
|
|
|
|
|
8247
|
|
|
|
|
|
|
|
|
8248
|
|
|
|
|
|
|
|
|
8249
|
|
|
|
|
|
|
|
|
8250
|
|
|
|
|
|
|
|
|
8251
|
|
|
|
|
|
|
|
|
8252
|
|
|
|
|
|
|
*rotg = \&PDL::rotg; |
|
8253
|
|
|
|
|
|
|
|
|
8254
|
|
|
|
|
|
|
|
|
8255
|
|
|
|
|
|
|
|
|
8256
|
|
|
|
|
|
|
|
|
8257
|
|
|
|
|
|
|
|
|
8258
|
|
|
|
|
|
|
=head2 lasrt |
|
8259
|
|
|
|
|
|
|
|
|
8260
|
|
|
|
|
|
|
=for sig |
|
8261
|
|
|
|
|
|
|
|
|
8262
|
|
|
|
|
|
|
Signature: ([io,phys]d(n); int id();int [o,phys]info()) |
|
8263
|
|
|
|
|
|
|
|
|
8264
|
|
|
|
|
|
|
|
|
8265
|
|
|
|
|
|
|
|
|
8266
|
|
|
|
|
|
|
=for ref |
|
8267
|
|
|
|
|
|
|
|
|
8268
|
|
|
|
|
|
|
Sort the numbers in d in increasing order (if id = 0) or |
|
8269
|
|
|
|
|
|
|
in decreasing order (if id = 1 ). |
|
8270
|
|
|
|
|
|
|
|
|
8271
|
|
|
|
|
|
|
Use Quick Sort, reverting to Insertion sort on arrays of |
|
8272
|
|
|
|
|
|
|
size <= 20. Dimension of stack limits N to about 2**32. |
|
8273
|
|
|
|
|
|
|
|
|
8274
|
|
|
|
|
|
|
Arguments |
|
8275
|
|
|
|
|
|
|
========= |
|
8276
|
|
|
|
|
|
|
|
|
8277
|
|
|
|
|
|
|
id: = 0: sort d in increasing order; |
|
8278
|
|
|
|
|
|
|
= 1: sort d in decreasing order. |
|
8279
|
|
|
|
|
|
|
|
|
8280
|
|
|
|
|
|
|
d: On entry, the array to be sorted. |
|
8281
|
|
|
|
|
|
|
On exit, d has been sorted into increasing order |
|
8282
|
|
|
|
|
|
|
(d(1) <= ... <= d(N) ) or into decreasing order |
|
8283
|
|
|
|
|
|
|
(d(1) >= ... >= d(N) ), depending on id. |
|
8284
|
|
|
|
|
|
|
|
|
8285
|
|
|
|
|
|
|
info: = 0: successful exit |
|
8286
|
|
|
|
|
|
|
< 0: if info = -i, the i-th argument had an illegal value |
|
8287
|
|
|
|
|
|
|
|
|
8288
|
|
|
|
|
|
|
=for example |
|
8289
|
|
|
|
|
|
|
|
|
8290
|
|
|
|
|
|
|
$a = random(5); |
|
8291
|
|
|
|
|
|
|
lasrt ($a, 0, ($info = null)); |
|
8292
|
|
|
|
|
|
|
|
|
8293
|
|
|
|
|
|
|
|
|
8294
|
|
|
|
|
|
|
=for bad |
|
8295
|
|
|
|
|
|
|
|
|
8296
|
|
|
|
|
|
|
lasrt ignores the bad-value flag of the input piddles. |
|
8297
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8298
|
|
|
|
|
|
|
|
|
8299
|
|
|
|
|
|
|
|
|
8300
|
|
|
|
|
|
|
=cut |
|
8301
|
|
|
|
|
|
|
|
|
8302
|
|
|
|
|
|
|
|
|
8303
|
|
|
|
|
|
|
|
|
8304
|
|
|
|
|
|
|
|
|
8305
|
|
|
|
|
|
|
|
|
8306
|
|
|
|
|
|
|
|
|
8307
|
|
|
|
|
|
|
*lasrt = \&PDL::lasrt; |
|
8308
|
|
|
|
|
|
|
|
|
8309
|
|
|
|
|
|
|
|
|
8310
|
|
|
|
|
|
|
|
|
8311
|
|
|
|
|
|
|
|
|
8312
|
|
|
|
|
|
|
|
|
8313
|
|
|
|
|
|
|
=head2 lacpy |
|
8314
|
|
|
|
|
|
|
|
|
8315
|
|
|
|
|
|
|
=for sig |
|
8316
|
|
|
|
|
|
|
|
|
8317
|
|
|
|
|
|
|
Signature: ([phys]A(m,n); int uplo(); [o,phys]B(p,n)) |
|
8318
|
|
|
|
|
|
|
|
|
8319
|
|
|
|
|
|
|
|
|
8320
|
|
|
|
|
|
|
|
|
8321
|
|
|
|
|
|
|
=for ref |
|
8322
|
|
|
|
|
|
|
|
|
8323
|
|
|
|
|
|
|
Copies all or part of a two-dimensional matrix A to another |
|
8324
|
|
|
|
|
|
|
matrix B. |
|
8325
|
|
|
|
|
|
|
|
|
8326
|
|
|
|
|
|
|
Arguments |
|
8327
|
|
|
|
|
|
|
========= |
|
8328
|
|
|
|
|
|
|
|
|
8329
|
|
|
|
|
|
|
uplo: Specifies the part of the matrix A to be copied to B. |
|
8330
|
|
|
|
|
|
|
= 0: Upper triangular part |
|
8331
|
|
|
|
|
|
|
= 1: Lower triangular part |
|
8332
|
|
|
|
|
|
|
Otherwise: All of the matrix A |
|
8333
|
|
|
|
|
|
|
|
|
8334
|
|
|
|
|
|
|
A: The m by n matrix A. If uplo = 0, only the upper triangle |
|
8335
|
|
|
|
|
|
|
or trapezoid is accessed; if uplo = 1, only the lower |
|
8336
|
|
|
|
|
|
|
triangle or trapezoid is accessed. |
|
8337
|
|
|
|
|
|
|
|
|
8338
|
|
|
|
|
|
|
B: On exit, B = A in the locations specified by uplo. |
|
8339
|
|
|
|
|
|
|
|
|
8340
|
|
|
|
|
|
|
=for example |
|
8341
|
|
|
|
|
|
|
|
|
8342
|
|
|
|
|
|
|
$a = random(5,5); |
|
8343
|
|
|
|
|
|
|
$b = zeroes($a); |
|
8344
|
|
|
|
|
|
|
lacpy ($a, 0, $b); |
|
8345
|
|
|
|
|
|
|
|
|
8346
|
|
|
|
|
|
|
|
|
8347
|
|
|
|
|
|
|
=for bad |
|
8348
|
|
|
|
|
|
|
|
|
8349
|
|
|
|
|
|
|
lacpy ignores the bad-value flag of the input piddles. |
|
8350
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8351
|
|
|
|
|
|
|
|
|
8352
|
|
|
|
|
|
|
|
|
8353
|
|
|
|
|
|
|
=cut |
|
8354
|
|
|
|
|
|
|
|
|
8355
|
|
|
|
|
|
|
|
|
8356
|
|
|
|
|
|
|
|
|
8357
|
|
|
|
|
|
|
|
|
8358
|
|
|
|
|
|
|
|
|
8359
|
|
|
|
|
|
|
|
|
8360
|
|
|
|
|
|
|
*lacpy = \&PDL::lacpy; |
|
8361
|
|
|
|
|
|
|
|
|
8362
|
|
|
|
|
|
|
|
|
8363
|
|
|
|
|
|
|
|
|
8364
|
|
|
|
|
|
|
|
|
8365
|
|
|
|
|
|
|
|
|
8366
|
|
|
|
|
|
|
=head2 laswp |
|
8367
|
|
|
|
|
|
|
|
|
8368
|
|
|
|
|
|
|
=for sig |
|
8369
|
|
|
|
|
|
|
|
|
8370
|
|
|
|
|
|
|
Signature: ([io,phys]A(m,n);int [phys]k1();int [phys] k2(); int [phys]ipiv(p);int [phys]inc()) |
|
8371
|
|
|
|
|
|
|
|
|
8372
|
|
|
|
|
|
|
|
|
8373
|
|
|
|
|
|
|
|
|
8374
|
|
|
|
|
|
|
=for ref |
|
8375
|
|
|
|
|
|
|
|
|
8376
|
|
|
|
|
|
|
Performs a series of row interchanges on the matrix A. |
|
8377
|
|
|
|
|
|
|
One row interchange is initiated for each of rows k1 through k2 of A. |
|
8378
|
|
|
|
|
|
|
Dosen't use PDL indice (start = 1). |
|
8379
|
|
|
|
|
|
|
|
|
8380
|
|
|
|
|
|
|
Arguments |
|
8381
|
|
|
|
|
|
|
========= |
|
8382
|
|
|
|
|
|
|
|
|
8383
|
|
|
|
|
|
|
A: On entry, the matrix of column dimension N to which the row |
|
8384
|
|
|
|
|
|
|
interchanges will be applied. |
|
8385
|
|
|
|
|
|
|
On exit, the permuted matrix. |
|
8386
|
|
|
|
|
|
|
|
|
8387
|
|
|
|
|
|
|
k1: The first element of ipiv for which a row interchange will |
|
8388
|
|
|
|
|
|
|
be done. |
|
8389
|
|
|
|
|
|
|
|
|
8390
|
|
|
|
|
|
|
k2: The last element of ipiv for which a row interchange will |
|
8391
|
|
|
|
|
|
|
be done. |
|
8392
|
|
|
|
|
|
|
|
|
8393
|
|
|
|
|
|
|
ipiv: The vector of pivot indices. Only the elements in positions |
|
8394
|
|
|
|
|
|
|
k1 through k2 of ipiv are accessed. |
|
8395
|
|
|
|
|
|
|
ipiv(k) = l implies rows k and l are to be interchanged. |
|
8396
|
|
|
|
|
|
|
|
|
8397
|
|
|
|
|
|
|
inc: The increment between successive values of ipiv. If ipiv |
|
8398
|
|
|
|
|
|
|
is negative, the pivots are applied in reverse order. |
|
8399
|
|
|
|
|
|
|
|
|
8400
|
|
|
|
|
|
|
=for example |
|
8401
|
|
|
|
|
|
|
|
|
8402
|
|
|
|
|
|
|
$a = random(5,5); |
|
8403
|
|
|
|
|
|
|
# reverse row (col for PDL) |
|
8404
|
|
|
|
|
|
|
$b = pdl([5,4,3,2,1]); |
|
8405
|
|
|
|
|
|
|
$a->laswp(1,2,$b,1); |
|
8406
|
|
|
|
|
|
|
|
|
8407
|
|
|
|
|
|
|
|
|
8408
|
|
|
|
|
|
|
=for bad |
|
8409
|
|
|
|
|
|
|
|
|
8410
|
|
|
|
|
|
|
laswp ignores the bad-value flag of the input piddles. |
|
8411
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8412
|
|
|
|
|
|
|
|
|
8413
|
|
|
|
|
|
|
|
|
8414
|
|
|
|
|
|
|
=cut |
|
8415
|
|
|
|
|
|
|
|
|
8416
|
|
|
|
|
|
|
|
|
8417
|
|
|
|
|
|
|
|
|
8418
|
|
|
|
|
|
|
|
|
8419
|
|
|
|
|
|
|
|
|
8420
|
|
|
|
|
|
|
|
|
8421
|
|
|
|
|
|
|
*laswp = \&PDL::laswp; |
|
8422
|
|
|
|
|
|
|
|
|
8423
|
|
|
|
|
|
|
|
|
8424
|
|
|
|
|
|
|
|
|
8425
|
|
|
|
|
|
|
|
|
8426
|
|
|
|
|
|
|
|
|
8427
|
|
|
|
|
|
|
=head2 lamch |
|
8428
|
|
|
|
|
|
|
|
|
8429
|
|
|
|
|
|
|
=for sig |
|
8430
|
|
|
|
|
|
|
|
|
8431
|
|
|
|
|
|
|
Signature: (cmach(); [o]precision()) |
|
8432
|
|
|
|
|
|
|
|
|
8433
|
|
|
|
|
|
|
|
|
8434
|
|
|
|
|
|
|
|
|
8435
|
|
|
|
|
|
|
=for ref |
|
8436
|
|
|
|
|
|
|
|
|
8437
|
|
|
|
|
|
|
Determines precision machine parameters. |
|
8438
|
|
|
|
|
|
|
Works inplace. |
|
8439
|
|
|
|
|
|
|
|
|
8440
|
|
|
|
|
|
|
Arguments |
|
8441
|
|
|
|
|
|
|
========= |
|
8442
|
|
|
|
|
|
|
|
|
8443
|
|
|
|
|
|
|
cmach: Specifies the value to be returned by lamch: |
|
8444
|
|
|
|
|
|
|
= 0 LAMCH := eps |
|
8445
|
|
|
|
|
|
|
= 1 LAMCH := sfmin |
|
8446
|
|
|
|
|
|
|
= 2 LAMCH := base |
|
8447
|
|
|
|
|
|
|
= 3 LAMCH := eps*base |
|
8448
|
|
|
|
|
|
|
= 4 LAMCH := t |
|
8449
|
|
|
|
|
|
|
= 5 LAMCH := rnd |
|
8450
|
|
|
|
|
|
|
= 6 LAMCH := emin |
|
8451
|
|
|
|
|
|
|
= 7 LAMCH := rmin |
|
8452
|
|
|
|
|
|
|
= 8 LAMCH := emax |
|
8453
|
|
|
|
|
|
|
= 9 LAMCH := rmax |
|
8454
|
|
|
|
|
|
|
|
|
8455
|
|
|
|
|
|
|
where |
|
8456
|
|
|
|
|
|
|
|
|
8457
|
|
|
|
|
|
|
eps = relative machine precision |
|
8458
|
|
|
|
|
|
|
sfmin = safe minimum, such that 1/sfmin does not overflow |
|
8459
|
|
|
|
|
|
|
base = base of the machine |
|
8460
|
|
|
|
|
|
|
prec = eps*base |
|
8461
|
|
|
|
|
|
|
t = number of (base) digits in the mantissa |
|
8462
|
|
|
|
|
|
|
rnd = 1.0 when rounding occurs in addition, 0.0 otherwise |
|
8463
|
|
|
|
|
|
|
emin = minimum exponent before (gradual) underflow |
|
8464
|
|
|
|
|
|
|
rmin = underflow threshold - base**(emin-1) |
|
8465
|
|
|
|
|
|
|
emax = largest exponent before overflow |
|
8466
|
|
|
|
|
|
|
rmax = overflow threshold - (base**emax)*(1-eps) |
|
8467
|
|
|
|
|
|
|
|
|
8468
|
|
|
|
|
|
|
=for example |
|
8469
|
|
|
|
|
|
|
|
|
8470
|
|
|
|
|
|
|
$a = lamch (0); |
|
8471
|
|
|
|
|
|
|
print "EPS is $a for double\n"; |
|
8472
|
|
|
|
|
|
|
|
|
8473
|
|
|
|
|
|
|
|
|
8474
|
|
|
|
|
|
|
=for bad |
|
8475
|
|
|
|
|
|
|
|
|
8476
|
|
|
|
|
|
|
lamch ignores the bad-value flag of the input piddles. |
|
8477
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8478
|
|
|
|
|
|
|
|
|
8479
|
|
|
|
|
|
|
|
|
8480
|
|
|
|
|
|
|
=cut |
|
8481
|
|
|
|
|
|
|
|
|
8482
|
|
|
|
|
|
|
|
|
8483
|
|
|
|
|
|
|
|
|
8484
|
|
|
|
|
|
|
|
|
8485
|
|
|
|
|
|
|
|
|
8486
|
|
|
|
|
|
|
|
|
8487
|
|
|
|
|
|
|
*lamch = \&PDL::lamch; |
|
8488
|
|
|
|
|
|
|
|
|
8489
|
|
|
|
|
|
|
|
|
8490
|
|
|
|
|
|
|
|
|
8491
|
|
|
|
|
|
|
|
|
8492
|
|
|
|
|
|
|
|
|
8493
|
|
|
|
|
|
|
=head2 labad |
|
8494
|
|
|
|
|
|
|
|
|
8495
|
|
|
|
|
|
|
=for sig |
|
8496
|
|
|
|
|
|
|
|
|
8497
|
|
|
|
|
|
|
Signature: ([io,phys]small(); [io,phys]large()) |
|
8498
|
|
|
|
|
|
|
|
|
8499
|
|
|
|
|
|
|
|
|
8500
|
|
|
|
|
|
|
|
|
8501
|
|
|
|
|
|
|
=for ref |
|
8502
|
|
|
|
|
|
|
|
|
8503
|
|
|
|
|
|
|
Takes as input the values computed by C for underflow and |
|
8504
|
|
|
|
|
|
|
overflow, and returns the square root of each of these values if the |
|
8505
|
|
|
|
|
|
|
log of large is sufficiently large. This subroutine is intended to |
|
8506
|
|
|
|
|
|
|
identify machines with a large exponent range, such as the Crays, and |
|
8507
|
|
|
|
|
|
|
redefine the underflow and overflow limits to be the square roots of |
|
8508
|
|
|
|
|
|
|
the values computed by C. This subroutine is needed because |
|
8509
|
|
|
|
|
|
|
lamch does not compensate for poor arithmetic in the upper half of |
|
8510
|
|
|
|
|
|
|
the exponent range, as is found on a Cray. |
|
8511
|
|
|
|
|
|
|
|
|
8512
|
|
|
|
|
|
|
Arguments |
|
8513
|
|
|
|
|
|
|
========= |
|
8514
|
|
|
|
|
|
|
|
|
8515
|
|
|
|
|
|
|
small: On entry, the underflow threshold as computed by lamch. |
|
8516
|
|
|
|
|
|
|
On exit, if LOG10(large) is sufficiently large, the square |
|
8517
|
|
|
|
|
|
|
root of small, otherwise unchanged. |
|
8518
|
|
|
|
|
|
|
|
|
8519
|
|
|
|
|
|
|
large: On entry, the overflow threshold as computed by lamch. |
|
8520
|
|
|
|
|
|
|
On exit, if LOG10(large) is sufficiently large, the square |
|
8521
|
|
|
|
|
|
|
root of large, otherwise unchanged. |
|
8522
|
|
|
|
|
|
|
|
|
8523
|
|
|
|
|
|
|
=for example |
|
8524
|
|
|
|
|
|
|
|
|
8525
|
|
|
|
|
|
|
$underflow = lamch(7); |
|
8526
|
|
|
|
|
|
|
$overflow = lamch(9); |
|
8527
|
|
|
|
|
|
|
labad ($underflow, $overflow); |
|
8528
|
|
|
|
|
|
|
|
|
8529
|
|
|
|
|
|
|
|
|
8530
|
|
|
|
|
|
|
|
|
8531
|
|
|
|
|
|
|
=for bad |
|
8532
|
|
|
|
|
|
|
|
|
8533
|
|
|
|
|
|
|
labad ignores the bad-value flag of the input piddles. |
|
8534
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8535
|
|
|
|
|
|
|
|
|
8536
|
|
|
|
|
|
|
|
|
8537
|
|
|
|
|
|
|
=cut |
|
8538
|
|
|
|
|
|
|
|
|
8539
|
|
|
|
|
|
|
|
|
8540
|
|
|
|
|
|
|
|
|
8541
|
|
|
|
|
|
|
|
|
8542
|
|
|
|
|
|
|
|
|
8543
|
|
|
|
|
|
|
|
|
8544
|
|
|
|
|
|
|
*labad = \&PDL::labad; |
|
8545
|
|
|
|
|
|
|
|
|
8546
|
|
|
|
|
|
|
|
|
8547
|
|
|
|
|
|
|
|
|
8548
|
|
|
|
|
|
|
|
|
8549
|
|
|
|
|
|
|
|
|
8550
|
|
|
|
|
|
|
=head2 tricpy |
|
8551
|
|
|
|
|
|
|
|
|
8552
|
|
|
|
|
|
|
=for sig |
|
8553
|
|
|
|
|
|
|
|
|
8554
|
|
|
|
|
|
|
Signature: (A(m,n);int uplo();[o] C(m,n)) |
|
8555
|
|
|
|
|
|
|
|
|
8556
|
|
|
|
|
|
|
=for ref |
|
8557
|
|
|
|
|
|
|
|
|
8558
|
|
|
|
|
|
|
Copy triangular part to another matrix. If uplo == 0 copy upper triangular part. |
|
8559
|
|
|
|
|
|
|
|
|
8560
|
|
|
|
|
|
|
|
|
8561
|
|
|
|
|
|
|
|
|
8562
|
|
|
|
|
|
|
=for bad |
|
8563
|
|
|
|
|
|
|
|
|
8564
|
|
|
|
|
|
|
tricpy does not process bad values. |
|
8565
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8566
|
|
|
|
|
|
|
|
|
8567
|
|
|
|
|
|
|
|
|
8568
|
|
|
|
|
|
|
=cut |
|
8569
|
|
|
|
|
|
|
|
|
8570
|
|
|
|
|
|
|
|
|
8571
|
|
|
|
|
|
|
|
|
8572
|
|
|
|
|
|
|
|
|
8573
|
|
|
|
|
|
|
|
|
8574
|
|
|
|
|
|
|
|
|
8575
|
|
|
|
|
|
|
*tricpy = \&PDL::tricpy; |
|
8576
|
|
|
|
|
|
|
|
|
8577
|
|
|
|
|
|
|
|
|
8578
|
|
|
|
|
|
|
|
|
8579
|
|
|
|
|
|
|
|
|
8580
|
|
|
|
|
|
|
|
|
8581
|
|
|
|
|
|
|
=head2 cplx_eigen |
|
8582
|
|
|
|
|
|
|
|
|
8583
|
|
|
|
|
|
|
=for sig |
|
8584
|
|
|
|
|
|
|
|
|
8585
|
|
|
|
|
|
|
Signature: (eigreval(n);eigimval(n); eigvec(n,p);int fortran();[o]cplx_val(q=2,n);[o]cplx_vec(r=2,n,p)) |
|
8586
|
|
|
|
|
|
|
|
|
8587
|
|
|
|
|
|
|
=for ref |
|
8588
|
|
|
|
|
|
|
|
|
8589
|
|
|
|
|
|
|
Output complex eigen-values/vectors from eigen-values/vectors |
|
8590
|
|
|
|
|
|
|
as computed by geev or geevx. |
|
8591
|
|
|
|
|
|
|
'fortran' means fortran storage type. |
|
8592
|
|
|
|
|
|
|
|
|
8593
|
|
|
|
|
|
|
|
|
8594
|
|
|
|
|
|
|
|
|
8595
|
|
|
|
|
|
|
=for bad |
|
8596
|
|
|
|
|
|
|
|
|
8597
|
|
|
|
|
|
|
cplx_eigen does not process bad values. |
|
8598
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8599
|
|
|
|
|
|
|
|
|
8600
|
|
|
|
|
|
|
|
|
8601
|
|
|
|
|
|
|
=cut |
|
8602
|
|
|
|
|
|
|
|
|
8603
|
|
|
|
|
|
|
|
|
8604
|
|
|
|
|
|
|
|
|
8605
|
|
|
|
|
|
|
|
|
8606
|
|
|
|
|
|
|
|
|
8607
|
|
|
|
|
|
|
|
|
8608
|
|
|
|
|
|
|
*cplx_eigen = \&PDL::cplx_eigen; |
|
8609
|
|
|
|
|
|
|
|
|
8610
|
|
|
|
|
|
|
|
|
8611
|
|
|
|
|
|
|
|
|
8612
|
|
|
|
|
|
|
|
|
8613
|
|
|
|
|
|
|
|
|
8614
|
|
|
|
|
|
|
=head2 augment |
|
8615
|
|
|
|
|
|
|
|
|
8616
|
|
|
|
|
|
|
=for sig |
|
8617
|
|
|
|
|
|
|
|
|
8618
|
|
|
|
|
|
|
Signature: (x(n); y(p);[o]out(q)) |
|
8619
|
|
|
|
|
|
|
|
|
8620
|
|
|
|
|
|
|
=for ref |
|
8621
|
|
|
|
|
|
|
|
|
8622
|
|
|
|
|
|
|
Combine two pidlles into a single piddle. |
|
8623
|
|
|
|
|
|
|
This routine does backward and forward dataflow automatically. |
|
8624
|
|
|
|
|
|
|
|
|
8625
|
|
|
|
|
|
|
|
|
8626
|
|
|
|
|
|
|
|
|
8627
|
|
|
|
|
|
|
=for bad |
|
8628
|
|
|
|
|
|
|
|
|
8629
|
|
|
|
|
|
|
augment does not process bad values. |
|
8630
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8631
|
|
|
|
|
|
|
|
|
8632
|
|
|
|
|
|
|
|
|
8633
|
|
|
|
|
|
|
=cut |
|
8634
|
|
|
|
|
|
|
|
|
8635
|
|
|
|
|
|
|
|
|
8636
|
|
|
|
|
|
|
|
|
8637
|
|
|
|
|
|
|
|
|
8638
|
|
|
|
|
|
|
|
|
8639
|
|
|
|
|
|
|
|
|
8640
|
|
|
|
|
|
|
*augment = \&PDL::augment; |
|
8641
|
|
|
|
|
|
|
|
|
8642
|
|
|
|
|
|
|
|
|
8643
|
|
|
|
|
|
|
|
|
8644
|
|
|
|
|
|
|
|
|
8645
|
|
|
|
|
|
|
|
|
8646
|
|
|
|
|
|
|
=head2 mstack |
|
8647
|
|
|
|
|
|
|
|
|
8648
|
|
|
|
|
|
|
=for sig |
|
8649
|
|
|
|
|
|
|
|
|
8650
|
|
|
|
|
|
|
Signature: (x(n,m);y(n,p);[o]out(n,q)) |
|
8651
|
|
|
|
|
|
|
|
|
8652
|
|
|
|
|
|
|
=for ref |
|
8653
|
|
|
|
|
|
|
|
|
8654
|
|
|
|
|
|
|
Combine two pidlles into a single piddle. |
|
8655
|
|
|
|
|
|
|
This routine does backward and forward dataflow automatically. |
|
8656
|
|
|
|
|
|
|
|
|
8657
|
|
|
|
|
|
|
|
|
8658
|
|
|
|
|
|
|
|
|
8659
|
|
|
|
|
|
|
=for bad |
|
8660
|
|
|
|
|
|
|
|
|
8661
|
|
|
|
|
|
|
mstack does not process bad values. |
|
8662
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8663
|
|
|
|
|
|
|
|
|
8664
|
|
|
|
|
|
|
|
|
8665
|
|
|
|
|
|
|
=cut |
|
8666
|
|
|
|
|
|
|
|
|
8667
|
|
|
|
|
|
|
|
|
8668
|
|
|
|
|
|
|
|
|
8669
|
|
|
|
|
|
|
|
|
8670
|
|
|
|
|
|
|
|
|
8671
|
|
|
|
|
|
|
|
|
8672
|
|
|
|
|
|
|
*mstack = \&PDL::mstack; |
|
8673
|
|
|
|
|
|
|
|
|
8674
|
|
|
|
|
|
|
|
|
8675
|
|
|
|
|
|
|
|
|
8676
|
|
|
|
|
|
|
|
|
8677
|
|
|
|
|
|
|
|
|
8678
|
|
|
|
|
|
|
=head2 charpol |
|
8679
|
|
|
|
|
|
|
|
|
8680
|
|
|
|
|
|
|
=for sig |
|
8681
|
|
|
|
|
|
|
|
|
8682
|
|
|
|
|
|
|
Signature: ([phys]A(n,n);[phys,o]Y(n,n);[phys,o]out(p)) |
|
8683
|
|
|
|
|
|
|
|
|
8684
|
|
|
|
|
|
|
=for ref |
|
8685
|
|
|
|
|
|
|
|
|
8686
|
|
|
|
|
|
|
Compute adjoint matrix and characteristic polynomial. |
|
8687
|
|
|
|
|
|
|
|
|
8688
|
|
|
|
|
|
|
|
|
8689
|
|
|
|
|
|
|
|
|
8690
|
|
|
|
|
|
|
=for bad |
|
8691
|
|
|
|
|
|
|
|
|
8692
|
|
|
|
|
|
|
charpol does not process bad values. |
|
8693
|
|
|
|
|
|
|
It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. |
|
8694
|
|
|
|
|
|
|
|
|
8695
|
|
|
|
|
|
|
|
|
8696
|
|
|
|
|
|
|
=cut |
|
8697
|
|
|
|
|
|
|
|
|
8698
|
|
|
|
|
|
|
|
|
8699
|
|
|
|
|
|
|
|
|
8700
|
|
|
|
|
|
|
|
|
8701
|
|
|
|
|
|
|
|
|
8702
|
|
|
|
|
|
|
|
|
8703
|
|
|
|
|
|
|
*charpol = \&PDL::charpol; |
|
8704
|
|
|
|
|
|
|
|
|
8705
|
|
|
|
|
|
|
|
|
8706
|
|
|
|
|
|
|
|
|
8707
|
|
|
|
|
|
|
; |
|
8708
|
|
|
|
|
|
|
|
|
8709
|
|
|
|
|
|
|
|
|
8710
|
|
|
|
|
|
|
=head1 AUTHOR |
|
8711
|
|
|
|
|
|
|
|
|
8712
|
|
|
|
|
|
|
Copyright (C) Grégory Vanuxem 2005-2007. |
|
8713
|
|
|
|
|
|
|
|
|
8714
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
8715
|
|
|
|
|
|
|
it under the terms of the artistic license as specified in the Artistic |
|
8716
|
|
|
|
|
|
|
file. |
|
8717
|
|
|
|
|
|
|
|
|
8718
|
|
|
|
|
|
|
=cut |
|
8719
|
|
|
|
|
|
|
|
|
8720
|
|
|
|
|
|
|
|
|
8721
|
|
|
|
|
|
|
|
|
8722
|
|
|
|
|
|
|
|
|
8723
|
|
|
|
|
|
|
|
|
8724
|
|
|
|
|
|
|
# Exit with OK status |
|
8725
|
|
|
|
|
|
|
|
|
8726
|
|
|
|
|
|
|
1; |
|
8727
|
|
|
|
|
|
|
|
|
8728
|
|
|
|
|
|
|
|