Debian Codegraph @

external/clapack/blas.cpp

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