File Coverage

blib/lib/PDL/LinearAlgebra/Real.pm
Criterion Covered Total %
statement 18 19 94.7
branch n/a
condition n/a
subroutine 7 8 87.5
pod n/a
total 25 27 92.5


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