Debian Codegraph @

GENERATED/PDL/LinearAlgebra/Real.pm

raw symbols SCIP
1 #
2 # GENERATED WITH PDL::PP from lib/PDL/LinearAlgebra/Real.pd! Don't modify!
3 #
4 package PDL::LinearAlgebra::Real;
5
6 our @EXPORT_OK = qw(gtsv gesvd gesdd ggsvd geev geevx ggev ggevx gees geesx gges ggesx syev syevd syevx syevr sygv sygvd sygvx gesv gesvx sysv sysvx posv posvx gels gelsy gelss gelsd gglse ggglm getrf getf2 sytrf sytf2 potrf potf2 getri sytri potri trtri trti2 getrs sytrs potrs trtrs latrs gecon sycon pocon trcon geqp3 geqrf orgqr ormqr gelqf orglq ormlq geqlf orgql ormql gerqf orgrq ormrq tzrzf ormrz gehrd orghr hseqr trevc tgevc gebal gebak lange lansy lantr gemm mmult crossprod syrk dot axpy nrm2 asum scal rot rotg lasrt lacpy laswp lamch labad cplx_eigen charpol );
7 our %EXPORT_TAGS = (Func=>\@EXPORT_OK);
8
9 use PDL::Core;
10 use PDL::Exporter;
11 use DynaLoader;
12
13
14 our $VERSION = '0.437';
15 our @ISA = ( 'PDL::Exporter','DynaLoader' );
16 push @PDL::Core::PP, __PACKAGE__;
17 bootstrap PDL::LinearAlgebra::Real $VERSION;
18
19
20
21
22
23
24
25
26 #line 71 "lib/PDL/LinearAlgebra/Real.pd"
27
28 use strict;
29
30 {
31 package # hide from CPAN
32 PDL;
33 my $warningFlag;
34 BEGIN{
35 $warningFlag = $^W;
36 $^W = 0;
37 }
38
39 sub overload_mmult {
40 !(grep ref($_) && !$_->type->real, @_[0,1])
41 ? PDL::mmult($_[0], $_[1])
42 : PDL::cmmult($_[0], $_[1])
43 }
44 use overload
45 'x' => \&overload_mmult;
46
47 BEGIN{ $^W = $warningFlag;}
48 }
49
50 =encoding utf8
51
52 =head1 NAME
53
54 PDL::LinearAlgebra::Real - PDL interface to the real lapack linear algebra programming library
55
56 =head1 SYNOPSIS
57
58 use PDL::LinearAlgebra::Real;
59
60 $a = random (100,100);
61 $s = zeroes(100);
62 $u = zeroes(100,100);
63 $v = zeroes(100,100);
64 $info = 0;
65 $job = 0;
66 gesdd($a, $job, $info, $s , $u, $v);
67
68 =head1 DESCRIPTION
69
70 This module provides an interface to parts of the real lapack library.
71 These routines accept either float or double ndarrays.
72
73 =cut
74 #line 75 "lib/PDL/LinearAlgebra/Real.pm"
75
76
77 =head1 FUNCTIONS
78
79 =cut
80
81
82
83
84
85
86 =head2 gtsv
87
88 =for sig
89
90 Signature: ([io]DL(n); [io]D(n); [io]DU(n); [io]B(n,nrhs); int [o]info())
91 Types: (float double)
92
93 =for usage
94
95 $info = gtsv($DL, $D, $DU, $B);
96 gtsv($DL, $D, $DU, $B, $info); # all arguments given
97 $info = $DL->gtsv($D, $DU, $B); # method call
98 $DL->gtsv($D, $DU, $B, $info);
99
100 =for ref
101
102 Solves the equation
103
104 A * X = B
105
106 where A is an C<n> by C<n> tridiagonal matrix, by Gaussian elimination with
107 partial pivoting, and B is an C<n> by C<nrhs> matrix.
108
109 Note that the equation C<A**T*X = B> may be solved by interchanging the
110 order of the arguments DU and DL.
111
112 B<NB> This differs from the LINPACK function C<dgtsl> in that C<DL>
113 starts from its first element, while the LINPACK equivalent starts from
114 its second element.
115
116 Arguments
117 =========
118
119 DL: On entry, DL must contain the (n-1) sub-diagonal elements of A.
120
121 On exit, DL is overwritten by the (n-2) elements of the
122 second super-diagonal of the upper triangular matrix U from
123 the LU factorization of A, in DL(1), ..., DL(n-2).
124
125 D: On entry, D must contain the diagonal elements of A.
126
127 On exit, D is overwritten by the n diagonal elements of U.
128
129 DU: On entry, DU must contain the (n-1) super-diagonal elements of A.
130
131 On exit, DU is overwritten by the (n-1) elements of the
132 first super-diagonal of the U.
133
134 B: On entry, the n by nrhs matrix of right hand side matrix B.
135 On exit, if info = 0, the n by nrhs solution matrix X.
136
137 info: = 0: successful exit
138 < 0: if info = -i, the i-th argument had an illegal value
139 > 0: if info = i, U(i,i) is exactly zero, and the solution
140 has not been computed. The factorization has not been
141 completed unless i = n.
142
143 =for example
144
145 $dl = random(float, 9);
146 $d = random(float, 10);
147 $du = random(float, 9);
148 $b = random(10,5);
149 gtsv($dl, $d, $du, $b, ($info=null));
150 print "X is:\n$b" unless $info;
151
152 =pod
153
154 Broadcasts over its inputs.
155
156 =for bad
157
158 C<gtsv> ignores the bad-value flag of the input ndarrays.
159 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
160
161 =cut
162
163
164
165
166 *gtsv = \&PDL::gtsv;
167
168
169
170
171
172
173 =head2 gesvd
174
175 =for sig
176
177 Signature: ([io]A(m,n); [o]s(minmn=CALC(PDLMIN($SIZE(m),$SIZE(n)))); [o]U(p,p); [o]VT(s,s); int [o]info(); int jobu; int jobvt)
178 Types: (float double)
179
180 =for usage
181
182 ($s, $U, $VT, $info) = gesvd($A, $jobu, $jobvt);
183 gesvd($A, $jobu, $jobvt, $s, $U, $VT, $info); # all arguments given
184 ($s, $U, $VT, $info) = $A->gesvd($jobu, $jobvt); # method call
185 $A->gesvd($jobu, $jobvt, $s, $U, $VT, $info);
186
187 =for ref
188
189 Computes the singular value decomposition (SVD) of a real
190 M-by-N matrix A.
191
192 The SVD is written
193
194 A = U * SIGMA * V'
195
196 where SIGMA is an M-by-N matrix which is zero except for its
197 min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and
198 V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA
199 are the singular values of A; they are real and non-negative, and
200 are returned in descending order. The first min(m,n) columns of
201 U and V are the left and right singular vectors of A.
202
203 Note that the routine returns VT = V', not V.
204
205 jobu: Specifies options for computing all or part of the matrix U:
206 = 0: no columns of U (no left singular vectors) are
207 computed.
208 = 1: all M columns of U are returned in array U:
209 = 2: the first min(m,n) columns of U (the left singular
210 vectors) are returned in the array U;
211 = 3: the first min(m,n) columns of U (the left singular
212 vectors) are overwritten on the array A;
213
214 jobvt: Specifies options for computing all or part of the matrix
215 V':
216 = 0: no rows of V' (no right singular vectors) are
217 computed.
218 = 1: all N rows of V' are returned in the array VT;
219 = 2: the first min(m,n) rows of V' (the right singular
220 vectors) are returned in the array VT;
221 = 3: the first min(m,n) rows of V' (the right singular
222 vectors) are overwritten on the array A;
223
224 jobvt and jobu cannot both be 3.
225
226 A: On entry, the M-by-N matrix A.
227 On exit,
228 if jobu = 3, A is overwritten with the first min(m,n)
229 columns of U (the left singular vectors,
230 stored columnwise);
231 if jobvt = 3, A is overwritten with the first min(m,n)
232 rows of V' (the right singular vectors,
233 stored rowwise);
234 if jobu != 3 and jobvt != 3, the contents of A
235 are destroyed.
236
237 s: The singular values of A, sorted so that s(i) >= s(i+1).
238
239 U: If jobu = 1, U contains the M-by-M orthogonal matrix U;
240 if jobu = 3, U contains the first min(m,n) columns of U
241 (the left singular vectors, stored columnwise);
242 if jobu = 0 or 3, U is not referenced.
243 Min size = [1,1].
244
245 VT: If jobvt = 1, VT contains the N-by-N orthogonal matrix
246 V';
247 if jobvt = 2, VT contains the first min(m,n) rows of
248 V' (the right singular vectors, stored rowwise);
249 if jobvt = 0 or 3, VT is not referenced.
250 Min size = [1,1].
251
252 info: = 0: successful exit.
253 < 0: if info = -i, the i-th argument had an illegal value.
254 > 0: if bdsqr did not converge, info specifies how many
255 superdiagonals of an intermediate bidiagonal form B
256 did not converge to zero.
257
258 =for example
259
260 $a = random (float, 100,100);
261 $s = zeroes(float, 100);
262 $u = zeroes(float, 100,100);
263 $vt = zeroes(float, 100,100);
264 $info = pdl(long, 0);
265 gesvd($a, 2, 2, $s , $u, $vt, $info);
266
267 =pod
268
269 Broadcasts over its inputs.
270
271 =for bad
272
273 C<gesvd> ignores the bad-value flag of the input ndarrays.
274 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
275
276 =cut
277
278
279
280
281 *gesvd = \&PDL::gesvd;
282
283
284
285
286
287
288 =head2 gesdd
289
290 =for sig
291
292 Signature: ([io]A(m,n); [o]s(minmn=CALC(PDLMIN($SIZE(m),$SIZE(n)))); [o]U(p,p); [o]VT(s,s); int [o]info(); int [t]iwork(iworkn); int jobz)
293 Types: (float double)
294
295 =for usage
296
297 ($s, $U, $VT, $info) = gesdd($A, $jobz);
298 gesdd($A, $jobz, $s, $U, $VT, $info); # all arguments given
299 ($s, $U, $VT, $info) = $A->gesdd($jobz); # method call
300 $A->gesdd($jobz, $s, $U, $VT, $info);
301
302 =for ref
303
304 Computes the singular value decomposition (SVD) of a real
305 M-by-N matrix A.
306
307 This routine use the Cuppen's divide and conquer algorithm.
308 It is much faster than the simple driver for large matrices, but uses more workspace.
309
310 jobz: Specifies options for computing all or part of matrix:
311
312 = 0: no columns of U or rows of V' are computed;
313 = 1: all M columns of U and all N rows of V' are
314 returned in the arrays U and VT;
315 = 2: the first min(M,N) columns of U and the first
316 min(M,N) rows of V' are returned in the arrays U
317 and VT;
318 = 3: If M >= N, the first N columns of U are overwritten
319 on the array A and all rows of V' are returned in
320 the array VT;
321 otherwise, all columns of U are returned in the
322 array U and the first M rows of V' are overwritten
323 on the array A.
324
325 A: On entry, the M-by-N matrix A.
326 On exit,
327 if jobz = 3, A is overwritten with the first N columns
328 of U (the left singular vectors, stored
329 columnwise) if M >= N;
330 A is overwritten with the first M rows
331 of V' (the right singular vectors, stored
332 rowwise) otherwise.
333 if jobz != 3, the contents of A are destroyed.
334
335 s: The singular values of A, sorted so that s(i) >= s(i+1).
336
337 U: If jobz = 1 or jobz = 3 and M < N, U contains the M-by-M
338 orthogonal matrix U;
339 if jobz = 2, U contains the first min(M,N) columns of U
340 (the left singular vectors, stored columnwise);
341 if jobz = 3 and M >= N, or jobz = 0, U is not referenced.
342 Min size = [1,1].
343
344 VT: If jobz = 1 or jobz = 3 and M >= N, VT contains the
345 N-by-N orthogonal matrix V';
346 if jobz = 2, VT contains the first min(M,N) rows of
347 V' (the right singular vectors, stored rowwise);
348 if jobz = 3 and M < N, or jobz = 0, VT is not referenced.
349 Min size = [1,1].
350
351 info: = 0: successful exit.
352 < 0: if info = -i, the i-th argument had an illegal value.
353 > 0: bdsdc did not converge, updating process failed.
354
355 =for example
356
357 $lines = 50;
358 $columns = 100;
359 $a = random (float, $lines, $columns);
360 $min = $lines < $columns ? $lines : $columns;
361 $s = zeroes(float, $min);
362 $u = zeroes(float, $lines, $lines);
363 $vt = zeroes(float, $columns, $columns);
364 $info = long (0);
365 gesdd($a, 1, $s , $u, $vt, $info);
366
367 =pod
368
369 Broadcasts over its inputs.
370
371 =for bad
372
373 C<gesdd> ignores the bad-value flag of the input ndarrays.
374 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
375
376 =cut
377
378
379
380
381 *gesdd = \&PDL::gesdd;
382
383
384
385
386
387
388 =head2 ggsvd
389
390 =for sig
391
392 Signature: ([io]A(m,n); [io]B(p,n); int [o]k(); int [o]l();[o]alpha(n);[o]beta(n); [o]U(q,q); [o]V(r,r); [o]Q(s,s); int [o]iwork(n); int [o]info(); int jobu; int jobv; int jobq)
393 Types: (float double)
394
395 =for usage
396
397 ($k, $l, $alpha, $beta, $U, $V, $Q, $iwork, $info) = ggsvd($A, $jobu, $jobv, $jobq, $B);
398 ggsvd($A, $jobu, $jobv, $jobq, $B, $k, $l, $alpha, $beta, $U, $V, $Q, $iwork, $info); # all arguments given
399 ($k, $l, $alpha, $beta, $U, $V, $Q, $iwork, $info) = $A->ggsvd($jobu, $jobv, $jobq, $B); # method call
400 $A->ggsvd($jobu, $jobv, $jobq, $B, $k, $l, $alpha, $beta, $U, $V, $Q, $iwork, $info);
401
402 =for ref
403
404 Computes the generalized singular value decomposition (GSVD)
405 of an M-by-N real matrix A and P-by-N real matrix B:
406
407 U'*A*Q = D1*( 0 R ), V'*B*Q = D2*( 0 R )
408
409 where U, V and Q are orthogonal matrices, and Z' is the transpose
410 of Z.
411
412 Let K+L = the effective numerical rank of the matrix (A',B')',
413 then R is a K+L-by-K+L nonsingular upper triangular matrix, D1 and
414 D2 are M-by-(K+L) and P-by-(K+L) "diagonal" matrices and of the
415 following structures, respectively:
416
417 If M-K-L >= 0,
418
419 K L
420 D1 = K ( I 0 )
421 L ( 0 C )
422 M-K-L ( 0 0 )
423
424 K L
425 D2 = L ( 0 S )
426 P-L ( 0 0 )
427
428 N-K-L K L
429 ( 0 R ) = K ( 0 R11 R12 )
430 L ( 0 0 R22 )
431
432 where
433
434 C = diag( ALPHA(K+1), ... , ALPHA(K+L) ),
435 S = diag( BETA(K+1), ... , BETA(K+L) ),
436 C**2 + S**2 = I.
437
438 R is stored in A(1:K+L,N-K-L+1:N) on exit.
439
440 If M-K-L < 0,
441
442 K M-K K+L-M
443 D1 = K ( I 0 0 )
444 M-K ( 0 C 0 )
445
446 K M-K K+L-M
447 D2 = M-K ( 0 S 0 )
448 K+L-M ( 0 0 I )
449 P-L ( 0 0 0 )
450
451 N-K-L K M-K K+L-M
452 ( 0 R ) = K ( 0 R11 R12 R13 )
453 M-K ( 0 0 R22 R23 )
454 K+L-M ( 0 0 0 R33 )
455
456 where
457
458 C = diag( ALPHA(K+1), ... , ALPHA(M) ),
459 S = diag( BETA(K+1), ... , BETA(M) ),
460 C**2 + S**2 = I.
461
462 (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), and R33 is stored
463 ( 0 R22 R23 )
464 in B(M-K+1:L,N+M-K-L+1:N) on exit.
465
466 The routine computes C, S, R, and optionally the orthogonal
467 transformation matrices U, V and Q.
468
469 In particular, if B is an N-by-N nonsingular matrix, then the GSVD of
470 A and B implicitly gives the SVD of A*inv(B):
471
472 A*inv(B) = U*(D1*inv(D2))*V'.
473
474 If ( A',B')' has orthonormal columns, then the GSVD of A and B is
475 also equal to the CS decomposition of A and B. Furthermore, the GSVD
476 can be used to derive the solution of the eigenvalue problem:
477
478 A'*A x = lambda* B'*B x.
479
480 In some literature, the GSVD of A and B is presented in the form
481
482 U'*A*X = ( 0 D1 ), V'*B*X = ( 0 D2 )
483 where U and V are orthogonal and X is nonsingular, D1 and D2 are "diagonal".
484
485 The former GSVD form can be converted to the latter
486 form by taking the nonsingular matrix X as
487
488 X = Q*( I 0 )
489 ( 0 inv(R) ).
490
491 Arguments
492 =========
493
494 jobu: = 0: U is not computed.
495 = 1: Orthogonal matrix U is computed;
496
497 jobv: = 0: V is not computed.
498 = 1: Orthogonal matrix V is computed;
499
500 jobq: = 0: Q is not computed.
501 = 1: Orthogonal matrix Q is computed;
502
503 k:
504 l: On exit, k and l specify the dimension of the subblocks
505 described in the Purpose section.
506 k + l = effective numerical rank of (A',B')'.
507
508 A: On entry, the M-by-N matrix A.
509 On exit, A contains the triangular matrix R, or part of R.
510
511 B: On entry, the P-by-N matrix B.
512 On exit, B contains the triangular matrix R if M-k-l < 0.
513
514 alpha:
515 beta: On exit, alpha and beta contain the generalized singular
516 value pairs of A and B;
517 alpha(1:k) = 1,
518 beta(1:k) = 0,
519 and if M-k-l >= 0,
520 alpha(k+1:k+l) = C,
521 beta(k+1:k+l) = S,
522 or if M-k-l < 0,
523 alpha(k+1:M)=C, alpha(M+1:k+l)=0
524 beta(k+1:M) =S, beta(M+1:k+l) =1
525 and
526 alpha(k+l+1:N) = 0
527 beta(k+l+1:N) = 0
528
529 U: If jobu = 1, U contains the M-by-M orthogonal matrix U.
530 If jobu = 0, U is not referenced.
531 Need a minimum array of (1,1) if jobu = 0;
532
533 V: If jobv = 1, V contains the P-by-P orthogonal matrix V.
534 If jobv = 0, V is not referenced.
535 Need a minimum array of (1,1) if jobv = 0;
536
537 Q: If jobq = 1, Q contains the N-by-N orthogonal matrix Q.
538 If jobq = 0, Q is not referenced.
539 Need a minimum array of (1,1) if jobq = 0;
540
541 iwork: On exit, iwork stores the sorting information. More
542 precisely, the following loop will sort alpha
543 for I = k+1, min(M,k+l)
544 swap alpha(I) and alpha(iwork(I))
545 endfor
546 such that alpha(1) >= alpha(2) >= ... >= alpha(N).
547
548 info: = 0: successful exit
549 < 0: if info = -i, the i-th argument had an illegal value.
550 > 0: if info = 1, the Jacobi-type procedure failed to
551 converge. For further details, see subroutine tgsja.
552
553 =for example
554
555 $k = null;
556 $l = null;
557 $A = random(5,6);
558 $B = random(7,6);
559 $alpha = zeroes(6);
560 $beta = zeroes(6);
561 $U = zeroes(5,5);
562 $V = zeroes(7,7);
563 $Q = zeroes(6,6);
564 $iwork = zeroes(long, 6);
565 $info = null;
566 ggsvd($A,1,1,1,$B,$k,$l,$alpha, $beta,$U, $V, $Q, $iwork,$info);
567
568 =pod
569
570 Broadcasts over its inputs.
571
572 =for bad
573
574 C<ggsvd> ignores the bad-value flag of the input ndarrays.
575 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
576
577 =cut
578
579
580
581
582 *ggsvd = \&PDL::ggsvd;
583
584
585
586
587
588
589 =head2 geev
590
591 =for sig
592
593 Signature: ([io]A(n,n); [o]wr(n); [o]wi(n); [o]vl(m,m); [o]vr(p,p); int [o]info(); int jobvl; int jobvr)
594 Types: (float double)
595
596 =for usage
597
598 ($wr, $wi, $vl, $vr, $info) = geev($A, $jobvl, $jobvr);
599 geev($A, $jobvl, $jobvr, $wr, $wi, $vl, $vr, $info); # all arguments given
600 ($wr, $wi, $vl, $vr, $info) = $A->geev($jobvl, $jobvr); # method call
601 $A->geev($jobvl, $jobvr, $wr, $wi, $vl, $vr, $info);
602
603 =for ref
604
605 Computes for an N-by-N real nonsymmetric matrix A, the
606 eigenvalues and, optionally, the left and/or right eigenvectors.
607
608 The right eigenvector v(j) of A satisfies:
609 A * v(j) = lambda(j) * v(j)
610 where lambda(j) is its eigenvalue.
611
612 The left eigenvector u(j) of A satisfies:
613 u(j)**H * A = lambda(j) * u(j)**H
614 where u(j)**H denotes the conjugate transpose of u(j).
615
616 The computed eigenvectors are normalized to have Euclidean norm
617 equal to 1 and largest component real.
618
619 Arguments
620 =========
621
622 jobvl: = 0: left eigenvectors of A are not computed;
623 = 1: left eigenvectors of A are computed.
624
625 jobvr: = 0: right eigenvectors of A are not computed;
626 = 1: right eigenvectors of A are computed.
627
628 A: A is overwritten.
629
630 wr:
631 wi: wr and wi contain the real and imaginary parts,
632 respectively, of the computed eigenvalues. Complex
633 conjugate pairs of eigenvalues appear consecutively
634 with the eigenvalue having the positive imaginary part
635 first.
636
637 vl: If jobvl = 1, the left eigenvectors u(j) are stored one
638 after another in the columns of vl, in the same order
639 as their eigenvalues else vl is not referenced.
640 If the j-th eigenvalue is real, then u(j) = vl(:,j),
641 the j-th column of vl.
642 If the j-th and (j+1)-st eigenvalues form a complex
643 conjugate pair, then u(j) = vl(:,j) + i*vl(:,j+1) and
644 u(j+1) = vl(:,j) - i*vl(:,j+1).
645 Min size = [1].
646
647 vr: If jobvr = 1, the right eigenvectors v(j) are stored one
648 after another in the columns of vr, in the same order
649 as their eigenvalues else vr is not referenced.
650 If the j-th eigenvalue is real, then v(j) = vr(:,j),
651 the j-th column of vr.
652 If the j-th and (j+1)-st eigenvalues form a complex
653 conjugate pair, then v(j) = vr(:,j) + i*vr(:,j+1) and
654 v(j+1) = vr(:,j) - i*vr(:,j+1).
655 Min size = [1].
656
657 info: = 0: successful exit
658 < 0: if info = -i, the i-th argument had an illegal value.
659 > 0: if info = i, the QR algorithm failed to compute all the
660 eigenvalues, and no eigenvectors have been computed;
661 elements i+1:N of wr and wi contain eigenvalues which
662 have converged.
663
664 =for example
665
666 $a = random (5, 5);
667 $wr = zeroes(5);
668 $wi = zeroes($wr);
669 $vl = zeroes($a);
670 $vr = zeroes($a);
671 $info = null;
672 geev($a, 1, 1, $wr, $wi, $vl, $vr, $info);
673
674 =pod
675
676 Broadcasts over its inputs.
677
678 =for bad
679
680 C<geev> ignores the bad-value flag of the input ndarrays.
681 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
682
683 =cut
684
685
686
687
688 *geev = \&PDL::geev;
689
690
691
692
693
694
695 =head2 geevx
696
697 =for sig
698
699 Signature: ([io]A(n,n); [o]wr(n); [o]wi(n); [o]vl(m,m); [o]vr(p,p); int [o]ilo(); int [o]ihi(); [o]scale(n); [o]abnrm(); [o]rconde(q); [o]rcondv(r); int [o]info(); int [t]iwork(iworkn); int jobvl; int jobvr; int balance; int sense)
700 Types: (float double)
701
702 =for usage
703
704 ($wr, $wi, $vl, $vr, $ilo, $ihi, $scale, $abnrm, $rconde, $rcondv, $info) = geevx($A, $jobvl, $jobvr, $balance, $sense);
705 geevx($A, $jobvl, $jobvr, $balance, $sense, $wr, $wi, $vl, $vr, $ilo, $ihi, $scale, $abnrm, $rconde, $rcondv, $info); # all arguments given
706 ($wr, $wi, $vl, $vr, $ilo, $ihi, $scale, $abnrm, $rconde, $rcondv, $info) = $A->geevx($jobvl, $jobvr, $balance, $sense); # method call
707 $A->geevx($jobvl, $jobvr, $balance, $sense, $wr, $wi, $vl, $vr, $ilo, $ihi, $scale, $abnrm, $rconde, $rcondv, $info);
708
709 =for ref
710
711 Computes for an N-by-N real nonsymmetric matrix A, the
712 eigenvalues and, optionally, the left and/or right eigenvectors.
713
714 Optionally also, it computes a balancing transformation to improve
715 the conditioning of the eigenvalues and eigenvectors (ilo, ihi,
716 scale, and abnrm), reciprocal condition numbers for the eigenvalues
717 (rconde), and reciprocal condition numbers for the right
718 eigenvectors (rcondv).
719
720 The right eigenvector v(j) of A satisfies:
721
722 A * v(j) = lambda(j) * v(j)
723 where lambda(j) is its eigenvalue.
724
725 The left eigenvector u(j) of A satisfies:
726
727 u(j)**H * A = lambda(j) * u(j)**H
728 where u(j)**H denotes the conjugate transpose of u(j).
729
730 The computed eigenvectors are normalized to have Euclidean norm
731 equal to 1 and largest component real.
732
733 Balancing a matrix means permuting the rows and columns to make it
734 more nearly upper triangular, and applying a diagonal similarity
735 transformation D * A * D**(-1), where D is a diagonal matrix, to
736 make its rows and columns closer in norm and the condition numbers
737 of its eigenvalues and eigenvectors smaller. The computed
738 reciprocal condition numbers correspond to the balanced matrix.
739 Permuting rows and columns will not change the condition numbers
740 (in exact arithmetic) but diagonal scaling will. For further
741 explanation of balancing, see section 4.10.2 of the LAPACK
742 Users' Guide.
743
744 Arguments
745 =========
746
747 balance:
748 Indicates how the input matrix should be diagonally scaled
749 and/or permuted to improve the conditioning of its
750 eigenvalues.
751 = 0: Do not diagonally scale or permute;
752 = 1: Perform permutations to make the matrix more nearly
753 upper triangular. Do not diagonally scale;
754 = 2: Diagonally scale the matrix, i.e. replace A by
755 D*A*D**(-1), where D is a diagonal matrix chosen
756 to make the rows and columns of A more equal in
757 norm. Do not permute;
758 = 3: Both diagonally scale and permute A.
759
760 Computed reciprocal condition numbers will be for the matrix
761 after balancing and/or permuting. Permuting does not change
762 condition numbers (in exact arithmetic), but balancing does.
763
764 jobvl: = 0: left eigenvectors of A are not computed;
765 = 1: left eigenvectors of A are computed.
766 If sense = 1 or 3, jobvl must = 1.
767
768 jobvr; = 0: right eigenvectors of A are not computed;
769 = 1: right eigenvectors of A are computed.
770 If sense = 1 or 3, jobvr must = 1.
771
772 sense: Determines which reciprocal condition numbers are computed.
773 = 0: None are computed;
774 = 1: Computed for eigenvalues only;
775 = 2: Computed for right eigenvectors only;
776 = 3: Computed for eigenvalues and right eigenvectors.
777
778 If sense = 1 or 3, both left and right eigenvectors
779 must also be computed (jobvl = 1 and jobvr = 1).
780
781 A: The N-by-N matrix.
782 It is overwritten. If jobvl = 1 or
783 jobvr = 1, A contains the real Schur form of the balanced
784 version of the input matrix A.
785
786 wr
787 wi: wr and wi contain the real and imaginary parts,
788 respectively, of the computed eigenvalues. Complex
789 conjugate pairs of eigenvalues will appear consecutively
790 with the eigenvalue having the positive imaginary part
791 first.
792
793 vl: If jobvl = 1, the left eigenvectors u(j) are stored one
794 after another in the columns of vl, in the same order
795 as their eigenvalues else vl is not referenced.
796 If the j-th eigenvalue is real, then u(j) = vl(:,j),
797 the j-th column of vl.
798 If the j-th and (j+1)-st eigenvalues form a complex
799 conjugate pair, then u(j) = vl(:,j) + i*vl(:,j+1) and
800 u(j+1) = vl(:,j) - i*vl(:,j+1).
801 Min size = [1].
802
803 vr: If jobvr = 1, the right eigenvectors v(j) are stored one
804 after another in the columns of vr, in the same order
805 as their eigenvalues else vr is not referenced.
806 If the j-th eigenvalue is real, then v(j) = vr(:,j),
807 the j-th column of vr.
808 If the j-th and (j+1)-st eigenvalues form a complex
809 conjugate pair, then v(j) = vr(:,j) + i*vr(:,j+1) and
810 v(j+1) = vr(:,j) - i*vr(:,j+1).
811 Min size = [1].
812
813 ilo,ihi:Integer values determined when A was
814 balanced. The balanced A(i,j) = 0 if I > J and
815 J = 1,...,ilo-1 or I = ihi+1,...,N.
816
817 scale: Details of the permutations and scaling factors applied
818 when balancing A. If P(j) is the index of the row and column
819 interchanged with row and column j, and D(j) is the scaling
820 factor applied to row and column j, then
821 scale(J) = P(J), for J = 1,...,ilo-1
822 = D(J), for J = ilo,...,ihi
823 = P(J) for J = ihi+1,...,N.
824 The order in which the interchanges are made is N to ihi+1,
825 then 1 to ilo-1.
826
827 abnrm: The one-norm of the balanced matrix (the maximum
828 of the sum of absolute values of elements of any column).
829
830 rconde: rconde(j) is the reciprocal condition number of the j-th
831 eigenvalue.
832
833 rcondv: rcondv(j) is the reciprocal condition number of the j-th
834 right eigenvector.
835
836 info: = 0: successful exit
837 < 0: if info = -i, the i-th argument had an illegal value.
838 > 0: if info = i, the QR algorithm failed to compute all the
839 eigenvalues, and no eigenvectors or condition numbers
840 have been computed; elements 1:ilo-1 and i+1:N of wr
841 and wi contain eigenvalues which have converged.
842
843 =for example
844
845 $a = random (5,5);
846 $wr = zeroes(5);
847 $wi = zeroes(5);
848 $vl = zeroes(5,5);
849 $vr = zeroes(5,5);
850 $ilo = null;
851 $ihi = null;
852 $scale = zeroes(5);
853 $abnrm = null;
854 $rconde = zeroes(5);
855 $rcondv = zeroes(5);
856 $info = null;
857 geevx($a, 1,1,3,3,$wr, $wi, $vl, $vr, $ilo, $ihi, $scale, $abnrm,$rconde, $rcondv, $info);
858
859 =pod
860
861 Broadcasts over its inputs.
862
863 =for bad
864
865 C<geevx> ignores the bad-value flag of the input ndarrays.
866 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
867
868 =cut
869
870
871
872
873 *geevx = \&PDL::geevx;
874
875
876
877
878
879
880 =head2 ggev
881
882 =for sig
883
884 Signature: ([io]A(n,n);[io]B(n,n);[o]alphar(n);[o]alphai(n);[o]beta(n);[o]VL(m,m);[o]VR(p,p);int [o]info(); int jobvl; int jobvr)
885 Types: (float double)
886
887 =for usage
888
889 ($alphar, $alphai, $beta, $VL, $VR, $info) = ggev($A, $jobvl, $jobvr, $B);
890 ggev($A, $jobvl, $jobvr, $B, $alphar, $alphai, $beta, $VL, $VR, $info); # all arguments given
891 ($alphar, $alphai, $beta, $VL, $VR, $info) = $A->ggev($jobvl, $jobvr, $B); # method call
892 $A->ggev($jobvl, $jobvr, $B, $alphar, $alphai, $beta, $VL, $VR, $info);
893
894 =for ref
895
896 Computes for a pair of N-by-N real nonsymmetric matrices (A,B)
897 the generalized eigenvalues, and optionally, the left and/or right
898 generalized eigenvectors.
899
900 A generalized eigenvalue for a pair of matrices (A,B) is a scalar
901 lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
902 singular. It is usually represented as the pair (alpha,beta), as
903 there is a reasonable interpretation for beta=0, and even for both
904 being zero.
905
906 The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
907 of (A,B) satisfies
908
909 A * v(j) = lambda(j) * B * v(j).
910
911 The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
912 of (A,B) satisfies
913
914 u(j)**H * A = lambda(j) * u(j)**H * B .
915
916 where u(j)**H is the conjugate-transpose of u(j).
917
918 Arguments
919 =========
920
921 jobvl: = 0: do not compute the left generalized eigenvectors;
922 = 1: compute the left generalized eigenvectors.
923
924 jobvr: = 0: do not compute the right generalized eigenvectors;
925 = 1: compute the right generalized eigenvectors.
926
927 A: On entry, the matrix A in the pair (A,B).
928 On exit, A has been overwritten.
929
930 B: On entry, the matrix B in the pair (A,B).
931 On exit, B has been overwritten.
932
933 alphar:
934 alphai:
935 beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will
936 be the generalized eigenvalues. If alphai(j) is zero, then
937 the j-th eigenvalue is real; if positive, then the j-th and
938 (j+1)-st eigenvalues are a complex conjugate pair, with
939 alphai(j+1) negative.
940
941 Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j)
942 may easily over- or underflow, and beta(j) may even be zero.
943 Thus, the user should avoid naively computing the ratio
944 alpha/beta. However, alphar and alphai will be always less
945 than and usually comparable with norm(A) in magnitude, and
946 beta always less than and usually comparable with norm(B).
947
948 VL: If jobvl = 1, the left eigenvectors u(j) are stored one
949 after another in the columns of VL, in the same order as
950 their eigenvalues. If the j-th eigenvalue is real, then
951 u(j) = VL(:,j), the j-th column of VL. If the j-th and
952 (j+1)-th eigenvalues form a complex conjugate pair, then
953 u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1).
954 Each eigenvector will be scaled so the largest component have
955 abs(real part)+abs(imag. part)=1.
956 Not referenced if jobvl = 0.
957
958 VR: If jobvr = 1, the right eigenvectors v(j) are stored one
959 after another in the columns of VR, in the same order as
960 their eigenvalues. If the j-th eigenvalue is real, then
961 v(j) = VR(:,j), the j-th column of VR. If the j-th and
962 (j+1)-th eigenvalues form a complex conjugate pair, then
963 v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1).
964 Each eigenvector will be scaled so the largest component have
965 abs(real part)+abs(imag. part)=1.
966 Not referenced if jobvr = 0.
967
968 info: = 0: successful exit
969 < 0: if info = -i, the i-th argument had an illegal value.
970 = 1,...,N:
971 The QZ iteration failed. No eigenvectors have been
972 calculated, but alphar(j), alphai(j), and beta(j)
973 should be correct for j=info+1,...,N.
974 > N: =N+1: other than QZ iteration failed in hgeqz.
975 =N+2: error return from tgevc.
976
977 =for example
978
979 $a = random(5,5);
980 $b = random(5,5);
981 $alphar = zeroes(5);
982 $alphai = zeroes(5);
983 $beta = zeroes(5);
984 $vl = zeroes(5,5);
985 $vr = zeroes(5,5);
986 ggev($a, 1, 1, $b, $alphar, $alphai, $beta, $vl, $vr, ($info=null));
987
988 =pod
989
990 Broadcasts over its inputs.
991
992 =for bad
993
994 C<ggev> ignores the bad-value flag of the input ndarrays.
995 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
996
997 =cut
998
999
1000
1001
1002 *ggev = \&PDL::ggev;
1003
1004
1005
1006
1007
1008
1009 =head2 ggevx
1010
1011 =for sig
1012
1013 Signature: ([io]A(n,n);[io]B(n,n);[o]alphar(n);[o]alphai(n);[o]beta(n);[o]VL(m,m);[o]VR(p,p);int [o]ilo();int [o]ihi();[o]lscale(n);[o]rscale(n);[o]abnrm();[o]bbnrm();[o]rconde(r);[o]rcondv(s);int [o]info(); int [t]bwork(bworkn); int [t]iwork(iworkn); int balanc; int jobvl; int jobvr; int sense)
1014 Types: (float double)
1015
1016 =for usage
1017
1018 ($alphar, $alphai, $beta, $VL, $VR, $ilo, $ihi, $lscale, $rscale, $abnrm, $bbnrm, $rconde, $rcondv, $info) = ggevx($A, $balanc, $jobvl, $jobvr, $sense, $B);
1019 ggevx($A, $balanc, $jobvl, $jobvr, $sense, $B, $alphar, $alphai, $beta, $VL, $VR, $ilo, $ihi, $lscale, $rscale, $abnrm, $bbnrm, $rconde, $rcondv, $info); # all arguments given
1020 ($alphar, $alphai, $beta, $VL, $VR, $ilo, $ihi, $lscale, $rscale, $abnrm, $bbnrm, $rconde, $rcondv, $info) = $A->ggevx($balanc, $jobvl, $jobvr, $sense, $B); # method call
1021 $A->ggevx($balanc, $jobvl, $jobvr, $sense, $B, $alphar, $alphai, $beta, $VL, $VR, $ilo, $ihi, $lscale, $rscale, $abnrm, $bbnrm, $rconde, $rcondv, $info);
1022
1023 =for ref
1024
1025 Computes for a pair of N-by-N real nonsymmetric matrices (A,B)
1026 the generalized eigenvalues, and optionally, the left and/or right
1027 generalized eigenvectors.
1028
1029 Optionally also, it computes a balancing transformation to improve
1030 the conditioning of the eigenvalues and eigenvectors (ilo, ihi,
1031 lscale, rscale, abnrm, and bbnrm), reciprocal condition numbers for
1032 the eigenvalues (rconde), and reciprocal condition numbers for the
1033 right eigenvectors (rcondv).
1034
1035 A generalized eigenvalue for a pair of matrices (A,B) is a scalar
1036 lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
1037 singular. It is usually represented as the pair (alpha,beta), as
1038 there is a reasonable interpretation for beta=0, and even for both
1039 being zero.
1040
1041 The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
1042 of (A,B) satisfies
1043
1044 A * v(j) = lambda(j) * B * v(j) .
1045
1046 The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
1047 of (A,B) satisfies
1048
1049 u(j)**H * A = lambda(j) * u(j)**H * B.
1050
1051 where u(j)**H is the conjugate-transpose of u(j).
1052
1053 Further Details
1054 ===============
1055
1056 Balancing a matrix pair (A,B) includes, first, permuting rows and
1057 columns to isolate eigenvalues, second, applying diagonal similarity
1058 transformation to the rows and columns to make the rows and columns
1059 as close in norm as possible. The computed reciprocal condition
1060 numbers correspond to the balanced matrix. Permuting rows and columns
1061 will not change the condition numbers (in exact arithmetic) but
1062 diagonal scaling will. For further explanation of balancing, see
1063 section 4.11.1.2 of LAPACK Users' Guide.
1064
1065 An approximate error bound on the chordal distance between the i-th
1066 computed generalized eigenvalue w and the corresponding exact
1067 eigenvalue lambda is
1068
1069 chord(w, lambda) <= EPS * norm(abnrm, bbnrm) / rconde(I)
1070
1071 An approximate error bound for the angle between the i-th computed
1072 eigenvector vl(i) or vr(i) is given by
1073
1074 EPS * norm(abnrm, bbnrm) / DIF(i).
1075
1076 For further explanation of the reciprocal condition numbers rconde
1077 and rcondv, see section 4.11 of LAPACK User's Guide.
1078
1079 Arguments
1080 =========
1081
1082 balanc: Specifies the balance option to be performed.
1083 = 0: do not diagonally scale or permute;
1084 = 1: permute only;
1085 = 2: scale only;
1086 = 3: both permute and scale.
1087 Computed reciprocal condition numbers will be for the
1088 matrices after permuting and/or balancing. Permuting does
1089 not change condition numbers (in exact arithmetic), but
1090 balancing does.
1091
1092 jobvl: = 0: do not compute the left generalized eigenvectors;
1093 = 1: compute the left generalized eigenvectors.
1094
1095 jobvr: = 0: do not compute the right generalized eigenvectors;
1096 = 1: compute the right generalized eigenvectors.
1097
1098 sense: Determines which reciprocal condition numbers are computed.
1099 = 0: none are computed;
1100 = 1: computed for eigenvalues only;
1101 = 2: computed for eigenvectors only;
1102 = 3: computed for eigenvalues and eigenvectors.
1103
1104 A: On entry, the matrix A in the pair (A,B).
1105 On exit, A has been overwritten. If jobvl=1 or jobvr=1
1106 or both, then A contains the first part of the real Schur
1107 form of the "balanced" versions of the input A and B.
1108
1109 B: On entry, the matrix B in the pair (A,B).
1110 On exit, B has been overwritten. If jobvl=1 or jobvr=1
1111 or both, then B contains the second part of the real Schur
1112 form of the "balanced" versions of the input A and B.
1113
1114 alphar:
1115 alphai:
1116 beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will
1117 be the generalized eigenvalues. If alphai(j) is zero, then
1118 the j-th eigenvalue is real; if positive, then the j-th and
1119 (j+1)-st eigenvalues are a complex conjugate pair, with
1120 alphai(j+1) negative.
1121
1122 Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j)
1123 may easily over- or underflow, and beta(j) may even be zero.
1124 Thus, the user should avoid naively computing the ratio
1125 ALPHA/beta. However, alphar and alphai will be always less
1126 than and usually comparable with norm(A) in magnitude, and
1127 beta always less than and usually comparable with norm(B).
1128
1129 vl: If jobvl = 1, the left eigenvectors u(j) are stored one
1130 after another in the columns of vl, in the same order as
1131 their eigenvalues. If the j-th eigenvalue is real, then
1132 u(j) = vl(:,j), the j-th column of vl. If the j-th and
1133 (j+1)-th eigenvalues form a complex conjugate pair, then
1134 u(j) = vl(:,j)+i*vl(:,j+1) and u(j+1) = vl(:,j)-i*vl(:,j+1).
1135 Each eigenvector will be scaled so the largest component have
1136 abs(real part) + abs(imag. part) = 1.
1137 Not referenced if jobvl = 0.
1138
1139 vr: If jobvr = 1, the right eigenvectors v(j) are stored one
1140 after another in the columns of vr, in the same order as
1141 their eigenvalues. If the j-th eigenvalue is real, then
1142 v(j) = vr(:,j), the j-th column of vr. If the j-th and
1143 (j+1)-th eigenvalues form a complex conjugate pair, then
1144 v(j) = vr(:,j)+i*vr(:,j+1) and v(j+1) = vr(:,j)-i*vr(:,j+1).
1145 Each eigenvector will be scaled so the largest component have
1146 abs(real part) + abs(imag. part) = 1.
1147 Not referenced if jobvr = 0.
1148
1149 ilo,ihi:ilo and ihi are integer values such that on exit
1150 A(i,j) = 0 and B(i,j) = 0 if i > j and
1151 j = 1,...,ilo-1 or i = ihi+1,...,N.
1152 If balanc = 0 or 2, ilo = 1 and ihi = N.
1153
1154 lscale: Details of the permutations and scaling factors applied
1155 to the left side of A and B. If PL(j) is the index of the
1156 row interchanged with row j, and DL(j) is the scaling
1157 factor applied to row j, then
1158 lscale(j) = PL(j) for j = 1,...,ilo-1
1159 = DL(j) for j = ilo,...,ihi
1160 = PL(j) for j = ihi+1,...,N.
1161 The order in which the interchanges are made is N to ihi+1,
1162 then 1 to ilo-1.
1163
1164 rscale: Details of the permutations and scaling factors applied
1165 to the right side of A and B. If PR(j) is the index of the
1166 column interchanged with column j, and DR(j) is the scaling
1167 factor applied to column j, then
1168 rscale(j) = PR(j) for j = 1,...,ilo-1
1169 = DR(j) for j = ilo,...,ihi
1170 = PR(j) for j = ihi+1,...,N
1171 The order in which the interchanges are made is N to ihi+1,
1172 then 1 to ilo-1.
1173
1174 abnrm: The one-norm of the balanced matrix A.
1175
1176 bbnrm: The one-norm of the balanced matrix B.
1177
1178 rconde: If sense = 1 or 3, the reciprocal condition numbers of
1179 the selected eigenvalues, stored in consecutive elements of
1180 the array. For a complex conjugate pair of eigenvalues two
1181 consecutive elements of rconde are set to the same value.
1182 Thus rconde(j), rcondv(j), and the j-th columns of vl and vr
1183 all correspond to the same eigenpair (but not in general the
1184 j-th eigenpair, unless all eigenpairs are selected).
1185 If sense = 2, rconde is not referenced.
1186
1187 rcondv: If sense = 2 or 3, the estimated reciprocal condition
1188 numbers of the selected eigenvectors, stored in consecutive
1189 elements of the array. For a complex eigenvector two
1190 consecutive elements of rcondv are set to the same value. If
1191 the eigenvalues cannot be reordered to compute rcondv(j),
1192 rcondv(j) is set to 0; this can only occur when the true
1193 value would be very small anyway.
1194 If sense = 1, rcondv is not referenced.
1195
1196 info: = 0: successful exit
1197 < 0: if info = -i, the i-th argument had an illegal value.
1198 = 1,...,N:
1199 The QZ iteration failed. No eigenvectors have been
1200 calculated, but alphar(j), alphai(j), and beta(j)
1201 should be correct for j=info+1,...,N.
1202 > N: =N+1: other than QZ iteration failed in hgeqz.
1203 =N+2: error return from tgevc.
1204
1205 =for example
1206
1207 $a = random(5,5);
1208 $b = random(5,5);
1209 $alphar = zeroes(5);
1210 $alphai = zeroes(5);
1211 $beta = zeroes(5);
1212 $vl = zeroes(5,5);
1213 $vr = zeroes(5,5);
1214 $lscale = zeroes(5);
1215 $rscale = zeroes(5);
1216 $ilo = null;
1217 $ihi = null;
1218 $abnrm = null;
1219 $bbnrm = null;
1220 $rconde = zeroes(5);
1221 $rcondv = zeroes(5);
1222 ggevx($a, 3, 1, 1, 3, $b, $alphar, $alphai, $beta, $vl, $vr,
1223 $ilo, $ihi, $lscale, $rscale, $abnrm, $bbnrm, $rconde,$rcondv,($info=null));
1224
1225 =pod
1226
1227 Broadcasts over its inputs.
1228
1229 =for bad
1230
1231 C<ggevx> ignores the bad-value flag of the input ndarrays.
1232 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1233
1234 =cut
1235
1236
1237
1238
1239 *ggevx = \&PDL::ggevx;
1240
1241
1242
1243
1244
1245
1246 =head2 gees
1247
1248 =for sig
1249
1250 Signature: ([io]A(n,n); [o]wr(n); [o]wi(n); [o]vs(p,p); int [o]sdim(); int [o]info(); int [t]bwork(bworkn); int jobvs; int sort; SV* select_func)
1251 Types: (float double)
1252
1253 =for usage
1254
1255 ($wr, $wi, $vs, $sdim, $info) = gees($A, $jobvs, $sort, $select_func);
1256 gees($A, $jobvs, $sort, $select_func, $wr, $wi, $vs, $sdim, $info); # all arguments given
1257 ($wr, $wi, $vs, $sdim, $info) = $A->gees($jobvs, $sort, $select_func); # method call
1258 $A->gees($jobvs, $sort, $select_func, $wr, $wi, $vs, $sdim, $info);
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 The leading columns of Z then form an orthonormal basis for the
1269 invariant subspace corresponding to the selected eigenvalues.
1270
1271 A matrix is in real Schur form if it is upper quasi-triangular with
1272 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in the
1273 form
1274
1275 [ a b ]
1276 [ c a ]
1277 where b*c < 0.
1278
1279 The eigenvalues of such a block are a +- sqrt(bc).
1280
1281 Arguments
1282 =========
1283
1284 jobvs: = 0: Schur vectors are not computed;
1285 = 1: Schur vectors are computed.
1286
1287 sort: Specifies whether or not to order the eigenvalues on the
1288 diagonal of the Schur form.
1289 = 0: Eigenvalues are not ordered;
1290 = 1: Eigenvalues are ordered (see select_func).
1291
1292 select_func:
1293 If sort = 1, select_func is used to select eigenvalues to sort
1294 to the top left of the Schur form.
1295 If sort = 0, select_func is not referenced.
1296 An eigenvalue wr(j)+sqrt(-1)*wi(j) is selected if
1297 select_func(SCALAR(wr(j)), SCALAR(wi(j))) is true; i.e.,
1298 if either one of a complex conjugate pair of eigenvalues
1299 is selected, then both complex eigenvalues are selected.
1300 Note that a selected complex eigenvalue may no longer
1301 satisfy select_func(wr(j),wi(j)) = 1 after ordering, since
1302 ordering may change the value of complex eigenvalues
1303 (especially if the eigenvalue is ill-conditioned); in this
1304 case info is set to N+2 (see info below).
1305
1306 A: The N-by-N matrix A.
1307 On exit, A has been overwritten by its real Schur form T.
1308
1309 sdim: If sort = 0, sdim = 0.
1310 If sort = 1, sdim = number of eigenvalues (after sorting)
1311 for which select_func is true. (Complex conjugate
1312 pairs for which select_func is true for either
1313 eigenvalue count as 2.)
1314
1315 wr:
1316 wi: wr and wi contain the real and imaginary parts,
1317 respectively, of the computed eigenvalues in the same order
1318 that they appear on the diagonal of the output Schur form T.
1319 Complex conjugate pairs of eigenvalues will appear
1320 consecutively with the eigenvalue having the positive
1321 imaginary part first.
1322
1323 vs: If jobvs = 1, vs contains the orthogonal matrix Z of Schur
1324 vectors else vs is not referenced.
1325
1326 info = 0: successful exit
1327 < 0: if info = -i, the i-th argument had an illegal value.
1328 > 0: if info = i, and i is
1329 <= N: the QR algorithm failed to compute all the
1330 eigenvalues; elements 1:ILO-1 and i+1:N of wr and wi
1331 contain those eigenvalues which have converged; if
1332 jobvs = 1, vs contains the matrix which reduces A
1333 to its partially converged Schur form.
1334 = N+1: the eigenvalues could not be reordered because some
1335 eigenvalues were too close to separate (the problem
1336 is very ill-conditioned);
1337 = N+2: after reordering, roundoff changed values of some
1338 complex eigenvalues so that leading eigenvalues in
1339 the Schur form no longer satisfy select_func = 1 This
1340 could also be caused by underflow due to scaling.
1341
1342 =for example
1343
1344 sub select_function{
1345 my ($a, $b ) = @_;
1346 # Stable "continuous time" eigenspace
1347 return $a < 0 ? 1 : 0;
1348 }
1349 $A = random (5,5);
1350 $wr= zeroes(5);
1351 $wi = zeroes(5);
1352 $vs = zeroes(5,5);
1353 $sdim = null;
1354 $info = null;
1355 gees($A, 1,1, $wr, $wi, $vs, $sdim, $info,\&select_function);
1356
1357 =pod
1358
1359 Broadcasts over its inputs.
1360
1361 =for bad
1362
1363 C<gees> ignores the bad-value flag of the input ndarrays.
1364 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1365
1366 =cut
1367
1368
1369
1370
1371 *gees = \&PDL::gees;
1372
1373
1374
1375
1376
1377
1378 =head2 geesx
1379
1380 =for sig
1381
1382 Signature: ([io]A(n,n); [o]wr(n); [o]wi(n); [o]vs(p,p); int [o]sdim(); [o]rconde();[o]rcondv(); int [o]info(); int [t]bwork(bworkn); int jobvs; int sort; int sense; SV* select_func)
1383 Types: (float double)
1384
1385 =for usage
1386
1387 ($wr, $wi, $vs, $sdim, $rconde, $rcondv, $info) = geesx($A, $jobvs, $sort, $sense, $select_func);
1388 geesx($A, $jobvs, $sort, $sense, $select_func, $wr, $wi, $vs, $sdim, $rconde, $rcondv, $info); # all arguments given
1389 ($wr, $wi, $vs, $sdim, $rconde, $rcondv, $info) = $A->geesx($jobvs, $sort, $sense, $select_func); # method call
1390 $A->geesx($jobvs, $sort, $sense, $select_func, $wr, $wi, $vs, $sdim, $rconde, $rcondv, $info);
1391
1392 =for ref
1393
1394 Computes for an N-by-N real nonsymmetric matrix A, the
1395 eigenvalues, the real Schur form T, and, optionally, the matrix of
1396 Schur vectors Z. This gives the Schur factorization A = Z*T*Z'.
1397
1398 Optionally, it also orders the eigenvalues on the diagonal of the
1399 real Schur form so that selected eigenvalues are at the top left;
1400 computes a reciprocal condition number for the average of the
1401 selected eigenvalues (rconde); and computes a reciprocal condition
1402 number for the right invariant subspace corresponding to the
1403 selected eigenvalues (rcondv). The leading columns of Z form an
1404 orthonormal basis for this invariant subspace.
1405
1406 For further explanation of the reciprocal condition numbers rconde
1407 and rcondv, see Section 4.10 of the LAPACK Users' Guide (where
1408 these quantities are called s and sep respectively).
1409
1410 A real matrix is in real Schur form if it is upper quasi-triangular
1411 with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in
1412 the form
1413
1414 [ a b ]
1415 [ c a ]
1416 where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc).
1417
1418 Arguments
1419 =========
1420
1421 jobvs: = 0: Schur vectors are not computed;
1422 = 1: Schur vectors are computed.
1423
1424 sort: Specifies whether or not to order the eigenvalues on the
1425 diagonal of the Schur form.
1426 = 0: Eigenvalues are not ordered;
1427 = 1: Eigenvalues are ordered (see select_func).
1428
1429 select_func:
1430 If sort = 1, select_func is used to select eigenvalues to sort
1431 to the top left of the Schur form else select_func is not referenced.
1432 An eigenvalue wr(j)+sqrt(-1)*wi(j) is selected if
1433 select_func(wr(j),wi(j)) is true; i.e., if either one of a
1434 complex conjugate pair of eigenvalues is selected, then both
1435 are. Note that a selected complex eigenvalue may no longer
1436 satisfy select_func(wr(j),wi(j)) = 1 after ordering, since
1437 ordering may change the value of complex eigenvalues
1438 (especially if the eigenvalue is ill-conditioned); in this
1439 case info may be set to N+3 (see info below).
1440
1441 sense: Determines which reciprocal condition numbers are computed.
1442 = 0: None are computed;
1443 = 1: Computed for average of selected eigenvalues only;
1444 = 2: Computed for selected right invariant subspace only;
1445 = 3: Computed for both.
1446 If sense = 1, 2 or 3, sort must equal 1.
1447
1448 A: On entry, the N-by-N matrix A.
1449 On exit, A is overwritten by its real Schur form T.
1450
1451 sdim: If sort = 0, sdim = 0.
1452 If sort = 1, sdim = number of eigenvalues (after sorting)
1453 for which select_func is 1. (Complex conjugate
1454 pairs for which select_func is 1 for either
1455 eigenvalue count as 2.)
1456
1457 wr:
1458 wi: wr and wi contain the real and imaginary parts, respectively,
1459 of the computed eigenvalues, in the same order that they
1460 appear on the diagonal of the output Schur form T. Complex
1461 conjugate pairs of eigenvalues appear consecutively with the
1462 eigenvalue having the positive imaginary part first.
1463
1464 vs If jobvs = 1, vs contains the orthogonal matrix Z of Schur
1465 vectors else vs is not referenced.
1466
1467 rconde: If sense = 1 or 3, rconde contains the reciprocal
1468 condition number for the average of the selected eigenvalues.
1469 Not referenced if sense = 0 or 2.
1470
1471 rcondv: If sense = 2 or 3, rcondv contains the reciprocal
1472 condition number for the selected right invariant subspace.
1473 Not referenced if sense = 0 or 1.
1474
1475 info: = 0: successful exit
1476 < 0: if info = -i, the i-th argument had an illegal value.
1477 > 0: if info = i, and i is
1478 <= N: the QR algorithm failed to compute all the
1479 eigenvalues; elements 1:ilo-1 and i+1:N of wr and wi
1480 contain those eigenvalues which have converged; if
1481 jobvs = 1, vs contains the transformation which
1482 reduces A to its partially converged Schur form.
1483 = N+1: the eigenvalues could not be reordered because some
1484 eigenvalues were too close to separate (the problem
1485 is very ill-conditioned);
1486 = N+2: after reordering, roundoff changed values of some
1487 complex eigenvalues so that leading eigenvalues in
1488 the Schur form no longer satisfy select_func=1 This
1489 could also be caused by underflow due to scaling.
1490
1491 =for example
1492
1493 sub select_function{
1494 my ($a, $b) = @_;
1495 # Stable "discrete time" eigenspace
1496 return sqrt($a**2 + $b**2) < 1 ? 1 : 0;
1497 }
1498 $A = random (5,5);
1499 $wr= zeroes(5);
1500 $wi = zeroes(5);
1501 $vs = zeroes(5,5);
1502 $sdim = null;
1503 $rconde = null;
1504 $rcondv = null;
1505 $info = null;
1506 geesx($A, 1,1, 3, $wr, $wi, $vs, $sdim, $rconde, $rcondv, $info, \&select_function);
1507
1508 =pod
1509
1510 Broadcasts over its inputs.
1511
1512 =for bad
1513
1514 C<geesx> ignores the bad-value flag of the input ndarrays.
1515 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1516
1517 =cut
1518
1519
1520
1521
1522 *geesx = \&PDL::geesx;
1523
1524
1525
1526
1527
1528
1529 =head2 gges
1530
1531 =for sig
1532
1533 Signature: ([io]A(n,n);[io]B(n,n);[o]alphar(n);[o]alphai(n);[o]beta(n);[o]VSL(m,m);[o]VSR(p,p);int [o]sdim();int [o]info(); int [t]bwork(bworkn); int jobvsl; int jobvsr; int sort; SV* select_func)
1534 Types: (float double)
1535
1536 =for usage
1537
1538 ($alphar, $alphai, $beta, $VSL, $VSR, $sdim, $info) = gges($A, $jobvsl, $jobvsr, $sort, $B, $select_func);
1539 gges($A, $jobvsl, $jobvsr, $sort, $B, $select_func, $alphar, $alphai, $beta, $VSL, $VSR, $sdim, $info); # all arguments given
1540 ($alphar, $alphai, $beta, $VSL, $VSR, $sdim, $info) = $A->gges($jobvsl, $jobvsr, $sort, $B, $select_func); # method call
1541 $A->gges($jobvsl, $jobvsr, $sort, $B, $select_func, $alphar, $alphai, $beta, $VSL, $VSR, $sdim, $info);
1542
1543 =for ref
1544
1545 Computes for a pair of N-by-N real nonsymmetric matrices (A,B),
1546 the generalized eigenvalues, the generalized real Schur form (S,T),
1547 optionally, the left and/or right matrices of Schur vectors (VSL and
1548 VSR). This gives the generalized Schur factorization
1549
1550 (A,B) = ( (VSL)*S*(VSR)', (VSL)*T*(VSR)' )
1551
1552 Optionally, it also orders the eigenvalues so that a selected cluster
1553 of eigenvalues appears in the leading diagonal blocks of the upper
1554 quasi-triangular matrix S and the upper triangular matrix T.The
1555 leading columns of VSL and VSR then form an orthonormal basis for the
1556 corresponding left and right eigenspaces (deflating subspaces).
1557
1558 (If only the generalized eigenvalues are needed, use the driver
1559 ggev instead, which is faster.)
1560
1561 A generalized eigenvalue for a pair of matrices (A,B) is a scalar w
1562 or a ratio alpha/beta = w, such that A - w*B is singular. It is
1563 usually represented as the pair (alpha,beta), as there is a
1564 reasonable interpretation for beta=0 or both being zero.
1565
1566 A pair of matrices (S,T) is in generalized real Schur form if T is
1567 upper triangular with non-negative diagonal and S is block upper
1568 triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
1569 to real generalized eigenvalues, while 2-by-2 blocks of S will be
1570 "standardized" by making the corresponding elements of T have the
1571 form:
1572
1573 [ a 0 ]
1574 [ 0 b ]
1575
1576 and the pair of corresponding 2-by-2 blocks in S and T will have a
1577 complex conjugate pair of generalized eigenvalues.
1578
1579 Arguments
1580 =========
1581
1582 jobvsl: = 0: do not compute the left Schur vectors;
1583 = 1: compute the left Schur vectors.
1584
1585 jobvsr: = 0: do not compute the right Schur vectors;
1586 = 1: compute the right Schur vectors.
1587
1588 sort: Specifies whether or not to order the eigenvalues on the
1589 diagonal of the generalized Schur form.
1590 = 0: Eigenvalues are not ordered;
1591 = 1: Eigenvalues are ordered (see delztg);
1592
1593 delztg: If sort = 0, delztg is not referenced.
1594 If sort = 1, delztg is used to select eigenvalues to sort
1595 to the top left of the Schur form.
1596 An eigenvalue (alphar(j)+alphai(j))/beta(j) is selected if
1597 delztg(alphar(j),alphai(j),beta(j)) is true; i.e. if either
1598 one of a complex conjugate pair of eigenvalues is selected,
1599 then both complex eigenvalues are selected.
1600
1601 Note that in the ill-conditioned case, a selected complex
1602 eigenvalue may no longer satisfy delztg(alphar(j),alphai(j),
1603 beta(j)) = 1 after ordering. info is to be set to N+2
1604 in this case.
1605
1606 A: On entry, the first of the pair of matrices.
1607 On exit, A has been overwritten by its generalized Schur
1608 form S.
1609
1610 B: On entry, the second of the pair of matrices.
1611 On exit, B has been overwritten by its generalized Schur
1612 form T.
1613
1614 sdim: If sort = 0, sdim = 0.
1615 If sort = 1, sdim = number of eigenvalues (after sorting)
1616 for which delztg is true. (Complex conjugate pairs for which
1617 delztg is true for either eigenvalue count as 2.)
1618
1619 alphar:
1620 alphai:
1621 beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will
1622 be the generalized eigenvalues. alphar(j) + alphai(j)*i,
1623 and beta(j),j=1,...,N are the diagonals of the complex Schur
1624 form (S,T) that would result if the 2-by-2 diagonal blocks of
1625 the real Schur form of (A,B) were further reduced to
1626 triangular form using 2-by-2 complex unitary transformations.
1627 If alphai(j) is zero, then the j-th eigenvalue is real; if
1628 positive, then the j-th and (j+1)-st eigenvalues are a
1629 complex conjugate pair, with alphai(j+1) negative.
1630
1631 Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j)
1632 may easily over- or underflow, and beta(j) may even be zero.
1633 Thus, the user should avoid naively computing the ratio.
1634 However, alphar and alphai will be always less than and
1635 usually comparable with norm(A) in magnitude, and beta always
1636 less than and usually comparable with norm(B).
1637
1638 VSL: If jobvsl = 1, VSL will contain the left Schur vectors.
1639 Not referenced if jobvsl = 0.
1640 The leading dimension must always be >=1.
1641
1642 VSR: If jobvsr = 1, VSR will contain the right Schur vectors.
1643 Not referenced if jobvsr = 0.
1644 The leading dimension must always be >=1.
1645
1646 info: = 0: successful exit
1647 < 0: if info = -i, the i-th argument had an illegal value.
1648 = 1,...,N:
1649 The QZ iteration failed. (A,B) are not in Schur
1650 form, but alphar(j), alphai(j), and beta(j) should
1651 be correct for j=info+1,...,N.
1652 > N: =N+1: other than QZ iteration failed in hgeqz.
1653 =N+2: after reordering, roundoff changed values of
1654 some complex eigenvalues so that leading
1655 eigenvalues in the Generalized Schur form no
1656 longer satisfy delztg=1 This could also
1657 be caused due to scaling.
1658 =N+3: reordering failed in tgsen.
1659
1660 =for example
1661
1662 sub my_select{
1663 my ($zr, $zi, $d) = @_;
1664 # stable generalized eigenvalues for continuous time
1665 return ( ($zr < 0 && $d > 0 ) || ($zr > 0 && $d < 0) ) ? 1 : 0;
1666 }
1667 $a = random(5,5);
1668 $b = random(5,5);
1669 $sdim = null;
1670 $alphar = zeroes(5);
1671 $alphai = zeroes(5);
1672 $beta = zeroes(5);
1673 $vsl = zeroes(5,5);
1674 $vsr = zeroes(5,5);
1675 gges($a, 1, 1, 1, $b, $alphar, $alphai, $beta, $vsl, $vsr, $sdim,($info=null), \&my_select);
1676
1677 =pod
1678
1679 Broadcasts over its inputs.
1680
1681 =for bad
1682
1683 C<gges> ignores the bad-value flag of the input ndarrays.
1684 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1685
1686 =cut
1687
1688
1689
1690
1691 *gges = \&PDL::gges;
1692
1693
1694
1695
1696
1697
1698 =head2 ggesx
1699
1700 =for sig
1701
1702 Signature: ([io]A(n,n);[io]B(n,n);[o]alphar(n);[o]alphai(n);[o]beta(n);[o]VSL(m,m);[o]VSR(p,p);int [o]sdim();[o]rconde(q=2);[o]rcondv(q=2);int [o]info(); int [t]bwork(bworkn); int [t]iwork(iworkn); int jobvsl; int jobvsr; int sort; int sense; SV* select_func)
1703 Types: (float double)
1704
1705 =for usage
1706
1707 ($alphar, $alphai, $beta, $VSL, $VSR, $sdim, $rconde, $rcondv, $info) = ggesx($A, $jobvsl, $jobvsr, $sort, $sense, $B, $select_func);
1708 ggesx($A, $jobvsl, $jobvsr, $sort, $sense, $B, $select_func, $alphar, $alphai, $beta, $VSL, $VSR, $sdim, $rconde, $rcondv, $info); # all arguments given
1709 ($alphar, $alphai, $beta, $VSL, $VSR, $sdim, $rconde, $rcondv, $info) = $A->ggesx($jobvsl, $jobvsr, $sort, $sense, $B, $select_func); # method call
1710 $A->ggesx($jobvsl, $jobvsr, $sort, $sense, $B, $select_func, $alphar, $alphai, $beta, $VSL, $VSR, $sdim, $rconde, $rcondv, $info);
1711
1712 =for ref
1713
1714 Computes for a pair of N-by-N real nonsymmetric matrices
1715 (A,B), the generalized eigenvalues, the real Schur form (S,T), and,
1716 optionally, the left and/or right matrices of Schur vectors (VSL and
1717 VSR). This gives the generalized Schur factorization
1718
1719 (A,B) = ( (VSL) S (VSR)', (VSL) T (VSR)' )
1720
1721 Optionally, it also orders the eigenvalues so that a selected cluster
1722 of eigenvalues appears in the leading diagonal blocks of the upper
1723 quasi-triangular matrix S and the upper triangular matrix T; computes
1724 a reciprocal condition number for the average of the selected
1725 eigenvalues (RCONDE); and computes a reciprocal condition number for
1726 the right and left deflating subspaces corresponding to the selected
1727 eigenvalues (RCONDV). The leading columns of VSL and VSR then form
1728 an orthonormal basis for the corresponding left and right eigenspaces
1729 (deflating subspaces).
1730
1731 A generalized eigenvalue for a pair of matrices (A,B) is a scalar w
1732 or a ratio alpha/beta = w, such that A - w*B is singular. It is
1733 usually represented as the pair (alpha,beta), as there is a
1734 reasonable interpretation for beta=0 or for both being zero.
1735
1736 A pair of matrices (S,T) is in generalized real Schur form if T is
1737 upper triangular with non-negative diagonal and S is block upper
1738 triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
1739 to real generalized eigenvalues, while 2-by-2 blocks of S will be
1740 "standardized" by making the corresponding elements of T have the
1741 form:
1742
1743 [ a 0 ]
1744 [ 0 b ]
1745
1746 and the pair of corresponding 2-by-2 blocks in S and T will have a
1747 complex conjugate pair of generalized eigenvalues.
1748
1749 Further details
1750 ===============
1751
1752 An approximate (asymptotic) bound on the average absolute error of
1753 the selected eigenvalues is
1754
1755 EPS * norm((A, B)) / RCONDE( 1 ).
1756
1757 An approximate (asymptotic) bound on the maximum angular error in
1758 the computed deflating subspaces is
1759
1760 EPS * norm((A, B)) / RCONDV( 2 ).
1761
1762 See LAPACK User's Guide, section 4.11 for more information.
1763
1764 Arguments
1765 =========
1766
1767 jobvsl: = 0: do not compute the left Schur vectors;
1768 = 1: compute the left Schur vectors.
1769
1770 jobvsr: = 0: do not compute the right Schur vectors;
1771 = 1: compute the right Schur vectors.
1772
1773 sort: Specifies whether or not to order the eigenvalues on the
1774 diagonal of the generalized Schur form.
1775 = 0: Eigenvalues are not ordered;
1776 = 1: Eigenvalues are ordered (see delztg);
1777
1778 delztg: If sort = 0, delztg is not referenced.
1779 If sort = 1, delztg is used to select eigenvalues to sort
1780 to the top left of the Schur form.
1781 An eigenvalue (alphar(j)+alphai(j))/beta(j) is selected if
1782 delztg(alphar(j),alphai(j),beta(j)) is true; i.e. if either
1783 one of a complex conjugate pair of eigenvalues is selected,
1784 then both complex eigenvalues are selected.
1785
1786 Note that in the ill-conditioned case, a selected complex
1787 eigenvalue may no longer satisfy delztg(alphar(j),alphai(j),
1788 beta(j)) = 1 after ordering. info is to be set to N+2
1789 in this case.
1790
1791 sense: Determines which reciprocal condition numbers are computed.
1792 = 0 : None are computed;
1793 = 1 : Computed for average of selected eigenvalues only;
1794 = 2 : Computed for selected deflating subspaces only;
1795 = 3 : Computed for both.
1796 If sense = 1, 2, or 3, sort must equal 1.
1797
1798 A: On entry, the first of the pair of matrices.
1799 On exit, A has been overwritten by its generalized Schur
1800 form S.
1801
1802 B: On entry, the second of the pair of matrices.
1803 On exit, B has been overwritten by its generalized Schur
1804 form T.
1805
1806 sdim: If sort = 0, sdim = 0.
1807 If sort = 1, sdim = number of eigenvalues (after sorting)
1808 for which delztg is true. (Complex conjugate pairs for which
1809 delztg is true for either eigenvalue count as 2.)
1810
1811 alphar:
1812 alphai:
1813 beta: On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,...,N, will
1814 be the generalized eigenvalues. alphar(j) + alphai(j)*i,
1815 and beta(j),j=1,...,N are the diagonals of the complex Schur
1816 form (S,T) that would result if the 2-by-2 diagonal blocks of
1817 the real Schur form of (A,B) were further reduced to
1818 triangular form using 2-by-2 complex unitary transformations.
1819 If alphai(j) is zero, then the j-th eigenvalue is real; if
1820 positive, then the j-th and (j+1)-st eigenvalues are a
1821 complex conjugate pair, with alphai(j+1) negative.
1822
1823 Note: the quotients alphar(j)/beta(j) and alphai(j)/beta(j)
1824 may easily over- or underflow, and beta(j) may even be zero.
1825 Thus, the user should avoid naively computing the ratio.
1826 However, alphar and alphai will be always less than and
1827 usually comparable with norm(A) in magnitude, and beta always
1828 less than and usually comparable with norm(B).
1829
1830 VSL: If jobvsl = 1, VSL will contain the left Schur vectors.
1831 Not referenced if jobvsl = 0.
1832 The leading dimension must always be >=1.
1833
1834 VSR: If jobvsr = 1, VSR will contain the right Schur vectors.
1835 Not referenced if jobvsr = 0.
1836 The leading dimension must always be >=1.
1837
1838 rconde: If sense = 1 or 3, rconde(1) and rconde(2) contain the
1839 reciprocal condition numbers for the average of the selected
1840 eigenvalues.
1841 Not referenced if sense = 0 or 2.
1842
1843 rcondv: If sense = 2 or 3, rcondv(1) and rcondv(2) contain the
1844 reciprocal condition numbers for the selected deflating
1845 subspaces.
1846 Not referenced if sense = 0 or 1.
1847
1848 info: = 0: successful exit
1849 < 0: if info = -i, the i-th argument had an illegal value.
1850 = 1,...,N:
1851 The QZ iteration failed. (A,B) are not in Schur
1852 form, but alphar(j), alphai(j), and beta(j) should
1853 be correct for j=info+1,...,N.
1854 > N: =N+1: other than QZ iteration failed in hgeqz.
1855 =N+2: after reordering, roundoff changed values of
1856 some complex eigenvalues so that leading
1857 eigenvalues in the Generalized Schur form no
1858 longer satisfy delztg=1 This could also
1859 be caused due to scaling.
1860 =N+3: reordering failed in tgsen.
1861
1862 =for example
1863
1864 sub my_select{
1865 my ($zr, $zi, $d) = @_;
1866 # Eigenvalue : (ZR/D) + sqrt(-1)*(ZI/D)
1867 # stable generalized eigenvalues for discrete time
1868 return (sqrt($zr**2 + $zi**2) < abs($d) ) ? 1 : 0;
1869
1870 }
1871 $a = random(5,5);
1872 $b = random(5,5);
1873 $sdim = null;
1874 $alphar = zeroes(5);
1875 $alphai = zeroes(5);
1876 $beta = zeroes(5);
1877 $vsl = zeroes(5,5);
1878 $vsr = zeroes(5,5);
1879 $rconde = zeroes(2);
1880 $rcondv = zeroes(2);
1881 ggesx($a, 1, 1, 1, 3,$b, $alphar, $alphai, $beta, $vsl, $vsr, $sdim, $rconde, $rcondv, ($info=null), \&my_select);
1882
1883 =pod
1884
1885 Broadcasts over its inputs.
1886
1887 =for bad
1888
1889 C<ggesx> ignores the bad-value flag of the input ndarrays.
1890 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1891
1892 =cut
1893
1894
1895
1896
1897 *ggesx = \&PDL::ggesx;
1898
1899
1900
1901
1902
1903
1904 =head2 syev
1905
1906 =for sig
1907
1908 Signature: ([io]A(n,n); int jobz(); int uplo(); [o]w(n); int [o]info())
1909 Types: (float double)
1910
1911 =for usage
1912
1913 ($w, $info) = syev($A, $jobz, $uplo);
1914 syev($A, $jobz, $uplo, $w, $info); # all arguments given
1915 ($w, $info) = $A->syev($jobz, $uplo); # method call
1916 $A->syev($jobz, $uplo, $w, $info);
1917
1918 =for ref
1919
1920 Computes all eigenvalues and, optionally, eigenvectors of a
1921 real symmetric matrix A.
1922
1923 Arguments
1924 =========
1925
1926 jobz: = 0: Compute eigenvalues only;
1927 = 1: Compute eigenvalues and eigenvectors.
1928
1929 uplo = 0: Upper triangle of A is stored;
1930 = 1: Lower triangle of A is stored.
1931
1932 A: On entry, the symmetric matrix A. If uplo = 0, the
1933 leading N-by-N upper triangular part of A contains the
1934 upper triangular part of the matrix A. If uplo = 1,
1935 the leading N-by-N lower triangular part of A contains
1936 the lower triangular part of the matrix A.
1937 On exit, if jobz = 1, then if info = 0, A contains the
1938 orthonormal eigenvectors of the matrix A.
1939 If jobz = 0, then on exit the lower triangle (if uplo=1)
1940 or the upper triangle (if uplo=0) of A, including the
1941 diagonal, is destroyed.
1942
1943 w: If info = 0, the eigenvalues in ascending order.
1944
1945 info: = 0: successful exit
1946 < 0: if info = -i, the i-th argument had an illegal value
1947 > 0: if info = i, the algorithm failed to converge; i
1948 off-diagonal elements of an intermediate tridiagonal
1949 form did not converge to zero.
1950
1951 =for example
1952
1953 # Assume $a is symmetric ;)
1954 $a = random (5,5);
1955 syev($a, 1,1, (my $w = zeroes(5)), (my $info=null));
1956
1957 =pod
1958
1959 Broadcasts over its inputs.
1960
1961 =for bad
1962
1963 C<syev> ignores the bad-value flag of the input ndarrays.
1964 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
1965
1966 =cut
1967
1968
1969
1970
1971 *syev = \&PDL::syev;
1972
1973
1974
1975
1976
1977
1978 =head2 syevd
1979
1980 =for sig
1981
1982 Signature: ([io]A(n,n); int jobz(); int uplo(); [o]w(n); int [o]info())
1983 Types: (float double)
1984
1985 =for usage
1986
1987 ($w, $info) = syevd($A, $jobz, $uplo);
1988 syevd($A, $jobz, $uplo, $w, $info); # all arguments given
1989 ($w, $info) = $A->syevd($jobz, $uplo); # method call
1990 $A->syevd($jobz, $uplo, $w, $info);
1991
1992 =for ref
1993
1994 Computes all eigenvalues and, optionally, eigenvectors of a
1995 real symmetric matrix A. If eigenvectors are desired, it uses a
1996 divide and conquer algorithm.
1997
1998 The divide and conquer algorithm makes very mild assumptions about
1999 floating point arithmetic. It will work on machines with a guard
2000 digit in add/subtract, or on those binary machines without guard
2001 digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
2002 Cray-2. It could conceivably fail on hexadecimal or decimal machines
2003 without guard digits, but we know of none.
2004
2005 Because of large use of BLAS of level 3, syevd needs N**2 more
2006 workspace than syevx.
2007
2008 Arguments
2009 =========
2010
2011 jobz: = 0: Compute eigenvalues only;
2012 = 1: Compute eigenvalues and eigenvectors.
2013
2014 uplo = 0: Upper triangle of A is stored;
2015 = 1: Lower triangle of A is stored.
2016
2017 A: On entry, the symmetric matrix A. If uplo = 0, the
2018 leading N-by-N upper triangular part of A contains the
2019 upper triangular part of the matrix A. If uplo = 1,
2020 the leading N-by-N lower triangular part of A contains
2021 the lower triangular part of the matrix A.
2022 On exit, if jobz = 1, then if info = 0, A contains the
2023 orthonormal eigenvectors of the matrix A.
2024 If jobz = 0, then on exit the lower triangle (if uplo=1)
2025 or the upper triangle (if uplo=0) of A, including the
2026 diagonal, is destroyed.
2027
2028 w: If info = 0, the eigenvalues in ascending order.
2029
2030 info: = 0: successful exit
2031 < 0: if info = -i, the i-th argument had an illegal value
2032 > 0: if info = i, the algorithm failed to converge; i
2033 off-diagonal elements of an intermediate tridiagonal
2034 form did not converge to zero.
2035
2036 =for example
2037
2038 # Assume $a is symmetric ;)
2039 $a = random (5,5);
2040 syevd($a, 1,1, (my $w = zeroes(5)), (my $info=null));
2041
2042 =pod
2043
2044 Broadcasts over its inputs.
2045
2046 =for bad
2047
2048 C<syevd> ignores the bad-value flag of the input ndarrays.
2049 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2050
2051 =cut
2052
2053
2054
2055
2056 *syevd = \&PDL::syevd;
2057
2058
2059
2060
2061
2062
2063 =head2 syevx
2064
2065 =for sig
2066
2067 Signature: ([io]A(n,n); vl(); vu(); int il(); int iu(); abstol(); int [o]m(); [o]w(n); [o]z(p,p);int [o]ifail(n); int [o]info(); int [t]iwork(iworkn=CALC(5*$SIZE(n))); int jobz; int range; int uplo)
2068 Types: (float double)
2069
2070 =for usage
2071
2072 ($m, $w, $z, $ifail, $info) = syevx($A, $jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol);
2073 syevx($A, $jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol, $m, $w, $z, $ifail, $info); # all arguments given
2074 ($m, $w, $z, $ifail, $info) = $A->syevx($jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol); # method call
2075 $A->syevx($jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol, $m, $w, $z, $ifail, $info);
2076
2077 =for ref
2078
2079 Computes selected eigenvalues and, optionally, eigenvectors
2080 of a real symmetric matrix A. Eigenvalues and eigenvectors can be
2081 selected by specifying either a range of values or a range of indices
2082 for the desired eigenvalues.
2083
2084 Arguments
2085 =========
2086
2087 jobz: = 0: Compute eigenvalues only;
2088 = 1: Compute eigenvalues and eigenvectors.
2089
2090 range: = 0: all eigenvalues will be found.
2091 = 1: all eigenvalues in the half-open interval (vl,vu]
2092 will be found.
2093 = 1: the il-th through iu-th eigenvalues will be found.
2094
2095 uplo = 0: Upper triangle of A is stored;
2096 = 1: Lower triangle of A is stored.
2097
2098 A: On entry, the symmetric matrix A. If uplo = 0, the
2099 leading N-by-N upper triangular part of A contains the
2100 upper triangular part of the matrix A. If uplo = 1,
2101 the leading N-by-N lower triangular part of A contains
2102 the lower triangular part of the matrix A.
2103 On exit, the lower triangle (if uplo=1) or the upper
2104 triangle (if uplo=0) of A, including the diagonal, is
2105 destroyed.
2106
2107 vl:
2108 vu: If range=1, the lower and upper bounds of the interval to
2109 be searched for eigenvalues. vl < vu.
2110 Not referenced if range = 0 or 2.
2111
2112 il:
2113 iu: If range=2, the indices (in ascending order) of the
2114 smallest and largest eigenvalues to be returned.
2115 1 <= il <= iu <= N, if N > 0; il = 1 and iu = 0 if N = 0.
2116 Not referenced if range = 0 or 1.
2117
2118 abstol: The absolute error tolerance for the eigenvalues.
2119 An approximate eigenvalue is accepted as converged
2120 when it is determined to lie in an interval [a,b]
2121 of width less than or equal to
2122
2123 abstol + EPS * max( |a|,|b| ) ,
2124
2125 where EPS is the machine precision. If abstol is less than
2126 or equal to zero, then EPS*|T| will be used in its place,
2127 where |T| is the 1-norm of the tridiagonal matrix obtained
2128 by reducing A to tridiagonal form.
2129
2130 Eigenvalues will be computed most accurately when abstol is
2131 set to twice the underflow threshold 2*lamch(1), not zero.
2132 If this routine returns with info>0, indicating that some
2133 eigenvectors did not converge, try setting abstol to
2134 2*lamch(1).
2135
2136 See "Computing Small Singular Values of Bidiagonal Matrices
2137 with Guaranteed High Relative Accuracy," by Demmel and
2138 Kahan, LAPACK Working Note #3.
2139
2140 m: The total number of eigenvalues found. 0 <= m <= N.
2141 If range = 0, m = N, and if range = 2, m = iu-il+1.
2142
2143 w: On normal exit, the first M elements contain the selected
2144 eigenvalues in ascending order.
2145
2146 z: If jobz = 1, then if info = 0, the first m columns of z
2147 contain the orthonormal eigenvectors of the matrix A
2148 corresponding to the selected eigenvalues, with the i-th
2149 column of z holding the eigenvector associated with w(i).
2150 If an eigenvector fails to converge, then that column of z
2151 contains the latest approximation to the eigenvector, and the
2152 index of the eigenvector is returned in ifail.
2153 If jobz = 0, then z is not referenced.
2154 Note: the user must ensure that at least max(1,m) columns are
2155 supplied in the array z; if range = 1, the exact value of m
2156 is not known in advance and an upper bound must be used.
2157
2158 ifail: If jobz = 1, then if info = 0, the first m elements of
2159 ifail are zero. If info > 0, then ifail contains the
2160 indices of the eigenvectors that failed to converge.
2161 If jobz = 0, then ifail is not referenced.
2162
2163 info: = 0: successful exit
2164 < 0: if info = -i, the i-th argument had an illegal value
2165 > 0: if info = i, then i eigenvectors failed to converge.
2166 Their indices are stored in array ifail.
2167
2168 =for example
2169
2170 # Assume $a is symmetric ;)
2171 $a = random (5,5);
2172 $unfl = lamch(1);
2173 $ovfl = lamch(9);
2174 labad($unfl, $ovfl);
2175 $abstol = $unfl + $unfl;
2176 $m = null;
2177 $info = null;
2178 $ifail = zeroes(5);
2179 $w = zeroes(5);
2180 $z = zeroes(5,5);
2181 syevx($a, 1,0,1,0,0,0,0,$abstol, $m, $w, $z ,$ifail, $info);
2182
2183 =pod
2184
2185 Broadcasts over its inputs.
2186
2187 =for bad
2188
2189 C<syevx> ignores the bad-value flag of the input ndarrays.
2190 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2191
2192 =cut
2193
2194
2195
2196
2197 *syevx = \&PDL::syevx;
2198
2199
2200
2201
2202
2203
2204 =head2 syevr
2205
2206 =for sig
2207
2208 Signature: ([io]A(n,n); int jobz(); int range(); int uplo(); vl(); vu(); int il(); int iu();abstol();int [o]m();[o]w(n); [o]z(p,q);int [o]isuppz(r); int [o]info())
2209 Types: (float double)
2210
2211 =for usage
2212
2213 ($m, $w, $z, $isuppz, $info) = syevr($A, $jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol);
2214 syevr($A, $jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol, $m, $w, $z, $isuppz, $info); # all arguments given
2215 ($m, $w, $z, $isuppz, $info) = $A->syevr($jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol); # method call
2216 $A->syevr($jobz, $range, $uplo, $vl, $vu, $il, $iu, $abstol, $m, $w, $z, $isuppz, $info);
2217
2218 =for ref
2219
2220 Computes selected eigenvalues and, optionally, eigenvectors
2221 of a real symmetric matrix T. Eigenvalues and eigenvectors can be
2222 selected by specifying either a range of values or a range of
2223 indices for the desired eigenvalues.
2224
2225 Whenever possible, syevr calls stegr to compute the
2226 eigenspectrum using Relatively Robust Representations. stegr
2227 computes eigenvalues by the dqds algorithm, while orthogonal
2228 eigenvectors are computed from various "good" L D L^T representations
2229 (also known as Relatively Robust Representations). Gram-Schmidt
2230 orthogonalization is avoided as far as possible. More specifically,
2231 the various steps of the algorithm are as follows. For the i-th
2232 unreduced block of T,
2233
2234 (a) Compute T - sigma_i = L_i D_i L_i^T, such that L_i D_i L_i^T
2235 is a relatively robust representation,
2236 (b) Compute the eigenvalues, lambda_j, of L_i D_i L_i^T to high
2237 relative accuracy by the dqds algorithm,
2238 (c) If there is a cluster of close eigenvalues, "choose" sigma_i
2239 close to the cluster, and go to step (a),
2240 (d) Given the approximate eigenvalue lambda_j of L_i D_i L_i^T,
2241 compute the corresponding eigenvector by forming a
2242 rank-revealing twisted factorization.
2243
2244 The desired accuracy of the output can be specified by the input
2245 parameter abstol.
2246
2247 For more details, see "A new O(n^2) algorithm for the symmetric
2248 tridiagonal eigenvalue/eigenvector problem", by Inderjit Dhillon,
2249 Computer Science Division Technical Report No. UCB//CSD-97-971,
2250 UC Berkeley, May 1997.
2251
2252 Note 1 : syevr calls stegr when the full spectrum is requested
2253 on machines which conform to the ieee-754 floating point standard.
2254 syevr calls stebz and stein on non-ieee machines and
2255 when partial spectrum requests are made.
2256
2257 Normal execution of stegr may create NaNs and infinities and
2258 hence may abort due to a floating point exception in environments
2259 which do not handle NaNs and infinities in the ieee standard default
2260 manner.
2261
2262 Arguments
2263 =========
2264
2265 jobz: = 0: Compute eigenvalues only;
2266 = 1: Compute eigenvalues and eigenvectors.
2267
2268 range: = 0: all eigenvalues will be found.
2269 = 1: all eigenvalues in the half-open interval (vl,vu]
2270 will be found.
2271 = 2: the il-th through iu-th eigenvalues will be found.
2272 ********* For range = 1 or 2 and iu - il < N - 1, stebz and
2273 ********* stein are called
2274
2275 uplo: = 0: Upper triangle of A is stored;
2276 = 1: Lower triangle of A is stored.
2277
2278 A: On entry, the symmetric matrix A. If uplo = 0, the
2279 leading N-by-N upper triangular part of A contains the
2280 upper triangular part of the matrix A. If uplo = 1,
2281 the leading N-by-N lower triangular part of A contains
2282 the lower triangular part of the matrix A.
2283 On exit, the lower triangle (if uplo=1) or the upper
2284 triangle (if uplo=0) of A, including the diagonal, is
2285 destroyed.
2286
2287 vl:
2288 vu: If range=1, the lower and upper bounds of the interval to
2289 be searched for eigenvalues. vl < vu.
2290 Not referenced if range = 0 or 2.
2291
2292 il:
2293 iu: If range=2, the indices (in ascending order) of the
2294 smallest and largest eigenvalues to be returned.
2295 1 <= il <= iu <= N, if N > 0; il = 1 and iu = 0 if N = 0.
2296 Not referenced if range = 0 or 1.
2297
2298 abstol: The absolute error tolerance for the eigenvalues.
2299 An approximate eigenvalue is accepted as converged
2300 when it is determined to lie in an interval [a,b]
2301 of width less than or equal to
2302
2303 abstol + EPS * max( |a|,|b| ) ,
2304
2305 where EPS is the machine precision. If abstol is less than
2306 or equal to zero, then EPS*|T| will be used in its place,
2307 where |T| is the 1-norm of the tridiagonal matrix obtained
2308 by reducing A to tridiagonal form.
2309
2310 See "Computing Small Singular Values of Bidiagonal Matrices
2311 with Guaranteed High Relative Accuracy," by Demmel and
2312 Kahan, LAPACK Working Note #3.
2313
2314 If high relative accuracy is important, set abstol to
2315 lamch(1). Doing so will guarantee that
2316 eigenvalues are computed to high relative accuracy when
2317 possible in future releases. The current code does not
2318 make any guarantees about high relative accuracy, but
2319 future releases will. See J. Barlow and J. Demmel,
2320 "Computing Accurate Eigensystems of Scaled Diagonally
2321 Dominant Matrices", LAPACK Working Note #7, for a discussion
2322 of which matrices define their eigenvalues to high relative
2323 accuracy.
2324
2325 m: The total number of eigenvalues found. 0 <= m <= N.
2326 If range = 0, m = N, and if range = 2, m = iu-il+1.
2327
2328 w: The first m elements contain the selected eigenvalues in
2329 ascending order.
2330
2331 z: If jobz = 1, then if info = 0, the first m columns of z
2332 contain the orthonormal eigenvectors of the matrix A
2333 corresponding to the selected eigenvalues, with the i-th
2334 column of z holding the eigenvector associated with w(i).
2335 If jobz = 0, then z is not referenced.
2336 Note: the user must ensure that at least max(1,m) columns are
2337 supplied in the array z; if range = 1, the exact value of m
2338 is not known in advance and an upper bound must be used.
2339
2340 isuppz: array of int, dimension ( 2*max(1,m) )
2341 The support of the eigenvectors in z, i.e., the indices
2342 indicating the nonzero elements in z. The i-th eigenvector
2343 is nonzero only in elements isuppz( 2*i-1 ) through
2344 isuppz( 2*i ).
2345 ********* Implemented only for range = 0 or 2 and iu - il = N - 1
2346
2347 info: = 0: successful exit
2348 < 0: if info = -i, the i-th argument had an illegal value
2349 > 0: Internal error
2350
2351 =for example
2352
2353 # Assume $a is symmetric ;)
2354 $a = random (5,5);
2355 $unfl = lamch(1);
2356 $ovfl = lamch(9);
2357 labad($unfl, $ovfl);
2358 $abstol = $unfl + $unfl;
2359 $m = null;
2360 $info = null;
2361 $isuppz = zeroes(10);
2362 $w = zeroes(5);
2363 $z = zeroes(5,5);
2364 syevr($a, 1,0,1,0,0,0,0,$abstol, $m, $w, $z ,$isuppz, $info);
2365
2366 =pod
2367
2368 Broadcasts over its inputs.
2369
2370 =for bad
2371
2372 C<syevr> ignores the bad-value flag of the input ndarrays.
2373 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2374
2375 =cut
2376
2377
2378
2379
2380 *syevr = \&PDL::syevr;
2381
2382
2383
2384
2385
2386
2387 =head2 sygv
2388
2389 =for sig
2390
2391 Signature: ([io]A(n,n);int itype();int jobz(); int uplo();[io]B(n,n);[o]w(n); int [o]info())
2392 Types: (float double)
2393
2394 =for usage
2395
2396 ($w, $info) = sygv($A, $itype, $jobz, $uplo, $B);
2397 sygv($A, $itype, $jobz, $uplo, $B, $w, $info); # all arguments given
2398 ($w, $info) = $A->sygv($itype, $jobz, $uplo, $B); # method call
2399 $A->sygv($itype, $jobz, $uplo, $B, $w, $info);
2400
2401 =for ref
2402
2403 Computes all the eigenvalues, and optionally, the eigenvectors
2404 of a real generalized symmetric-definite eigenproblem, of the form
2405 A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x.
2406 Here A and B are assumed to be symmetric and B is also
2407 positive definite.
2408
2409 Arguments
2410 =========
2411
2412 itype: Specifies the problem type to be solved:
2413 = 1: A*x = (lambda)*B*x
2414 = 2: A*B*x = (lambda)*x
2415 = 3: B*A*x = (lambda)*x
2416
2417 jobz: = 0: Compute eigenvalues only;
2418 = 1: Compute eigenvalues and eigenvectors.
2419
2420 uplo: = 0: Upper triangles of A and B are stored;
2421 = 1: Lower triangles of A and B are stored.
2422
2423 A: On entry, the symmetric matrix A. If uplo = 0, the
2424 leading N-by-N upper triangular part of A contains the
2425 upper triangular part of the matrix A. If uplo = 1,
2426 the leading N-by-N lower triangular part of A contains
2427 the lower triangular part of the matrix A.
2428
2429 On exit, if jobz = 1, then if info = 0, A contains the
2430 matrix Z of eigenvectors. The eigenvectors are normalized
2431 as follows:
2432 if itype = 1 or 2, Z'*B*Z = I;
2433 if itype = 3, Z'*inv(B)*Z = I.
2434 If jobz = 0, then on exit the upper triangle (if uplo=0)
2435 or the lower triangle (if uplo=1) of A, including the
2436 diagonal, is destroyed.
2437
2438 B: On entry, the symmetric positive definite matrix B.
2439 If uplo = 0, the leading N-by-N upper triangular part of B
2440 contains the upper triangular part of the matrix B.
2441 If uplo = 1, the leading N-by-N lower triangular part of B
2442 contains the lower triangular part of the matrix B.
2443
2444 On exit, if info <= N, the part of B containing the matrix is
2445 overwritten by the triangular factor U or L from the Cholesky
2446 factorization B = U'*U or B = L*L'.
2447
2448 W: If info = 0, the eigenvalues in ascending order.
2449
2450 info: = 0: successful exit
2451 < 0: if info = -i, the i-th argument had an illegal value
2452 > 0: potrf or syev returned an error code:
2453 <= N: if info = i, syev failed to converge;
2454 i off-diagonal elements of an intermediate
2455 tridiagonal form did not converge to zero;
2456 > N: if info = N + i, for 1 <= i <= N, then the leading
2457 minor of order i of B is not positive definite.
2458 The factorization of B could not be completed and
2459 no eigenvalues or eigenvectors were computed.
2460
2461 =for example
2462
2463 # Assume $a is symmetric ;)
2464 $a = random (5,5);
2465 # Assume $a is symmetric and positive definite ;)
2466 $b = random (5,5);
2467 sygv($a, 1,1, 0, $b, (my $w = zeroes(5)), (my $info=null));
2468
2469 =pod
2470
2471 Broadcasts over its inputs.
2472
2473 =for bad
2474
2475 C<sygv> ignores the bad-value flag of the input ndarrays.
2476 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2477
2478 =cut
2479
2480
2481
2482
2483 *sygv = \&PDL::sygv;
2484
2485
2486
2487
2488
2489
2490 =head2 sygvd
2491
2492 =for sig
2493
2494 Signature: ([io]A(n,n);int itype();int jobz(); int uplo();[io]B(n,n);[o]w(n); int [o]info())
2495 Types: (float double)
2496
2497 =for usage
2498
2499 ($w, $info) = sygvd($A, $itype, $jobz, $uplo, $B);
2500 sygvd($A, $itype, $jobz, $uplo, $B, $w, $info); # all arguments given
2501 ($w, $info) = $A->sygvd($itype, $jobz, $uplo, $B); # method call
2502 $A->sygvd($itype, $jobz, $uplo, $B, $w, $info);
2503
2504 =for ref
2505
2506 Computes all the eigenvalues, and optionally, the eigenvectors
2507 of a real generalized symmetric-definite eigenproblem, of the form
2508 A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x.
2509 Here A and B are assumed to be symmetric and B is also
2510 positive definite.
2511
2512 The divide and conquer algorithm makes very mild assumptions about
2513 floating point arithmetic. It will work on machines with a guard
2514 digit in add/subtract, or on those binary machines without guard
2515 digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
2516 Cray-2. It could conceivably fail on hexadecimal or decimal machines
2517 without guard digits, but we know of none.
2518
2519 Arguments
2520 =========
2521
2522 itype: Specifies the problem type to be solved:
2523 = 1: A*x = (lambda)*B*x
2524 = 2: A*B*x = (lambda)*x
2525 = 3: B*A*x = (lambda)*x
2526
2527 jobz: = 0: Compute eigenvalues only;
2528 = 1: Compute eigenvalues and eigenvectors.
2529
2530 uplo: = 0: Upper triangles of A and B are stored;
2531 = 1: Lower triangles of A and B are stored.
2532
2533 A: On entry, the symmetric matrix A. If uplo = 0, the
2534 leading N-by-N upper triangular part of A contains the
2535 upper triangular part of the matrix A. If uplo = 1,
2536 the leading N-by-N lower triangular part of A contains
2537 the lower triangular part of the matrix A.
2538
2539 On exit, if jobz = 1, then if info = 0, A contains the
2540 matrix Z of eigenvectors. The eigenvectors are normalized
2541 as follows:
2542 if itype = 1 or 2, Z'*B*Z = I;
2543 if itype = 3, Z'*inv(B)*Z = I.
2544 If jobz = 0, then on exit the upper triangle (if uplo=0)
2545 or the lower triangle (if uplo=1) of A, including the
2546 diagonal, is destroyed.
2547
2548 B: On entry, the symmetric positive definite matrix B.
2549 If uplo = 0, the leading N-by-N upper triangular part of B
2550 contains the upper triangular part of the matrix B.
2551 If uplo = 1, the leading N-by-N lower triangular part of B
2552 contains the lower triangular part of the matrix B.
2553
2554 On exit, if info <= N, the part of B containing the matrix is
2555 overwritten by the triangular factor U or L from the Cholesky
2556 factorization B = U'*U or B = L*L'.
2557
2558 W: If info = 0, the eigenvalues in ascending order.
2559
2560 info: = 0: successful exit
2561 < 0: if info = -i, the i-th argument had an illegal value
2562 > 0: potrf or syev returned an error code:
2563 <= N: if info = i, syevd failed to converge;
2564 i off-diagonal elements of an intermediate
2565 tridiagonal form did not converge to zero;
2566 > N: if info = N + i, for 1 <= i <= N, then the leading
2567 minor of order i of B is not positive definite.
2568 The factorization of B could not be completed and
2569 no eigenvalues or eigenvectors were computed.
2570
2571 =for example
2572
2573 # Assume $a is symmetric ;)
2574 $a = random (5,5);
2575 # Assume $b is symmetric positive definite ;)
2576 $b = random (5,5);
2577 sygvd($a, 1,1, 0, $b, (my $w = zeroes(5)), (my $info=null));
2578
2579 =pod
2580
2581 Broadcasts over its inputs.
2582
2583 =for bad
2584
2585 C<sygvd> ignores the bad-value flag of the input ndarrays.
2586 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2587
2588 =cut
2589
2590
2591
2592
2593 *sygvd = \&PDL::sygvd;
2594
2595
2596
2597
2598
2599
2600 =head2 sygvx
2601
2602 =for sig
2603
2604 Signature: ([io]A(n,n); int itype();
2605 [io]B(n,n); vl(); vu(); int il(); int iu(); abstol();
2606 int [o]m(); [o]w(n); [o]Z(p,p); int [o]ifail(n); int [o]info();
2607 int [t]iwork(iworkn=CALC(5*$SIZE(n)));
2608 ; int jobz; int range; int uplo)
2609 Types: (float double)
2610
2611 =for usage
2612
2613 ($m, $w, $Z, $ifail, $info) = sygvx($A, $itype, $jobz, $range, $uplo, $B, $vl, $vu, $il, $iu, $abstol);
2614 sygvx($A, $itype, $jobz, $range, $uplo, $B, $vl, $vu, $il, $iu, $abstol, $m, $w, $Z, $ifail, $info); # all arguments given
2615 ($m, $w, $Z, $ifail, $info) = $A->sygvx($itype, $jobz, $range, $uplo, $B, $vl, $vu, $il, $iu, $abstol); # method call
2616 $A->sygvx($itype, $jobz, $range, $uplo, $B, $vl, $vu, $il, $iu, $abstol, $m, $w, $Z, $ifail, $info);
2617
2618 =for ref
2619
2620 Computes selected eigenvalues, and optionally, eigenvectors
2621 of a real generalized symmetric-definite eigenproblem, of the form
2622 A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A
2623 and B are assumed to be symmetric and B is also positive definite.
2624 Eigenvalues and eigenvectors can be selected by specifying either a
2625 range of values or a range of indices for the desired eigenvalues.
2626
2627 Arguments
2628 =========
2629
2630 itype: Specifies the problem type to be solved:
2631 = 1: A*x = (lambda)*B*x
2632 = 2: A*B*x = (lambda)*x
2633 = 3: B*A*x = (lambda)*x
2634
2635 jobz: = 0: Compute eigenvalues only;
2636 = 1: Compute eigenvalues and eigenvectors.
2637
2638 range: = 0: all eigenvalues will be found.
2639 = 1: all eigenvalues in the half-open interval (vl,vu]
2640 will be found.
2641 = 2: the il-th through iu-th eigenvalues will be found.
2642
2643 uplo: = 0: Upper triangle of A and B are stored;
2644 = 1: Lower triangle of A and B are stored.
2645
2646 A: On entry, the symmetric matrix A. If uplo = 0, the
2647 leading N-by-N upper triangular part of A contains the
2648 upper triangular part of the matrix A. If uplo = 1,
2649 the leading N-by-N lower triangular part of A contains
2650 the lower triangular part of the matrix A.
2651
2652 On exit, the lower triangle (if uplo=1) or the upper
2653 triangle (if uplo=0) of A, including the diagonal, is
2654 destroyed.
2655
2656 B: On entry, the symmetric matrix B. If uplo = 0, the
2657 leading N-by-N upper triangular part of B contains the
2658 upper triangular part of the matrix B. If uplo = 1,
2659 the leading N-by-N lower triangular part of B contains
2660 the lower triangular part of the matrix B.
2661
2662 On exit, if info <= N, the part of B containing the matrix is
2663 overwritten by the triangular factor U or L from the Cholesky
2664 factorization B = U'*U or B = L*L'.
2665
2666 vl:
2667 vu: If range=1, the lower and upper bounds of the interval to
2668 be searched for eigenvalues. vl < vu.
2669 Not referenced if range = 0 or 2.
2670
2671 il:
2672 iu: If range=2, the indices (in ascending order) of the
2673 smallest and largest eigenvalues to be returned.
2674 1 <= il <= iu <= N, if N > 0; il = 1 and iu = 0 if N = 0.
2675 Not referenced if range = 0 or 1.
2676
2677 abstol: The absolute error tolerance for the eigenvalues.
2678 An approximate eigenvalue is accepted as converged
2679 when it is determined to lie in an interval [a,b]
2680 of width less than or equal to
2681
2682 abstol + EPS * max( |a|,|b| ) ,
2683
2684 where EPS is the machine precision. If abstol is less than
2685 or equal to zero, then EPS*|T| will be used in its place,
2686 where |T| is the 1-norm of the tridiagonal matrix obtained
2687 by reducing A to tridiagonal form.
2688
2689 Eigenvalues will be computed most accurately when abstol is
2690 set to twice the underflow threshold 2*lamch(1), not zero.
2691 If this routine returns with info>0, indicating that some
2692 eigenvectors did not converge, try setting abstol to
2693 2* lamch(1).
2694
2695 m: The total number of eigenvalues found. 0 <= m <= N.
2696 If range = 0, m = N, and if range = 2, m = iu-il+1.
2697
2698 w: On normal exit, the first m elements contain the selected
2699 eigenvalues in ascending order.
2700
2701 Z: If jobz = 0, then Z is not referenced.
2702 If jobz = 1, then if info = 0, the first m columns of Z
2703 contain the orthonormal eigenvectors of the matrix A
2704 corresponding to the selected eigenvalues, with the i-th
2705 column of Z holding the eigenvector associated with w(i).
2706 The eigenvectors are normalized as follows:
2707 if itype = 1 or 2, Z'*B*Z = I;
2708 if itype = 3, Z'*inv(B)*Z = I.
2709
2710 If an eigenvector fails to converge, then that column of Z
2711 contains the latest approximation to the eigenvector, and the
2712 index of the eigenvector is returned in ifail.
2713 Note: the user must ensure that at least max(1,m) columns are
2714 supplied in the array Z; if range = 1, the exact value of m
2715 is not known in advance and an upper bound must be used.
2716
2717 ifail: If jobz = 1, then if info = 0, the first M elements of
2718 ifail are zero. If info > 0, then ifail contains the
2719 indices of the eigenvectors that failed to converge.
2720 If jobz = 0, then ifail is not referenced.
2721
2722 info: = 0: successful exit
2723 < 0: if info = -i, the i-th argument had an illegal value
2724 > 0: potrf or syevx returned an error code:
2725 <= N: if info = i, syevx failed to converge;
2726 i eigenvectors failed to converge. Their indices
2727 are stored in array ifail.
2728 > N: if info = N + i, for 1 <= i <= N, then the leading
2729 minor of order i of B is not positive definite.
2730 The factorization of B could not be completed and
2731 no eigenvalues or eigenvectors were computed.
2732
2733 =for example
2734
2735 # Assume $a is symmetric ;)
2736 $a = random (5,5);
2737 # Assume $b is symmetric positive definite ;)
2738 $b = random (5,5);
2739 $unfl = lamch(1);
2740 $ovfl = lamch(9);
2741 labad($unfl, $ovfl);
2742 $abstol = $unfl + $unfl;
2743 $m = null;
2744 $w=zeroes(5);
2745 $z = zeroes(5,5);
2746 $ifail = zeroes(5);
2747 sygvx($a, 1,1, 0,0, $b, 0, 0, 0, 0, $abstol, $m, $w, $z,$ifail,(my $info=null));
2748
2749 =pod
2750
2751 Broadcasts over its inputs.
2752
2753 =for bad
2754
2755 C<sygvx> ignores the bad-value flag of the input ndarrays.
2756 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2757
2758 =cut
2759
2760
2761
2762
2763 *sygvx = \&PDL::sygvx;
2764
2765
2766
2767
2768
2769
2770 =head2 gesv
2771
2772 =for sig
2773
2774 Signature: ([io]A(n,n); [io]B(n,m); int [o]ipiv(n); int [o]info())
2775 Types: (float double)
2776
2777 =for usage
2778
2779 ($ipiv, $info) = gesv($A, $B);
2780 gesv($A, $B, $ipiv, $info); # all arguments given
2781 ($ipiv, $info) = $A->gesv($B); # method call
2782 $A->gesv($B, $ipiv, $info);
2783
2784 =for ref
2785
2786 Computes the solution to a real system of linear equations
2787
2788 A * X = B,
2789 where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
2790
2791 The LU decomposition with partial pivoting and row interchanges is
2792 used to factor A as
2793
2794 A = P * L * U,
2795 where P is a permutation matrix, L is unit lower triangular, and U is
2796 upper triangular.
2797
2798 The factored form of A is then used to solve the
2799 system of equations A * X = B.
2800
2801 Arguments
2802 =========
2803
2804 A: On entry, the N-by-N coefficient matrix A.
2805 On exit, the factors L and U from the factorization
2806 A = P*L*U; the unit diagonal elements of L are not stored.
2807
2808 ipiv: The pivot indices that define the permutation matrix P;
2809 row i of the matrix was interchanged with row ipiv(i).
2810
2811 B: On entry, the N-by-NRHS matrix of right hand side matrix B.
2812 On exit, if info = 0, the N-by-NRHS solution matrix X.
2813
2814 info: = 0: successful exit
2815 < 0: if info = -i, the i-th argument had an illegal value
2816 > 0: if info = i, U(i,i) is exactly zero. The factorization
2817 has been completed, but the factor U is exactly
2818 singular, so the solution could not be computed.
2819
2820 =for example
2821
2822 $a = random (5,5);
2823 $a = transpose($a);
2824 $b = random (5,5);
2825 $b = transpose($b);
2826 gesv($a,$b, (my $ipiv=zeroes(5)),(my $info=null));
2827 print "The solution matrix X is :". transpose($b)."\n" unless $info;
2828
2829 =pod
2830
2831 Broadcasts over its inputs.
2832
2833 =for bad
2834
2835 C<gesv> ignores the bad-value flag of the input ndarrays.
2836 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
2837
2838 =cut
2839
2840
2841
2842
2843 *gesv = \&PDL::gesv;
2844
2845
2846
2847
2848
2849
2850 =head2 gesvx
2851
2852 =for sig
2853
2854 Signature: ([io]A(n,n); int trans(); int fact(); [io]B(n,m); [io]af(n,n); int [io]ipiv(n); int [io]equed(); [o]r(p); [o]c(q); [o]X(n,m); [o]rcond(); [o]ferr(m); [o]berr(m);[o]rpvgrw();int [o]info(); [t]work(workn=CALC(4*$SIZE(n))); int [t]iwork(n))
2855 Types: (float double)
2856
2857 =for usage
2858
2859 ($r, $c, $X, $rcond, $ferr, $berr, $rpvgrw, $info) = gesvx($A, $trans, $fact, $B, $af, $ipiv, $equed);
2860 gesvx($A, $trans, $fact, $B, $af, $ipiv, $equed, $r, $c, $X, $rcond, $ferr, $berr, $rpvgrw, $info); # all arguments given
2861 ($r, $c, $X, $rcond, $ferr, $berr, $rpvgrw, $info) = $A->gesvx($trans, $fact, $B, $af, $ipiv, $equed); # method call
2862 $A->gesvx($trans, $fact, $B, $af, $ipiv, $equed, $r, $c, $X, $rcond, $ferr, $berr, $rpvgrw, $info);
2863
2864 =for ref
2865
2866 Uses the LU factorization to compute the solution to a real
2867 system of linear equations
2868
2869 A * X = B,
2870 where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
2871
2872 Error bounds on the solution and a condition estimate are also
2873 provided.
2874
2875 =for desc
2876
2877 The following steps are performed:
2878
2879 =over 3
2880
2881 =item 1
2882
2883 If fact = 2, real scaling factors are computed to equilibrate
2884 the system:
2885
2886 trans = 0: diag(r)*A*diag(c) *inv(diag(c))*X = diag(c)*B
2887 trans = 1: (diag(r)*A*diag(c))' *inv(diag(r))*X = diag(c)*B
2888 trans = 2: (diag(r)*A*diag(c))**H *inv(diag(r))*X = diag(c)*B
2889
2890 Whether or not the system will be equilibrated depends on the
2891 scaling of the matrix A, but if equilibration is used, A is
2892 overwritten by diag(r)*A*diag(c) and B by diag(r)*B (if trans=0)
2893 or diag(c)*B (if trans = 1 or 2).
2894
2895 =item 2
2896
2897 If fact = 1 or 2, the LU decomposition is used to factor the
2898 matrix A (after equilibration if fact = 2) as
2899
2900 A = P * L * U,
2901 where P is a permutation matrix, L is a unit lower triangular
2902 matrix, and U is upper triangular.
2903
2904 =item 3
2905
2906 If some U(i,i)=0, so that U is exactly singular, then the routine
2907 returns with info = i. Otherwise, the factored form of A is used
2908 to estimate the condition number of the matrix A. If the
2909 reciprocal of the condition number is less than machine precision,
2910 info = N+1 is returned as a warning, but the routine still goes on
2911 to solve for X and compute error bounds as described below.
2912
2913 =item 4
2914
2915 The system of equations is solved for X using the factored form
2916 of A.
2917
2918 =item 5
2919
2920 Iterative refinement is applied to improve the computed solution
2921 matrix and calculate error bounds and backward error estimates
2922 for it.
2923
2924 =item 6
2925
2926 If equilibration was used, the matrix X is premultiplied by
2927 diag(c) (if trans = 0) or diag(r) (if trans = 1 or 2) so
2928 that it solves the original system before equilibration.
2929
2930 =back
2931
2932 Arguments
2933 =========
2934
2935 fact: Specifies whether or not the factored form of the matrix A is
2936 supplied on entry, and if not, whether the matrix A should be
2937 equilibrated before it is factored.
2938 = 0: On entry, af and ipiv contain the factored form of A.
2939 If equed is not 0, the matrix A has been
2940 equilibrated with scaling factors given by r and c.
2941 A, af, and ipiv are not modified.
2942 = 1: The matrix A will be copied to af and factored.
2943 = 2: The matrix A will be equilibrated if necessary, then
2944 copied to af and factored.
2945
2946 trans: Specifies the form of the system of equations:
2947 = 0: A * X = B (No transpose)
2948 = 1: A' * X = B (Transpose)
2949 = 2: A**H * X = B (Transpose)
2950
2951 A: On entry, the N-by-N matrix A. If fact = 0 and equed is
2952 not 0, then A must have been equilibrated by the scaling
2953 factors in r and/or c. A is not modified if fact = 0 or
2954 1, or if fact = 2 and equed = 0 on exit.
2955
2956 On exit, if equed != 0, A is scaled as follows:
2957 equed = 1: A := diag(r) * A
2958 equed = 2: A := A * diag(c)
2959 equed = 3: A := diag(r) * A * diag(c).
2960
2961 af: If fact = 0, then af is an input argument and on entry
2962 contains the factors L and U from the factorization
2963 A = P*L*U as computed by getrf. If equed != 0, then
2964 af is the factored form of the equilibrated matrix A.
2965
2966 If fact = 1, then af is an output argument and on exit
2967 returns the factors L and U from the factorization A = P*L*U
2968 of the original matrix A.
2969
2970 If fact = 2, then af is an output argument and on exit
2971 returns the factors L and U from the factorization A = P*L*U
2972 of the equilibrated matrix A (see the description of A for
2973 the form of the equilibrated matrix).
2974
2975 ipiv: If fact = 0, then ipiv is an input argument and on entry
2976 contains the pivot indices from the factorization A = P*L*U
2977 as computed by getrf; row i of the matrix was interchanged
2978 with row ipiv(i).
2979
2980 If fact = 1, then ipiv is an output argument and on exit
2981 contains the pivot indices from the factorization A = P*L*U
2982 of the original matrix A.
2983
2984 If fact = 2, then ipiv is an output argument and on exit
2985 contains the pivot indices from the factorization A = P*L*U
2986 of the equilibrated matrix A.
2987
2988 equed: Specifies the form of equilibration that was done.
2989 = 0: No equilibration (always true if fact = 1).
2990 = 1: Row equilibration, i.e., A has been premultiplied by
2991 diag(r).
2992 = 2: Column equilibration, i.e., A has been postmultiplied
2993 by diag(c).
2994 = 3: Both row and column equilibration, i.e., A has been
2995 replaced by diag(r) * A * diag(c).
2996 equed is an input argument if fact = 0; otherwise, it is an
2997 output argument.
2998
2999 r: The row scale factors for A. If equed = 1 or 3, A is
3000 multiplied on the left by diag(r); if equed = 0 or 2, r
3001 is not accessed. r is an input argument if fact = 0;
3002 otherwise, r is an output argument. If fact = 0 and
3003 equed = 1 or 3, each element of r must be positive.
3004
3005 c: The column scale factors for A. If equed = 2 or 3, A is
3006 multiplied on the right by diag(c); if equed = 0 or 1, c
3007 is not accessed. c is an input argument if fact = 0;
3008 otherwise, c is an output argument. If fact = 0 and
3009 equed = 2 or 3, each element of c must be positive.
3010
3011 B: On entry, the N-by-NRHS right hand side matrix B.
3012 On exit,
3013 if equed = 0, B is not modified;
3014 if trans = 0 and equed = 1 or 3, B is overwritten by
3015 diag(r)*B;
3016 if trans = 1 or 2 and equed = 2 or 3, B is
3017 overwritten by diag(c)*B.
3018
3019 X: If info = 0 or info = N+1, the N-by-NRHS solution matrix X
3020 to the original system of equations. Note that A and B are
3021 modified on exit if equed != 0, and the solution to the
3022 equilibrated system is inv(diag(c))*X if trans = 0 and
3023 equed = 2 or 3, or inv(diag(r))*X if trans = 1 or 2
3024 and equed = 1 or 3.
3025
3026 rcond: The estimate of the reciprocal condition number of the matrix
3027 A after equilibration (if done). If rcond is less than the
3028 machine precision (in particular, if rcond = 0), the matrix
3029 is singular to working precision. This condition is
3030 indicated by a return code of info > 0.
3031
3032 ferr: The estimated forward error bound for each solution vector
3033 X(j) (the j-th column of the solution matrix X).
3034 If XTRUE is the true solution corresponding to X(j), ferr(j)
3035 is an estimated upper bound for the magnitude of the largest
3036 element in (X(j) - XTRUE) divided by the magnitude of the
3037 largest element in X(j). The estimate is as reliable as
3038 the estimate for rcond, and is almost always a slight
3039 overestimate of the true error.
3040
3041 berr: The componentwise relative backward error of each solution
3042 vector X(j) (i.e., the smallest relative change in
3043 any element of A or B that makes X(j) an exact solution).
3044
3045 rpvgrw: Contains the reciprocal pivot growth factor norm(A)/norm(U).
3046 The "max absolute element" norm is used. If it is much less
3047 than 1, then the stability of the LU factorization of the
3048 (equilibrated) matrix A could be poor. This also means that
3049 the solution X, condition estimator rcond, and forward error
3050 bound ferr could be unreliable. If factorization fails with
3051 0<info<=N, then it contains the reciprocal pivot growth factor
3052 for the leading info columns of A.
3053
3054 info: = 0: successful exit
3055 < 0: if info = -i, the i-th argument had an illegal value
3056 > 0: if info = i, and i is
3057 <= N: U(i,i) is exactly zero. The factorization has
3058 been completed, but the factor U is exactly
3059 singular, so the solution and error bounds
3060 could not be computed. rcond = 0 is returned.
3061 = N+1: U is nonsingular, but rcond is less than machine
3062 precision, meaning that the matrix is singular
3063 to working precision. Nevertheless, the
3064 solution and error bounds are computed because
3065 there are a number of situations where the
3066 computed solution can be more accurate than the
3067 value of rcond would suggest.
3068
3069 =for example
3070
3071 $a= random(5,5);
3072 $b = random(5,5);
3073 $a = transpose($a);
3074 $b = transpose($b);
3075 $rcond = pdl(0);
3076 $rpvgrw = pdl(0);
3077 $equed = pdl(long,0);
3078 $info = pdl(long,0);
3079 $berr = zeroes(5);
3080 $ipiv = zeroes(5);
3081 $ferr = zeroes(5);
3082 $r = zeroes(5);
3083 $c = zeroes(5);
3084 $X = zeroes(5,5);
3085 $af = zeroes(5,5);
3086 gesvx($a,0, 2, $b, $af, $ipiv, $equed, $r, $c, $X, $rcond, $ferr, $berr, $rpvgrw, $info);
3087 print "The solution matrix X is :". transpose($X)."\n" unless $info;
3088
3089 =pod
3090
3091 Broadcasts over its inputs.
3092
3093 =for bad
3094
3095 C<gesvx> ignores the bad-value flag of the input ndarrays.
3096 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3097
3098 =cut
3099
3100
3101
3102
3103 *gesvx = \&PDL::gesvx;
3104
3105
3106
3107
3108
3109
3110 =head2 sysv
3111
3112 =for sig
3113
3114 Signature: ([io]A(n,n); int uplo(); [io]B(n,m); int [o]ipiv(n); int [o]info())
3115 Types: (float double)
3116
3117 =for usage
3118
3119 ($ipiv, $info) = sysv($A, $uplo, $B);
3120 sysv($A, $uplo, $B, $ipiv, $info); # all arguments given
3121 ($ipiv, $info) = $A->sysv($uplo, $B); # method call
3122 $A->sysv($uplo, $B, $ipiv, $info);
3123
3124 =for ref
3125
3126 Computes the solution to a real system of linear equations
3127
3128 A * X = B,
3129 where A is an N-by-N symmetric matrix and X and B are N-by-NRHS
3130 matrices.
3131
3132 The diagonal pivoting method is used to factor A as
3133
3134 A = U * D * U', if uplo = 0, or
3135 A = L * D * L', if uplo = 1,
3136 where U (or L) is a product of permutation and unit upper (lower)
3137 triangular matrices, and D is symmetric and block diagonal with
3138 1-by-1 and 2-by-2 diagonal blocks.
3139
3140 The factored form of A is then
3141 used to solve the system of equations A * X = B.
3142
3143 Arguments
3144 =========
3145
3146 uplo: = 0: Upper triangle of A is stored;
3147 = 1: Lower triangle of A is stored.
3148
3149 A: On entry, the symmetric matrix A. If uplo = 0, the leading
3150 N-by-N upper triangular part of A contains the upper
3151 triangular part of the matrix A, and the strictly lower
3152 triangular part of A is not referenced. If uplo = 1, the
3153 leading N-by-N lower triangular part of A contains the lower
3154 triangular part of the matrix A, and the strictly upper
3155 triangular part of A is not referenced.
3156
3157 On exit, if info = 0, the block diagonal matrix D and the
3158 multipliers used to obtain the factor U or L from the
3159 factorization A = U*D*U' or A = L*D*L' as computed by
3160 sytrf.
3161
3162 ipiv: Details of the interchanges and the block structure of D, as
3163 determined by sytrf. If ipiv(k) > 0, then rows and columns
3164 k and ipiv(k) were interchanged, and D(k,k) is a 1-by-1
3165 diagonal block. If uplo = 0 and ipiv(k) = ipiv(k-1) < 0,
3166 then rows and columns k-1 and -ipiv(k) were interchanged and
3167 D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If uplo = 1 and
3168 ipiv(k) = ipiv(k+1) < 0, then rows and columns k+1 and
3169 -ipiv(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2
3170 diagonal block.
3171
3172 B: On entry, the N-by-NRHS right hand side matrix B.
3173 On exit, if info = 0, the N-by-NRHS solution matrix X.
3174
3175 info: = 0: successful exit
3176 < 0: if info = -i, the i-th argument had an illegal value
3177 > 0: if info = i, D(i,i) is exactly zero. The factorization
3178 has been completed, but the block diagonal matrix D is
3179 exactly singular, so the solution could not be computed.
3180
3181 =for example
3182
3183 # Assume $a is symmetric ;)
3184 $a = random (5,5);
3185 $a = transpose($a);
3186 $b = random(4,5);
3187 $b = transpose($b);
3188 sysv($a, 1, $b, (my $ipiv=zeroes(5)),(my $info=null));
3189 print "The solution matrix X is :". transpose($b)."\n" unless $info;
3190
3191 =pod
3192
3193 Broadcasts over its inputs.
3194
3195 =for bad
3196
3197 C<sysv> ignores the bad-value flag of the input ndarrays.
3198 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3199
3200 =cut
3201
3202
3203
3204
3205 *sysv = \&PDL::sysv;
3206
3207
3208
3209
3210
3211
3212 =head2 sysvx
3213
3214 =for sig
3215
3216 Signature: (A(n,n); int uplo(); int fact(); B(n,m); [io]af(n,n); int [io]ipiv(n); [o]X(n,m); [o]rcond(); [o]ferr(m); [o]berr(m); int [o]info(); int [t]iwork(n))
3217 Types: (float double)
3218
3219 =for usage
3220
3221 ($X, $rcond, $ferr, $berr, $info) = sysvx($A, $uplo, $fact, $B, $af, $ipiv);
3222 sysvx($A, $uplo, $fact, $B, $af, $ipiv, $X, $rcond, $ferr, $berr, $info); # all arguments given
3223 ($X, $rcond, $ferr, $berr, $info) = $A->sysvx($uplo, $fact, $B, $af, $ipiv); # method call
3224 $A->sysvx($uplo, $fact, $B, $af, $ipiv, $X, $rcond, $ferr, $berr, $info);
3225
3226 =for ref
3227
3228 Uses the diagonal pivoting factorization to compute the
3229 solution to a real system of linear equations A * X = B,
3230 where A is an N-by-N symmetric matrix and X and B are N-by-NRHS
3231 matrices.
3232
3233 Error bounds on the solution and a condition estimate are also
3234 provided.
3235
3236 The following steps are performed:
3237
3238 =over 3
3239
3240 =item 1
3241
3242 If fact = 0, the diagonal pivoting method is used to factor A.
3243 The form of the factorization is
3244
3245 A = U * D * U', if uplo = 0, or
3246 A = L * D * L', if uplo = 1,
3247 where U (or L) is a product of permutation and unit upper (lower)
3248 triangular matrices, and D is symmetric and block diagonal with
3249 1-by-1 and 2-by-2 diagonal blocks.
3250
3251 =item 2
3252
3253 If some D(i,i)=0, so that D is exactly singular, then the routine
3254 returns with info = i. Otherwise, the factored form of A is used
3255 to estimate the condition number of the matrix A. If the
3256 reciprocal of the condition number is less than machine precision,
3257 info = N+1 is returned as a warning, but the routine still goes on
3258 to solve for X and compute error bounds as described below.
3259
3260 =item 3
3261
3262 The system of equations is solved for X using the factored form
3263 of A.
3264
3265 =item 4
3266
3267 Iterative refinement is applied to improve the computed solution
3268 matrix and calculate error bounds and backward error estimates
3269 for it.
3270
3271 =back
3272
3273 Arguments
3274 =========
3275
3276 fact: Specifies whether or not the factored form of A has been
3277 supplied on entry.
3278 = 0: The matrix A will be copied to af and factored.
3279 = 1: On entry, af and ipiv contain the factored form of
3280 A. af and ipiv will not be modified.
3281
3282 uplo: = 0: Upper triangle of A is stored;
3283 = 1: Lower triangle of A is stored.
3284
3285 A: The symmetric matrix A. If uplo = 0, the leading N-by-N
3286 upper triangular part of A contains the upper triangular part
3287 of the matrix A, and the strictly lower triangular part of A
3288 is not referenced. If uplo = 1, the leading N-by-N lower
3289 triangular part of A contains the lower triangular part of
3290 the matrix A, and the strictly upper triangular part of A is
3291 not referenced.
3292
3293 af: If fact = 1, then af is an input argument and on entry
3294 contains the block diagonal matrix D and the multipliers used
3295 to obtain the factor U or L from the factorization
3296 A = U*D*U' or A = L*D*L' as computed by sytrf.
3297
3298 If fact = 0, then af is an output argument and on exit
3299 returns the block diagonal matrix D and the multipliers used
3300 to obtain the factor U or L from the factorization
3301 A = U*D*U' or A = L*D*L'.
3302
3303 ipiv: If fact = 1, then ipiv is an input argument and on entry
3304 contains details of the interchanges and the block structure
3305 of D, as determined by sytrf.
3306 If ipiv(k) > 0, then rows and columns k and ipiv(k) were
3307 interchanged and D(k,k) is a 1-by-1 diagonal block.
3308 If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, then rows and
3309 columns k-1 and -ipiv(k) were interchanged and D(k-1:k,k-1:k)
3310 is a 2-by-2 diagonal block. If uplo = 1 and ipiv(k) =
3311 ipiv(k+1) < 0, then rows and columns k+1 and -ipiv(k) were
3312 interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
3313
3314 If fact = 0, then ipiv is an output argument and on exit
3315 contains details of the interchanges and the block structure
3316 of D, as determined by sytrf.
3317
3318 B: The N-by-NRHS right hand side matrix B.
3319
3320 X: If info = 0 or info = N+1, the N-by-NRHS solution matrix X.
3321
3322 rcond: The estimate of the reciprocal condition number of the matrix
3323 A. If rcond is less than the machine precision (in
3324 particular, if rcond = 0), the matrix is singular to working
3325 precision. This condition is indicated by a return code of
3326 info > 0.
3327
3328 ferr: The estimated forward error bound for each solution vector
3329 X(j) (the j-th column of the solution matrix X).
3330 If XTRUE is the true solution corresponding to X(j), ferr(j)
3331 is an estimated upper bound for the magnitude of the largest
3332 element in (X(j) - XTRUE) divided by the magnitude of the
3333 largest element in X(j). The estimate is as reliable as
3334 the estimate for rcond, and is almost always a slight
3335 overestimate of the true error.
3336
3337 berr: The componentwise relative backward error of each solution
3338 vector X(j) (i.e., the smallest relative change in
3339 any element of A or B that makes X(j) an exact solution).
3340
3341 info: = 0: successful exit
3342 < 0: if info = -i, the i-th argument had an illegal value
3343 > 0: if info = i, and i is
3344 <= N: D(i,i) is exactly zero. The factorization
3345 has been completed but the factor D is exactly
3346 singular, so the solution and error bounds could
3347 not be computed. rcond = 0 is returned.
3348 = N+1: D is nonsingular, but rcond is less than machine
3349 precision, meaning that the matrix is singular
3350 to working precision. Nevertheless, the
3351 solution and error bounds are computed because
3352 there are a number of situations where the
3353 computed solution can be more accurate than the
3354 value of rcond would suggest.
3355
3356 =for example
3357
3358 $a= random(5,5);
3359 $b = random(10,5);
3360 $a = transpose($a);
3361 $b = transpose($b);
3362 $X = zeroes($b);
3363 $af = zeroes($a);
3364 $ipiv = zeroes(long, 5);
3365 $rcond = pdl(0);
3366 $ferr = zeroes(10);
3367 $berr = zeroes(10);
3368 $info = pdl(long, 0);
3369 # Assume $a is symmetric
3370 sysvx($a, 0, 0, $b,$af, $ipiv, $X, $rcond, $ferr, $berr,$info);
3371 print "The solution matrix X is :". transpose($X)."\n";
3372
3373 =pod
3374
3375 Broadcasts over its inputs.
3376
3377 =for bad
3378
3379 C<sysvx> ignores the bad-value flag of the input ndarrays.
3380 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3381
3382 =cut
3383
3384
3385
3386
3387 *sysvx = \&PDL::sysvx;
3388
3389
3390
3391
3392
3393
3394 =head2 posv
3395
3396 =for sig
3397
3398 Signature: ([io]A(n,n); int uplo(); [io]B(n,m); int [o]info())
3399 Types: (float double)
3400
3401 =for usage
3402
3403 $info = posv($A, $uplo, $B);
3404 posv($A, $uplo, $B, $info); # all arguments given
3405 $info = $A->posv($uplo, $B); # method call
3406 $A->posv($uplo, $B, $info);
3407
3408 =for ref
3409
3410 Computes the solution to a real system of linear equations
3411
3412 A * X = B,
3413 where A is an N-by-N symmetric positive definite matrix and X and B
3414 are N-by-NRHS matrices.
3415
3416 The Cholesky decomposition is used to factor A as
3417
3418 A = U'* U, if uplo = 0, or
3419 A = L * L', if uplo = 1,
3420 where U is an upper triangular matrix and L is a lower triangular
3421 matrix.
3422
3423 The factored form of A is then used to solve the system of
3424 equations A * X = B.
3425
3426 Arguments
3427 =========
3428
3429 uplo: = 0: Upper triangle of A is stored;
3430 = 1: Lower triangle of A is stored.
3431
3432 A: On entry, the symmetric matrix A. If uplo = 0, the leading
3433 N-by-N upper triangular part of A contains the upper
3434 triangular part of the matrix A, and the strictly lower
3435 triangular part of A is not referenced. If uplo = 1, the
3436 leading N-by-N lower triangular part of A contains the lower
3437 triangular part of the matrix A, and the strictly upper
3438 triangular part of A is not referenced.
3439
3440 On exit, if info = 0, the factor U or L from the Cholesky
3441 factorization A = U'*U or A = L*L'.
3442
3443 B: On entry, the N-by-NRHS right hand side matrix B.
3444 On exit, if info = 0, the N-by-NRHS solution matrix X.
3445
3446 info: = 0: successful exit
3447 < 0: if info = -i, the i-th argument had an illegal value
3448 > 0: if info = i, the leading minor of order i of A is not
3449 positive definite, so the factorization could not be
3450 completed, and the solution has not been computed.
3451
3452 =for example
3453
3454 # Assume $a is symmetric positive definite ;)
3455 $a = random (5,5);
3456 $a = transpose($a);
3457 $b = random(4,5);
3458 $b = transpose($b);
3459 posv($a, 1, $b, (my $info=null));
3460 print "The solution matrix X is :". transpose($b)."\n" unless $info;
3461
3462 =pod
3463
3464 Broadcasts over its inputs.
3465
3466 =for bad
3467
3468 C<posv> ignores the bad-value flag of the input ndarrays.
3469 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3470
3471 =cut
3472
3473
3474
3475
3476 *posv = \&PDL::posv;
3477
3478
3479
3480
3481
3482
3483 =head2 posvx
3484
3485 =for sig
3486
3487 Signature: ([io]A(n,n); int uplo(); int fact(); [io]B(n,m); [io]af(n,n); int [io]equed(); [o]s(p); [o]X(n,m); [o]rcond(); [o]ferr(m); [o]berr(m); int [o]info(); int [t]iwork(n); [t]work(workn=CALC(3*$SIZE(n))))
3488 Types: (float double)
3489
3490 =for usage
3491
3492 ($s, $X, $rcond, $ferr, $berr, $info) = posvx($A, $uplo, $fact, $B, $af, $equed);
3493 posvx($A, $uplo, $fact, $B, $af, $equed, $s, $X, $rcond, $ferr, $berr, $info); # all arguments given
3494 ($s, $X, $rcond, $ferr, $berr, $info) = $A->posvx($uplo, $fact, $B, $af, $equed); # method call
3495 $A->posvx($uplo, $fact, $B, $af, $equed, $s, $X, $rcond, $ferr, $berr, $info);
3496
3497 =for ref
3498
3499 Uses the Cholesky factorization A = U'*U or A = L*L' to
3500 compute the solution to a real system of linear equations
3501
3502 A * X = B,
3503 where A is an N-by-N symmetric positive definite matrix and X and B
3504 are N-by-NRHS matrices.
3505
3506 Error bounds on the solution and a condition estimate are also
3507 provided.
3508
3509 The following steps are performed:
3510
3511 =over 3
3512
3513 =item 1
3514
3515 If fact = 2, real scaling factors are computed to equilibrate
3516 the system:
3517
3518 diag(s) * A * diag(s) * inv(diag(s)) * X = diag(s) * B
3519
3520 Whether or not the system will be equilibrated depends on the
3521 scaling of the matrix A, but if equilibration is used, A is
3522 overwritten by diag(s)*A*diag(s) and B by diag(s)*B.
3523
3524 =item 2
3525
3526 If fact = 1 or 2, the Cholesky decomposition is used to
3527 factor the matrix A (after equilibration if fact = 2) as
3528
3529 A = U'* U, if uplo = 0, or
3530 A = L * L', if uplo = 1,
3531 where U is an upper triangular matrix and L is a lower triangular
3532 matrix.
3533
3534 =item 3
3535
3536 If the leading i-by-i principal minor is not positive definite,
3537 then the routine returns with info = i. Otherwise, the factored
3538 form of A is used to estimate the condition number of the matrix
3539 A. If the reciprocal of the condition number is less than machine
3540 precision, info = N+1 is returned as a warning, but the routine
3541 still goes on to solve for X and compute error bounds as
3542 described below.
3543
3544 =item 4
3545
3546 The system of equations is solved for X using the factored form
3547 of A.
3548
3549 =item 5
3550
3551 Iterative refinement is applied to improve the computed solution
3552 matrix and calculate error bounds and backward error estimates
3553 for it.
3554
3555 =item 6
3556
3557 If equilibration was used, the matrix X is premultiplied by
3558 diag(s) so that it solves the original system before
3559 equilibration.
3560
3561 =back
3562
3563 Arguments
3564 =========
3565
3566 fact: Specifies whether or not the factored form of the matrix A is
3567 supplied on entry, and if not, whether the matrix A should be
3568 equilibrated before it is factored.
3569 = 0: On entry, af contains the factored form of A.
3570 If equed = 1, the matrix A has been equilibrated
3571 with scaling factors given by s. A and af will not
3572 be modified.
3573 = 1: The matrix A will be copied to af and factored.
3574 = 2: The matrix A will be equilibrated if necessary, then
3575 copied to af and factored.
3576
3577 uplo: = 0: Upper triangle of A is stored;
3578 = 1: Lower triangle of A is stored.
3579
3580 A: On entry, the symmetric matrix A, except if fact = 0 and
3581 equed = 1, then A must contain the equilibrated matrix
3582 diag(s)*A*diag(s). If uplo = 0, the leading
3583 N-by-N upper triangular part of A contains the upper
3584 triangular part of the matrix A, and the strictly lower
3585 triangular part of A is not referenced. If uplo = 1, the
3586 leading N-by-N lower triangular part of A contains the lower
3587 triangular part of the matrix A, and the strictly upper
3588 triangular part of A is not referenced. A is not modified if
3589 fact = 0 or 1, or if fact = 2 and equed = 0 on exit.
3590
3591 On exit, if fact = 2 and equed = 1, A is overwritten by
3592 diag(s)*A*diag(s).
3593
3594 af: If fact = 0, then af is an input argument and on entry
3595 contains the triangular factor U or L from the Cholesky
3596 factorization A = U'*U or A = L*L', in the same storage
3597 format as A. If equed != 0, then af is the factored form
3598 of the equilibrated matrix diag(s)*A*diag(s).
3599
3600 If fact = 1, then af is an output argument and on exit
3601 returns the triangular factor U or L from the Cholesky
3602 factorization A = U'*U or A = L*L' of the original
3603 matrix A.
3604
3605 If fact = 2, then af is an output argument and on exit
3606 returns the triangular factor U or L from the Cholesky
3607 factorization A = U'*U or A = L*L' of the equilibrated
3608 matrix A (see the description of A for the form of the
3609 equilibrated matrix).
3610
3611 equed: Specifies the form of equilibration that was done.
3612 = 0: No equilibration (always true if fact = 1).
3613 = 1: Equilibration was done, i.e., A has been replaced by
3614 diag(s) * A * diag(s).
3615 equed is an input argument if fact = 0; otherwise, it is an
3616 output argument.
3617
3618 s: The scale factors for A; not accessed if equed = 0. s is
3619 an input argument if fact = 0; otherwise, s is an output
3620 argument. If fact = 0 and equed = 1, each element of s
3621 must be positive.
3622
3623 B: On entry, the N-by-NRHS right hand side matrix B.
3624 On exit, if equed = 0, B is not modified; if equed = 1,
3625 B is overwritten by diag(s) * B.
3626
3627 X: If info = 0 or info = N+1, the N-by-NRHS solution matrix X to
3628 the original system of equations. Note that if equed = 1,
3629 A and B are modified on exit, and the solution to the
3630 equilibrated system is inv(diag(s))*X.
3631
3632 rcond: The estimate of the reciprocal condition number of the matrix
3633 A after equilibration (if done). If rcond is less than the
3634 machine precision (in particular, if rcond = 0), the matrix
3635 is singular to working precision. This condition is
3636 indicated by a return code of info > 0.
3637
3638 ferr: The estimated forward error bound for each solution vector
3639 X(j) (the j-th column of the solution matrix X).
3640 If XTRUE is the true solution corresponding to X(j), FERR(j)
3641 is an estimated upper bound for the magnitude of the largest
3642 element in (X(j) - XTRUE) divided by the magnitude of the
3643 largest element in X(j). The estimate is as reliable as
3644 the estimate for rcond, and is almost always a slight
3645 overestimate of the true error.
3646
3647 berr: The componentwise relative backward error of each solution
3648 vector X(j) (i.e., the smallest relative change in
3649 any element of A or B that makes X(j) an exact solution).
3650
3651 info: = 0: successful exit
3652 < 0: if info = -i, the i-th argument had an illegal value
3653 > 0: if info = i, and i is
3654 <= N: the leading minor of order i of A is
3655 not positive definite, so the factorization
3656 could not be completed, and the solution has not
3657 been computed. rcond = 0 is returned.
3658 = N+1: U is nonsingular, but rcond is less than machine
3659 precision, meaning that the matrix is singular
3660 to working precision. Nevertheless, the
3661 solution and error bounds are computed because
3662 there are a number of situations where the
3663 computed solution can be more accurate than the
3664 value of rcond would suggest.
3665
3666 =for example
3667
3668 $a= random(5,5);
3669 $b = random(5,5);
3670 $a = transpose($a);
3671 $b = transpose($b);
3672 # Assume $a is symmetric positive definite
3673 $rcond = pdl(0);
3674 $equed = pdl(long,0);
3675 $info = pdl(long,0);
3676 $berr = zeroes(5);
3677 $ferr = zeroes(5);
3678 $s = zeroes(5);
3679 $X = zeroes(5,5);
3680 $af = zeroes(5,5);
3681 posvx($a,0,2,$b,$af, $equed, $s, $X, $rcond, $ferr, $berr,$info);
3682 print "The solution matrix X is :". transpose($X)."\n" unless $info;
3683
3684 =pod
3685
3686 Broadcasts over its inputs.
3687
3688 =for bad
3689
3690 C<posvx> ignores the bad-value flag of the input ndarrays.
3691 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3692
3693 =cut
3694
3695
3696
3697
3698 *posvx = \&PDL::posvx;
3699
3700
3701
3702
3703
3704
3705 =head2 gels
3706
3707 =for sig
3708
3709 Signature: ([io]A(m,n); int trans(); [io]B(p,q);int [o]info())
3710 Types: (float double)
3711
3712 =for usage
3713
3714 $info = gels($A, $trans, $B);
3715 gels($A, $trans, $B, $info); # all arguments given
3716 $info = $A->gels($trans, $B); # method call
3717 $A->gels($trans, $B, $info);
3718
3719 =for ref
3720
3721 Solves overdetermined or underdetermined real linear systems
3722 involving an M-by-N matrix A, or its transpose, using a QR or LQ
3723 factorization of A. It is assumed that A has full rank.
3724
3725 The following options are provided:
3726
3727 =over 3
3728
3729 =item 1
3730
3731 If trans = 0 and m >= n: find the least squares solution of
3732 an overdetermined system, i.e., solve the least squares problem
3733 minimize || B - A*X ||.
3734
3735 =item 2
3736
3737 If trans = 0 and m < n: find the minimum norm solution of
3738 an underdetermined system A * X = B.
3739
3740 =item 3
3741
3742 If trans = 1 and m >= n: find the minimum norm solution of
3743 an undetermined system A' * X = B.
3744
3745 =item 4
3746
3747 If trans = 1 and m < n: find the least squares solution of
3748 an overdetermined system, i.e., solve the least squares problem
3749 minimize || B - A' * X ||.
3750
3751 =back
3752
3753 Several right hand side vectors b and solution vectors x can be
3754 handled in a single call; they are stored as the columns of the
3755 M-by-NRHS right hand side matrix B and the N-by-NRHS solution
3756 matrix X.
3757
3758 Arguments
3759 =========
3760
3761 trans: = 0: the linear system involves A;
3762 = 1: the linear system involves A'.
3763
3764 A: On entry, the M-by-N matrix A.
3765 On exit,
3766 if M >= N, A is overwritten by details of its QR
3767 factorization as returned by geqrf;
3768 if M < N, A is overwritten by details of its LQ
3769 factorization as returned by gelqf.
3770
3771 B: On entry, the matrix B of right hand side vectors, stored
3772 columnwise; B is M-by-NRHS if trans = 0, or N-by-NRHS
3773 if trans = 1.
3774 On exit, B is overwritten by the solution vectors, stored
3775 columnwise:
3776 if trans = 0 and m >= n, rows 1 to n of B contain the least
3777 squares solution vectors; the residual sum of squares for the
3778 solution in each column is given by the sum of squares of
3779 elements N+1 to M in that column;
3780 if trans = 0 and m < n, rows 1 to N of B contain the
3781 minimum norm solution vectors;
3782 if trans = 1 and m >= n, rows 1 to M of B contain the
3783 minimum norm solution vectors;
3784 if trans = 1 and m < n, rows 1 to M of B contain the
3785 least squares solution vectors; the residual sum of squares
3786 for the solution in each column is given by the sum of
3787 squares of elements M+1 to N in that column.
3788 The leading dimension of the array B >= max(1,M,N).
3789
3790 info: = 0: successful exit
3791 < 0: if info = -i, the i-th argument had an illegal value
3792
3793 =for example
3794
3795 $a= random(7,5);
3796 # $b will contain X
3797 # TODO better example with slice
3798 $b = random(7,6);
3799 gels($a, 1, $b, ($info = null));
3800
3801 =pod
3802
3803 Broadcasts over its inputs.
3804
3805 =for bad
3806
3807 C<gels> ignores the bad-value flag of the input ndarrays.
3808 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3809
3810 =cut
3811
3812
3813
3814
3815 *gels = \&PDL::gels;
3816
3817
3818
3819
3820
3821
3822 =head2 gelsy
3823
3824 =for sig
3825
3826 Signature: ([io]A(m,n); [io]B(p,q); rcond(); int [io]jpvt(n); int [o]rank();int [o]info())
3827 Types: (float double)
3828
3829 =for usage
3830
3831 ($rank, $info) = gelsy($A, $B, $rcond, $jpvt);
3832 gelsy($A, $B, $rcond, $jpvt, $rank, $info); # all arguments given
3833 ($rank, $info) = $A->gelsy($B, $rcond, $jpvt); # method call
3834 $A->gelsy($B, $rcond, $jpvt, $rank, $info);
3835
3836 =for ref
3837
3838 Computes the minimum-norm solution to a real linear least
3839 squares problem:
3840
3841 minimize || A * X - B ||
3842
3843 using a complete orthogonal factorization of A.
3844
3845 A is an M-by-N matrix which may be rank-deficient.
3846
3847 Several right hand side vectors b and solution vectors x can be
3848 handled in a single call; they are stored as the columns of the
3849 M-by-NRHS right hand side matrix B and the N-by-NRHS solution
3850 matrix X.
3851
3852 The routine first computes a QR factorization with column pivoting:
3853
3854 A * P = Q * [ R11 R12 ]
3855 [ 0 R22 ]
3856
3857 with R11 defined as the largest leading submatrix whose estimated
3858 condition number is less than 1/rcond. The order of R11, rank,
3859 is the effective rank of A.
3860
3861 Then, R22 is considered to be negligible, and R12 is annihilated
3862 by orthogonal transformations from the right, arriving at the
3863 complete orthogonal factorization:
3864
3865 A * P = Q * [ T11 0 ] * Z
3866 [ 0 0 ]
3867
3868 The minimum-norm solution is then
3869
3870 X = P * Z' [ inv(T11)*Q1'*B ]
3871 [ 0 ]
3872 where Q1 consists of the first rank columns of Q.
3873
3874 Arguments
3875 =========
3876
3877 A: On entry, the M-by-N matrix A.
3878 On exit, A has been overwritten by details of its
3879 complete orthogonal factorization.
3880
3881 B: On entry, the M-by-NRHS right hand side matrix B.
3882 On exit, the N-by-NRHS solution matrix X.
3883 The leading dimension of the array B >= max(1,M,N).
3884
3885 jpvt: On entry, if jpvt(i) != 0, the i-th column of A is permuted
3886 to the front of AP, otherwise column i is a free column.
3887 On exit, if jpvt(i) = k, then the i-th column of AP
3888 was the k-th column of A.
3889
3890 rcond: rcond is used to determine the effective rank of A, which
3891 is defined as the order of the largest leading triangular
3892 submatrix R11 in the QR factorization with pivoting of A,
3893 whose estimated condition number < 1/rcond.
3894
3895 rank: The effective rank of A, i.e., the order of the submatrix
3896 R11. This is the same as the order of the submatrix T11
3897 in the complete orthogonal factorization of A.
3898
3899 info: = 0: successful exit
3900 < 0: If info = -i, the i-th argument had an illegal value.
3901
3902 =for example
3903
3904 $a= random(7,5);
3905 # $b will contain X
3906 # TODO better example with slice
3907 $b = random(7,6);
3908 $jpvt = zeroes(long, 5);
3909 $eps = lamch(0);
3910 #Threshold for rank estimation
3911 $rcond = sqrt($eps) - (sqrt($eps) - $eps) / 2;
3912 gelsy($a, $b, $rcond, $jpvt,($rank=null),($info = null));
3913
3914 =pod
3915
3916 Broadcasts over its inputs.
3917
3918 =for bad
3919
3920 C<gelsy> ignores the bad-value flag of the input ndarrays.
3921 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
3922
3923 =cut
3924
3925
3926
3927
3928 *gelsy = \&PDL::gelsy;
3929
3930
3931
3932
3933
3934
3935 =head2 gelss
3936
3937 =for sig
3938
3939 Signature: ([io]A(m,n); [io]B(p,q); rcond(); [o]s(r); int [o]rank();int [o]info())
3940 Types: (float double)
3941
3942 =for usage
3943
3944 ($s, $rank, $info) = gelss($A, $B, $rcond);
3945 gelss($A, $B, $rcond, $s, $rank, $info); # all arguments given
3946 ($s, $rank, $info) = $A->gelss($B, $rcond); # method call
3947 $A->gelss($B, $rcond, $s, $rank, $info);
3948
3949 =for ref
3950
3951 Computes the minimum norm solution to a real linear least
3952 squares problem:
3953
3954 Minimize 2-norm(| b - A*x |).
3955
3956 using the singular value decomposition (SVD) of A. A is an M-by-N
3957 matrix which may be rank-deficient.
3958
3959 Several right hand side vectors b and solution vectors x can be
3960 handled in a single call; they are stored as the columns of the
3961 M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix
3962 X.
3963
3964 The effective rank of A is determined by treating as zero those
3965 singular values which are less than rcond times the largest singular
3966 value.
3967
3968 Arguments
3969 =========
3970
3971 A: On entry, the M-by-N matrix A.
3972 On exit, the first min(m,n) rows of A are overwritten with
3973 its right singular vectors, stored rowwise.
3974
3975 B: On entry, the M-by-NRHS right hand side matrix B.
3976 On exit, B is overwritten by the N-by-NRHS solution
3977 matrix X. If m >= n and rank = n, the residual
3978 sum-of-squares for the solution in the i-th column is given
3979 by the sum of squares of elements n+1:m in that column.
3980 The leading dimension of the array B >= max(1,M,N).
3981
3982 s: The singular values of A in decreasing order.
3983 The condition number of A in the 2-norm = s(1)/s(min(m,n)).
3984
3985 rcond: rcond is used to determine the effective rank of A.
3986 Singular values s(i) <= rcond*s(1) are treated as zero.
3987 If rcond < 0, machine precision is used instead.
3988
3989 rank: The effective rank of A, i.e., the number of singular values
3990 which are greater than rcond*s(1).
3991
3992 info: = 0: successful exit
3993 < 0: if info = -i, the i-th argument had an illegal value.
3994 > 0: the algorithm for computing the SVD failed to converge;
3995 if info = i, i off-diagonal elements of an intermediate
3996 bidiagonal form did not converge to zero.
3997
3998 =for example
3999
4000 $a= random(7,5);
4001 # $b will contain X
4002 # TODO better example with slice
4003 $b = random(7,6);
4004 $eps = lamch(0);
4005 $s =zeroes(5);
4006 #Threshold for rank estimation
4007 $rcond = sqrt($eps) - (sqrt($eps) - $eps) / 2;
4008 gelss($a, $b, $rcond, $s, ($rank=null),($info = null));
4009
4010 =pod
4011
4012 Broadcasts over its inputs.
4013
4014 =for bad
4015
4016 C<gelss> ignores the bad-value flag of the input ndarrays.
4017 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4018
4019 =cut
4020
4021
4022
4023
4024 *gelss = \&PDL::gelss;
4025
4026
4027
4028
4029
4030
4031 =head2 gelsd
4032
4033 =for sig
4034
4035 Signature: ([io]A(m,n); [io]B(p,q); rcond(); [o]s(minmn=CALC(PDLMAX(1,PDLMIN($SIZE(m),$SIZE(n))))); int [o]rank();int [o]info(); int [t]iwork(iworkn))
4036 Types: (float double)
4037
4038 =for usage
4039
4040 ($s, $rank, $info) = gelsd($A, $B, $rcond);
4041 gelsd($A, $B, $rcond, $s, $rank, $info); # all arguments given
4042 ($s, $rank, $info) = $A->gelsd($B, $rcond); # method call
4043 $A->gelsd($B, $rcond, $s, $rank, $info);
4044
4045 =for ref
4046
4047 Computes the minimum-norm solution to a real linear least
4048 squares problem:
4049
4050 minimize 2-norm(| b - A*x |)
4051
4052 using the singular value decomposition (SVD) of A. A is an M-by-N
4053 matrix which may be rank-deficient.
4054
4055 Several right hand side vectors b and solution vectors x can be
4056 handled in a single call; they are stored as the columns of the
4057 M-by-NRHS right hand side matrix B and the N-by-NRHS solution
4058 matrix X.
4059
4060 The problem is solved in three steps:
4061
4062 =over 3
4063
4064 =item 1
4065
4066 Reduce the coefficient matrix A to bidiagonal form with
4067 Householder transformations, reducing the original problem
4068 into a "bidiagonal least squares problem" (BLS)
4069
4070 =item 2
4071
4072 Solve the BLS using a divide and conquer approach.
4073
4074 =item 3
4075
4076 Apply back all the Householder transformations to solve
4077 the original least squares problem.
4078
4079 =back
4080
4081 The effective rank of A is determined by treating as zero those
4082 singular values which are less than rcond times the largest singular
4083 value.
4084
4085 The divide and conquer algorithm makes very mild assumptions about
4086 floating point arithmetic. It will work on machines with a guard
4087 digit in add/subtract, or on those binary machines without guard
4088 digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
4089 Cray-2. It could conceivably fail on hexadecimal or decimal machines
4090 without guard digits, but we know of none.
4091
4092 Arguments
4093 =========
4094
4095 A: On entry, the M-by-N matrix A.
4096 On exit, A has been destroyed.
4097
4098 B: On entry, the M-by-NRHS right hand side matrix B.
4099 On exit, B is overwritten by the N-by-NRHS solution
4100 matrix X. If m >= n and rank = n, the residual
4101 sum-of-squares for the solution in the i-th column is given
4102 by the sum of squares of elements n+1:m in that column.
4103 The leading dimension of the array B >= max(1,M,N).
4104
4105 s: The singular values of A in decreasing order.
4106 The condition number of A in the 2-norm = s(1)/s(min(m,n)).
4107
4108 rcond: rcond is used to determine the effective rank of A.
4109 Singular values s(i) <= rcond*s(1) are treated as zero.
4110 If rcond < 0, machine precision is used instead.
4111
4112 rank: The effective rank of A, i.e., the number of singular values
4113 which are greater than rcond*s(1).
4114
4115 info: = 0: successful exit
4116 < 0: if info = -i, the i-th argument had an illegal value.
4117 > 0: the algorithm for computing the SVD failed to converge;
4118 if info = i, i off-diagonal elements of an intermediate
4119 bidiagonal form did not converge to zero.
4120
4121 =for example
4122
4123 $a= random(7,5);
4124 # $b will contain X
4125 # TODO better example with slice
4126 $b = random(7,6);
4127 $eps = lamch(0);
4128 $s =zeroes(5);
4129 #Threshold for rank estimation
4130 $rcond = sqrt($eps) - (sqrt($eps) - $eps) / 2;
4131 gelsd($a, $b, $rcond, $s, ($rank=null),($info = null));
4132
4133 =pod
4134
4135 Broadcasts over its inputs.
4136
4137 =for bad
4138
4139 C<gelsd> ignores the bad-value flag of the input ndarrays.
4140 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4141
4142 =cut
4143
4144
4145
4146
4147 *gelsd = \&PDL::gelsd;
4148
4149
4150
4151
4152
4153
4154 =head2 gglse
4155
4156 =for sig
4157
4158 Signature: ([io]A(m,n); [io]B(p,n);[io]c(m);[io]d(p);[o]x(n);int [o]info())
4159 Types: (float double)
4160
4161 =for usage
4162
4163 ($x, $info) = gglse($A, $B, $c, $d);
4164 gglse($A, $B, $c, $d, $x, $info); # all arguments given
4165 ($x, $info) = $A->gglse($B, $c, $d); # method call
4166 $A->gglse($B, $c, $d, $x, $info);
4167
4168 =for ref
4169
4170 Solves the linear equality-constrained least squares (LSE)
4171 problem:
4172
4173 minimize || c - A*x ||_2 subject to B*x = d
4174
4175 where A is an M-by-N matrix, B is a P-by-N matrix, c is a given
4176 M-vector, and d is a given P-vector. It is assumed that
4177 P <= N <= M+P, and
4178
4179 rank(B) = P and rank( ( A ) ) = N.
4180 ( ( B ) )
4181
4182 These conditions ensure that the LSE problem has a unique solution,
4183 which is obtained using a GRQ factorization of the matrices B and A.
4184
4185 Arguments
4186 =========
4187
4188 A: On entry, the M-by-N matrix A.
4189 On exit, A is destroyed.
4190
4191 B: On entry, the P-by-N matrix B.
4192 On exit, B is destroyed.
4193
4194 c: On entry, c contains the right hand side vector for the
4195 least squares part of the LSE problem.
4196 On exit, the residual sum of squares for the solution
4197 is given by the sum of squares of elements N-P+1 to M of
4198 vector c.
4199
4200 d: On entry, d contains the right hand side vector for the
4201 constrained equation.
4202 On exit, d is destroyed.
4203
4204 x: On exit, x is the solution of the LSE problem.
4205
4206 info: = 0: successful exit.
4207 < 0: if info = -i, the i-th argument had an illegal value.
4208
4209 =for example
4210
4211 $a = random(7,5);
4212 $b = random(4,5);
4213 $c = random(7);
4214 $d = random(4);
4215 $x = zeroes(5);
4216 gglse($a, $b, $c, $d, $x, ($info=null));
4217
4218 =pod
4219
4220 Broadcasts over its inputs.
4221
4222 =for bad
4223
4224 C<gglse> ignores the bad-value flag of the input ndarrays.
4225 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4226
4227 =cut
4228
4229
4230
4231
4232 *gglse = \&PDL::gglse;
4233
4234
4235
4236
4237
4238
4239 =head2 ggglm
4240
4241 =for sig
4242
4243 Signature: ([io]A(n,m); [io]B(n,p);[io]d(n);[o]x(m);[o]y(p);int [o]info())
4244 Types: (float double)
4245
4246 =for usage
4247
4248 ($x, $y, $info) = ggglm($A, $B, $d);
4249 ggglm($A, $B, $d, $x, $y, $info); # all arguments given
4250 ($x, $y, $info) = $A->ggglm($B, $d); # method call
4251 $A->ggglm($B, $d, $x, $y, $info);
4252
4253 =for ref
4254
4255 Solves a general Gauss-Markov linear model (GLM) problem:
4256
4257 minimize || y ||_2 subject to d = A*x + B*y
4258 x
4259
4260 where A is an N-by-M matrix, B is an N-by-P matrix, and d is a
4261 given N-vector. It is assumed that M <= N <= M+P, and
4262
4263 rank(A) = M and rank( A B ) = N.
4264
4265 Under these assumptions, the constrained equation is always
4266 consistent, and there is a unique solution x and a minimal 2-norm
4267 solution y, which is obtained using a generalized QR factorization
4268 of A and B.
4269
4270 In particular, if matrix B is square nonsingular, then the problem
4271 GLM is equivalent to the following weighted linear least squares
4272 problem
4273
4274 minimize || inv(B)*(d-A*x) ||_2
4275 x
4276
4277 where inv(B) denotes the inverse of B.
4278
4279 Arguments
4280 =========
4281
4282 A: On entry, the N-by-M matrix A.
4283 On exit, A is destroyed.
4284
4285 B: On entry, the N-by-P matrix B.
4286 On exit, B is destroyed.
4287
4288 d: On entry, d is the left hand side of the GLM equation.
4289 On exit, d is destroyed.
4290
4291 x:
4292 y: On exit, x and y are the solutions of the GLM problem.
4293
4294 info: = 0: successful exit.
4295 < 0: if info = -i, the i-th argument had an illegal value.
4296
4297 =for example
4298
4299 $a = random(7,5);
4300 $b = random(7,4);
4301 $d = random(7);
4302 $x = zeroes(5);
4303 $y = zeroes(4);
4304 ggglm($a, $b, $d, $x, $y,($info=null));
4305
4306 =pod
4307
4308 Broadcasts over its inputs.
4309
4310 =for bad
4311
4312 C<ggglm> ignores the bad-value flag of the input ndarrays.
4313 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4314
4315 =cut
4316
4317
4318
4319
4320 *ggglm = \&PDL::ggglm;
4321
4322
4323
4324
4325
4326
4327 =head2 getrf
4328
4329 =for sig
4330
4331 Signature: ([io]A(m,n); int [o]ipiv(p=CALC(PDLMIN($SIZE(m),$SIZE(n)))); int [o]info())
4332 Types: (float double)
4333
4334 =for usage
4335
4336 ($ipiv, $info) = getrf($A);
4337 getrf($A, $ipiv, $info); # all arguments given
4338 ($ipiv, $info) = $A->getrf; # method call
4339 $A->getrf($ipiv, $info);
4340
4341 =for ref
4342
4343 Computes an LU factorization of a general M-by-N matrix A
4344 using partial pivoting with row interchanges.
4345
4346 The factorization has the form
4347
4348 A = P * L * U
4349
4350 where P is a permutation matrix, L is lower triangular with unit
4351 diagonal elements (lower trapezoidal if m > n), and U is upper
4352 triangular (upper trapezoidal if m < n).
4353
4354 This is the right-looking Level 3 BLAS version of the algorithm.
4355
4356 Arguments
4357 =========
4358
4359 A: On entry, the M-by-N matrix to be factored.
4360 On exit, the factors L and U from the factorization
4361 A = P*L*U; the unit diagonal elements of L are not stored.
4362
4363 ipiv: The pivot indices; for 1 <= i <= min(M,N), row i of the
4364 matrix was interchanged with row ipiv(i).
4365
4366 info: = 0: successful exit
4367 < 0: if info = -i, the i-th argument had an illegal value
4368 > 0: if info = i, U(i,i) is exactly zero. The factorization
4369 has been completed, but the factor U is exactly
4370 singular, and division by zero will occur if it is used
4371 to solve a system of equations.
4372
4373 =for example
4374
4375 $a = random (float, 100,50);
4376 $ipiv = zeroes(long, 50);
4377 $info = null;
4378 getrf($a, $ipiv, $info);
4379
4380 =pod
4381
4382 Broadcasts over its inputs.
4383
4384 =for bad
4385
4386 C<getrf> ignores the bad-value flag of the input ndarrays.
4387 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4388
4389 =cut
4390
4391
4392
4393
4394 *getrf = \&PDL::getrf;
4395
4396
4397
4398
4399
4400
4401 =head2 getf2
4402
4403 =for sig
4404
4405 Signature: ([io]A(m,n); int [o]ipiv(p=CALC(PDLMIN($SIZE(m),$SIZE(n)))); int [o]info())
4406 Types: (float double)
4407
4408 =for usage
4409
4410 ($ipiv, $info) = getf2($A);
4411 getf2($A, $ipiv, $info); # all arguments given
4412 ($ipiv, $info) = $A->getf2; # method call
4413 $A->getf2($ipiv, $info);
4414
4415 =for ref
4416
4417 Computes an LU factorization of a general M-by-N matrix A
4418 using partial pivoting with row interchanges.
4419
4420 The factorization has the form
4421
4422 A = P * L * U
4423
4424 where P is a permutation matrix, L is lower triangular with unit
4425 diagonal elements (lower trapezoidal if m > n), and U is upper
4426 triangular (upper trapezoidal if m < n).
4427
4428 This is the right-looking Level 2 BLAS version of the algorithm.
4429
4430 Arguments
4431 =========
4432
4433 A: On entry, the M-by-N matrix to be factored.
4434 On exit, the factors L and U from the factorization
4435 A = P*L*U; the unit diagonal elements of L are not stored.
4436
4437 ipiv: The pivot indices; for 1 <= i <= min(M,N), row i of the
4438 matrix was interchanged with row ipiv(i).
4439
4440 info: = 0: successful exit
4441 < 0: if info = -i, the i-th argument had an illegal value
4442 > 0: if info = i, U(i,i) is exactly zero. The factorization
4443 has been completed, but the factor U is exactly
4444 singular, and division by zero will occur if it is used
4445 to solve a system of equations.
4446
4447 =for example
4448
4449 $a = random (float, 100,50);
4450 $ipiv = zeroes(long, 50);
4451 $info = null;
4452 getf2($a, $ipiv, $info);
4453
4454 =pod
4455
4456 Broadcasts over its inputs.
4457
4458 =for bad
4459
4460 C<getf2> ignores the bad-value flag of the input ndarrays.
4461 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4462
4463 =cut
4464
4465
4466
4467
4468 *getf2 = \&PDL::getf2;
4469
4470
4471
4472
4473
4474
4475 =head2 sytrf
4476
4477 =for sig
4478
4479 Signature: ([io]A(n,n); int uplo(); int [o]ipiv(n); int [o]info())
4480 Types: (float double)
4481
4482 =for usage
4483
4484 ($ipiv, $info) = sytrf($A, $uplo);
4485 sytrf($A, $uplo, $ipiv, $info); # all arguments given
4486 ($ipiv, $info) = $A->sytrf($uplo); # method call
4487 $A->sytrf($uplo, $ipiv, $info);
4488
4489 =for ref
4490
4491 Computes the factorization of a real symmetric matrix A using
4492 the Bunch-Kaufman diagonal pivoting method. The form of the
4493 factorization is
4494
4495 A = U*D*U' or A = L*D*L'
4496 where U (or L) is a product of permutation and unit upper (lower)
4497 triangular matrices, and D is symmetric and block diagonal with
4498 1-by-1 and 2-by-2 diagonal blocks.
4499
4500 This is the blocked version of the algorithm, calling Level 3 BLAS.
4501
4502 Arguments
4503 =========
4504
4505 uplo: = 0: Upper triangle of A is stored;
4506 = 1: Lower triangle of A is stored.
4507
4508 A: On entry, the symmetric matrix A. If uplo = 0, the leading
4509 N-by-N upper triangular part of A contains the upper
4510 triangular part of the matrix A, and the strictly lower
4511 triangular part of A is not referenced. If uplo = 1, the
4512 leading N-by-N lower triangular part of A contains the lower
4513 triangular part of the matrix A, and the strictly upper
4514 triangular part of A is not referenced.
4515
4516 On exit, the block diagonal matrix D and the multipliers used
4517 to obtain the factor U or L (see below for further details).
4518
4519 ipiv: Details of the interchanges and the block structure of D.
4520 If ipiv(k) > 0, then rows and columns k and ipiv(k) were
4521 interchanged and D(k,k) is a 1-by-1 diagonal block.
4522 If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, then rows and
4523 columns k-1 and -ipiv(k) were interchanged and D(k-1:k,k-1:k)
4524 is a 2-by-2 diagonal block. If uplo = 1 and ipiv(k) =
4525 ipiv(k+1) < 0, then rows and columns k+1 and -ipiv(k) were
4526 interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
4527
4528 info: = 0: successful exit
4529 < 0: if info = -i, the i-th argument had an illegal value
4530 > 0: if info = i, D(i,i) is exactly zero. The factorization
4531 has been completed, but the block diagonal matrix D is
4532 exactly singular, and division by zero will occur if it
4533 is used to solve a system of equations.
4534
4535 Further Details
4536 ===============
4537
4538 If uplo = 0, then A = U*D*U', where
4539 U = P(n)*U(n)* ... *P(k)U(k)* ...,
4540 i.e., U is a product of terms P(k)*U(k), where k decreases from n to
4541 1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
4542 and 2-by-2 diagonal blocks D(k). P(k) is a permutation matrix as
4543 defined by ipiv(k), and U(k) is a unit upper triangular matrix, such
4544 that if the diagonal block D(k) is of order s (s = 1 or 2), then
4545
4546 ( I v 0 ) k-s
4547 U(k) = ( 0 I 0 ) s
4548 ( 0 0 I ) n-k
4549 k-s s n-k
4550
4551 If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
4552 If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
4553 and A(k,k), and v overwrites A(1:k-2,k-1:k).
4554
4555 If uplo = 1, then A = L*D*L', where
4556 L = P(1)*L(1)* ... *P(k)*L(k)* ...,
4557 i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
4558 n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
4559 and 2-by-2 diagonal blocks D(k). P(k) is a permutation matrix as
4560 defined by ipiv(k), and L(k) is a unit lower triangular matrix, such
4561 that if the diagonal block D(k) is of order s (s = 1 or 2), then
4562
4563 ( I 0 0 ) k-1
4564 L(k) = ( 0 I 0 ) s
4565 ( 0 v I ) n-k-s+1
4566 k-1 s n-k-s+1
4567
4568 If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
4569 If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
4570 and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).
4571
4572 =for example
4573
4574 $a = random(100,100);
4575 $ipiv = zeroes(100);
4576 $info = null;
4577 # Assume $a is symmetric
4578 sytrf($a, 0, $ipiv, $info);
4579
4580 =pod
4581
4582 Broadcasts over its inputs.
4583
4584 =for bad
4585
4586 C<sytrf> ignores the bad-value flag of the input ndarrays.
4587 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4588
4589 =cut
4590
4591
4592
4593
4594 *sytrf = \&PDL::sytrf;
4595
4596
4597
4598
4599
4600
4601 =head2 sytf2
4602
4603 =for sig
4604
4605 Signature: ([io]A(n,n); int uplo(); int [o]ipiv(n); int [o]info())
4606 Types: (float double)
4607
4608 =for usage
4609
4610 ($ipiv, $info) = sytf2($A, $uplo);
4611 sytf2($A, $uplo, $ipiv, $info); # all arguments given
4612 ($ipiv, $info) = $A->sytf2($uplo); # method call
4613 $A->sytf2($uplo, $ipiv, $info);
4614
4615 =for ref
4616
4617 Computes the factorization of a real symmetric matrix A using
4618 the Bunch-Kaufman diagonal pivoting method. The form of the
4619 factorization is
4620
4621 A = U*D*U' or A = L*D*L'
4622 where U (or L) is a product of permutation and unit upper (lower)
4623 triangular matrices, and D is symmetric and block diagonal with
4624 1-by-1 and 2-by-2 diagonal blocks.
4625
4626 This is the unblocked version of the algorithm, calling Level 2 BLAS.
4627
4628 Arguments
4629 =========
4630
4631 uplo: = 0: Upper triangle of A is stored;
4632 = 1: Lower triangle of A is stored.
4633
4634 A: On entry, the symmetric matrix A. If uplo = 0, the leading
4635 N-by-N upper triangular part of A contains the upper
4636 triangular part of the matrix A, and the strictly lower
4637 triangular part of A is not referenced. If uplo = 1, the
4638 leading N-by-N lower triangular part of A contains the lower
4639 triangular part of the matrix A, and the strictly upper
4640 triangular part of A is not referenced.
4641
4642 On exit, the block diagonal matrix D and the multipliers used
4643 to obtain the factor U or L (see below for further details).
4644
4645 ipiv: Details of the interchanges and the block structure of D.
4646 If ipiv(k) > 0, then rows and columns k and ipiv(k) were
4647 interchanged and D(k,k) is a 1-by-1 diagonal block.
4648 If uplo = 0 and ipiv(k) = ipiv(k-1) < 0, then rows and
4649 columns k-1 and -ipiv(k) were interchanged and D(k-1:k,k-1:k)
4650 is a 2-by-2 diagonal block. If uplo = 1 and ipiv(k) =
4651 ipiv(k+1) < 0, then rows and columns k+1 and -ipiv(k) were
4652 interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
4653
4654 info: = 0: successful exit
4655 < 0: if info = -i, the i-th argument had an illegal value
4656 > 0: if info = i, D(i,i) is exactly zero. The factorization
4657 has been completed, but the block diagonal matrix D is
4658 exactly singular, and division by zero will occur if it
4659 is used to solve a system of equations.
4660
4661 For further details see sytrf
4662
4663 =for example
4664
4665 $a = random(100,100);
4666 $ipiv = zeroes(100);
4667 $info = null;
4668 # Assume $a is symmetric
4669 sytf2($a, 0, $ipiv, $info);
4670
4671 =pod
4672
4673 Broadcasts over its inputs.
4674
4675 =for bad
4676
4677 C<sytf2> ignores the bad-value flag of the input ndarrays.
4678 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4679
4680 =cut
4681
4682
4683
4684
4685 *sytf2 = \&PDL::sytf2;
4686
4687
4688
4689
4690
4691
4692 =head2 potrf
4693
4694 =for sig
4695
4696 Signature: ([io]A(n,n); int uplo(); int [o]info())
4697 Types: (float double)
4698
4699 =for usage
4700
4701 $info = potrf($A, $uplo);
4702 potrf($A, $uplo, $info); # all arguments given
4703 $info = $A->potrf($uplo); # method call
4704 $A->potrf($uplo, $info);
4705
4706 =for ref
4707
4708 Computes the Cholesky factorization of a real symmetric
4709 positive definite matrix A.
4710
4711 The factorization has the form
4712
4713 A = U' * U, if uplo = 0, or
4714 A = L * L', if uplo = 1,
4715 where U is an upper triangular matrix and L is lower triangular.
4716
4717 This is the block version of the algorithm, calling Level 3 BLAS.
4718
4719 Arguments
4720 =========
4721
4722 uplo: = 0: Upper triangle of A is stored;
4723 = 1: Lower triangle of A is stored.
4724
4725 A: On entry, the symmetric matrix A. If uplo = 0, the leading
4726 N-by-N upper triangular part of A contains the upper
4727 triangular part of the matrix A, and the strictly lower
4728 triangular part of A is not referenced. If uplo = 1, the
4729 leading N-by-N lower triangular part of A contains the lower
4730 triangular part of the matrix A, and the strictly upper
4731 triangular part of A is not referenced.
4732
4733 On exit, if info = 0, the factor U or L from the Cholesky
4734 factorization A = U'*U or A = L*L'.
4735
4736 info: = 0: successful exit
4737 < 0: if info = -i, the i-th argument had an illegal value
4738 > 0: if info = i, the leading minor of order i is not
4739 positive definite, and the factorization could not be
4740 completed.
4741
4742 =for example
4743
4744 $a = random(100,100);
4745 # Assume $a is symmetric positive definite
4746 potrf($a, 0, ($info = null));
4747
4748 =pod
4749
4750 Broadcasts over its inputs.
4751
4752 =for bad
4753
4754 C<potrf> ignores the bad-value flag of the input ndarrays.
4755 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4756
4757 =cut
4758
4759
4760
4761
4762 *potrf = \&PDL::potrf;
4763
4764
4765
4766
4767
4768
4769 =head2 potf2
4770
4771 =for sig
4772
4773 Signature: ([io]A(n,n); int uplo(); int [o]info())
4774 Types: (float double)
4775
4776 =for usage
4777
4778 $info = potf2($A, $uplo);
4779 potf2($A, $uplo, $info); # all arguments given
4780 $info = $A->potf2($uplo); # method call
4781 $A->potf2($uplo, $info);
4782
4783 =for ref
4784
4785 Computes the Cholesky factorization of a real symmetric
4786 positive definite matrix A.
4787
4788 The factorization has the form
4789
4790 A = U' * U, if uplo = 0, or
4791 A = L * L', if uplo = 1,
4792 where U is an upper triangular matrix and L is lower triangular.
4793
4794 This is the unblocked version of the algorithm, calling Level 2 BLAS.
4795
4796 Arguments
4797 =========
4798
4799 uplo: = 0: Upper triangle of A is stored;
4800 = 1: Lower triangle of A is stored.
4801
4802 A: On entry, the symmetric matrix A. If uplo = 0, the leading
4803 N-by-N upper triangular part of A contains the upper
4804 triangular part of the matrix A, and the strictly lower
4805 triangular part of A is not referenced. If uplo = 1, the
4806 leading N-by-N lower triangular part of A contains the lower
4807 triangular part of the matrix A, and the strictly upper
4808 triangular part of A is not referenced.
4809
4810 On exit, if info = 0, the factor U or L from the Cholesky
4811 factorization A = U'*U or A = L*L'.
4812
4813 info: = 0: successful exit
4814 < 0: if info = -i, the i-th argument had an illegal value
4815 > 0: if info = i, the leading minor of order i is not
4816 positive definite, and the factorization could not be
4817 completed.
4818
4819 =for example
4820
4821 $a = random(100,100);
4822 # Assume $a is symmetric positive definite
4823 potf2($a, 0, ($info = null));
4824
4825 =pod
4826
4827 Broadcasts over its inputs.
4828
4829 =for bad
4830
4831 C<potf2> ignores the bad-value flag of the input ndarrays.
4832 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4833
4834 =cut
4835
4836
4837
4838
4839 *potf2 = \&PDL::potf2;
4840
4841
4842
4843
4844
4845
4846 =head2 getri
4847
4848 =for sig
4849
4850 Signature: ([io]A(n,n); int ipiv(n); int [o]info())
4851 Types: (float double)
4852
4853 =for usage
4854
4855 $info = getri($A, $ipiv);
4856 getri($A, $ipiv, $info); # all arguments given
4857 $info = $A->getri($ipiv); # method call
4858 $A->getri($ipiv, $info);
4859
4860 =for ref
4861
4862 Computes the inverse of a matrix using the LU factorization
4863 computed by C<getrf>.
4864
4865 This method inverts U and then computes inv(A) by solving the system
4866
4867 inv(A)*L = inv(U) for inv(A).
4868
4869 Arguments
4870 =========
4871
4872 A: On entry, the factors L and U from the factorization
4873 A = P*L*U as computed by getrf.
4874 On exit, if info = 0, the inverse of the original matrix A.
4875
4876 ipiv: The pivot indices from getrf; for 1<=i<=N, row i of the
4877 matrix was interchanged with row ipiv(i).
4878
4879 info: = 0: successful exit
4880 < 0: if info = -i, the i-th argument had an illegal value
4881 > 0: if info = i, U(i,i) is exactly zero; the matrix is
4882 singular and its inverse could not be computed.
4883
4884 =for example
4885
4886 $a = random (float, 100, 100);
4887 $ipiv = zeroes(long, 100);
4888 $info = null;
4889 getrf($a, $ipiv, $info);
4890 if ($info == 0){
4891 getri($a, $ipiv, $info);
4892 }
4893 print "Inverse of \$a is :\n $a" unless $info;
4894
4895 =pod
4896
4897 Broadcasts over its inputs.
4898
4899 =for bad
4900
4901 C<getri> ignores the bad-value flag of the input ndarrays.
4902 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4903
4904 =cut
4905
4906
4907
4908
4909 *getri = \&PDL::getri;
4910
4911
4912
4913
4914
4915
4916 =head2 sytri
4917
4918 =for sig
4919
4920 Signature: ([io]A(n,n); int uplo(); int ipiv(n); int [o]info(); [t]work(n))
4921 Types: (float double)
4922
4923 =for usage
4924
4925 $info = sytri($A, $uplo, $ipiv);
4926 sytri($A, $uplo, $ipiv, $info); # all arguments given
4927 $info = $A->sytri($uplo, $ipiv); # method call
4928 $A->sytri($uplo, $ipiv, $info);
4929
4930 =for ref
4931
4932 Computes the inverse of a real symmetric indefinite matrix
4933 A using the factorization A = U*D*U' or A = L*D*L' computed by
4934 C<sytrf>.
4935
4936 Arguments
4937 =========
4938
4939 uplo: Specifies whether the details of the factorization are stored
4940 as an upper or lower triangular matrix.
4941 = 0: Upper triangular, form is A = U*D*U';
4942 = 1: Lower triangular, form is A = L*D*L'.
4943
4944 A: On entry, the block diagonal matrix D and the multipliers
4945 used to obtain the factor U or L as computed by sytrf.
4946
4947 On exit, if info = 0, the (symmetric) inverse of the original
4948 matrix. If uplo = 0, the upper triangular part of the
4949 inverse is formed and the part of A below the diagonal is not
4950 referenced; if uplo = 1 the lower triangular part of the
4951 inverse is formed and the part of A above the diagonal is
4952 not referenced.
4953
4954 ipiv: Details of the interchanges and the block structure of D
4955 as determined by sytrf.
4956
4957 info: = 0: successful exit
4958 < 0: if info = -i, the i-th argument had an illegal value
4959 > 0: if info = i, D(i,i) = 0; the matrix is singular and its
4960 inverse could not be computed.
4961
4962 =for example
4963
4964 $a = random (float, 100, 100);
4965 # assume $a is symmetric
4966 $ipiv = zeroes(long, 100);
4967 sytrf($a, 0, $ipiv, ($info=null));
4968 if ($info == 0){
4969 sytri($a, 0, $ipiv, $info);
4970 }
4971 print "Inverse of \$a is :\n $a" unless $info;
4972
4973 =pod
4974
4975 Broadcasts over its inputs.
4976
4977 =for bad
4978
4979 C<sytri> ignores the bad-value flag of the input ndarrays.
4980 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
4981
4982 =cut
4983
4984
4985
4986
4987 *sytri = \&PDL::sytri;
4988
4989
4990
4991
4992
4993
4994 =head2 potri
4995
4996 =for sig
4997
4998 Signature: ([io]A(n,n); int uplo(); int [o]info())
4999 Types: (float double)
5000
5001 =for usage
5002
5003 $info = potri($A, $uplo);
5004 potri($A, $uplo, $info); # all arguments given
5005 $info = $A->potri($uplo); # method call
5006 $A->potri($uplo, $info);
5007
5008 =for ref
5009
5010 Computes the inverse of a real symmetric positive definite
5011 matrix A using the Cholesky factorization A = U'*U or A = L*L'
5012 computed by C<potrf>.
5013
5014 Arguments
5015 =========
5016
5017 uplo: = 0: Upper triangle of A is stored;
5018 = 1: Lower triangle of A is stored.
5019
5020 A: On entry, the triangular factor U or L from the Cholesky
5021 factorization A = U'*U or A = L*L', as computed by
5022 potrf.
5023 On exit, the upper or lower triangle of the (symmetric)
5024 inverse of A, overwriting the input factor U or L.
5025
5026 info: = 0: successful exit
5027 < 0: if info = -i, the i-th argument had an illegal value
5028 > 0: if info = i, the (i,i) element of the factor U or L is
5029 zero, and the inverse could not be computed.
5030
5031 =for example
5032
5033 $a = random (float, 100, 100);
5034 # Assume $a is symmetric positive definite
5035 potrf($a, 0, ($info = null));
5036 if ($info == 0){ # Hum... is it positive definite????
5037 potri($a, 0,$info);
5038 }
5039 print "Inverse of \$a is :\n $a" unless $info;
5040
5041 =pod
5042
5043 Broadcasts over its inputs.
5044
5045 =for bad
5046
5047 C<potri> ignores the bad-value flag of the input ndarrays.
5048 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5049
5050 =cut
5051
5052
5053
5054
5055 *potri = \&PDL::potri;
5056
5057
5058
5059
5060
5061
5062 =head2 trtri
5063
5064 =for sig
5065
5066 Signature: ([io]A(n,n); int uplo(); int diag(); int [o]info())
5067 Types: (float double)
5068
5069 =for usage
5070
5071 $info = trtri($A, $uplo, $diag);
5072 trtri($A, $uplo, $diag, $info); # all arguments given
5073 $info = $A->trtri($uplo, $diag); # method call
5074 $A->trtri($uplo, $diag, $info);
5075
5076 =for ref
5077
5078 Computes the inverse of a real upper or lower triangular
5079 matrix A.
5080
5081 This is the Level 3 BLAS version of the algorithm.
5082
5083 Arguments
5084 =========
5085
5086 uplo: = 0: A is upper triangular;
5087 = 1: A is lower triangular.
5088
5089 diag: = 0: A is non-unit triangular;
5090 = 1: A is unit triangular.
5091
5092 A: On entry, the triangular matrix A. If uplo = 0, the
5093 leading N-by-N upper triangular part of the array A contains
5094 the upper triangular matrix, and the strictly lower
5095 triangular part of A is not referenced. If uplo = 1, the
5096 leading N-by-N lower triangular part of the array A contains
5097 the lower triangular matrix, and the strictly upper
5098 triangular part of A is not referenced. If diag = 1, the
5099 diagonal elements of A are also not referenced and are
5100 assumed to be 1.
5101 On exit, the (triangular) inverse of the original matrix, in
5102 the same storage format.
5103
5104 info: = 0: successful exit
5105 < 0: if info = -i, the i-th argument had an illegal value
5106 > 0: if info = i, A(i,i) is exactly zero. The triangular
5107 matrix is singular and its inverse can not be computed.
5108
5109 =for example
5110
5111 $a = random (float, 100, 100);
5112 # assume $a is upper triangular
5113 trtri($a, 1, ($info=null));
5114 print "Inverse of \$a is :\n transpose($a)" unless $info;
5115
5116 =pod
5117
5118 Broadcasts over its inputs.
5119
5120 =for bad
5121
5122 C<trtri> ignores the bad-value flag of the input ndarrays.
5123 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5124
5125 =cut
5126
5127
5128
5129
5130 *trtri = \&PDL::trtri;
5131
5132
5133
5134
5135
5136
5137 =head2 trti2
5138
5139 =for sig
5140
5141 Signature: ([io]A(n,n); int uplo(); int diag(); int [o]info())
5142 Types: (float double)
5143
5144 =for usage
5145
5146 $info = trti2($A, $uplo, $diag);
5147 trti2($A, $uplo, $diag, $info); # all arguments given
5148 $info = $A->trti2($uplo, $diag); # method call
5149 $A->trti2($uplo, $diag, $info);
5150
5151 =for ref
5152
5153 Computes the inverse of a real upper or lower triangular
5154 matrix A.
5155
5156 This is the Level 2 BLAS version of the algorithm.
5157
5158 Arguments
5159 =========
5160
5161 uplo: = 0: A is upper triangular;
5162 = 1: A is lower triangular.
5163
5164 diag: = 0: A is non-unit triangular;
5165 = 1: A is unit triangular.
5166
5167 A: On entry, the triangular matrix A. If uplo = 0, the
5168 leading N-by-N upper triangular part of the array A contains
5169 the upper triangular matrix, and the strictly lower
5170 triangular part of A is not referenced. If uplo = 1, the
5171 leading N-by-N lower triangular part of the array A contains
5172 the lower triangular matrix, and the strictly upper
5173 triangular part of A is not referenced. If diag = 1, the
5174 diagonal elements of A are also not referenced and are
5175 assumed to be 1.
5176 On exit, the (triangular) inverse of the original matrix, in
5177 the same storage format.
5178
5179 info: = 0: successful exit
5180 < 0: if info = -i, the i-th argument had an illegal value
5181
5182 =for example
5183
5184 $a = random (float, 100, 100);
5185 # assume $a is upper triangular
5186 trtri2($a, 1, ($info=null));
5187 print "Inverse of \$a is :\n transpose($a)" unless $info;
5188
5189 =pod
5190
5191 Broadcasts over its inputs.
5192
5193 =for bad
5194
5195 C<trti2> ignores the bad-value flag of the input ndarrays.
5196 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5197
5198 =cut
5199
5200
5201
5202
5203 *trti2 = \&PDL::trti2;
5204
5205
5206
5207
5208
5209
5210 =head2 getrs
5211
5212 =for sig
5213
5214 Signature: (A(n,n); int trans(); [io]B(n,m); int ipiv(n); int [o]info())
5215 Types: (float double)
5216
5217 =for usage
5218
5219 $info = getrs($A, $trans, $B, $ipiv);
5220 getrs($A, $trans, $B, $ipiv, $info); # all arguments given
5221 $info = $A->getrs($trans, $B, $ipiv); # method call
5222 $A->getrs($trans, $B, $ipiv, $info);
5223
5224 =for ref
5225
5226 Solves a system of linear equations
5227
5228 A * X = B or A' * X = B
5229
5230 with a general N-by-N matrix A using the LU factorization computed
5231 by getrf.
5232
5233 Arguments
5234 =========
5235
5236 trans: Specifies the form of the system of equations:
5237 = 0: A * X = B (No transpose)
5238 = 1: A'* X = B (Transpose)
5239
5240 A: The factors L and U from the factorization A = P*L*U
5241 as computed by getrf.
5242
5243 ipiv: The pivot indices from getrf; for 1<=i<=N, row i of the
5244 matrix was interchanged with row ipiv(i).
5245
5246 B: On entry, the right hand side matrix B.
5247 On exit, the solution matrix X.
5248
5249 info: = 0: successful exit
5250 < 0: if info = -i, the i-th argument had an illegal value
5251
5252 =for example
5253
5254 $a = random (float, 100, 100);
5255 $ipiv = zeroes(long, 100);
5256 $b = random(100,50);
5257 getrf($a, $ipiv, ($info=null));
5258 if ($info == 0){
5259 getrs($a, 0, $b, $ipiv, $info);
5260 }
5261 print "X is :\n $b" unless $info;
5262
5263 =pod
5264
5265 Broadcasts over its inputs.
5266
5267 =for bad
5268
5269 C<getrs> ignores the bad-value flag of the input ndarrays.
5270 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5271
5272 =cut
5273
5274
5275
5276
5277 *getrs = \&PDL::getrs;
5278
5279
5280
5281
5282
5283
5284 =head2 sytrs
5285
5286 =for sig
5287
5288 Signature: (A(n,n); int uplo();[io]B(n,m); int ipiv(n); int [o]info())
5289 Types: (float double)
5290
5291 =for usage
5292
5293 $info = sytrs($A, $uplo, $B, $ipiv);
5294 sytrs($A, $uplo, $B, $ipiv, $info); # all arguments given
5295 $info = $A->sytrs($uplo, $B, $ipiv); # method call
5296 $A->sytrs($uplo, $B, $ipiv, $info);
5297
5298 =for ref
5299
5300 Solves a system of linear equations A*X = B with a real
5301 symmetric matrix A using the factorization A = U*D*U' or
5302 A = L*D*L' computed by C<sytrf>.
5303
5304 Arguments
5305 =========
5306
5307 uplo: Specifies whether the details of the factorization are stored
5308 as an upper or lower triangular matrix.
5309 = 0: Upper triangular, form is A = U*D*U';
5310 = 1: Lower triangular, form is A = L*D*L'.
5311
5312 A: The block diagonal matrix D and the multipliers used to
5313 obtain the factor U or L as computed by sytrf.
5314
5315 ipiv: Details of the interchanges and the block structure of D
5316 as determined by sytrf.
5317
5318 B: On entry, the right hand side matrix B.
5319 On exit, the solution matrix X.
5320
5321 info: = 0: successful exit
5322 < 0: if info = -i, the i-th argument had an illegal value
5323
5324 =for example
5325
5326 $a = random (float, 100, 100);
5327 $b = random(50,100);
5328 $a = transpose($a);
5329 $b = transpose($b);
5330 # Assume $a is symmetric
5331 sytrf($a, 0, ($ipiv=zeroes(100)), ($info=null));
5332 if ($info == 0){
5333 sytrs($a, 0, $b, $ipiv, $info);
5334 }
5335 print("X is :\n".transpose($b))unless $info;
5336
5337 =pod
5338
5339 Broadcasts over its inputs.
5340
5341 =for bad
5342
5343 C<sytrs> ignores the bad-value flag of the input ndarrays.
5344 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5345
5346 =cut
5347
5348
5349
5350
5351 *sytrs = \&PDL::sytrs;
5352
5353
5354
5355
5356
5357
5358 =head2 potrs
5359
5360 =for sig
5361
5362 Signature: (A(n,n); int uplo(); [io]B(n,m); int [o]info())
5363 Types: (float double)
5364
5365 =for usage
5366
5367 $info = potrs($A, $uplo, $B);
5368 potrs($A, $uplo, $B, $info); # all arguments given
5369 $info = $A->potrs($uplo, $B); # method call
5370 $A->potrs($uplo, $B, $info);
5371
5372 =for ref
5373
5374 Solves a system of linear equations A*X = B with a symmetric
5375 positive definite matrix A using the Cholesky factorization
5376 A = U'*U or A = L*L' computed by C<potrf>.
5377
5378 Arguments
5379 =========
5380
5381 uplo: = 0: Upper triangle of A is stored;
5382 = 1: Lower triangle of A is stored.
5383
5384 A: The triangular factor U or L from the Cholesky factorization
5385 A = U'*U or A = L*L', as computed by potrf.
5386
5387 B: On entry, the right hand side matrix B.
5388 On exit, the solution matrix X.
5389
5390 info: = 0: successful exit
5391 < 0: if info = -i, the i-th argument had an illegal value
5392
5393 =for example
5394
5395 $a = random (float, 100, 100);
5396 $b = random(50,100);
5397 $a = transpose($a);
5398 $b = transpose($b);
5399 # Assume $a is symmetric positive definite
5400 potrf($a, 0, ($info=null));
5401 if ($info == 0){
5402 potrs($a, 0, $b, $info);
5403 }
5404 print("X is :\n".transpose($b))unless $info;
5405
5406 =pod
5407
5408 Broadcasts over its inputs.
5409
5410 =for bad
5411
5412 C<potrs> ignores the bad-value flag of the input ndarrays.
5413 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5414
5415 =cut
5416
5417
5418
5419
5420 *potrs = \&PDL::potrs;
5421
5422
5423
5424
5425
5426
5427 =head2 trtrs
5428
5429 =for sig
5430
5431 Signature: (A(n,n); int uplo(); int trans(); int diag();[io]B(n,m); int [o]info())
5432 Types: (float double)
5433
5434 =for usage
5435
5436 $info = trtrs($A, $uplo, $trans, $diag, $B);
5437 trtrs($A, $uplo, $trans, $diag, $B, $info); # all arguments given
5438 $info = $A->trtrs($uplo, $trans, $diag, $B); # method call
5439 $A->trtrs($uplo, $trans, $diag, $B, $info);
5440
5441 =for ref
5442
5443 Solves a triangular system of the form
5444
5445 A * X = B or A' * X = B,
5446
5447 where A is a triangular matrix of order N, and B is an N-by-NRHS
5448 matrix.
5449
5450 A check is made to verify that A is nonsingular.
5451
5452 Arguments
5453 =========
5454
5455 uplo: = 0: A is upper triangular;
5456 = 1: A is lower triangular.
5457
5458 trans: Specifies the form of the system of equations:
5459 = 0: A * X = B (No transpose)
5460 = 1: A**T * X = B (Transpose)
5461
5462 diag: = 0: A is non-unit triangular;
5463 = 1: A is unit triangular.
5464
5465 A: The triangular matrix A. If uplo = 0, the leading N-by-N
5466 upper triangular part of the array A contains the upper
5467 triangular matrix, and the strictly lower triangular part of
5468 A is not referenced. If uplo = 1, the leading N-by-N lower
5469 triangular part of the array A contains the lower triangular
5470 matrix, and the strictly upper triangular part of A is not
5471 referenced. If diag = 1, the diagonal elements of A are
5472 also not referenced and are assumed to be 1.
5473
5474 B: On entry, the right hand side matrix B.
5475 On exit, if info = 0, the solution matrix X.
5476
5477 info = 0: successful exit
5478 < 0: if info = -i, the i-th argument had an illegal value
5479 > 0: if info = i, the i-th diagonal element of A is zero,
5480 indicating that the matrix is singular and the solutions
5481 X have not been computed.
5482
5483 =for example
5484
5485 # Assume $a is upper triangular
5486 $a = random (float, 100, 100);
5487 $b = random(50,100);
5488 $a = transpose($a);
5489 $b = transpose($b);
5490 $info = null;
5491 trtrs($a, 0, 0, 0, $b, $info);
5492 print("X is :\n".transpose($b))unless $info;
5493
5494 =pod
5495
5496 Broadcasts over its inputs.
5497
5498 =for bad
5499
5500 C<trtrs> ignores the bad-value flag of the input ndarrays.
5501 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5502
5503 =cut
5504
5505
5506
5507
5508 *trtrs = \&PDL::trtrs;
5509
5510
5511
5512
5513
5514
5515 =head2 latrs
5516
5517 =for sig
5518
5519 Signature: (A(n,n); int uplo(); int trans(); int diag(); int normin();[io]x(n); [o]scale();[io]cnorm(n);int [o]info())
5520 Types: (float double)
5521
5522 =for usage
5523
5524 ($scale, $info) = latrs($A, $uplo, $trans, $diag, $normin, $x, $cnorm);
5525 latrs($A, $uplo, $trans, $diag, $normin, $x, $scale, $cnorm, $info); # all arguments given
5526 ($scale, $info) = $A->latrs($uplo, $trans, $diag, $normin, $x, $cnorm); # method call
5527 $A->latrs($uplo, $trans, $diag, $normin, $x, $scale, $cnorm, $info);
5528
5529 =for ref
5530
5531 Solves one of the triangular systems
5532
5533 A *x = s*b or A'*x = s*b
5534
5535 with scaling to prevent overflow. Here A is an upper or lower
5536 triangular matrix, A' denotes the transpose of A, x and b are
5537 n-element vectors, and s is a scaling factor, usually less than
5538 or equal to 1, chosen so that the components of x will be less than
5539 the overflow threshold. If the unscaled problem will not cause
5540 overflow, the Level 2 BLAS routine C<trsv> is called. If the matrix A
5541 is singular (A(j,j) = 0 for some j), then s is set to 0 and a
5542 non-trivial solution to A*x = 0 is returned.
5543
5544 Further Details
5545 ======= =======
5546
5547 A rough bound on x is computed; if that is less than overflow, trsv
5548 is called, otherwise, specific code is used which checks for possible
5549 overflow or divide-by-zero at every operation.
5550
5551 A columnwise scheme is used for solving A*x = b. The basic algorithm
5552 if A is lower triangular is
5553
5554 x[1:n] := b[1:n]
5555 for j = 1, ..., n
5556 x(j) := x(j) / A(j,j)
5557 x[j+1:n] := x[j+1:n] - x(j) * A[j+1:n,j]
5558 end
5559
5560 Define bounds on the components of x after j iterations of the loop:
5561
5562 M(j) = bound on x[1:j]
5563 G(j) = bound on x[j+1:n]
5564
5565 Initially, let M(0) = 0 and G(0) = max{x(i), i=1,...,n}.
5566
5567 Then for iteration j+1 we have
5568 M(j+1) <= G(j) / | A(j+1,j+1) |
5569 G(j+1) <= G(j) + M(j+1) * | A[j+2:n,j+1] |
5570 <= G(j) ( 1 + cnorm(j+1) / | A(j+1,j+1) | )
5571
5572 where cnorm(j+1) is greater than or equal to the infinity-norm of
5573 column j+1 of A, not counting the diagonal.
5574
5575 Hence
5576
5577 G(j) <= G(0) product ( 1 + cnorm(i) / | A(i,i) | )
5578 1<=i<=j
5579 and
5580
5581 |x(j)| <= ( G(0) / |A(j,j)| ) product ( 1 + cnorm(i) / |A(i,i)| )
5582 1<=i< j
5583
5584 Since |x(j)| <= M(j), we use the Level 2 BLAS routine DTRSV if the
5585 reciprocal of the largest M(j), j=1,..,n, is larger than
5586 max(underflow, 1/overflow).
5587
5588 The bound on x(j) is also used to determine when a step in the
5589 columnwise method can be performed without fear of overflow. If
5590 the computed bound is greater than a large constant, x is scaled to
5591 prevent overflow, but if the bound overflows, x is set to 0, x(j) to
5592 1, and scale to 0, and a non-trivial solution to A*x = 0 is found.
5593
5594 Similarly, a row-wise scheme is used to solve A'*x = b. The basic
5595 algorithm for A upper triangular is
5596
5597 for j = 1, ..., n
5598 x(j) := ( b(j) - A[1:j-1,j]' * x[1:j-1] ) / A(j,j)
5599 end
5600
5601 We simultaneously compute two bounds
5602
5603 G(j) = bound on ( b(i) - A[1:i-1,i]' * x[1:i-1] ), 1<=i<=j
5604 M(j) = bound on x(i), 1<=i<=j
5605
5606 The initial values are G(0) = 0, M(0) = max{b(i), i=1,..,n}, and we
5607 add the constraint G(j) >= G(j-1) and M(j) >= M(j-1) for j >= 1.
5608 Then the bound on x(j) is
5609
5610 M(j) <= M(j-1) * ( 1 + cnorm(j) ) / | A(j,j) |
5611
5612 <= M(0) * product ( ( 1 + cnorm(i) ) / |A(i,i)| )
5613 1<=i<=j
5614
5615 and we can safely call trsv if 1/M(n) and 1/G(n) are both greater
5616 than max(underflow, 1/overflow).
5617
5618 Arguments
5619 =========
5620
5621 uplo: Specifies whether the matrix A is upper or lower triangular.
5622 = 0: Upper triangular
5623 = 1: Lower triangular
5624
5625 trans: Specifies the operation applied to A.
5626 = 0: Solve A * x = s*b (No transpose)
5627 = 1: Solve A'* x = s*b (Transpose)
5628
5629 diag: Specifies whether or not the matrix A is unit triangular.
5630 = 0: Non-unit triangular
5631 = 1: Unit triangular
5632
5633 normin: Specifies whether cnorm has been set or not.
5634 = 1: cnorm contains the column norms on entry
5635 = 0: cnorm is not set on entry. On exit, the norms will
5636 be computed and stored in cnorm.
5637
5638 A: The triangular matrix A. If uplo = 0, the leading n by n
5639 upper triangular part of the array A contains the upper
5640 triangular matrix, and the strictly lower triangular part of
5641 A is not referenced. If uplo = 1, the leading n by n lower
5642 triangular part of the array A contains the lower triangular
5643 matrix, and the strictly upper triangular part of A is not
5644 referenced. If diag = 1, the diagonal elements of A are
5645 also not referenced and are assumed to be 1.
5646
5647 x: On entry, the right hand side b of the triangular system.
5648 On exit, x is overwritten by the solution vector x.
5649
5650 scale: The scaling factor s for the triangular system
5651 A * x = s*b or A'* x = s*b.
5652 If scale = 0, the matrix A is singular or badly scaled, and
5653 the vector x is an exact or approximate solution to A*x = 0.
5654
5655 cnorm: If normin = 0, cnorm is an output argument and cnorm(j)
5656 returns the 1-norm of the offdiagonal part of the j-th column
5657 of A.
5658 If normin = 1, cnorm is an input argument and cnorm(j)
5659 contains the norm of the off-diagonal part of the j-th column
5660 of A. If trans = 0, cnorm(j) must be greater than or equal
5661 to the infinity-norm, and if trans = 1, cnorm(j)
5662 must be greater than or equal to the 1-norm.
5663
5664 info: = 0: successful exit
5665 < 0: if info = -k, the k-th argument had an illegal value
5666
5667 =for example
5668
5669 # Assume $a is upper triangular
5670 $a = random (float, 100, 100);
5671 $b = random(100);
5672 $a = transpose($a);
5673 $info = null;
5674 $scale= null;
5675 $cnorm = zeroes(100);
5676 latrs($a, 0, 0, 0, 0,$b, $scale, $cnorm,$info);
5677
5678 =pod
5679
5680 Broadcasts over its inputs.
5681
5682 =for bad
5683
5684 C<latrs> ignores the bad-value flag of the input ndarrays.
5685 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5686
5687 =cut
5688
5689
5690
5691
5692 *latrs = \&PDL::latrs;
5693
5694
5695
5696
5697
5698
5699 =head2 gecon
5700
5701 =for sig
5702
5703 Signature: (A(n,n); int norm(); anorm(); [o]rcond();int [o]info(); int [t]iwork(n); [t]work(workn=CALC(4*$SIZE(n))))
5704 Types: (float double)
5705
5706 =for usage
5707
5708 ($rcond, $info) = gecon($A, $norm, $anorm);
5709 gecon($A, $norm, $anorm, $rcond, $info); # all arguments given
5710 ($rcond, $info) = $A->gecon($norm, $anorm); # method call
5711 $A->gecon($norm, $anorm, $rcond, $info);
5712
5713 =for ref
5714
5715 Estimates the reciprocal of the condition number of a general
5716 real matrix A, in either the 1-norm or the infinity-norm, using
5717 the LU factorization computed by C<getrf>.
5718
5719 An estimate is obtained for norm(inv(A)), and the reciprocal of the
5720 condition number is computed as
5721
5722 rcond = 1 / ( norm(A) * norm(inv(A)) ).
5723
5724 Arguments
5725 =========
5726
5727 norm: Specifies whether the 1-norm condition number or the
5728 infinity-norm condition number is required:
5729 = 0: Infinity-norm.
5730 = 1: 1-norm;
5731
5732 A: The factors L and U from the factorization A = P*L*U
5733 as computed by getrf.
5734
5735 anorm: If norm = 0, the infinity-norm of the original matrix A.
5736 If norm = 1, the 1-norm of the original matrix A.
5737
5738 rcond: The reciprocal of the condition number of the matrix A,
5739 computed as rcond = 1/(norm(A) * norm(inv(A))).
5740
5741 info: = 0: successful exit
5742 < 0: if info = -i, the i-th argument had an illegal value
5743
5744 =for example
5745
5746 $a = random (float, 100, 100);
5747 $anorm = $a->lange(1);
5748 $ipiv = zeroes(long, 100);
5749 $info = null;
5750 getrf($a, $ipiv, $info);
5751 ($rcond, $info) = gecon($a, 1, $anorm) unless $info != 0;
5752
5753 =pod
5754
5755 Broadcasts over its inputs.
5756
5757 =for bad
5758
5759 C<gecon> ignores the bad-value flag of the input ndarrays.
5760 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5761
5762 =cut
5763
5764
5765
5766
5767 *gecon = \&PDL::gecon;
5768
5769
5770
5771
5772
5773
5774 =head2 sycon
5775
5776 =for sig
5777
5778 Signature: (A(n,n); int uplo(); int ipiv(n); anorm(); [o]rcond();int [o]info(); int [t]iwork(n); [t]work(workn=CALC(2*$SIZE(n))))
5779 Types: (float double)
5780
5781 =for usage
5782
5783 ($rcond, $info) = sycon($A, $uplo, $ipiv, $anorm);
5784 sycon($A, $uplo, $ipiv, $anorm, $rcond, $info); # all arguments given
5785 ($rcond, $info) = $A->sycon($uplo, $ipiv, $anorm); # method call
5786 $A->sycon($uplo, $ipiv, $anorm, $rcond, $info);
5787
5788 =for ref
5789
5790 Estimates the reciprocal of the condition number (in the
5791 1-norm) of a real symmetric matrix A using the factorization
5792 A = U*D*U' or A = L*D*L' computed by C<sytrf>.
5793
5794 An estimate is obtained for norm(inv(A)), and the reciprocal of the
5795 condition number is computed as rcond = 1 / (anorm * norm(inv(A))).
5796
5797 Arguments
5798 =========
5799
5800 uplo: Specifies whether the details of the factorization are stored
5801 as an upper or lower triangular matrix.
5802 = 0: Upper triangular, form is A = U*D*U';
5803 = 1: Lower triangular, form is A = L*D*L'.
5804
5805 A: The block diagonal matrix D and the multipliers used to
5806 obtain the factor U or L as computed by sytrf.
5807
5808 ipiv: Details of the interchanges and the block structure of D
5809 as determined by sytrf.
5810
5811 anorm: The 1-norm of the original matrix A.
5812
5813 rcond: The reciprocal of the condition number of the matrix A,
5814 computed as rcond = 1/(anorm * aimvnm), where ainvnm is an
5815 estimate of the 1-norm of inv(A) computed in this routine.
5816
5817 info: = 0: successful exit
5818 < 0: if info = -i, the i-th argument had an illegal value.
5819
5820 =for example
5821
5822 # Assume $a is symmetric
5823 $a = random (float, 100, 100);
5824 $anorm = $a->lansy(1,1);
5825 $ipiv = zeroes(long, 100);
5826 $info = null;
5827 sytrf($a, 1,$ipiv, $info);
5828 ($rcond, $info) = sycon($a, 1, $anorm) unless $info != 0;
5829
5830 =pod
5831
5832 Broadcasts over its inputs.
5833
5834 =for bad
5835
5836 C<sycon> ignores the bad-value flag of the input ndarrays.
5837 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5838
5839 =cut
5840
5841
5842
5843
5844 *sycon = \&PDL::sycon;
5845
5846
5847
5848
5849
5850
5851 =head2 pocon
5852
5853 =for sig
5854
5855 Signature: (A(n,n); int uplo(); anorm(); [o]rcond();int [o]info(); int [t]iwork(n); [t]work(workn=CALC(3*$SIZE(n))))
5856 Types: (float double)
5857
5858 =for usage
5859
5860 ($rcond, $info) = pocon($A, $uplo, $anorm);
5861 pocon($A, $uplo, $anorm, $rcond, $info); # all arguments given
5862 ($rcond, $info) = $A->pocon($uplo, $anorm); # method call
5863 $A->pocon($uplo, $anorm, $rcond, $info);
5864
5865 =for ref
5866
5867 Estimates the reciprocal of the condition number (in the
5868 1-norm) of a real symmetric positive definite matrix using the
5869 Cholesky factorization A = U'*U or A = L*L' computed by C<potrf>.
5870
5871 An estimate is obtained for norm(inv(A)), and the reciprocal of the
5872 condition number is computed as rcond = 1 / (anorm * norm(inv(A))).
5873
5874 Arguments
5875 =========
5876
5877 uplo: = 0: Upper triangle of A is stored;
5878 = 1: Lower triangle of A is stored.
5879
5880 A: The triangular factor U or L from the Cholesky factorization
5881 A = U'*U or A = L*L', as computed by potrf.
5882
5883 anorm: The 1-norm of the matrix A.
5884
5885 rcond: The reciprocal of the condition number of the matrix A,
5886 computed as rcond = 1/(anorm * ainvnm), where ainvnm is an
5887 estimate of the 1-norm of inv(A) computed in this routine.
5888
5889 info: = 0: successful exit
5890 < 0: if info = -i, the i-th argument had an illegal value
5891
5892 =for example
5893
5894 # Assume $a is symmetric positive definite
5895 $a = random (float, 100, 100);
5896 $anorm = $a->lansy(1,1);
5897 $info = null;
5898 potrf($a, 0, $info);
5899 ($rcond, $info) = pocon($a, 1, $anorm) unless $info != 0;
5900
5901 =pod
5902
5903 Broadcasts over its inputs.
5904
5905 =for bad
5906
5907 C<pocon> ignores the bad-value flag of the input ndarrays.
5908 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5909
5910 =cut
5911
5912
5913
5914
5915 *pocon = \&PDL::pocon;
5916
5917
5918
5919
5920
5921
5922 =head2 trcon
5923
5924 =for sig
5925
5926 Signature: (A(n,n); int norm();int uplo();int diag(); [o]rcond();int [o]info(); int [t]iwork(n); [t]work(workn=CALC(3*$SIZE(n))))
5927 Types: (float double)
5928
5929 =for usage
5930
5931 ($rcond, $info) = trcon($A, $norm, $uplo, $diag);
5932 trcon($A, $norm, $uplo, $diag, $rcond, $info); # all arguments given
5933 ($rcond, $info) = $A->trcon($norm, $uplo, $diag); # method call
5934 $A->trcon($norm, $uplo, $diag, $rcond, $info);
5935
5936 =for ref
5937
5938 Estimates the reciprocal of the condition number of a
5939 triangular matrix A, in either the 1-norm or the infinity-norm.
5940
5941 The norm of A is computed and an estimate is obtained for
5942 norm(inv(A)), then the reciprocal of the condition number is
5943 computed as
5944
5945 rcond = 1 / ( norm(A) * norm(inv(A)) ).
5946
5947 Arguments
5948 =========
5949
5950 norm: Specifies whether the 1-norm condition number or the
5951 infinity-norm condition number is required:
5952 = 0: Infinity-norm.
5953 = 1: 1-norm;
5954
5955 uplo: = 0: A is upper triangular;
5956 = 1: A is lower triangular.
5957
5958 diag: = 0: A is non-unit triangular;
5959 = 1: A is unit triangular.
5960
5961 A: The triangular matrix A. If uplo = 0, the leading N-by-N
5962 upper triangular part of the array A contains the upper
5963 triangular matrix, and the strictly lower triangular part of
5964 A is not referenced. If uplo = 1, the leading N-by-N lower
5965 triangular part of the array A contains the lower triangular
5966 matrix, and the strictly upper triangular part of A is not
5967 referenced. If diag = 1, the diagonal elements of A are
5968 also not referenced and are assumed to be 1.
5969
5970 rcond: The reciprocal of the condition number of the matrix A,
5971 computed as rcond = 1/(norm(A) * norm(inv(A))).
5972
5973 info: = 0: successful exit
5974 < 0: if info = -i, the i-th argument had an illegal value
5975
5976 =for example
5977
5978 # Assume $a is upper triangular
5979 $a = random (float, 100, 100);
5980 $info = null;
5981 ($rcond, $info) = trcon($a, 1, 1, 0) unless $info != 0;
5982
5983 =pod
5984
5985 Broadcasts over its inputs.
5986
5987 =for bad
5988
5989 C<trcon> ignores the bad-value flag of the input ndarrays.
5990 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
5991
5992 =cut
5993
5994
5995
5996
5997 *trcon = \&PDL::trcon;
5998
5999
6000
6001
6002
6003
6004 =head2 geqp3
6005
6006 =for sig
6007
6008 Signature: ([io]A(m,n); int [io]jpvt(n); [o]tau(k); int [o]info())
6009 Types: (float double)
6010
6011 =for usage
6012
6013 ($tau, $info) = geqp3($A, $jpvt);
6014 geqp3($A, $jpvt, $tau, $info); # all arguments given
6015 ($tau, $info) = $A->geqp3($jpvt); # method call
6016 $A->geqp3($jpvt, $tau, $info);
6017
6018 =for ref
6019
6020 geqp3 computes a QR factorization using Level 3 BLAS with column pivoting of a
6021 matrix A:
6022
6023 A*P = Q*R
6024
6025 The matrix Q is represented as a product of elementary reflectors
6026
6027 Q = H(1) H(2) . . . H(k), where k = min(m,n).
6028
6029 Each H(i) has the form
6030
6031 H(i) = I - tau * v * v'
6032
6033 where tau is a real/complex scalar, and v is a real/complex vector
6034 with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in
6035 A(i+1:m,i), and tau in tau(i).
6036
6037 Arguments
6038 =========
6039
6040 A: On entry, the M-by-N matrix A.
6041 On exit, the upper triangle of the array contains the
6042 min(M,N)-by-N upper trapezoidal matrix R; the elements below
6043 the diagonal, together with the array tau, represent the
6044 orthogonal matrix Q as a product of min(M,N) elementary
6045 reflectors.
6046
6047 jpvt: On entry, if jpvt(J)!=0, the J-th column of A is permuted
6048 to the front of A*P (a leading column); if jpvt(J)=0,
6049 the J-th column of A is a free column.
6050 On exit, if jpvt(J)=K, then the J-th column of A*P was the
6051 the K-th column of A.
6052
6053 tau: The scalar factors of the elementary reflectors.
6054
6055 info: = 0: successful exit.
6056 < 0: if info = -i, the i-th argument had an illegal value.
6057
6058 =for example
6059
6060 $a = random (float, 100, 50);
6061 $info = null;
6062 $tau = zeroes(float, 50);
6063 $jpvt = zeroes(long, 50);
6064 geqp3($a, $jpvt, $tau, $info);
6065
6066 =pod
6067
6068 Broadcasts over its inputs.
6069
6070 =for bad
6071
6072 C<geqp3> ignores the bad-value flag of the input ndarrays.
6073 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6074
6075 =cut
6076
6077
6078
6079
6080 *geqp3 = \&PDL::geqp3;
6081
6082
6083
6084
6085
6086
6087 =head2 geqrf
6088
6089 =for sig
6090
6091 Signature: ([io]A(m,n); [o]tau(k); int [o]info())
6092 Types: (float double)
6093
6094 =for usage
6095
6096 ($tau, $info) = geqrf($A);
6097 geqrf($A, $tau, $info); # all arguments given
6098 ($tau, $info) = $A->geqrf; # method call
6099 $A->geqrf($tau, $info);
6100
6101 =for ref
6102
6103 geqrf computes a QR factorization of a
6104 matrix A:
6105
6106 A = Q * R
6107
6108 The matrix Q is represented as a product of elementary reflectors
6109
6110 Q = H(1) H(2) . . . H(k), where k = min(m,n).
6111
6112 Each H(i) has the form
6113
6114 H(i) = I - tau * v * v'
6115
6116 where tau is a real/complex scalar, and v is a real/complex vector
6117 with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in
6118 A(i+1:m,i), and tau in tau(i).
6119
6120 Arguments
6121 =========
6122
6123 A: On exit, the elements on and above the diagonal of the array
6124 contain the min(M,N)-by-N upper trapezoidal matrix R (R is
6125 upper triangular if m >= n); the elements below the diagonal,
6126 with the array TAU, represent the orthogonal matrix Q as a
6127 product of min(m,n) elementary reflectors.
6128
6129 tau: The scalar factors of the elementary reflectors.
6130
6131 info: = 0: successful exit.
6132 < 0: if info = -i, the i-th argument had an illegal value.
6133
6134 =for example
6135
6136 $a = random (float, 100, 50);
6137 $info = null;
6138 $tau = zeroes(float, 50);
6139 geqrf($a, $tau, $info);
6140
6141 =pod
6142
6143 Broadcasts over its inputs.
6144
6145 =for bad
6146
6147 C<geqrf> ignores the bad-value flag of the input ndarrays.
6148 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6149
6150 =cut
6151
6152
6153
6154
6155 *geqrf = \&PDL::geqrf;
6156
6157
6158
6159
6160
6161
6162 =head2 orgqr
6163
6164 =for sig
6165
6166 Signature: ([io]A(m,n); tau(k); int [o]info())
6167 Types: (float double)
6168
6169 =for usage
6170
6171 $info = orgqr($A, $tau);
6172 orgqr($A, $tau, $info); # all arguments given
6173 $info = $A->orgqr($tau); # method call
6174 $A->orgqr($tau, $info);
6175
6176 =for ref
6177
6178 Generates an M-by-N real matrix Q with orthonormal columns,
6179 which is defined as the first N columns of a product of K elementary
6180 reflectors of order M
6181
6182 Q = H(1) H(2) . . . H(k)
6183
6184 as returned by geqrf or geqp3.
6185
6186 Arguments
6187 =========
6188
6189 A: On entry, the i-th column must contain the vector which
6190 defines the elementary reflector H(i), for i = 1,2,...,k, as
6191 returned by geqrf or geqp3 in the first k columns of its array
6192 argument A.
6193 On exit, the M-by-N matrix Q.
6194
6195 tau: tau(i) must contain the scalar factor of the elementary
6196 reflector H(i), as returned by geqrf or geqp3.
6197
6198 info: = 0: successful exit
6199 < 0: if info = -i, the i-th argument has an illegal value
6200
6201 =for example
6202
6203 $a = random (float, 100, 50);
6204 $info = null;
6205 $tau = zeroes(float, 50);
6206 geqrf($a, $tau, $info);
6207 orgqr($a, $tau, $info) unless $info != 0;
6208
6209 =pod
6210
6211 Broadcasts over its inputs.
6212
6213 =for bad
6214
6215 C<orgqr> ignores the bad-value flag of the input ndarrays.
6216 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6217
6218 =cut
6219
6220
6221
6222
6223 *orgqr = \&PDL::orgqr;
6224
6225
6226
6227
6228
6229
6230 =head2 ormqr
6231
6232 =for sig
6233
6234 Signature: (A(p,k); int side(); int trans(); tau(k); [io]C(m,n);int [o]info())
6235 Types: (float double)
6236
6237 =for usage
6238
6239 $info = ormqr($A, $side, $trans, $tau, $C);
6240 ormqr($A, $side, $trans, $tau, $C, $info); # all arguments given
6241 $info = $A->ormqr($side, $trans, $tau, $C); # method call
6242 $A->ormqr($side, $trans, $tau, $C, $info);
6243
6244 =for ref
6245
6246 Overwrites the general real M-by-N matrix C with
6247
6248 side = 0 side = 1
6249 trans = 0: Q * C C * Q
6250 trans = 1: Q' * C C * Q'
6251
6252 where Q is a real orthogonal matrix defined as the product of k
6253 elementary reflectors
6254
6255 Q = H(1) H(2) . . . H(k)
6256
6257 as returned by geqrf or geqp3.
6258
6259 Q is of order M if C<side> = 0 and of order N
6260 if C<side> = 1.
6261
6262 Arguments
6263 =========
6264
6265 side: = 0: apply Q or Q' from the Left;
6266 = 1: apply Q or Q' from the Right.
6267
6268 trans: = 0: No transpose, apply Q;
6269 = 1: Transpose, apply Q'.
6270
6271 A: The i-th column must contain the vector which defines the
6272 elementary reflector H(i), for i = 1,2,...,k, as returned by
6273 geqrf or geqp3 in the first k columns of its array argument A.
6274 A is modified by the routine but restored on exit.
6275
6276 tau: tau(i) must contain the scalar factor of the elementary
6277 reflector H(i), as returned by geqrf or geqp3.
6278
6279 C: On entry, the M-by-N matrix C.
6280 On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
6281
6282 info: = 0: successful exit
6283 < 0: if info = -i, the i-th argument had an illegal value
6284
6285 =for example
6286
6287 $a = random (float, 50, 100);
6288 $a = transpose($a);
6289 $info = null;
6290 $tau = zeroes(float, 50);
6291 geqrf($a, $tau, $info);
6292 $c = random(70,50);
6293 # $c will contain the result
6294 $c->reshape(70,100);
6295 $c = transpose($c);
6296 ormqr($a, $tau, $c, $info);
6297
6298 =pod
6299
6300 Broadcasts over its inputs.
6301
6302 =for bad
6303
6304 C<ormqr> ignores the bad-value flag of the input ndarrays.
6305 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6306
6307 =cut
6308
6309
6310
6311
6312 *ormqr = \&PDL::ormqr;
6313
6314
6315
6316
6317
6318
6319 =head2 gelqf
6320
6321 =for sig
6322
6323 Signature: ([io]A(m,n); [o]tau(k); int [o]info())
6324 Types: (float double)
6325
6326 =for usage
6327
6328 ($tau, $info) = gelqf($A);
6329 gelqf($A, $tau, $info); # all arguments given
6330 ($tau, $info) = $A->gelqf; # method call
6331 $A->gelqf($tau, $info);
6332
6333 =for ref
6334
6335 Computes an LQ factorization of a real M-by-N matrix A:
6336
6337 A = L * Q.
6338
6339 The matrix Q is represented as a product of elementary reflectors
6340
6341 Q = H(k) . . . H(2) H(1), where k = min(m,n).
6342
6343 Each H(i) has the form
6344
6345 H(i) = I - tau * v * v'
6346
6347 where tau is a real scalar, and v is a real vector with
6348 v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n),
6349 and tau in tau(i).
6350
6351 Arguments
6352 =========
6353
6354 A: On entry, the M-by-N matrix A.
6355 On exit, the elements on and below the diagonal of the array
6356 contain the m-by-min(m,n) lower trapezoidal matrix L (L is
6357 lower triangular if m <= n); the elements above the diagonal,
6358 with the array tau, represent the orthogonal matrix Q as a
6359 product of elementary reflectors.
6360
6361 tau: The scalar factors of the elementary reflectors.
6362
6363 info: = 0: successful exit
6364 < 0: if info = -i, the i-th argument had an illegal value
6365
6366 =for example
6367
6368 $a = random (float, 100, 50);
6369 $info = null;
6370 $tau = zeroes(float, 50);
6371 gelqf($a, $tau, $info);
6372
6373 =pod
6374
6375 Broadcasts over its inputs.
6376
6377 =for bad
6378
6379 C<gelqf> ignores the bad-value flag of the input ndarrays.
6380 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6381
6382 =cut
6383
6384
6385
6386
6387 *gelqf = \&PDL::gelqf;
6388
6389
6390
6391
6392
6393
6394 =head2 orglq
6395
6396 =for sig
6397
6398 Signature: ([io]A(m,n); tau(k); int [o]info())
6399 Types: (float double)
6400
6401 =for usage
6402
6403 $info = orglq($A, $tau);
6404 orglq($A, $tau, $info); # all arguments given
6405 $info = $A->orglq($tau); # method call
6406 $A->orglq($tau, $info);
6407
6408 =for ref
6409
6410 Generates an M-by-N real matrix Q with orthonormal rows,
6411 which is defined as the first M rows of a product of K elementary
6412 reflectors of order N
6413
6414 Q = H(k) . . . H(2) H(1)
6415
6416 as returned by gelqf.
6417
6418 Arguments
6419 =========
6420
6421 A: On entry, the i-th row must contain the vector which defines
6422 the elementary reflector H(i), for i = 1,2,...,k, as returned
6423 by gelqf in the first k rows of its array argument A.
6424 On exit, the M-by-N matrix Q.
6425
6426 tau: tau(i) must contain the scalar factor of the elementary
6427 reflector H(i), as returned by gelqf.
6428
6429 info: = 0: successful exit
6430 < 0: if info = -i, the i-th argument has an illegal value
6431
6432 =for example
6433
6434 $a = random (float, 100, 50);
6435 $info = null;
6436 $tau = zeroes(float, 50);
6437 gelqf($a, $tau, $info);
6438 orglq($a, $tau, $info) unless $info != 0;
6439
6440 =pod
6441
6442 Broadcasts over its inputs.
6443
6444 =for bad
6445
6446 C<orglq> ignores the bad-value flag of the input ndarrays.
6447 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6448
6449 =cut
6450
6451
6452
6453
6454 *orglq = \&PDL::orglq;
6455
6456
6457
6458
6459
6460
6461 =head2 ormlq
6462
6463 =for sig
6464
6465 Signature: (A(k,p); int side(); int trans(); tau(k); [io]C(m,n);int [o]info())
6466 Types: (float double)
6467
6468 =for usage
6469
6470 $info = ormlq($A, $side, $trans, $tau, $C);
6471 ormlq($A, $side, $trans, $tau, $C, $info); # all arguments given
6472 $info = $A->ormlq($side, $trans, $tau, $C); # method call
6473 $A->ormlq($side, $trans, $tau, $C, $info);
6474
6475 =for ref
6476
6477 Overwrites the general real M-by-N matrix C with
6478
6479 side = 0 side = 1
6480 trans = 0: Q * C C * Q
6481 trans = 1: Q' * C C * Q'
6482
6483 where Q is a real orthogonal matrix defined as the product of k
6484 elementary reflectors
6485
6486 Q = H(k) . . . H(2) H(1)
6487
6488 as returned by gelqf.
6489
6490 Q is of order M if C<side> = 0 and of order N
6491 if C<side> = 1.
6492
6493 Arguments
6494 =========
6495
6496 side: = 0: apply Q or Q' from the Left;
6497 = 1: apply Q or Q' from the Right.
6498
6499 trans: = 0: No transpose, apply Q;
6500 = 1: Transpose, apply Q'.
6501
6502 A: The i-th row must contain the vector which defines the
6503 elementary reflector H(i), for i = 1,2,...,k, as returned by
6504 gelqf in the first k rows of its array argument A.
6505 A is modified by the routine but restored on exit.
6506
6507 tau: tau(i) must contain the scalar factor of the elementary
6508 reflector H(i), as returned by gelqf.
6509
6510 C: On entry, the M-by-N matrix C.
6511 On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
6512
6513 info: = 0: successful exit
6514 < 0: if info = -i, the i-th argument had an illegal value
6515
6516 =for example
6517
6518 $a = random (float, 50, 100);
6519 $a = transpose($a);
6520 $info = null;
6521 $tau = zeroes(float, 50);
6522 gelqf($a, $tau, $info);
6523 $c = random(70,50);
6524 # $c will contain the result
6525 $c->reshape(70,100);
6526 $c = transpose($c);
6527 ormlq($a, $tau, $c, $info);
6528
6529 =pod
6530
6531 Broadcasts over its inputs.
6532
6533 =for bad
6534
6535 C<ormlq> ignores the bad-value flag of the input ndarrays.
6536 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6537
6538 =cut
6539
6540
6541
6542
6543 *ormlq = \&PDL::ormlq;
6544
6545
6546
6547
6548
6549
6550 =head2 geqlf
6551
6552 =for sig
6553
6554 Signature: ([io]A(m,n); [o]tau(k); int [o]info())
6555 Types: (float double)
6556
6557 =for usage
6558
6559 ($tau, $info) = geqlf($A);
6560 geqlf($A, $tau, $info); # all arguments given
6561 ($tau, $info) = $A->geqlf; # method call
6562 $A->geqlf($tau, $info);
6563
6564 =for ref
6565
6566 Computes a QL factorization of a real M-by-N matrix A:
6567
6568 A = Q * L
6569
6570 The matrix Q is represented as a product of elementary reflectors
6571
6572 Q = H(k) . . . H(2) H(1), where k = min(m,n).
6573
6574 Each H(i) has the form
6575
6576 H(i) = I - tau * v * v'
6577
6578 where tau is a real scalar, and v is a real vector with
6579 v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in
6580 A(1:m-k+i-1,n-k+i), and tau in TAU(i).
6581
6582 Arguments
6583 =========
6584
6585 A: On entry, the M-by-N matrix A.
6586 On exit,
6587 if m >= n, the lower triangle of the subarray
6588 A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L;
6589 if m <= n, the elements on and below the (n-m)-th
6590 superdiagonal contain the M-by-N lower trapezoidal matrix L;
6591 the remaining elements, with the array tau, represent the
6592 orthogonal matrix Q as a product of elementary reflectors.
6593
6594 tau: The scalar factors of the elementary reflectors.
6595
6596 info: = 0: successful exit
6597 < 0: if info = -i, the i-th argument had an illegal value
6598
6599 =for example
6600
6601 $a = random (float, 100, 50);
6602 $info = null;
6603 $tau = zeroes(float, 50);
6604 geqlf($a, $tau, $info);
6605
6606 =pod
6607
6608 Broadcasts over its inputs.
6609
6610 =for bad
6611
6612 C<geqlf> ignores the bad-value flag of the input ndarrays.
6613 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6614
6615 =cut
6616
6617
6618
6619
6620 *geqlf = \&PDL::geqlf;
6621
6622
6623
6624
6625
6626
6627 =head2 orgql
6628
6629 =for sig
6630
6631 Signature: ([io]A(m,n); tau(k); int [o]info())
6632 Types: (float double)
6633
6634 =for usage
6635
6636 $info = orgql($A, $tau);
6637 orgql($A, $tau, $info); # all arguments given
6638 $info = $A->orgql($tau); # method call
6639 $A->orgql($tau, $info);
6640
6641 =for ref
6642
6643 Generates an M-by-N real matrix Q with orthonormal columns,
6644 which is defined as the last N columns of a product of K elementary
6645 reflectors of order M
6646
6647 Q = H(k) . . . H(2) H(1)
6648
6649 as returned by geqlf.
6650
6651 Arguments
6652 =========
6653
6654 A: On entry, the (n-k+i)-th column must contain the vector which
6655 defines the elementary reflector H(i), for i = 1,2,...,k, as
6656 returned by geqlf in the last k columns of its array
6657 argument A.
6658 On exit, the M-by-N matrix Q.
6659
6660 tau: tau(i) must contain the scalar factor of the elementary
6661 reflector H(i), as returned by geqlf.
6662
6663 info: = 0: successful exit
6664 < 0: if info = -i, the i-th argument has an illegal value
6665
6666 =for example
6667
6668 $a = random (float, 100, 50);
6669 $info = null;
6670 $tau = zeroes(float, 50);
6671 geqlf($a, $tau, $info);
6672 orgql($a, $tau, $info) unless $info != 0;
6673
6674 =pod
6675
6676 Broadcasts over its inputs.
6677
6678 =for bad
6679
6680 C<orgql> ignores the bad-value flag of the input ndarrays.
6681 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6682
6683 =cut
6684
6685
6686
6687
6688 *orgql = \&PDL::orgql;
6689
6690
6691
6692
6693
6694
6695 =head2 ormql
6696
6697 =for sig
6698
6699 Signature: (A(p,k); int side(); int trans(); tau(k); [io]C(m,n);int [o]info())
6700 Types: (float double)
6701
6702 =for usage
6703
6704 $info = ormql($A, $side, $trans, $tau, $C);
6705 ormql($A, $side, $trans, $tau, $C, $info); # all arguments given
6706 $info = $A->ormql($side, $trans, $tau, $C); # method call
6707 $A->ormql($side, $trans, $tau, $C, $info);
6708
6709 =for ref
6710
6711 Overwrites the general real M-by-N matrix C with
6712
6713 side = 0 side = 1
6714 trans = 0: Q * C C * Q
6715 trans = 1: Q' * C C * Q'
6716
6717 where Q is a real orthogonal matrix defined as the product of k
6718 elementary reflectors
6719
6720 Q = H(k) . . . H(2) H(1)
6721
6722 as returned by geqlf.
6723
6724 Q is of order M if C<side> = 0 and of order N
6725 if C<side> = 1.
6726
6727 Arguments
6728 =========
6729
6730 side: = 0: apply Q or Q' from the Left;
6731 = 1: apply Q or Q' from the Right.
6732
6733 trans: = 0: No transpose, apply Q;
6734 = 1: Transpose, apply Q'.
6735
6736 A: The i-th row must contain the vector which defines the
6737 elementary reflector H(i), for i = 1,2,...,k, as returned by
6738 geqlf in the last k rows of its array argument A.
6739 A is modified by the routine but restored on exit.
6740
6741 tau: tau(i) must contain the scalar factor of the elementary
6742 reflector H(i), as returned by geqlf.
6743
6744 C: On entry, the M-by-N matrix C.
6745 On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
6746
6747 info: = 0: successful exit
6748 < 0: if info = -i, the i-th argument had an illegal value
6749
6750 =for example
6751
6752 $a = random (float, 50, 100);
6753 $a = transpose($a);
6754 $info = null;
6755 $tau = zeroes(float, 50);
6756 geqlf($a, $tau, $info);
6757 $c = random(70,50);
6758 # $c will contain the result
6759 $c->reshape(70,100);
6760 $c = transpose($c);
6761 ormql($a, $tau, $c, $info);
6762
6763 =pod
6764
6765 Broadcasts over its inputs.
6766
6767 =for bad
6768
6769 C<ormql> ignores the bad-value flag of the input ndarrays.
6770 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6771
6772 =cut
6773
6774
6775
6776
6777 *ormql = \&PDL::ormql;
6778
6779
6780
6781
6782
6783
6784 =head2 gerqf
6785
6786 =for sig
6787
6788 Signature: ([io]A(m,n); [o]tau(k); int [o]info())
6789 Types: (float double)
6790
6791 =for usage
6792
6793 ($tau, $info) = gerqf($A);
6794 gerqf($A, $tau, $info); # all arguments given
6795 ($tau, $info) = $A->gerqf; # method call
6796 $A->gerqf($tau, $info);
6797
6798 =for ref
6799
6800 Computes an RQ factorization of a real M-by-N matrix A:
6801
6802 A = R * Q.
6803
6804 The matrix Q is represented as a product of elementary reflectors
6805
6806 Q = H(1) H(2) . . . H(k), where k = min(m,n).
6807
6808 Each H(i) has the form
6809
6810 H(i) = I - tau * v * v'
6811
6812 where tau is a real scalar, and v is a real vector with
6813 v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in
6814 A(m-k+i,1:n-k+i-1), and tau in TAU(i).
6815
6816 Arguments
6817 =========
6818
6819 A: On entry, the M-by-N matrix A.
6820 On exit,
6821 if m <= n, the upper triangle of the subarray
6822 A(1:m,n-m+1:n) contains the M-by-M upper triangular matrix R;
6823 if m >= n, the elements on and above the (m-n)-th subdiagonal
6824 contain the M-by-N upper trapezoidal matrix R;
6825 the remaining elements, with the array tau, represent the
6826 orthogonal matrix Q as a product of min(m,n) elementary
6827 reflectors (see Further Details).
6828
6829 tau: The scalar factors of the elementary reflectors.
6830
6831 info: = 0: successful exit
6832 < 0: if info = -i, the i-th argument had an illegal value
6833
6834 =for example
6835
6836 $a = random (float, 100, 50);
6837 $info = null;
6838 $tau = zeroes(float, 50);
6839 gerqf($a, $tau, $info);
6840
6841 =pod
6842
6843 Broadcasts over its inputs.
6844
6845 =for bad
6846
6847 C<gerqf> ignores the bad-value flag of the input ndarrays.
6848 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6849
6850 =cut
6851
6852
6853
6854
6855 *gerqf = \&PDL::gerqf;
6856
6857
6858
6859
6860
6861
6862 =head2 orgrq
6863
6864 =for sig
6865
6866 Signature: ([io]A(m,n); tau(k); int [o]info())
6867 Types: (float double)
6868
6869 =for usage
6870
6871 $info = orgrq($A, $tau);
6872 orgrq($A, $tau, $info); # all arguments given
6873 $info = $A->orgrq($tau); # method call
6874 $A->orgrq($tau, $info);
6875
6876 =for ref
6877
6878 Generates an M-by-N real matrix Q with orthonormal rows,
6879 which is defined as the last M rows of a product of K elementary
6880 reflectors of order N
6881
6882 Q = H(1) H(2) . . . H(k)
6883
6884 as returned by gerqf.
6885
6886 Arguments
6887 =========
6888
6889 A: On entry, the (m-k+i)-th row must contain the vector which
6890 defines the elementary reflector H(i), for i = 1,2,...,k, as
6891 returned by gerqf in the last k rows of its array argument
6892 A.
6893 On exit, the M-by-N matrix Q.
6894
6895 tau: tau(i) must contain the scalar factor of the elementary
6896 reflector H(i), as returned by gerqf.
6897
6898 info: = 0: successful exit
6899 < 0: if info = -i, the i-th argument has an illegal value
6900
6901 =for example
6902
6903 $a = random (float, 100, 50);
6904 $info = null;
6905 $tau = zeroes(float, 50);
6906 gerqf($a, $tau, $info);
6907 orgrq($a, $tau, $info) unless $info != 0;
6908
6909 =pod
6910
6911 Broadcasts over its inputs.
6912
6913 =for bad
6914
6915 C<orgrq> ignores the bad-value flag of the input ndarrays.
6916 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
6917
6918 =cut
6919
6920
6921
6922
6923 *orgrq = \&PDL::orgrq;
6924
6925
6926
6927
6928
6929
6930 =head2 ormrq
6931
6932 =for sig
6933
6934 Signature: (A(k,p); int side(); int trans(); tau(k); [io]C(m,n);int [o]info())
6935 Types: (float double)
6936
6937 =for usage
6938
6939 $info = ormrq($A, $side, $trans, $tau, $C);
6940 ormrq($A, $side, $trans, $tau, $C, $info); # all arguments given
6941 $info = $A->ormrq($side, $trans, $tau, $C); # method call
6942 $A->ormrq($side, $trans, $tau, $C, $info);
6943
6944 =for ref
6945
6946 Overwrites the general real M-by-N matrix C with
6947
6948 side = 0 side = 1
6949 trans = 0: Q * C C * Q
6950 trans = 1: Q' * C C * Q'
6951
6952 where Q is a real orthogonal matrix defined as the product of k
6953 elementary reflectors
6954
6955 Q = H(1) H(2) . . . H(k)
6956
6957 as returned by gerqf.
6958
6959 Q is of order M if C<side> = 0 and of order N
6960 if C<side> = 1.
6961
6962 Arguments
6963 =========
6964
6965 side: = 0: apply Q or Q' from the Left;
6966 = 1: apply Q or Q' from the Right.
6967
6968 trans: = 0: No transpose, apply Q;
6969 = 1: Transpose, apply Q'.
6970
6971 A: The i-th row must contain the vector which defines the
6972 elementary reflector H(i), for i = 1,2,...,k, as returned by
6973 gerqf in the last k rows of its array argument A.
6974 A is modified by the routine but restored on exit.
6975
6976 tau: tau(i) must contain the scalar factor of the elementary
6977 reflector H(i), as returned by gerqf.
6978
6979 C: On entry, the M-by-N matrix C.
6980 On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
6981
6982 info: = 0: successful exit
6983 < 0: if info = -i, the i-th argument had an illegal value
6984
6985 =for example
6986
6987 $a = random (float, 50, 100);
6988 $a = transpose($a);
6989 $info = null;
6990 $tau = zeroes(float, 50);
6991 gerqf($a, $tau, $info);
6992 $c = random(70,50);
6993 # $c will contain the result
6994 $c->reshape(70,100);
6995 $c = transpose($c);
6996 ormrq($a, $tau, $c, $info);
6997
6998 =pod
6999
7000 Broadcasts over its inputs.
7001
7002 =for bad
7003
7004 C<ormrq> ignores the bad-value flag of the input ndarrays.
7005 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7006
7007 =cut
7008
7009
7010
7011
7012 *ormrq = \&PDL::ormrq;
7013
7014
7015
7016
7017
7018
7019 =head2 tzrzf
7020
7021 =for sig
7022
7023 Signature: ([io]A(m,n); [o]tau(k); int [o]info())
7024 Types: (float double)
7025
7026 =for usage
7027
7028 ($tau, $info) = tzrzf($A);
7029 tzrzf($A, $tau, $info); # all arguments given
7030 ($tau, $info) = $A->tzrzf; # method call
7031 $A->tzrzf($tau, $info);
7032
7033 =for ref
7034
7035 Reduces the M-by-N ( M <= N ) real upper trapezoidal matrix A
7036 to upper triangular form by means of orthogonal transformations.
7037
7038 The upper trapezoidal matrix A is factored as
7039
7040 A = ( R 0 ) * Z,
7041
7042 where Z is an N-by-N orthogonal matrix and R is an M-by-M upper
7043 triangular matrix.
7044
7045 The factorization is obtained by Householder's method. The kth
7046 transformation matrix, Z( k ), which is used to introduce zeros into
7047 the ( m - k + 1 )th row of A, is given in the form
7048
7049 Z( k ) = ( I 0 ),
7050 ( 0 T( k ) )
7051
7052 where
7053
7054 T( k ) = I - tau*u( k )*u( k )', u( k ) = ( 1 ),
7055 ( 0 )
7056 ( z( k ) )
7057
7058 tau is a scalar and z( k ) is an ( n - m ) element vector.
7059 tau and z( k ) are chosen to annihilate the elements of the kth row
7060 of X.
7061
7062 The scalar tau is returned in the kth element of C<tau> and the vector
7063 u( k ) in the kth row of A, such that the elements of z( k ) are
7064 in a( k, m + 1 ), ..., a( k, n ). The elements of R are returned in
7065 the upper triangular part of A.
7066
7067 Z is given by
7068
7069 Z = Z( 1 ) * Z( 2 ) * ... * Z( m ).
7070
7071 Arguments
7072 =========
7073
7074 A: On entry, the leading M-by-N upper trapezoidal part of the
7075 array A must contain the matrix to be factorized.
7076 On exit, the leading M-by-M upper triangular part of A
7077 contains the upper triangular matrix R, and elements M+1 to
7078 N of the first M rows of A, with the array tau, represent the
7079 orthogonal matrix Z as a product of M elementary reflectors.
7080
7081 tau: The scalar factors of the elementary reflectors.
7082
7083 info: = 0: successful exit
7084 < 0: if info = -i, the i-th argument had an illegal value
7085
7086 =for example
7087
7088 $a = random (float, 50, 100);
7089 $info = null;
7090 $tau = zeroes(float, 50);
7091 tzrzf($a, $tau, $info);
7092
7093 =pod
7094
7095 Broadcasts over its inputs.
7096
7097 =for bad
7098
7099 C<tzrzf> ignores the bad-value flag of the input ndarrays.
7100 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7101
7102 =cut
7103
7104
7105
7106
7107 *tzrzf = \&PDL::tzrzf;
7108
7109
7110
7111
7112
7113
7114 =head2 ormrz
7115
7116 =for sig
7117
7118 Signature: (A(k,p); int side(); int trans(); tau(k); [io]C(m,n);int [o]info())
7119 Types: (float double)
7120
7121 =for usage
7122
7123 $info = ormrz($A, $side, $trans, $tau, $C);
7124 ormrz($A, $side, $trans, $tau, $C, $info); # all arguments given
7125 $info = $A->ormrz($side, $trans, $tau, $C); # method call
7126 $A->ormrz($side, $trans, $tau, $C, $info);
7127
7128 =for ref
7129
7130 Overwrites the general real M-by-N matrix C with
7131
7132 side = 0 side = 1
7133 trans = 0: Q * C C * Q
7134 trans = 1: Q' * C C * Q'
7135
7136 where Q is a real orthogonal matrix defined as the product of k
7137 elementary reflectors
7138
7139 Q = H(1) H(2) . . . H(k)
7140
7141 as returned by tzrzf.
7142
7143 Q is of order M if C<side> = 0 and of order N
7144 if C<side> = 1.
7145
7146 Arguments
7147 =========
7148
7149 side: = 0: apply Q or Q' from the Left;
7150 = 1: apply Q or Q' from the Right.
7151
7152 trans: = 0: No transpose, apply Q;
7153 = 1: Transpose, apply Q'.
7154
7155 A: The i-th row must contain the vector which defines the
7156 elementary reflector H(i), for i = 1,2,...,k, as returned by
7157 tzrzf in the last k rows of its array argument A.
7158 A is modified by the routine but restored on exit.
7159
7160 tau: tau(i) must contain the scalar factor of the elementary
7161 reflector H(i), as returned by tzrzf.
7162
7163 C: On entry, the M-by-N matrix C.
7164 On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
7165
7166 info: = 0: successful exit
7167 < 0: if info = -i, the i-th argument had an illegal value
7168
7169 =for example
7170
7171 $a = random (float, 50, 100);
7172 $a = transpose($a);
7173 $info = null;
7174 $tau = zeroes(float, 50);
7175 tzrzf($a, $tau, $info);
7176 $c = random(70,50);
7177 # $c will contain the result
7178 $c->reshape(70,100);
7179 $c = transpose($c);
7180 ormrz($a, $tau, $c, $info);
7181
7182 =pod
7183
7184 Broadcasts over its inputs.
7185
7186 =for bad
7187
7188 C<ormrz> ignores the bad-value flag of the input ndarrays.
7189 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7190
7191 =cut
7192
7193
7194
7195
7196 *ormrz = \&PDL::ormrz;
7197
7198
7199
7200
7201
7202
7203 =head2 gehrd
7204
7205 =for sig
7206
7207 Signature: ([io]A(n,n); int ilo();int ihi();[o]tau(k); int [o]info())
7208 Types: (float double)
7209
7210 =for usage
7211
7212 ($tau, $info) = gehrd($A, $ilo, $ihi);
7213 gehrd($A, $ilo, $ihi, $tau, $info); # all arguments given
7214 ($tau, $info) = $A->gehrd($ilo, $ihi); # method call
7215 $A->gehrd($ilo, $ihi, $tau, $info);
7216
7217 =for ref
7218
7219 Reduces a real general matrix A to upper Hessenberg form H by
7220 an orthogonal similarity transformation: Q' * A * Q = H .
7221
7222 Further Details
7223 ===============
7224
7225 The matrix Q is represented as a product of (ihi-ilo) elementary
7226 reflectors
7227
7228 Q = H(ilo) H(ilo+1) . . . H(ihi-1).
7229
7230 Each H(i) has the form
7231
7232 H(i) = I - tau * v * v'
7233 where tau is a real scalar, and v is a real vector with
7234 v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on
7235 exit in A(i+2:ihi,i), and tau in tau(i).
7236
7237 The contents of A are illustrated by the following example, with
7238 n = 7, ilo = 2 and ihi = 6:
7239
7240 on entry, on exit,
7241
7242 ( a a a a a a a ) ( a a h h h h a )
7243 ( a a a a a a ) ( a h h h h a )
7244 ( a a a a a a ) ( h h h h h h )
7245 ( a a a a a a ) ( v2 h h h h h )
7246 ( a a a a a a ) ( v2 v3 h h h h )
7247 ( a a a a a a ) ( v2 v3 v4 h h h )
7248 ( a ) ( a )
7249
7250 where a denotes an element of the original matrix A, h denotes a
7251 modified element of the upper Hessenberg matrix H, and vi denotes an
7252 element of the vector defining H(i).
7253
7254 Arguments
7255 =========
7256
7257 ilo:
7258 ihi: It is assumed that A is already upper triangular in rows
7259 and columns 1:ilo-1 and ihi+1:N. ilo and ihi are normally
7260 set by a previous call to gebal; otherwise they should be
7261 set to 1 and N respectively. See Further Details.
7262 1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0.
7263
7264 A: On entry, the N-by-N general matrix to be reduced.
7265 On exit, the upper triangle and the first subdiagonal of A
7266 are overwritten with the upper Hessenberg matrix H, and the
7267 elements below the first subdiagonal, with the array tau,
7268 represent the orthogonal matrix Q as a product of elementary
7269 reflectors. See Further Details.
7270
7271 tau: The scalar factors of the elementary reflectors (see Further
7272 Details). Elements 1:ilo-1 and ihi:N-1 of tau are set to
7273 zero. (dimension (N-1))
7274
7275 info: = 0: successful exit
7276 < 0: if info = -i, the i-th argument had an illegal value.
7277
7278 =for example
7279
7280 $a = random (50, 50);
7281 $info = null;
7282 $tau = zeroes(50);
7283 gehrd($a, 1, 50, $tau, $info);
7284
7285 =pod
7286
7287 Broadcasts over its inputs.
7288
7289 =for bad
7290
7291 C<gehrd> ignores the bad-value flag of the input ndarrays.
7292 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7293
7294 =cut
7295
7296
7297
7298
7299 *gehrd = \&PDL::gehrd;
7300
7301
7302
7303
7304
7305
7306 =head2 orghr
7307
7308 =for sig
7309
7310 Signature: ([io]A(n,n); int ilo();int ihi();tau(k); int [o]info())
7311 Types: (float double)
7312
7313 =for usage
7314
7315 $info = orghr($A, $ilo, $ihi, $tau);
7316 orghr($A, $ilo, $ihi, $tau, $info); # all arguments given
7317 $info = $A->orghr($ilo, $ihi, $tau); # method call
7318 $A->orghr($ilo, $ihi, $tau, $info);
7319
7320 =for ref
7321
7322 Generates a real orthogonal matrix Q which is defined as the
7323 product of ihi-ilo elementary reflectors of order N, as returned by
7324 C<gehrd>:
7325
7326 Q = H(ilo) H(ilo+1) . . . H(ihi-1).
7327
7328 Arguments
7329 =========
7330
7331 ilo:
7332 ihi: ilo and ihi must have the same values as in the previous call
7333 of gehrd. Q is equal to the unit matrix except in the
7334 submatrix Q(ilo+1:ihi,ilo+1:ihi).
7335 1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0.
7336
7337 A: On entry, the vectors which define the elementary reflectors,
7338 as returned by gehrd.
7339 On exit, the N-by-N orthogonal matrix Q.
7340
7341 tau: tau(i) must contain the scalar factor of the elementary
7342 reflector H(i), as returned by gehrd.(dimension (N-1))
7343
7344 info: = 0: successful exit
7345 < 0: if info = -i, the i-th argument had an illegal value
7346
7347 =for example
7348
7349 $a = random (50, 50);
7350 $info = null;
7351 $tau = zeroes(50);
7352 gehrd($a, 1, 50, $tau, $info);
7353 orghr($a, 1, 50, $tau, $info);
7354
7355 =pod
7356
7357 Broadcasts over its inputs.
7358
7359 =for bad
7360
7361 C<orghr> ignores the bad-value flag of the input ndarrays.
7362 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7363
7364 =cut
7365
7366
7367
7368
7369 *orghr = \&PDL::orghr;
7370
7371
7372
7373
7374
7375
7376 =head2 hseqr
7377
7378 =for sig
7379
7380 Signature: ([io]H(n,n); int job();int compz();int ilo();int ihi();[o]wr(n); [o]wi(n);[o]Z(m,m); int [o]info())
7381 Types: (float double)
7382
7383 =for usage
7384
7385 ($wr, $wi, $Z, $info) = hseqr($H, $job, $compz, $ilo, $ihi);
7386 hseqr($H, $job, $compz, $ilo, $ihi, $wr, $wi, $Z, $info); # all arguments given
7387 ($wr, $wi, $Z, $info) = $H->hseqr($job, $compz, $ilo, $ihi); # method call
7388 $H->hseqr($job, $compz, $ilo, $ihi, $wr, $wi, $Z, $info);
7389
7390 =for ref
7391
7392 Computes the eigenvalues of a real upper Hessenberg matrix H
7393 and, optionally, the matrices T and Z from the Schur decomposition
7394 H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur
7395 form), and Z is the orthogonal matrix of Schur vectors.
7396
7397 Optionally Z may be postmultiplied into an input orthogonal matrix Q,
7398 so that this routine can give the Schur factorization of a matrix A
7399 which has been reduced to the Hessenberg form H by the orthogonal
7400 matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T.
7401
7402 Arguments
7403 =========
7404
7405 job: = 0: compute eigenvalues only;
7406 = 1: compute eigenvalues and the Schur form T.
7407
7408 compz: = 0: no Schur vectors are computed;
7409 = 1: Z is initialized to the unit matrix and the matrix Z
7410 of Schur vectors of H is returned;
7411 = 2: Z must contain an orthogonal matrix Q on entry, and
7412 the product Q*Z is returned.
7413
7414 ilo:
7415 ihi: It is assumed that H is already upper triangular in rows
7416 and columns 1:ilo-1 and ihi+1:N. ilo and ihi are normally
7417 set by a previous call to gebal, and then passed to gehrd
7418 when the matrix output by gebal is reduced to Hessenberg
7419 form. Otherwise ilo and ihi should be set to 1 and N
7420 respectively.
7421 1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0.
7422
7423 H: On entry, the upper Hessenberg matrix H.
7424 On exit, if job = 1, H contains the upper quasi-triangular
7425 matrix T from the Schur decomposition (the Schur form);
7426 2-by-2 diagonal blocks (corresponding to complex conjugate
7427 pairs of eigenvalues) are returned in standard form, with
7428 H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0. If job = 0,
7429 the contents of H are unspecified on exit.
7430
7431 wr:
7432 wi: The real and imaginary parts, respectively, of the computed
7433 eigenvalues. If two eigenvalues are computed as a complex
7434 conjugate pair, they are stored in consecutive elements of
7435 wr and wi, say the i-th and (i+1)th, with wi(i) > 0 and
7436 wi(i+1) < 0. If job = 1, the eigenvalues are stored in the
7437 same order as on the diagonal of the Schur form returned in
7438 H, with wr(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2
7439 diagonal block, wi(i) = sqrt(H(i+1,i)*H(i,i+1)) and
7440 wi(i+1) = -wi(i).
7441
7442 Z: If compz = 0: Z is not referenced.
7443 If compz = 1: on entry, Z need not be set, and on exit, Z
7444 contains the orthogonal matrix Z of the Schur vectors of H.
7445 If compz = 2: on entry Z must contain an N-by-N matrix Q,
7446 which is assumed to be equal to the unit matrix except for
7447 the submatrix Z(ilo:ihi,ilo:ihi); on exit Z contains Q*Z.
7448 Normally Q is the orthogonal matrix generated by orghr after
7449 the call to gehrd which formed the Hessenberg matrix H.
7450
7451 info: = 0: successful exit
7452 < 0: if info = -i, the i-th argument had an illegal value
7453 > 0: if info = i, hseqr failed to compute all of the
7454 eigenvalues in a total of 30*(ihi-ilo+1) iterations;
7455 elements 1:ilo-1 and i+1:n of wr and wi contain those
7456 eigenvalues which have been successfully computed.
7457
7458 =for example
7459
7460 $a = random (50, 50);
7461 $info = null;
7462 $tau = zeroes(50);
7463 $z= zeroes(1,1);
7464 gehrd($a, 1, 50, $tau, $info);
7465 hseqr($a,0,0,1,50,($wr=null),($wi=null),$z,$info);
7466
7467 =pod
7468
7469 Broadcasts over its inputs.
7470
7471 =for bad
7472
7473 C<hseqr> ignores the bad-value flag of the input ndarrays.
7474 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7475
7476 =cut
7477
7478
7479
7480
7481 *hseqr = \&PDL::hseqr;
7482
7483
7484
7485
7486
7487
7488 =head2 trevc
7489
7490 =for sig
7491
7492 Signature: (T(n,n);int select(q);[o]VL(m,m); [o]VR(p,p);int [o]m(); int [o]info(); [t]work(workn=CALC(3*$SIZE(n))); int side; int howmny)
7493 Types: (float double)
7494
7495 =for usage
7496
7497 ($VL, $VR, $m, $info) = trevc($T, $side, $howmny, $select);
7498 trevc($T, $side, $howmny, $select, $VL, $VR, $m, $info); # all arguments given
7499 ($VL, $VR, $m, $info) = $T->trevc($side, $howmny, $select); # method call
7500 $T->trevc($side, $howmny, $select, $VL, $VR, $m, $info);
7501
7502 =for ref
7503
7504 Computes some or all of the right and/or left eigenvectors of
7505 a real upper quasi-triangular matrix T.
7506
7507 The right eigenvector x and the left eigenvector y of T corresponding
7508 to an eigenvalue w are defined by:
7509
7510 T*x = w*x, y'*T = w*y'
7511 where y' denotes the conjugate transpose of the vector y.
7512
7513 If all eigenvectors are requested, the routine may either return the
7514 matrices X and/or Y of right or left eigenvectors of T, or the
7515 products Q*X and/or Q*Y, where Q is an input orthogonal
7516 matrix. If T was obtained from the real-Schur factorization of an
7517 original matrix A = Q*T*Q', then Q*X and Q*Y are the matrices of
7518 right or left eigenvectors of A.
7519
7520 T must be in Schur canonical form (as returned by hseqr), that is,
7521 block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each
7522 2-by-2 diagonal block has its diagonal elements equal and its
7523 off-diagonal elements of opposite sign. Corresponding to each 2-by-2
7524 diagonal block is a complex conjugate pair of eigenvalues and
7525 eigenvectors; only one eigenvector of the pair is computed, namely
7526 the one corresponding to the eigenvalue with positive imaginary part.
7527
7528 Further Details
7529 ===============
7530
7531 The algorithm used in this program is basically backward (forward)
7532 substitution, with scaling to make the the code robust against
7533 possible overflow.
7534
7535 Each eigenvector is normalized so that the element of largest
7536 magnitude has magnitude 1; here the magnitude of a complex number
7537 (x,y) is taken to be |x| + |y|.
7538
7539 Arguments
7540 =========
7541
7542 side: = 0 : compute both right and left eigenvectors;
7543 = 1 : compute right eigenvectors only;
7544 = 2 : compute left eigenvectors only.
7545
7546 howmny: = 0: compute all right and/or left eigenvectors;
7547 = 1: compute all right and/or left eigenvectors,
7548 and backtransform them using the input matrices
7549 supplied in VR and/or VL;
7550 = 2: compute selected right and/or left eigenvectors,
7551 specified by the logical array select.
7552
7553 select: If howmny = 2, select specifies the eigenvectors to be
7554 computed.
7555 If howmny = 0 or 1, select is not referenced.
7556 To select the real eigenvector corresponding to a real
7557 eigenvalue w(j), select(j) must be set to TRUE. To select
7558 the complex eigenvector corresponding to a complex conjugate
7559 pair w(j) and w(j+1), either select(j) or select(j+1) must be
7560 set to TRUE; then on exit select(j) is TRUE and
7561 select(j+1) is FALSE.
7562
7563 T: The upper quasi-triangular matrix T in Schur canonical form.
7564
7565 VL: On entry, if side = 2 or 0 and howmny = 1, VL must
7566 contain an N-by-N matrix Q (usually the orthogonal matrix Q
7567 of Schur vectors returned by hseqr).
7568 On exit, if side = 2 or 0, VL contains:
7569 if howmny = 0, the matrix Y of left eigenvectors of T;
7570 VL has the same quasi-lower triangular form
7571 as T'. If T(i,i) is a real eigenvalue, then
7572 the i-th column VL(i) of VL is its
7573 corresponding eigenvector. If T(i:i+1,i:i+1)
7574 is a 2-by-2 block whose eigenvalues are
7575 complex-conjugate eigenvalues of T, then
7576 VL(i)+sqrt(-1)*VL(i+1) is the complex
7577 eigenvector corresponding to the eigenvalue
7578 with positive real part.
7579 if howmny = 1, the matrix Q*Y;
7580 if howmny = 2, the left eigenvectors of T specified by
7581 select, stored consecutively in the columns
7582 of VL, in the same order as their
7583 eigenvalues.
7584 A complex eigenvector corresponding to a complex eigenvalue
7585 is stored in two consecutive columns, the first holding the
7586 real part, and the second the imaginary part.
7587 If side = 1, VL is not referenced.
7588
7589 VR: On entry, if side = 1 or 0 and howmny = 1, VR must
7590 contain an N-by-N matrix Q (usually the orthogonal matrix Q
7591 of Schur vectors returned by hseqr).
7592 On exit, if side = 1 or 0, VR contains:
7593 if howmny = 0, the matrix X of right eigenvectors of T;
7594 VR has the same quasi-upper triangular form
7595 as T. If T(i,i) is a real eigenvalue, then
7596 the i-th column VR(i) of VR is its
7597 corresponding eigenvector. If T(i:i+1,i:i+1)
7598 is a 2-by-2 block whose eigenvalues are
7599 complex-conjugate eigenvalues of T, then
7600 VR(i)+sqrt(-1)*VR(i+1) is the complex
7601 eigenvector corresponding to the eigenvalue
7602 with positive real part.
7603 if howmny = 1, the matrix Q*X;
7604 if howmny = 2, the right eigenvectors of T specified by
7605 select, stored consecutively in the columns
7606 of VR, in the same order as their
7607 eigenvalues.
7608 A complex eigenvector corresponding to a complex eigenvalue
7609 is stored in two consecutive columns, the first holding the
7610 real part and the second the imaginary part.
7611 If side = 2, VR is not referenced.
7612
7613 m: The number of columns in the arrays VL and/or VR actually
7614 used to store the eigenvectors.
7615 If howmny = 0 or 1, m is set to N.
7616 Each selected real eigenvector occupies one column and each
7617 selected complex eigenvector occupies two columns.
7618
7619 info: = 0: successful exit
7620 < 0: if info = -i, the i-th argument had an illegal value
7621
7622 =for example
7623
7624 $a = random (50, 50);
7625 $info = null;
7626 $tau = zeroes(50);
7627 $z= zeroes(1,1);
7628 gehrd($a, 1, 50, $tau, $info);
7629 hseqr($a,0,0,1,50,($wr=null),($wi=null),$z,$info);
7630
7631 =pod
7632
7633 Broadcasts over its inputs.
7634
7635 =for bad
7636
7637 C<trevc> ignores the bad-value flag of the input ndarrays.
7638 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7639
7640 =cut
7641
7642
7643
7644
7645 *trevc = \&PDL::trevc;
7646
7647
7648
7649
7650
7651
7652 =head2 tgevc
7653
7654 =for sig
7655
7656 Signature: (A(n,n);B(n,n);int select(q);[o]VL(m,m); [o]VR(p,p);int [o]m(); int [o]info(); [t]work(workn=CALC(6*$SIZE(n))); int side; int howmny)
7657 Types: (float double)
7658
7659 =for usage
7660
7661 ($VL, $VR, $m, $info) = tgevc($A, $side, $howmny, $B, $select);
7662 tgevc($A, $side, $howmny, $B, $select, $VL, $VR, $m, $info); # all arguments given
7663 ($VL, $VR, $m, $info) = $A->tgevc($side, $howmny, $B, $select); # method call
7664 $A->tgevc($side, $howmny, $B, $select, $VL, $VR, $m, $info);
7665
7666 =for ref
7667
7668 Computes some or all of the right and/or left generalized
7669 eigenvectors of a pair of real upper triangular matrices (A,B).
7670
7671 The right generalized eigenvector x and the left generalized
7672 eigenvector y of (A,B) corresponding to a generalized eigenvalue
7673 w are defined by:
7674
7675 (A - wB) * x = 0 and y**H * (A - wB) = 0
7676 where y**H denotes the conjugate transpose of y.
7677
7678 If an eigenvalue w is determined by zero diagonal elements of both A
7679 and B, a unit vector is returned as the corresponding eigenvector.
7680
7681 If all eigenvectors are requested, the routine may either return
7682 the matrices X and/or Y of right or left eigenvectors of (A,B), or
7683 the products Z*X and/or Q*Y, where Z and Q are input orthogonal
7684 matrices. If (A,B) was obtained from the generalized real-Schur
7685 factorization of an original pair of matrices
7686
7687 (A0,B0) = (Q*A*Z**H,Q*B*Z**H),
7688
7689 then Z*X and Q*Y are the matrices of right or left eigenvectors of
7690 A.
7691
7692 A must be block upper triangular, with 1-by-1 and 2-by-2 diagonal
7693 blocks. Corresponding to each 2-by-2 diagonal block is a complex
7694 conjugate pair of eigenvalues and eigenvectors; only one
7695 eigenvector of the pair is computed, namely the one corresponding
7696 to the eigenvalue with positive imaginary part.
7697
7698 Arguments
7699 =========
7700
7701 side: = 0 : compute both right and left eigenvectors;
7702 = 1 : compute right eigenvectors only;
7703 = 2 : compute left eigenvectors only.
7704
7705 howmny: = 0 : compute all right and/or left eigenvectors;
7706 = 1 : compute all right and/or left eigenvectors, and
7707 backtransform them using the input matrices supplied
7708 in VR and/or VL;
7709 = 2 : compute selected right and/or left eigenvectors,
7710 specified by the logical array select.
7711
7712 select: If howmny=2, select specifies the eigenvectors to be
7713 computed.
7714 If howmny=0 or 1, select is not referenced.
7715 To select the real eigenvector corresponding to the real
7716 eigenvalue w(j), select(j) must be set to TRUE To select
7717 the complex eigenvector corresponding to a complex conjugate
7718 pair w(j) and w(j+1), either select(j) or select(j+1) must
7719 be set to TRUE.
7720
7721 A: The upper quasi-triangular matrix A.
7722
7723 B: The upper triangular matrix B. If A has a 2-by-2 diagonal
7724 block, then the corresponding 2-by-2 block of B must be
7725 diagonal with positive elements.
7726
7727 VL: On entry, if side = 2 or 0 and howmny = 1, VL must
7728 contain an N-by-N matrix Q (usually the orthogonal matrix Q
7729 of left Schur vectors returned by hgqez).
7730 On exit, if side = 2 or 0, VL contains:
7731 if howmny = 0, the matrix Y of left eigenvectors of (A,B);
7732 if howmny = 1, the matrix Q*Y;
7733 if howmny = 2, the left eigenvectors of (A,B) specified by
7734 select, stored consecutively in the columns of
7735 VL, in the same order as their eigenvalues.
7736 If side = 1, VL is not referenced.
7737
7738 A complex eigenvector corresponding to a complex eigenvalue
7739 is stored in two consecutive columns, the first holding the
7740 real part, and the second the imaginary part.
7741
7742 VR: On entry, if side = 1 or 0 and howmny = 1, VR must
7743 contain an N-by-N matrix Q (usually the orthogonal matrix Z
7744 of right Schur vectors returned by hgeqz).
7745 On exit, if side = 1 or 0, VR contains:
7746 if howmny = 0, the matrix X of right eigenvectors of (A,B);
7747 if howmny = 1, the matrix Z*X;
7748 if howmny = 2, the right eigenvectors of (A,B) specified by
7749 select, stored consecutively in the columns of
7750 VR, in the same order as their eigenvalues.
7751 If side = 2, VR is not referenced.
7752
7753 A complex eigenvector corresponding to a complex eigenvalue
7754 is stored in two consecutive columns, the first holding the
7755 real part and the second the imaginary part.
7756
7757 M: The number of columns in the arrays VL and/or VR actually
7758 used to store the eigenvectors. If howmny = 0 or 1, M
7759 is set to N. Each selected real eigenvector occupies one
7760 column and each selected complex eigenvector occupies two
7761 columns.
7762
7763 info: = 0: successful exit.
7764 < 0: if info = -i, the i-th argument had an illegal value.
7765 > 0: the 2-by-2 block (info:info+1) does not have a complex
7766 eigenvalue.
7767 =for example
7768
7769 $a = random (50, 50);
7770 $info = null;
7771 $tau = zeroes(50);
7772 $z= zeroes(1,1);
7773 gehrd($a, 1, 50, $tau, $info);
7774 hseqr($a,0,0,1,50,($wr=null),($wi=null),$z,$info);
7775
7776 =pod
7777
7778 Broadcasts over its inputs.
7779
7780 =for bad
7781
7782 C<tgevc> ignores the bad-value flag of the input ndarrays.
7783 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7784
7785 =cut
7786
7787
7788
7789
7790 *tgevc = \&PDL::tgevc;
7791
7792
7793
7794
7795
7796
7797 =head2 gebal
7798
7799 =for sig
7800
7801 Signature: ([io]A(n,n); int job(); int [o]ilo();int [o]ihi();[o]scale(n); int [o]info())
7802 Types: (float double)
7803
7804 =for usage
7805
7806 ($ilo, $ihi, $scale, $info) = gebal($A, $job);
7807 gebal($A, $job, $ilo, $ihi, $scale, $info); # all arguments given
7808 ($ilo, $ihi, $scale, $info) = $A->gebal($job); # method call
7809 $A->gebal($job, $ilo, $ihi, $scale, $info);
7810
7811 =for ref
7812
7813 Balances a general real matrix A. This involves, first,
7814 permuting A by a similarity transformation to isolate eigenvalues
7815 in the first 1 to ilo-1 and last ihi+1 to N elements on the
7816 diagonal; and second, applying a diagonal similarity transformation
7817 to rows and columns ilo to ihi to make the rows and columns as
7818 close in norm as possible. Both steps are optional.
7819
7820 Balancing may reduce the 1-norm of the matrix, and improve the
7821 accuracy of the computed eigenvalues and/or eigenvectors.
7822
7823 Further Details
7824 ===============
7825
7826 The permutations consist of row and column interchanges which put
7827 the matrix in the form
7828
7829 ( T1 X Y )
7830 P A P = ( 0 B Z )
7831 ( 0 0 T2 )
7832
7833 where T1 and T2 are upper triangular matrices whose eigenvalues lie
7834 along the diagonal. The column indices ilo and ihi mark the starting
7835 and ending columns of the submatrix B. Balancing consists of applying
7836 a diagonal similarity transformation inv(D) * B * D to make the
7837 1-norms of each row of B and its corresponding column nearly equal.
7838
7839 The output matrix is
7840
7841 ( T1 X*D Y )
7842 ( 0 inv(D)*B*D inv(D)*Z ).
7843 ( 0 0 T2 )
7844
7845 Information about the permutations P and the diagonal matrix D is
7846 returned in the vector C<scale>.
7847
7848 Arguments
7849 =========
7850
7851 job: Specifies the operations to be performed on A:
7852 = 0: none: simply set ilo = 1, ihi = N, scale(I) = 1.0
7853 for i = 1,...,N;
7854 = 1: permute only;
7855 = 2: scale only;
7856 = 3: both permute and scale.
7857
7858 A: On entry, the input matrix A.
7859 On exit, A is overwritten by the balanced matrix.
7860 If job = 0, A is not referenced.
7861 See Further Details.
7862
7863 ilo:
7864 ihi: ilo and ihi are set to integers such that on exit
7865 A(i,j) = 0 if i > j and j = 1,...,ilo-1 or I = ihi+1,...,N.
7866 If job = 0 or 2, ilo = 1 and ihi = N.
7867
7868 scale: Details of the permutations and scaling factors applied to
7869 A. If P(j) is the index of the row and column interchanged
7870 with row and column j and D(j) is the scaling factor
7871 applied to row and column j, then
7872 scale(j) = P(j) for j = 1,...,ilo-1
7873 = D(j) for j = ilo,...,ihi
7874 = P(j) for j = ihi+1,...,N.
7875 The order in which the interchanges are made is N to ihi+1,
7876 then 1 to ilo-1.
7877
7878 info: = 0: successful exit.
7879 < 0: if info = -i, the i-th argument had an illegal value.
7880
7881 =for example
7882
7883 $a = random (50, 50);
7884 $scale = zeroes(50);
7885 $info = null;
7886 $ilo = null;
7887 $ihi = null;
7888 gebal($a, $ilo, $ihi, $scale, $info);
7889
7890 =pod
7891
7892 Broadcasts over its inputs.
7893
7894 =for bad
7895
7896 C<gebal> ignores the bad-value flag of the input ndarrays.
7897 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7898
7899 =cut
7900
7901
7902
7903
7904 *gebal = \&PDL::gebal;
7905
7906
7907
7908
7909
7910
7911 =head2 gebak
7912
7913 =for sig
7914
7915 Signature: ([io]A(n,m); int job(); int side();int ilo();int ihi();scale(n); int [o]info())
7916 Types: (float double)
7917
7918 =for usage
7919
7920 $info = gebak($A, $job, $side, $ilo, $ihi, $scale);
7921 gebak($A, $job, $side, $ilo, $ihi, $scale, $info); # all arguments given
7922 $info = $A->gebak($job, $side, $ilo, $ihi, $scale); # method call
7923 $A->gebak($job, $side, $ilo, $ihi, $scale, $info);
7924
7925 =for ref
7926
7927 gebak forms the right or left eigenvectors of a real general matrix
7928 by backward transformation on the computed eigenvectors of the
7929 balanced matrix output by gebal.
7930
7931 Arguments
7932 =========
7933
7934 A: On entry, the matrix of right or left eigenvectors to be
7935 transformed, as returned by hsein or trevc.
7936 On exit, A is overwritten by the transformed eigenvectors.
7937
7938 job: Specifies the type of backward transformation required:
7939 = 0 , do nothing, return immediately;
7940 = 1, do backward transformation for permutation only;
7941 = 2, do backward transformation for scaling only;
7942 = 3, do backward transformations for both permutation and
7943 scaling.
7944 job must be the same as the argument job supplied to gebal.
7945
7946 side: = 0: V contains left eigenvectors.
7947 = 1: V contains right eigenvectors;
7948
7949 ilo:
7950 ihi: The integers ilo and ihi determined by gebal.
7951 1 <= ilo <= ihi <= N, if N > 0; ilo=1 and ihi=0, if N=0.
7952 Here N is the the number of rows of the matrix A.
7953
7954 scale: Details of the permutation and scaling factors, as returned
7955 by gebal.
7956
7957 info: = 0: successful exit
7958 < 0: if info = -i, the i-th argument had an illegal value.
7959
7960 =for example
7961
7962 $a = random (50, 50);
7963 $scale = zeroes(50);
7964 $info = null;
7965 $ilo = null;
7966 $ihi = null;
7967 gebal($a, $ilo, $ihi, $scale, $info);
7968 # Compute eigenvectors ($ev)
7969 gebak($ev, $ilo, $ihi, $scale, $info);
7970
7971 =pod
7972
7973 Broadcasts over its inputs.
7974
7975 =for bad
7976
7977 C<gebak> ignores the bad-value flag of the input ndarrays.
7978 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
7979
7980 =cut
7981
7982
7983
7984
7985 *gebak = \&PDL::gebak;
7986
7987
7988
7989
7990
7991
7992 =head2 lange
7993
7994 =for sig
7995
7996 Signature: (A(n,m); [o]b(); [t]work(workn); int norm)
7997 Types: (float double)
7998
7999 =for usage
8000
8001 $b = lange($A, $norm);
8002 lange($A, $norm, $b); # all arguments given
8003 $b = $A->lange($norm); # method call
8004 $A->lange($norm, $b);
8005
8006 =for ref
8007
8008 Computes the value of the one norm, or the Frobenius norm, or
8009 the infinity norm, or the element of largest absolute value of a
8010 real matrix A.
8011
8012 Description
8013 ===========
8014
8015 returns the value
8016
8017 lange = ( max(abs(A(i,j))), norm = 0
8018 (
8019 ( norm1(A), norm = 1
8020 (
8021 ( normI(A), norm = 2
8022 (
8023 ( normF(A), norm = 3
8024
8025 where norm1 denotes the one norm of a matrix (maximum column sum),
8026 normI denotes the infinity norm of a matrix (maximum row sum) and
8027 normF denotes the Frobenius norm of a matrix (square root of sum of
8028 squares). Note that max(abs(A(i,j))) is not a matrix norm.
8029
8030 Arguments
8031 =========
8032
8033 norm: Specifies the value to be returned in lange as described
8034 above.
8035
8036 A: The n by m matrix A.
8037
8038 =for example
8039
8040 $a = random (float, 100, 100);
8041 $norm = $a->lange(1);
8042
8043 =pod
8044
8045 Broadcasts over its inputs.
8046
8047 =for bad
8048
8049 C<lange> ignores the bad-value flag of the input ndarrays.
8050 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8051
8052 =cut
8053
8054
8055
8056
8057 *lange = \&PDL::lange;
8058
8059
8060
8061
8062
8063
8064 =head2 lansy
8065
8066 =for sig
8067
8068 Signature: (A(n,n); [o]b(); [t]work(workn); int uplo; int norm)
8069 Types: (float double)
8070
8071 =for usage
8072
8073 $b = lansy($A, $uplo, $norm);
8074 lansy($A, $uplo, $norm, $b); # all arguments given
8075 $b = $A->lansy($uplo, $norm); # method call
8076 $A->lansy($uplo, $norm, $b);
8077
8078 =for ref
8079
8080 Computes the value of the one norm, or the Frobenius norm, or
8081 the infinity norm, or the element of largest absolute value of a
8082 real symmetric matrix A.
8083
8084 Description
8085 ===========
8086
8087 returns the value
8088
8089 lansy = ( max(abs(A(i,j))), norm = 0
8090 (
8091 ( norm1(A), norm = 1
8092 (
8093 ( normI(A), norm = 2
8094 (
8095 ( normF(A), norm = 3
8096
8097 where norm1 denotes the one norm of a matrix (maximum column sum),
8098 normI denotes the infinity norm of a matrix (maximum row sum) and
8099 normF denotes the Frobenius norm of a matrix (square root of sum of
8100 squares). Note that max(abs(A(i,j))) is not a matrix norm.
8101
8102 norm: Specifies the value to be returned in lansy as described
8103 above.
8104
8105 uplo: Specifies whether the upper or lower triangular part of the
8106 symmetric matrix A is to be referenced.
8107 = 0: Upper triangular part of A is referenced
8108 = 1: Lower triangular part of A is referenced
8109
8110 A: The symmetric matrix A. If uplo = 0, the leading n by n
8111 upper triangular part of A contains the upper triangular part
8112 of the matrix A, and the strictly lower triangular part of A
8113 is not referenced. If uplo = 1, the leading n by n lower
8114 triangular part of A contains the lower triangular part of
8115 the matrix A, and the strictly upper triangular part of A is
8116 not referenced.
8117
8118 =for example
8119
8120 # Assume $a is symmetric
8121 $a = random (float, 100, 100);
8122 $norm = $a->lansy(1, 1);
8123
8124 =pod
8125
8126 Broadcasts over its inputs.
8127
8128 =for bad
8129
8130 C<lansy> ignores the bad-value flag of the input ndarrays.
8131 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8132
8133 =cut
8134
8135
8136
8137
8138 *lansy = \&PDL::lansy;
8139
8140
8141
8142
8143
8144
8145 =head2 lantr
8146
8147 =for sig
8148
8149 Signature: (A(m,n); [o]b(); [t]work(workn); int uplo; int norm; int diag)
8150 Types: (float double)
8151
8152 =for usage
8153
8154 $b = lantr($A, $uplo, $norm, $diag);
8155 lantr($A, $uplo, $norm, $diag, $b); # all arguments given
8156 $b = $A->lantr($uplo, $norm, $diag); # method call
8157 $A->lantr($uplo, $norm, $diag, $b);
8158
8159 =for ref
8160
8161 Computes the value of the one norm, or the Frobenius norm, or
8162 the infinity norm, or the element of largest absolute value of a
8163 trapezoidal or triangular matrix A.
8164
8165 Description
8166 ===========
8167
8168 returns the value
8169
8170 lantr = ( max(abs(A(i,j))), norm = 0
8171 (
8172 ( norm1(A), norm = 1
8173 (
8174 ( normI(A), norm = 2
8175 (
8176 ( normF(A), norm = 3
8177
8178 where norm1 denotes the one norm of a matrix (maximum column sum),
8179 normI denotes the infinity norm of a matrix (maximum row sum) and
8180 normF denotes the Frobenius norm of a matrix (square root of sum of
8181 squares). Note that max(abs(A(i,j))) is not a matrix norm.
8182
8183 norm: Specifies the value to be returned in lantr as described
8184 above.
8185
8186 uplo: Specifies whether the matrix A is upper or lower trapezoidal.
8187 = 0: Upper triangular part of A is referenced
8188 = 1: Lower triangular part of A is referenced
8189 Note that A is triangular instead of trapezoidal if M = N.
8190
8191 diag: Specifies whether or not the matrix A has unit diagonal.
8192 = 0: Non-unit diagonal
8193 = 1: Unit diagonal
8194
8195 A: The trapezoidal matrix A (A is triangular if m = n).
8196 If uplo = 0, the leading m by n upper trapezoidal part of
8197 the array A contains the upper trapezoidal matrix, and the
8198 strictly lower triangular part of A is not referenced.
8199 If uplo = 1, the leading m by n lower trapezoidal part of
8200 the array A contains the lower trapezoidal matrix, and the
8201 strictly upper triangular part of A is not referenced. Note
8202 that when diag = 1, the diagonal elements of A are not
8203 referenced and are assumed to be one.
8204
8205 =for example
8206
8207 # Assume $a is upper triangular
8208 $a = random (float, 100, 100);
8209 $norm = $a->lantr(1, 1, 0);
8210
8211 =pod
8212
8213 Broadcasts over its inputs.
8214
8215 =for bad
8216
8217 C<lantr> ignores the bad-value flag of the input ndarrays.
8218 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8219
8220 =cut
8221
8222
8223
8224
8225 *lantr = \&PDL::lantr;
8226
8227
8228
8229
8230
8231
8232 =head2 gemm
8233
8234 =for sig
8235
8236 Signature: (A(m,n); int transa(); int transb(); B(p,q);alpha(); beta(); [io]C(r,s))
8237 Types: (float double)
8238
8239 =for usage
8240
8241 gemm($A, $transa, $transb, $B, $alpha, $beta, $C); # all arguments given
8242 $A->gemm($transa, $transb, $B, $alpha, $beta, $C); # method call
8243
8244 =for ref
8245
8246 Performs one of the matrix-matrix operations
8247
8248 C := alpha*op( A )*op( B ) + beta*C,
8249 where op( X ) is one of p( X ) = X or op( X ) = X',
8250 alpha and beta are scalars, and A, B and C are matrices, with op( A )
8251 an m by k matrix, op( B ) a k by n matrix and C an m by n matrix.
8252
8253 Parameters
8254 ==========
8255 transa: On entry, transa specifies the form of op( A ) to be used in
8256 the matrix multiplication as follows:
8257 transa = 0, op( A ) = A.
8258 transa = 1, op( A ) = A'.
8259
8260 transb: On entry, transb specifies the form of op( B ) to be used in
8261 the matrix multiplication as follows:
8262 transb = 0, op( B ) = B.
8263 transb = 1, op( B ) = B'.
8264
8265 alpha: On entry, alpha specifies the scalar alpha.
8266
8267 A: Before entry with transa = 0, the leading m by k
8268 part of the array A must contain the matrix A, otherwise
8269 the leading k by m part of the array A must contain the
8270 matrix A.
8271
8272 B: Before entry with transb = 0, the leading k by n
8273 part of the array B must contain the matrix B, otherwise
8274 the leading n by k part of the array B must contain the
8275 matrix B.
8276
8277 beta: On entry, beta specifies the scalar beta. When beta is
8278 supplied as zero then C need not be set on input.
8279
8280 C: Before entry, the leading m by n part of the array C must
8281 contain the matrix C, except when beta is zero, in which
8282 case C need not be set on entry.
8283 On exit, the array C is overwritten by the m by n matrix
8284 ( alpha*op( A )*op( B ) + beta*C ).
8285
8286 =for example
8287
8288 $a = random(5,4);
8289 $b = random(5,4);
8290 $alpha = pdl(0.5);
8291 $beta = pdl(0);
8292 $c = zeroes(5,5);
8293 gemm($a, 0, 1,$b, $alpha, $beta, $c);
8294
8295 =pod
8296
8297 Broadcasts over its inputs.
8298
8299 =for bad
8300
8301 C<gemm> ignores the bad-value flag of the input ndarrays.
8302 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8303
8304 =cut
8305
8306
8307
8308
8309 *gemm = \&PDL::gemm;
8310
8311
8312
8313
8314
8315
8316 =head2 mmult
8317
8318 =for sig
8319
8320 Signature: (A(m,n); B(p,m); [o]C(p,n))
8321 Types: (float double)
8322
8323 =for usage
8324
8325 $C = mmult($A, $B);
8326 mmult($A, $B, $C); # all arguments given
8327 $C = $A->mmult($B); # method call
8328 $A->mmult($B, $C);
8329
8330 =for ref
8331
8332 Blas matrix multiplication based on gemm
8333
8334 =pod
8335
8336 Broadcasts over its inputs.
8337
8338 =for bad
8339
8340 C<mmult> ignores the bad-value flag of the input ndarrays.
8341 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8342
8343 =cut
8344
8345
8346
8347
8348 *mmult = \&PDL::mmult;
8349
8350
8351
8352
8353
8354
8355 =head2 crossprod
8356
8357 =for sig
8358
8359 Signature: (A(n,m); B(p,m); [o]C(p,n))
8360 Types: (float double)
8361
8362 =for usage
8363
8364 $C = crossprod($A, $B);
8365 crossprod($A, $B, $C); # all arguments given
8366 $C = $A->crossprod($B); # method call
8367 $A->crossprod($B, $C);
8368
8369 =for ref
8370
8371 Blas matrix cross product based on gemm
8372
8373 =pod
8374
8375 Broadcasts over its inputs.
8376
8377 =for bad
8378
8379 C<crossprod> ignores the bad-value flag of the input ndarrays.
8380 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8381
8382 =cut
8383
8384
8385
8386
8387 *crossprod = \&PDL::crossprod;
8388
8389
8390
8391
8392
8393
8394 =head2 syrk
8395
8396 =for sig
8397
8398 Signature: (A(m,n); int uplo(); int trans(); alpha(); beta(); [io]C(p,p))
8399 Types: (float double)
8400
8401 =for usage
8402
8403 syrk($A, $uplo, $trans, $alpha, $beta, $C); # all arguments given
8404 $A->syrk($uplo, $trans, $alpha, $beta, $C); # method call
8405
8406 =for ref
8407
8408 Performs one of the symmetric rank k operations
8409
8410 C := alpha*A*A' + beta*C,
8411
8412 or
8413
8414 C := alpha*A'*A + beta*C,
8415
8416 where alpha and beta are scalars, C is an n by n symmetric matrix
8417 and A is an n by k matrix in the first case and a k by n matrix
8418 in the second case.
8419
8420 Parameters
8421 ==========
8422 uplo: On entry, uplo specifies whether the upper or lower
8423 triangular part of the array C is to be referenced as
8424 follows:
8425 uplo = 0 Only the upper triangular part of C
8426 is to be referenced.
8427 uplo = 1 Only the lower triangular part of C
8428 is to be referenced.
8429 Unchanged on exit.
8430
8431 trans: On entry, trans specifies the operation to be performed as
8432 follows:
8433 trans = 0 C := alpha*A*A' + beta*C.
8434 trans = 1 C := alpha*A'*A + beta*C.
8435
8436 alpha: On entry, alpha specifies the scalar alpha.
8437 Unchanged on exit.
8438
8439 A: Before entry with trans = 0, the leading n by k
8440 part of the array A must contain the matrix A, otherwise
8441 the leading k by n part of the array A must contain the
8442 matrix A.
8443
8444 beta: On entry, beta specifies the scalar beta.
8445
8446 C: Before entry with uplo = 0, the leading n by n
8447 upper triangular part of the array C must contain the upper
8448 triangular part of the symmetric matrix and the strictly
8449 lower triangular part of C is not referenced. On exit, the
8450 upper triangular part of the array C is overwritten by the
8451 upper triangular part of the updated matrix.
8452 Before entry with uplo = 1, the leading n by n
8453 lower triangular part of the array C must contain the lower
8454 triangular part of the symmetric matrix and the strictly
8455 upper triangular part of C is not referenced. On exit, the
8456 lower triangular part of the array C is overwritten by the
8457 lower triangular part of the updated matrix.
8458
8459 =for example
8460
8461 $a = random(5,4);
8462 $b = zeroes(5,5);
8463 $alpha = 1;
8464 $beta = 0;
8465 syrk ($a, 1,0,$alpha, $beta , $b);
8466
8467 =pod
8468
8469 Broadcasts over its inputs.
8470
8471 =for bad
8472
8473 C<syrk> ignores the bad-value flag of the input ndarrays.
8474 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8475
8476 =cut
8477
8478
8479
8480
8481 *syrk = \&PDL::syrk;
8482
8483
8484
8485
8486
8487
8488 =head2 dot
8489
8490 =for sig
8491
8492 Signature: (a(n);b(n);[o]c())
8493 Types: (float double)
8494
8495 =for usage
8496
8497 $c = dot($a, $b);
8498 dot($a, $b, $c); # all arguments given
8499 $c = $a->dot($b); # method call
8500 $a->dot($b, $c);
8501
8502 =for ref
8503
8504 Dot product of two vectors using Blas.
8505
8506 =for example
8507
8508 $a = random(5);
8509 $b = random(5);
8510 $c = dot($a, $b)
8511
8512 =pod
8513
8514 Broadcasts over its inputs.
8515
8516 =for bad
8517
8518 C<dot> ignores the bad-value flag of the input ndarrays.
8519 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8520
8521 =cut
8522
8523
8524
8525
8526 *dot = \&PDL::dot;
8527
8528
8529
8530
8531
8532
8533 =head2 axpy
8534
8535 =for sig
8536
8537 Signature: (a(n); alpha();[io]b(m))
8538 Types: (float double)
8539
8540 =for usage
8541
8542 axpy($a, $alpha, $b); # all arguments given
8543 $a->axpy($alpha, $b); # method call
8544
8545 =for ref
8546
8547 Linear combination of vectors ax + b using Blas.
8548 Returns result in b.
8549
8550 =for example
8551
8552 $a = random(5);
8553 $b = random(5);
8554 axpy($a, 12, $b)
8555
8556 =pod
8557
8558 Broadcasts over its inputs.
8559
8560 =for bad
8561
8562 C<axpy> ignores the bad-value flag of the input ndarrays.
8563 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8564
8565 =cut
8566
8567
8568
8569
8570 *axpy = \&PDL::axpy;
8571
8572
8573
8574
8575
8576
8577 =head2 nrm2
8578
8579 =for sig
8580
8581 Signature: (a(n);[o]b())
8582 Types: (float double)
8583
8584 =for usage
8585
8586 $b = nrm2($a);
8587 nrm2($a, $b); # all arguments given
8588 $b = $a->nrm2; # method call
8589 $a->nrm2($b);
8590
8591 =for ref
8592
8593 Euclidean norm of a vector using Blas.
8594
8595 =for example
8596
8597 $a = random(5);
8598 $norm2 = nrm2($a)
8599
8600 =pod
8601
8602 Broadcasts over its inputs.
8603
8604 =for bad
8605
8606 C<nrm2> ignores the bad-value flag of the input ndarrays.
8607 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8608
8609 =cut
8610
8611
8612
8613
8614 *nrm2 = \&PDL::nrm2;
8615
8616
8617
8618
8619
8620
8621 =head2 asum
8622
8623 =for sig
8624
8625 Signature: (a(n);[o]b())
8626 Types: (float double)
8627
8628 =for usage
8629
8630 $b = asum($a);
8631 asum($a, $b); # all arguments given
8632 $b = $a->asum; # method call
8633 $a->asum($b);
8634
8635 =for ref
8636
8637 Sum of absolute values of a vector using Blas.
8638
8639 =for example
8640
8641 $a = random(5);
8642 $absum = asum($a)
8643
8644 =pod
8645
8646 Broadcasts over its inputs.
8647
8648 =for bad
8649
8650 C<asum> ignores the bad-value flag of the input ndarrays.
8651 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8652
8653 =cut
8654
8655
8656
8657
8658 *asum = \&PDL::asum;
8659
8660
8661
8662
8663
8664
8665 =head2 scal
8666
8667 =for sig
8668
8669 Signature: ([io]a(n);scale())
8670 Types: (float double)
8671
8672 =for usage
8673
8674 scal($a, $scale); # all arguments given
8675 $a->scal($scale); # method call
8676
8677 =for ref
8678
8679 Scale a vector by a constant using Blas.
8680
8681 =for example
8682
8683 $a = random(5);
8684 $a->scal(0.5)
8685
8686 =pod
8687
8688 Broadcasts over its inputs.
8689
8690 =for bad
8691
8692 C<scal> ignores the bad-value flag of the input ndarrays.
8693 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8694
8695 =cut
8696
8697
8698
8699
8700 *scal = \&PDL::scal;
8701
8702
8703
8704
8705
8706
8707 =head2 rot
8708
8709 =for sig
8710
8711 Signature: ([io]a(n);c(); s();[io]b(n))
8712 Types: (float double)
8713
8714 =for usage
8715
8716 rot($a, $c, $s, $b); # all arguments given
8717 $a->rot($c, $s, $b); # method call
8718
8719 =for ref
8720
8721 Applies plane rotation using Blas.
8722
8723 =for example
8724
8725 $a = random(5);
8726 $b = random(5);
8727 rot($a, 0.5, 0.7, $b)
8728
8729 =pod
8730
8731 Broadcasts over its inputs.
8732
8733 =for bad
8734
8735 C<rot> ignores the bad-value flag of the input ndarrays.
8736 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8737
8738 =cut
8739
8740
8741
8742
8743 *rot = \&PDL::rot;
8744
8745
8746
8747
8748
8749
8750 =head2 rotg
8751
8752 =for sig
8753
8754 Signature: ([io]a();[io]b();[o]c(); [o]s())
8755 Types: (float double)
8756
8757 =for usage
8758
8759 ($c, $s) = rotg($a, $b);
8760 rotg($a, $b, $c, $s); # all arguments given
8761 ($c, $s) = $a->rotg($b); # method call
8762 $a->rotg($b, $c, $s);
8763
8764 =for ref
8765
8766 Generates plane rotation using Blas.
8767
8768 =for example
8769
8770 $a = sequence(4);
8771 rotg($a(0), $a(1),$a(2),$a(3))
8772
8773 =pod
8774
8775 Broadcasts over its inputs.
8776
8777 =for bad
8778
8779 C<rotg> ignores the bad-value flag of the input ndarrays.
8780 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8781
8782 =cut
8783
8784
8785
8786
8787 *rotg = \&PDL::rotg;
8788
8789
8790
8791
8792
8793
8794 =head2 lasrt
8795
8796 =for sig
8797
8798 Signature: ([io]d(n); int id();int [o]info())
8799 Types: (float double)
8800
8801 =for usage
8802
8803 $info = lasrt($d, $id);
8804 lasrt($d, $id, $info); # all arguments given
8805 $info = $d->lasrt($id); # method call
8806 $d->lasrt($id, $info);
8807
8808 =for ref
8809
8810 Sort the numbers in d in increasing order (if id = 0) or
8811 in decreasing order (if id = 1 ).
8812
8813 Use Quick Sort, reverting to Insertion sort on arrays of
8814 size <= 20. Dimension of stack limits N to about 2**32.
8815
8816 Arguments
8817 =========
8818
8819 id: = 0: sort d in increasing order;
8820 = 1: sort d in decreasing order.
8821
8822 d: On entry, the array to be sorted.
8823 On exit, d has been sorted into increasing order
8824 (d(1) <= ... <= d(N) ) or into decreasing order
8825 (d(1) >= ... >= d(N) ), depending on id.
8826
8827 info: = 0: successful exit
8828 < 0: if info = -i, the i-th argument had an illegal value
8829
8830 =for example
8831
8832 $a = random(5);
8833 lasrt ($a, 0, ($info = null));
8834
8835 =pod
8836
8837 Broadcasts over its inputs.
8838
8839 =for bad
8840
8841 C<lasrt> ignores the bad-value flag of the input ndarrays.
8842 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8843
8844 =cut
8845
8846
8847
8848
8849 *lasrt = \&PDL::lasrt;
8850
8851
8852
8853
8854
8855
8856 =head2 lacpy
8857
8858 =for sig
8859
8860 Signature: (A(m,n); int uplo(); [o]B(p,n))
8861 Types: (float double)
8862
8863 =for usage
8864
8865 $B = lacpy($A, $uplo);
8866 lacpy($A, $uplo, $B); # all arguments given
8867 $B = $A->lacpy($uplo); # method call
8868 $A->lacpy($uplo, $B);
8869
8870 =for ref
8871
8872 Copies all or part of a two-dimensional matrix A to another
8873 matrix B.
8874
8875 Arguments
8876 =========
8877
8878 uplo: Specifies the part of the matrix A to be copied to B.
8879 = 0: Upper triangular part
8880 = 1: Lower triangular part
8881 Otherwise: All of the matrix A
8882
8883 A: The m by n matrix A. If uplo = 0, only the upper triangle
8884 or trapezoid is accessed; if uplo = 1, only the lower
8885 triangle or trapezoid is accessed.
8886
8887 B: On exit, B = A in the locations specified by uplo.
8888
8889 =for example
8890
8891 $a = random(5,5);
8892 $b = zeroes($a);
8893 lacpy ($a, 0, $b);
8894
8895 =pod
8896
8897 Broadcasts over its inputs.
8898
8899 =for bad
8900
8901 C<lacpy> ignores the bad-value flag of the input ndarrays.
8902 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8903
8904 =cut
8905
8906
8907
8908
8909 *lacpy = \&PDL::lacpy;
8910
8911
8912
8913
8914
8915
8916 =head2 laswp
8917
8918 =for sig
8919
8920 Signature: ([io]A(m,n);int k1();int k2(); int ipiv(p);int inc())
8921 Types: (float double)
8922
8923 =for usage
8924
8925 laswp($A, $k1, $k2, $ipiv, $inc); # all arguments given
8926 $A->laswp($k1, $k2, $ipiv, $inc); # method call
8927
8928 =for ref
8929
8930 Performs a series of row interchanges on the matrix A.
8931 One row interchange is initiated for each of rows k1 through k2 of A.
8932 Doesn't use PDL indices (start = 1).
8933
8934 Arguments
8935 =========
8936
8937 A: On entry, the matrix of column dimension N to which the row
8938 interchanges will be applied.
8939 On exit, the permuted matrix.
8940
8941 k1: The first element of ipiv for which a row interchange will
8942 be done.
8943
8944 k2: The last element of ipiv for which a row interchange will
8945 be done.
8946
8947 ipiv: The vector of pivot indices. Only the elements in positions
8948 k1 through k2 of ipiv are accessed.
8949 ipiv(k) = l implies rows k and l are to be interchanged.
8950
8951 inc: The increment between successive values of ipiv. If ipiv
8952 is negative, the pivots are applied in reverse order.
8953
8954 =for example
8955
8956 $a = random(5,5);
8957 # reverse row (col for PDL)
8958 $b = pdl([5,4,3,2,1]);
8959 $a->laswp(1,2,$b,1);
8960
8961 =pod
8962
8963 Broadcasts over its inputs.
8964
8965 =for bad
8966
8967 C<laswp> ignores the bad-value flag of the input ndarrays.
8968 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
8969
8970 =cut
8971
8972
8973
8974
8975 *laswp = \&PDL::laswp;
8976
8977
8978
8979
8980
8981
8982 =head2 lamch
8983
8984 =for sig
8985
8986 Signature: (cmach(); [o]precision())
8987 Types: (float double)
8988
8989 =for usage
8990
8991 $precision = lamch($cmach);
8992 lamch($cmach, $precision); # all arguments given
8993 $precision = $cmach->lamch; # method call
8994 $cmach->lamch($precision);
8995 $cmach->inplace->lamch; # can be used inplace
8996 lamch($cmach->inplace);
8997
8998 =for ref
8999
9000 Determines precision machine parameters.
9001 Works inplace.
9002
9003 Arguments
9004 =========
9005
9006 cmach: Specifies the value to be returned by lamch:
9007 = 0 LAMCH := eps
9008 = 1 LAMCH := sfmin
9009 = 2 LAMCH := base
9010 = 3 LAMCH := eps*base
9011 = 4 LAMCH := t
9012 = 5 LAMCH := rnd
9013 = 6 LAMCH := emin
9014 = 7 LAMCH := rmin
9015 = 8 LAMCH := emax
9016 = 9 LAMCH := rmax
9017
9018 where
9019
9020 eps = relative machine precision
9021 sfmin = safe minimum, such that 1/sfmin does not overflow
9022 base = base of the machine
9023 prec = eps*base
9024 t = number of (base) digits in the mantissa
9025 rnd = 1.0 when rounding occurs in addition, 0.0 otherwise
9026 emin = minimum exponent before (gradual) underflow
9027 rmin = underflow threshold - base**(emin-1)
9028 emax = largest exponent before overflow
9029 rmax = overflow threshold - (base**emax)*(1-eps)
9030
9031 =for example
9032
9033 $a = lamch (0);
9034 print "EPS is $a for double\n";
9035
9036 =pod
9037
9038 Can operate inplace with C<cmach> as output C<precision>.
9039 Broadcasts over its inputs.
9040
9041 =for bad
9042
9043 C<lamch> ignores the bad-value flag of the input ndarrays.
9044 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
9045
9046 =cut
9047
9048
9049
9050
9051 *lamch = \&PDL::lamch;
9052
9053
9054
9055
9056
9057
9058 =head2 labad
9059
9060 =for sig
9061
9062 Signature: ([io]small(); [io]large())
9063 Types: (float double)
9064
9065 =for usage
9066
9067 labad($small, $large); # all arguments given
9068 $small->labad($large); # method call
9069
9070 =for ref
9071
9072 Takes as input the values computed by C<lamch> for underflow and
9073 overflow, and returns the square root of each of these values if the
9074 log of large is sufficiently large. This subroutine is intended to
9075 identify machines with a large exponent range, such as the Crays, and
9076 redefine the underflow and overflow limits to be the square roots of
9077 the values computed by C<lamch>. This subroutine is needed because
9078 lamch does not compensate for poor arithmetic in the upper half of
9079 the exponent range, as is found on a Cray.
9080
9081 Arguments
9082 =========
9083
9084 small: On entry, the underflow threshold as computed by lamch.
9085 On exit, if LOG10(large) is sufficiently large, the square
9086 root of small, otherwise unchanged.
9087
9088 large: On entry, the overflow threshold as computed by lamch.
9089 On exit, if LOG10(large) is sufficiently large, the square
9090 root of large, otherwise unchanged.
9091
9092 =for example
9093
9094 $underflow = lamch(7);
9095 $overflow = lamch(9);
9096 labad ($underflow, $overflow);
9097
9098 =pod
9099
9100 Broadcasts over its inputs.
9101
9102 =for bad
9103
9104 C<labad> ignores the bad-value flag of the input ndarrays.
9105 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
9106
9107 =cut
9108
9109
9110
9111
9112 *labad = \&PDL::labad;
9113
9114
9115
9116
9117
9118
9119 =head2 cplx_eigen
9120
9121 =for sig
9122
9123 Signature: (eigreval(n);eigimval(n); eigvec(n,p);int fortran();[o]cplx_val(c=2,n);[o]cplx_vec(c=2,n,p))
9124 Types: (sbyte byte short ushort long ulong indx ulonglong longlong
9125 float double ldouble)
9126
9127 =for usage
9128
9129 ($cplx_val, $cplx_vec) = cplx_eigen($eigreval, $eigimval, $eigvec, $fortran);
9130 cplx_eigen($eigreval, $eigimval, $eigvec, $fortran, $cplx_val, $cplx_vec); # all arguments given
9131 ($cplx_val, $cplx_vec) = $eigreval->cplx_eigen($eigimval, $eigvec, $fortran); # method call
9132 $eigreval->cplx_eigen($eigimval, $eigvec, $fortran, $cplx_val, $cplx_vec);
9133
9134 =for ref
9135
9136 Output complex eigen-values/vectors from eigen-values/vectors
9137 as computed by geev or geevx.
9138 'fortran' means fortran storage type.
9139
9140 =pod
9141
9142 Broadcasts over its inputs.
9143
9144 =for bad
9145
9146 C<cplx_eigen> does not process bad values.
9147 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
9148
9149 =cut
9150
9151
9152
9153
9154 sub PDL::cplx_eigen {
9155 my ($eigre, $eigim, $eigvec, $fortran, @outs) = @_;
9156 my ($outval, $outvec) = @outs ? @outs : (null, null);
9157 PDL::_cplx_eigen_int($eigre, $eigim, $eigvec, $fortran, $outval, $outvec);
9158 $_ = $_->slice('(0)')->czip($_->slice('(1)')) for $outval, $outvec;
9159 ($outval, $outvec);
9160 }
9161
9162
9163
9164 *cplx_eigen = \&PDL::cplx_eigen;
9165
9166
9167
9168
9169
9170
9171 =head2 charpol
9172
9173 =for sig
9174
9175 Signature: (A(n,n);[o]Y(n,n);[o]out(p=CALC($SIZE(n)+1)))
9176 Types: (float double)
9177
9178 =for usage
9179
9180 ($Y, $out) = charpol($A);
9181 charpol($A, $Y, $out); # all arguments given
9182 ($Y, $out) = $A->charpol; # method call
9183 $A->charpol($Y, $out);
9184
9185 =for ref
9186
9187 Compute adjoint matrix and characteristic polynomial
9188
9189 =pod
9190
9191 Broadcasts over its inputs.
9192
9193 =for bad
9194
9195 C<charpol> does not process bad values.
9196 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
9197
9198 =cut
9199
9200
9201
9202
9203 *charpol = \&PDL::charpol;
9204
9205
9206
9207
9208
9209
9210
9211 #line 10591 "lib/PDL/LinearAlgebra/Real.pd"
9212
9213 =head1 AUTHOR
9214
9215 Copyright (C) Grégory Vanuxem 2005-2018.
9216
9217 This library is free software; you can redistribute it and/or modify
9218 it under the terms of the Perl Artistic License as in the file Artistic_2
9219 in this distribution.
9220
9221 =cut
9222 #line 9223 "lib/PDL/LinearAlgebra/Real.pm"
9223
9224 # Exit with OK status
9225
9226 1;