2 NOTE: This is generated code. Look in README.python for information on
5 #include "sphinxbase/f2c.h"
10 extern doublereal slamch_(char *);
11 #define EPSILON slamch_("Epsilon")
12 #define SAFEMINIMUM slamch_("Safe minimum")
13 #define PRECISION slamch_("Precision")
14 #define BASE slamch_("Base")
18 extern doublereal slapy2_(real *, real *);
22 /* Table of constant values */
24 static integer c__0 = 0;
25 static real c_b163 = 0.f;
26 static real c_b164 = 1.f;
27 static integer c__1 = 1;
28 static real c_b181 = -1.f;
29 static integer c_n1 = -1;
31 integer ieeeck_(integer *ispec, real *zero, real *one)
33 /* System generated locals */
37 static real nan1, nan2, nan3, nan4, nan5, nan6, neginf, posinf, negzro,
42 -- LAPACK auxiliary routine (version 3.0) --
43 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
44 Courant Institute, Argonne National Lab, and Rice University
51 IEEECK is called from the ILAENV to verify that Infinity and
52 possibly NaN arithmetic is safe (i.e. will not trap).
58 Specifies whether to test just for inifinity arithmetic
59 or whether to test for infinity and NaN arithmetic.
60 = 0: Verify infinity arithmetic only.
61 = 1: Verify infinity and NaN arithmetic.
64 Must contain the value 0.0
65 This is passed to prevent the compiler from optimizing
69 Must contain the value 1.0
70 This is passed to prevent the compiler from optimizing
74 = 0: Arithmetic failed to produce the correct answers
75 = 1: Arithmetic produced the correct answers
80 posinf = *one / *zero;
86 neginf = -(*one) / *zero;
87 if (neginf >= *zero) {
92 negzro = *one / (neginf + *one);
93 if (negzro != *zero) {
98 neginf = *one / negzro;
99 if (neginf >= *zero) {
104 newzro = negzro + *zero;
105 if (newzro != *zero) {
110 posinf = *one / newzro;
111 if (posinf <= *one) {
117 if (neginf >= *zero) {
123 if (posinf <= *one) {
129 /* Return if we were only asked to check infinity arithmetic */
135 nan1 = posinf + neginf;
137 nan2 = posinf / neginf;
139 nan3 = posinf / posinf;
141 nan4 = posinf * *zero;
143 nan5 = neginf * negzro;
180 integer ilaenv_(integer *ispec, char *name__, char *opts, integer *n1,
181 integer *n2, integer *n3, integer *n4, ftnlen name_len, ftnlen
184 /* System generated locals */
187 /* Builtin functions */
188 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
189 integer s_cmp(char *, char *, ftnlen, ftnlen);
191 /* Local variables */
193 static char c1[1], c2[2], c3[3], c4[2];
194 static integer ic, nb, iz, nx;
195 static logical cname, sname;
196 static integer nbmin;
197 extern integer ieeeck_(integer *, real *, real *);
198 static char subnam[6];
202 -- LAPACK auxiliary routine (version 3.0) --
203 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
204 Courant Institute, Argonne National Lab, and Rice University
211 ILAENV is called from the LAPACK routines to choose problem-dependent
212 parameters for the local environment. See ISPEC for a description of
215 This version provides a set of parameters which should give good,
216 but not optimal, performance on many of the currently available
217 computers. Users are encouraged to modify this subroutine to set
218 the tuning parameters for their particular machine using the option
219 and problem size information in the arguments.
221 This routine will not function correctly if it is converted to all
222 lower case. Converting it to all upper case is allowed.
227 ISPEC (input) INTEGER
228 Specifies the parameter to be returned as the value of
230 = 1: the optimal blocksize; if this value is 1, an unblocked
231 algorithm will give the best performance.
232 = 2: the minimum block size for which the block routine
233 should be used; if the usable block size is less than
234 this value, an unblocked routine should be used.
235 = 3: the crossover point (in a block routine, for N less
236 than this value, an unblocked routine should be used)
237 = 4: the number of shifts, used in the nonsymmetric
239 = 5: the minimum column dimension for blocking to be used;
240 rectangular blocks must have dimension at least k by m,
241 where k is given by ILAENV(2,...) and m by ILAENV(5,...)
242 = 6: the crossover point for the SVD (when reducing an m by n
243 matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds
244 this value, a QR factorization is used first to reduce
245 the matrix to a triangular form.)
246 = 7: the number of processors
247 = 8: the crossover point for the multishift QR and QZ methods
248 for nonsymmetric eigenvalue problems.
249 = 9: maximum size of the subproblems at the bottom of the
250 computation tree in the divide-and-conquer algorithm
251 (used by xGELSD and xGESDD)
252 =10: ieee NaN arithmetic can be trusted not to trap
253 =11: infinity arithmetic can be trusted not to trap
255 NAME (input) CHARACTER*(*)
256 The name of the calling subroutine, in either upper case or
259 OPTS (input) CHARACTER*(*)
260 The character options to the subroutine NAME, concatenated
261 into a single character string. For example, UPLO = 'U',
262 TRANS = 'T', and DIAG = 'N' for a triangular routine would
263 be specified as OPTS = 'UTN'.
269 Problem dimensions for the subroutine NAME; these may not all
272 (ILAENV) (output) INTEGER
273 >= 0: the value of the parameter specified by ISPEC
274 < 0: if ILAENV = -k, the k-th argument had an illegal value.
279 The following conventions have been used when calling ILAENV from the
281 1) OPTS is a concatenation of all of the character options to
282 subroutine NAME, in the same order that they appear in the
283 argument list for NAME, even if they are not used in determining
284 the value of the parameter specified by ISPEC.
285 2) The problem dimensions N1, N2, N3, N4 are specified in the order
286 that they appear in the argument list for NAME. N1 is used
287 first, N2 second, and so on, and unused problem dimensions are
288 passed a value of -1.
289 3) The parameter value returned by ILAENV is checked for validity in
290 the calling subroutine. For example, ILAENV is used to retrieve
291 the optimal blocksize for STRTRI as follows:
293 NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
294 IF( NB.LE.1 ) NB = MAX( 1, N )
296 =====================================================================
314 /* Invalid value for ISPEC */
321 /* Convert NAME to upper case if the first character is lower case. */
324 s_copy(subnam, name__, (ftnlen)6, name_len);
325 ic = *(unsigned char *)subnam;
327 if (iz == 90 || iz == 122) {
329 /* ASCII character set */
331 if (ic >= 97 && ic <= 122) {
332 *(unsigned char *)subnam = (char) (ic - 32);
333 for (i__ = 2; i__ <= 6; ++i__) {
334 ic = *(unsigned char *)&subnam[i__ - 1];
335 if (ic >= 97 && ic <= 122) {
336 *(unsigned char *)&subnam[i__ - 1] = (char) (ic - 32);
342 } else if (iz == 233 || iz == 169) {
344 /* EBCDIC character set */
346 if (ic >= 129 && ic <= 137 || ic >= 145 && ic <= 153 || ic >= 162 &&
348 *(unsigned char *)subnam = (char) (ic + 64);
349 for (i__ = 2; i__ <= 6; ++i__) {
350 ic = *(unsigned char *)&subnam[i__ - 1];
351 if (ic >= 129 && ic <= 137 || ic >= 145 && ic <= 153 || ic >=
353 *(unsigned char *)&subnam[i__ - 1] = (char) (ic + 64);
359 } else if (iz == 218 || iz == 250) {
361 /* Prime machines: ASCII+128 */
363 if (ic >= 225 && ic <= 250) {
364 *(unsigned char *)subnam = (char) (ic - 32);
365 for (i__ = 2; i__ <= 6; ++i__) {
366 ic = *(unsigned char *)&subnam[i__ - 1];
367 if (ic >= 225 && ic <= 250) {
368 *(unsigned char *)&subnam[i__ - 1] = (char) (ic - 32);
375 *(unsigned char *)c1 = *(unsigned char *)subnam;
376 sname = *(unsigned char *)c1 == 'S' || *(unsigned char *)c1 == 'D';
377 cname = *(unsigned char *)c1 == 'C' || *(unsigned char *)c1 == 'Z';
378 if (! (cname || sname)) {
381 s_copy(c2, subnam + 1, (ftnlen)2, (ftnlen)2);
382 s_copy(c3, subnam + 3, (ftnlen)3, (ftnlen)3);
383 s_copy(c4, c3 + 1, (ftnlen)2, (ftnlen)2);
394 ISPEC = 1: block size
396 In these examples, separate code is provided for setting NB for
397 real and complex. We assume that NB will take the same value in
398 single or double precision.
403 if (s_cmp(c2, "GE", (ftnlen)2, (ftnlen)2) == 0) {
404 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
410 } else if (s_cmp(c3, "QRF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3,
411 "RQF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "LQF", (ftnlen)
412 3, (ftnlen)3) == 0 || s_cmp(c3, "QLF", (ftnlen)3, (ftnlen)3)
419 } else if (s_cmp(c3, "HRD", (ftnlen)3, (ftnlen)3) == 0) {
425 } else if (s_cmp(c3, "BRD", (ftnlen)3, (ftnlen)3) == 0) {
431 } else if (s_cmp(c3, "TRI", (ftnlen)3, (ftnlen)3) == 0) {
438 } else if (s_cmp(c2, "PO", (ftnlen)2, (ftnlen)2) == 0) {
439 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
446 } else if (s_cmp(c2, "SY", (ftnlen)2, (ftnlen)2) == 0) {
447 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
453 } else if (sname && s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
455 } else if (sname && s_cmp(c3, "GST", (ftnlen)3, (ftnlen)3) == 0) {
458 } else if (cname && s_cmp(c2, "HE", (ftnlen)2, (ftnlen)2) == 0) {
459 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
461 } else if (s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
463 } else if (s_cmp(c3, "GST", (ftnlen)3, (ftnlen)3) == 0) {
466 } else if (sname && s_cmp(c2, "OR", (ftnlen)2, (ftnlen)2) == 0) {
467 if (*(unsigned char *)c3 == 'G') {
468 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
469 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
470 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
471 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
472 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
473 ftnlen)2, (ftnlen)2) == 0) {
476 } else if (*(unsigned char *)c3 == 'M') {
477 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
478 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
479 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
480 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
481 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
482 ftnlen)2, (ftnlen)2) == 0) {
486 } else if (cname && s_cmp(c2, "UN", (ftnlen)2, (ftnlen)2) == 0) {
487 if (*(unsigned char *)c3 == 'G') {
488 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
489 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
490 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
491 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
492 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
493 ftnlen)2, (ftnlen)2) == 0) {
496 } else if (*(unsigned char *)c3 == 'M') {
497 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
498 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
499 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
500 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
501 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
502 ftnlen)2, (ftnlen)2) == 0) {
506 } else if (s_cmp(c2, "GB", (ftnlen)2, (ftnlen)2) == 0) {
507 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
522 } else if (s_cmp(c2, "PB", (ftnlen)2, (ftnlen)2) == 0) {
523 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
538 } else if (s_cmp(c2, "TR", (ftnlen)2, (ftnlen)2) == 0) {
539 if (s_cmp(c3, "TRI", (ftnlen)3, (ftnlen)3) == 0) {
546 } else if (s_cmp(c2, "LA", (ftnlen)2, (ftnlen)2) == 0) {
547 if (s_cmp(c3, "UUM", (ftnlen)3, (ftnlen)3) == 0) {
554 } else if (sname && s_cmp(c2, "ST", (ftnlen)2, (ftnlen)2) == 0) {
555 if (s_cmp(c3, "EBZ", (ftnlen)3, (ftnlen)3) == 0) {
564 /* ISPEC = 2: minimum block size */
567 if (s_cmp(c2, "GE", (ftnlen)2, (ftnlen)2) == 0) {
568 if (s_cmp(c3, "QRF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "RQF", (
569 ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "LQF", (ftnlen)3, (
570 ftnlen)3) == 0 || s_cmp(c3, "QLF", (ftnlen)3, (ftnlen)3) == 0)
577 } else if (s_cmp(c3, "HRD", (ftnlen)3, (ftnlen)3) == 0) {
583 } else if (s_cmp(c3, "BRD", (ftnlen)3, (ftnlen)3) == 0) {
589 } else if (s_cmp(c3, "TRI", (ftnlen)3, (ftnlen)3) == 0) {
596 } else if (s_cmp(c2, "SY", (ftnlen)2, (ftnlen)2) == 0) {
597 if (s_cmp(c3, "TRF", (ftnlen)3, (ftnlen)3) == 0) {
603 } else if (sname && s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
606 } else if (cname && s_cmp(c2, "HE", (ftnlen)2, (ftnlen)2) == 0) {
607 if (s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
610 } else if (sname && s_cmp(c2, "OR", (ftnlen)2, (ftnlen)2) == 0) {
611 if (*(unsigned char *)c3 == 'G') {
612 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
613 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
614 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
615 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
616 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
617 ftnlen)2, (ftnlen)2) == 0) {
620 } else if (*(unsigned char *)c3 == 'M') {
621 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
622 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
623 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
624 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
625 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
626 ftnlen)2, (ftnlen)2) == 0) {
630 } else if (cname && s_cmp(c2, "UN", (ftnlen)2, (ftnlen)2) == 0) {
631 if (*(unsigned char *)c3 == 'G') {
632 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
633 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
634 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
635 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
636 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
637 ftnlen)2, (ftnlen)2) == 0) {
640 } else if (*(unsigned char *)c3 == 'M') {
641 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
642 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
643 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
644 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
645 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
646 ftnlen)2, (ftnlen)2) == 0) {
656 /* ISPEC = 3: crossover point */
659 if (s_cmp(c2, "GE", (ftnlen)2, (ftnlen)2) == 0) {
660 if (s_cmp(c3, "QRF", (ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "RQF", (
661 ftnlen)3, (ftnlen)3) == 0 || s_cmp(c3, "LQF", (ftnlen)3, (
662 ftnlen)3) == 0 || s_cmp(c3, "QLF", (ftnlen)3, (ftnlen)3) == 0)
669 } else if (s_cmp(c3, "HRD", (ftnlen)3, (ftnlen)3) == 0) {
675 } else if (s_cmp(c3, "BRD", (ftnlen)3, (ftnlen)3) == 0) {
682 } else if (s_cmp(c2, "SY", (ftnlen)2, (ftnlen)2) == 0) {
683 if (sname && s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
686 } else if (cname && s_cmp(c2, "HE", (ftnlen)2, (ftnlen)2) == 0) {
687 if (s_cmp(c3, "TRD", (ftnlen)3, (ftnlen)3) == 0) {
690 } else if (sname && s_cmp(c2, "OR", (ftnlen)2, (ftnlen)2) == 0) {
691 if (*(unsigned char *)c3 == 'G') {
692 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
693 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
694 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
695 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
696 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
697 ftnlen)2, (ftnlen)2) == 0) {
701 } else if (cname && s_cmp(c2, "UN", (ftnlen)2, (ftnlen)2) == 0) {
702 if (*(unsigned char *)c3 == 'G') {
703 if (s_cmp(c4, "QR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "RQ",
704 (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "LQ", (ftnlen)2, (
705 ftnlen)2) == 0 || s_cmp(c4, "QL", (ftnlen)2, (ftnlen)2) ==
706 0 || s_cmp(c4, "HR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(
707 c4, "TR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(c4, "BR", (
708 ftnlen)2, (ftnlen)2) == 0) {
718 /* ISPEC = 4: number of shifts (used by xHSEQR) */
725 /* ISPEC = 5: minimum column dimension (not used) */
732 /* ISPEC = 6: crossover point for SVD (used by xGELSS and xGESVD) */
734 ret_val = (integer) ((real) min(*n1,*n2) * 1.6f);
739 /* ISPEC = 7: number of processors (not used) */
746 /* ISPEC = 8: crossover point for multishift (used by xHSEQR) */
754 ISPEC = 9: maximum size of the subproblems at the bottom of the
755 computation tree in the divide-and-conquer algorithm
756 (used by xGELSD and xGESDD)
765 ISPEC = 10: ieee NaN arithmetic can be trusted not to trap
771 ret_val = ieeeck_(&c__0, &c_b163, &c_b164);
778 ISPEC = 11: infinity arithmetic can be trusted not to trap
784 ret_val = ieeeck_(&c__1, &c_b163, &c_b164);
792 /* Subroutine */ int sposv_(char *uplo, integer *n, integer *nrhs, real *a,
793 integer *lda, real *b, integer *ldb, integer *info)
795 /* System generated locals */
796 integer a_dim1, a_offset, b_dim1, b_offset, i__1;
798 /* Local variables */
799 extern logical lsame_(char *, char *);
800 extern /* Subroutine */ int xerbla_(char *, integer *), spotrf_(
801 char *, integer *, real *, integer *, integer *), spotrs_(
802 char *, integer *, integer *, real *, integer *, real *, integer *
807 -- LAPACK driver routine (version 3.0) --
808 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
809 Courant Institute, Argonne National Lab, and Rice University
816 SPOSV computes the solution to a real system of linear equations
818 where A is an N-by-N symmetric positive definite matrix and X and B
819 are N-by-NRHS matrices.
821 The Cholesky decomposition is used to factor A as
822 A = U**T* U, if UPLO = 'U', or
823 A = L * L**T, if UPLO = 'L',
824 where U is an upper triangular matrix and L is a lower triangular
825 matrix. The factored form of A is then used to solve the system of
831 UPLO (input) CHARACTER*1
832 = 'U': Upper triangle of A is stored;
833 = 'L': Lower triangle of A is stored.
836 The number of linear equations, i.e., the order of the
840 The number of right hand sides, i.e., the number of columns
841 of the matrix B. NRHS >= 0.
843 A (input/output) REAL array, dimension (LDA,N)
844 On entry, the symmetric matrix A. If UPLO = 'U', the leading
845 N-by-N upper triangular part of A contains the upper
846 triangular part of the matrix A, and the strictly lower
847 triangular part of A is not referenced. If UPLO = 'L', the
848 leading N-by-N lower triangular part of A contains the lower
849 triangular part of the matrix A, and the strictly upper
850 triangular part of A is not referenced.
852 On exit, if INFO = 0, the factor U or L from the Cholesky
853 factorization A = U**T*U or A = L*L**T.
856 The leading dimension of the array A. LDA >= max(1,N).
858 B (input/output) REAL array, dimension (LDB,NRHS)
859 On entry, the N-by-NRHS right hand side matrix B.
860 On exit, if INFO = 0, the N-by-NRHS solution matrix X.
863 The leading dimension of the array B. LDB >= max(1,N).
865 INFO (output) INTEGER
867 < 0: if INFO = -i, the i-th argument had an illegal value
868 > 0: if INFO = i, the leading minor of order i of A is not
869 positive definite, so the factorization could not be
870 completed, and the solution has not been computed.
872 =====================================================================
875 Test the input parameters.
878 /* Parameter adjustments */
880 a_offset = 1 + a_dim1;
883 b_offset = 1 + b_dim1;
888 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
892 } else if (*nrhs < 0) {
894 } else if (*lda < max(1,*n)) {
896 } else if (*ldb < max(1,*n)) {
901 xerbla_("SPOSV ", &i__1);
905 /* Compute the Cholesky factorization A = U'*U or A = L*L'. */
907 spotrf_(uplo, n, &a[a_offset], lda, info);
910 /* Solve the system A*X = B, overwriting B with X. */
912 spotrs_(uplo, n, nrhs, &a[a_offset], lda, &b[b_offset], ldb, info);
921 /* Subroutine */ int spotf2_(char *uplo, integer *n, real *a, integer *lda,
924 /* System generated locals */
925 integer a_dim1, a_offset, i__1, i__2, i__3;
928 /* Builtin functions */
929 double sqrt(doublereal);
931 /* Local variables */
934 extern doublereal sdot_(integer *, real *, integer *, real *, integer *);
935 extern logical lsame_(char *, char *);
936 extern /* Subroutine */ int sscal_(integer *, real *, real *, integer *),
937 sgemv_(char *, integer *, integer *, real *, real *, integer *,
938 real *, integer *, real *, real *, integer *);
939 static logical upper;
940 extern /* Subroutine */ int xerbla_(char *, integer *);
944 -- LAPACK routine (version 3.0) --
945 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
946 Courant Institute, Argonne National Lab, and Rice University
953 SPOTF2 computes the Cholesky factorization of a real symmetric
954 positive definite matrix A.
956 The factorization has the form
957 A = U' * U , if UPLO = 'U', or
958 A = L * L', if UPLO = 'L',
959 where U is an upper triangular matrix and L is lower triangular.
961 This is the unblocked version of the algorithm, calling Level 2 BLAS.
966 UPLO (input) CHARACTER*1
967 Specifies whether the upper or lower triangular part of the
968 symmetric matrix A is stored.
969 = 'U': Upper triangular
970 = 'L': Lower triangular
973 The order of the matrix A. N >= 0.
975 A (input/output) REAL array, dimension (LDA,N)
976 On entry, the symmetric matrix A. If UPLO = 'U', the leading
977 n by n upper triangular part of A contains the upper
978 triangular part of the matrix A, and the strictly lower
979 triangular part of A is not referenced. If UPLO = 'L', the
980 leading n by n lower triangular part of A contains the lower
981 triangular part of the matrix A, and the strictly upper
982 triangular part of A is not referenced.
984 On exit, if INFO = 0, the factor U or L from the Cholesky
985 factorization A = U'*U or A = L*L'.
988 The leading dimension of the array A. LDA >= max(1,N).
990 INFO (output) INTEGER
992 < 0: if INFO = -k, the k-th argument had an illegal value
993 > 0: if INFO = k, the leading minor of order k is not
994 positive definite, and the factorization could not be
997 =====================================================================
1000 Test the input parameters.
1003 /* Parameter adjustments */
1005 a_offset = 1 + a_dim1;
1010 upper = lsame_(uplo, "U");
1011 if (! upper && ! lsame_(uplo, "L")) {
1013 } else if (*n < 0) {
1015 } else if (*lda < max(1,*n)) {
1020 xerbla_("SPOTF2", &i__1);
1024 /* Quick return if possible */
1032 /* Compute the Cholesky factorization A = U'*U. */
1035 for (j = 1; j <= i__1; ++j) {
1037 /* Compute U(J,J) and test for non-positive-definiteness. */
1040 ajj = a[j + j * a_dim1] - sdot_(&i__2, &a[j * a_dim1 + 1], &c__1,
1041 &a[j * a_dim1 + 1], &c__1);
1043 a[j + j * a_dim1] = ajj;
1047 a[j + j * a_dim1] = ajj;
1049 /* Compute elements J+1:N of row J. */
1054 sgemv_("Transpose", &i__2, &i__3, &c_b181, &a[(j + 1) *
1055 a_dim1 + 1], lda, &a[j * a_dim1 + 1], &c__1, &c_b164,
1056 &a[j + (j + 1) * a_dim1], lda);
1059 sscal_(&i__2, &r__1, &a[j + (j + 1) * a_dim1], lda);
1065 /* Compute the Cholesky factorization A = L*L'. */
1068 for (j = 1; j <= i__1; ++j) {
1070 /* Compute L(J,J) and test for non-positive-definiteness. */
1073 ajj = a[j + j * a_dim1] - sdot_(&i__2, &a[j + a_dim1], lda, &a[j
1076 a[j + j * a_dim1] = ajj;
1080 a[j + j * a_dim1] = ajj;
1082 /* Compute elements J+1:N of column J. */
1087 sgemv_("No transpose", &i__2, &i__3, &c_b181, &a[j + 1 +
1088 a_dim1], lda, &a[j + a_dim1], lda, &c_b164, &a[j + 1
1089 + j * a_dim1], &c__1);
1092 sscal_(&i__2, &r__1, &a[j + 1 + j * a_dim1], &c__1);
1109 /* Subroutine */ int spotrf_(char *uplo, integer *n, real *a, integer *lda,
1112 /* System generated locals */
1113 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
1115 /* Local variables */
1116 static integer j, jb, nb;
1117 extern logical lsame_(char *, char *);
1118 extern /* Subroutine */ int sgemm_(char *, char *, integer *, integer *,
1119 integer *, real *, real *, integer *, real *, integer *, real *,
1121 static logical upper;
1122 extern /* Subroutine */ int strsm_(char *, char *, char *, char *,
1123 integer *, integer *, real *, real *, integer *, real *, integer *
1124 ), ssyrk_(char *, char *, integer
1125 *, integer *, real *, real *, integer *, real *, real *, integer *
1126 ), spotf2_(char *, integer *, real *, integer *,
1127 integer *), xerbla_(char *, integer *);
1128 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
1129 integer *, integer *, ftnlen, ftnlen);
1133 -- LAPACK routine (version 3.0) --
1134 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
1135 Courant Institute, Argonne National Lab, and Rice University
1142 SPOTRF computes the Cholesky factorization of a real symmetric
1143 positive definite matrix A.
1145 The factorization has the form
1146 A = U**T * U, if UPLO = 'U', or
1147 A = L * L**T, if UPLO = 'L',
1148 where U is an upper triangular matrix and L is lower triangular.
1150 This is the block version of the algorithm, calling Level 3 BLAS.
1155 UPLO (input) CHARACTER*1
1156 = 'U': Upper triangle of A is stored;
1157 = 'L': Lower triangle of A is stored.
1160 The order of the matrix A. N >= 0.
1162 A (input/output) REAL array, dimension (LDA,N)
1163 On entry, the symmetric matrix A. If UPLO = 'U', the leading
1164 N-by-N upper triangular part of A contains the upper
1165 triangular part of the matrix A, and the strictly lower
1166 triangular part of A is not referenced. If UPLO = 'L', the
1167 leading N-by-N lower triangular part of A contains the lower
1168 triangular part of the matrix A, and the strictly upper
1169 triangular part of A is not referenced.
1171 On exit, if INFO = 0, the factor U or L from the Cholesky
1172 factorization A = U**T*U or A = L*L**T.
1175 The leading dimension of the array A. LDA >= max(1,N).
1177 INFO (output) INTEGER
1178 = 0: successful exit
1179 < 0: if INFO = -i, the i-th argument had an illegal value
1180 > 0: if INFO = i, the leading minor of order i is not
1181 positive definite, and the factorization could not be
1184 =====================================================================
1187 Test the input parameters.
1190 /* Parameter adjustments */
1192 a_offset = 1 + a_dim1;
1197 upper = lsame_(uplo, "U");
1198 if (! upper && ! lsame_(uplo, "L")) {
1200 } else if (*n < 0) {
1202 } else if (*lda < max(1,*n)) {
1207 xerbla_("SPOTRF", &i__1);
1211 /* Quick return if possible */
1217 /* Determine the block size for this environment. */
1219 nb = ilaenv_(&c__1, "SPOTRF", uplo, n, &c_n1, &c_n1, &c_n1, (ftnlen)6, (
1221 if (nb <= 1 || nb >= *n) {
1223 /* Use unblocked code. */
1225 spotf2_(uplo, n, &a[a_offset], lda, info);
1228 /* Use blocked code. */
1232 /* Compute the Cholesky factorization A = U'*U. */
1236 for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
1239 Update and factorize the current diagonal block and test
1240 for non-positive-definiteness.
1244 i__3 = nb, i__4 = *n - j + 1;
1245 jb = min(i__3,i__4);
1247 ssyrk_("Upper", "Transpose", &jb, &i__3, &c_b181, &a[j *
1248 a_dim1 + 1], lda, &c_b164, &a[j + j * a_dim1], lda);
1249 spotf2_("Upper", &jb, &a[j + j * a_dim1], lda, info);
1255 /* Compute the current block row. */
1257 i__3 = *n - j - jb + 1;
1259 sgemm_("Transpose", "No transpose", &jb, &i__3, &i__4, &
1260 c_b181, &a[j * a_dim1 + 1], lda, &a[(j + jb) *
1261 a_dim1 + 1], lda, &c_b164, &a[j + (j + jb) *
1263 i__3 = *n - j - jb + 1;
1264 strsm_("Left", "Upper", "Transpose", "Non-unit", &jb, &
1265 i__3, &c_b164, &a[j + j * a_dim1], lda, &a[j + (j
1266 + jb) * a_dim1], lda);
1273 /* Compute the Cholesky factorization A = L*L'. */
1277 for (j = 1; i__1 < 0 ? j >= i__2 : j <= i__2; j += i__1) {
1280 Update and factorize the current diagonal block and test
1281 for non-positive-definiteness.
1285 i__3 = nb, i__4 = *n - j + 1;
1286 jb = min(i__3,i__4);
1288 ssyrk_("Lower", "No transpose", &jb, &i__3, &c_b181, &a[j +
1289 a_dim1], lda, &c_b164, &a[j + j * a_dim1], lda);
1290 spotf2_("Lower", &jb, &a[j + j * a_dim1], lda, info);
1296 /* Compute the current block column. */
1298 i__3 = *n - j - jb + 1;
1300 sgemm_("No transpose", "Transpose", &i__3, &jb, &i__4, &
1301 c_b181, &a[j + jb + a_dim1], lda, &a[j + a_dim1],
1302 lda, &c_b164, &a[j + jb + j * a_dim1], lda);
1303 i__3 = *n - j - jb + 1;
1304 strsm_("Right", "Lower", "Transpose", "Non-unit", &i__3, &
1305 jb, &c_b164, &a[j + j * a_dim1], lda, &a[j + jb +
1315 *info = *info + j - 1;
1324 /* Subroutine */ int spotrs_(char *uplo, integer *n, integer *nrhs, real *a,
1325 integer *lda, real *b, integer *ldb, integer *info)
1327 /* System generated locals */
1328 integer a_dim1, a_offset, b_dim1, b_offset, i__1;
1330 /* Local variables */
1331 extern logical lsame_(char *, char *);
1332 static logical upper;
1333 extern /* Subroutine */ int strsm_(char *, char *, char *, char *,
1334 integer *, integer *, real *, real *, integer *, real *, integer *
1335 ), xerbla_(char *, integer *);
1339 -- LAPACK routine (version 3.0) --
1340 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
1341 Courant Institute, Argonne National Lab, and Rice University
1348 SPOTRS solves a system of linear equations A*X = B with a symmetric
1349 positive definite matrix A using the Cholesky factorization
1350 A = U**T*U or A = L*L**T computed by SPOTRF.
1355 UPLO (input) CHARACTER*1
1356 = 'U': Upper triangle of A is stored;
1357 = 'L': Lower triangle of A is stored.
1360 The order of the matrix A. N >= 0.
1362 NRHS (input) INTEGER
1363 The number of right hand sides, i.e., the number of columns
1364 of the matrix B. NRHS >= 0.
1366 A (input) REAL array, dimension (LDA,N)
1367 The triangular factor U or L from the Cholesky factorization
1368 A = U**T*U or A = L*L**T, as computed by SPOTRF.
1371 The leading dimension of the array A. LDA >= max(1,N).
1373 B (input/output) REAL array, dimension (LDB,NRHS)
1374 On entry, the right hand side matrix B.
1375 On exit, the solution matrix X.
1378 The leading dimension of the array B. LDB >= max(1,N).
1380 INFO (output) INTEGER
1381 = 0: successful exit
1382 < 0: if INFO = -i, the i-th argument had an illegal value
1384 =====================================================================
1387 Test the input parameters.
1390 /* Parameter adjustments */
1392 a_offset = 1 + a_dim1;
1395 b_offset = 1 + b_dim1;
1400 upper = lsame_(uplo, "U");
1401 if (! upper && ! lsame_(uplo, "L")) {
1403 } else if (*n < 0) {
1405 } else if (*nrhs < 0) {
1407 } else if (*lda < max(1,*n)) {
1409 } else if (*ldb < max(1,*n)) {
1414 xerbla_("SPOTRS", &i__1);
1418 /* Quick return if possible */
1420 if (*n == 0 || *nrhs == 0) {
1427 Solve A*X = B where A = U'*U.
1429 Solve U'*X = B, overwriting B with X.
1432 strsm_("Left", "Upper", "Transpose", "Non-unit", n, nrhs, &c_b164, &a[
1433 a_offset], lda, &b[b_offset], ldb);
1435 /* Solve U*X = B, overwriting B with X. */
1437 strsm_("Left", "Upper", "No transpose", "Non-unit", n, nrhs, &c_b164,
1438 &a[a_offset], lda, &b[b_offset], ldb);
1442 Solve A*X = B where A = L*L'.
1444 Solve L*X = B, overwriting B with X.
1447 strsm_("Left", "Lower", "No transpose", "Non-unit", n, nrhs, &c_b164,
1448 &a[a_offset], lda, &b[b_offset], ldb);
1450 /* Solve L'*X = B, overwriting B with X. */
1452 strsm_("Left", "Lower", "Transpose", "Non-unit", n, nrhs, &c_b164, &a[
1453 a_offset], lda, &b[b_offset], ldb);