ztbmv.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /* ztbmv.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. /* Subroutine */ int ztbmv_(char *uplo, char *trans, char *diag, integer *n,
  14. integer *k, doublecomplex *a, integer *lda, doublecomplex *x, integer
  15. *incx)
  16. {
  17. /* System generated locals */
  18. integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
  19. doublecomplex z__1, z__2, z__3;
  20. /* Builtin functions */
  21. void d_cnjg(doublecomplex *, doublecomplex *);
  22. /* Local variables */
  23. integer i__, j, l, ix, jx, kx, info;
  24. doublecomplex temp;
  25. extern logical lsame_(char *, char *);
  26. integer kplus1;
  27. extern /* Subroutine */ int xerbla_(char *, integer *);
  28. logical noconj, nounit;
  29. /* .. Scalar Arguments .. */
  30. /* .. */
  31. /* .. Array Arguments .. */
  32. /* .. */
  33. /* Purpose */
  34. /* ======= */
  35. /* ZTBMV performs one of the matrix-vector operations */
  36. /* x := A*x, or x := A'*x, or x := conjg( A' )*x, */
  37. /* where x is an n element vector and A is an n by n unit, or non-unit, */
  38. /* upper or lower triangular band matrix, with ( k + 1 ) diagonals. */
  39. /* Arguments */
  40. /* ========== */
  41. /* UPLO - CHARACTER*1. */
  42. /* On entry, UPLO specifies whether the matrix is an upper or */
  43. /* lower triangular matrix as follows: */
  44. /* UPLO = 'U' or 'u' A is an upper triangular matrix. */
  45. /* UPLO = 'L' or 'l' A is a lower triangular matrix. */
  46. /* Unchanged on exit. */
  47. /* TRANS - CHARACTER*1. */
  48. /* On entry, TRANS specifies the operation to be performed as */
  49. /* follows: */
  50. /* TRANS = 'N' or 'n' x := A*x. */
  51. /* TRANS = 'T' or 't' x := A'*x. */
  52. /* TRANS = 'C' or 'c' x := conjg( A' )*x. */
  53. /* Unchanged on exit. */
  54. /* DIAG - CHARACTER*1. */
  55. /* On entry, DIAG specifies whether or not A is unit */
  56. /* triangular as follows: */
  57. /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */
  58. /* DIAG = 'N' or 'n' A is not assumed to be unit */
  59. /* triangular. */
  60. /* Unchanged on exit. */
  61. /* N - INTEGER. */
  62. /* On entry, N specifies the order of the matrix A. */
  63. /* N must be at least zero. */
  64. /* Unchanged on exit. */
  65. /* K - INTEGER. */
  66. /* On entry with UPLO = 'U' or 'u', K specifies the number of */
  67. /* super-diagonals of the matrix A. */
  68. /* On entry with UPLO = 'L' or 'l', K specifies the number of */
  69. /* sub-diagonals of the matrix A. */
  70. /* K must satisfy 0 .le. K. */
  71. /* Unchanged on exit. */
  72. /* A - COMPLEX*16 array of DIMENSION ( LDA, n ). */
  73. /* Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */
  74. /* by n part of the array A must contain the upper triangular */
  75. /* band part of the matrix of coefficients, supplied column by */
  76. /* column, with the leading diagonal of the matrix in row */
  77. /* ( k + 1 ) of the array, the first super-diagonal starting at */
  78. /* position 2 in row k, and so on. The top left k by k triangle */
  79. /* of the array A is not referenced. */
  80. /* The following program segment will transfer an upper */
  81. /* triangular band matrix from conventional full matrix storage */
  82. /* to band storage: */
  83. /* DO 20, J = 1, N */
  84. /* M = K + 1 - J */
  85. /* DO 10, I = MAX( 1, J - K ), J */
  86. /* A( M + I, J ) = matrix( I, J ) */
  87. /* 10 CONTINUE */
  88. /* 20 CONTINUE */
  89. /* Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */
  90. /* by n part of the array A must contain the lower triangular */
  91. /* band part of the matrix of coefficients, supplied column by */
  92. /* column, with the leading diagonal of the matrix in row 1 of */
  93. /* the array, the first sub-diagonal starting at position 1 in */
  94. /* row 2, and so on. The bottom right k by k triangle of the */
  95. /* array A is not referenced. */
  96. /* The following program segment will transfer a lower */
  97. /* triangular band matrix from conventional full matrix storage */
  98. /* to band storage: */
  99. /* DO 20, J = 1, N */
  100. /* M = 1 - J */
  101. /* DO 10, I = J, MIN( N, J + K ) */
  102. /* A( M + I, J ) = matrix( I, J ) */
  103. /* 10 CONTINUE */
  104. /* 20 CONTINUE */
  105. /* Note that when DIAG = 'U' or 'u' the elements of the array A */
  106. /* corresponding to the diagonal elements of the matrix are not */
  107. /* referenced, but are assumed to be unity. */
  108. /* Unchanged on exit. */
  109. /* LDA - INTEGER. */
  110. /* On entry, LDA specifies the first dimension of A as declared */
  111. /* in the calling (sub) program. LDA must be at least */
  112. /* ( k + 1 ). */
  113. /* Unchanged on exit. */
  114. /* X - COMPLEX*16 array of dimension at least */
  115. /* ( 1 + ( n - 1 )*abs( INCX ) ). */
  116. /* Before entry, the incremented array X must contain the n */
  117. /* element vector x. On exit, X is overwritten with the */
  118. /* tranformed vector x. */
  119. /* INCX - INTEGER. */
  120. /* On entry, INCX specifies the increment for the elements of */
  121. /* X. INCX must not be zero. */
  122. /* Unchanged on exit. */
  123. /* Level 2 Blas routine. */
  124. /* -- Written on 22-October-1986. */
  125. /* Jack Dongarra, Argonne National Lab. */
  126. /* Jeremy Du Croz, Nag Central Office. */
  127. /* Sven Hammarling, Nag Central Office. */
  128. /* Richard Hanson, Sandia National Labs. */
  129. /* .. Parameters .. */
  130. /* .. */
  131. /* .. Local Scalars .. */
  132. /* .. */
  133. /* .. External Functions .. */
  134. /* .. */
  135. /* .. External Subroutines .. */
  136. /* .. */
  137. /* .. Intrinsic Functions .. */
  138. /* .. */
  139. /* Test the input parameters. */
  140. /* Parameter adjustments */
  141. a_dim1 = *lda;
  142. a_offset = 1 + a_dim1;
  143. a -= a_offset;
  144. --x;
  145. /* Function Body */
  146. info = 0;
  147. if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
  148. info = 1;
  149. } else if (! lsame_(trans, "N") && ! lsame_(trans,
  150. "T") && ! lsame_(trans, "C")) {
  151. info = 2;
  152. } else if (! lsame_(diag, "U") && ! lsame_(diag,
  153. "N")) {
  154. info = 3;
  155. } else if (*n < 0) {
  156. info = 4;
  157. } else if (*k < 0) {
  158. info = 5;
  159. } else if (*lda < *k + 1) {
  160. info = 7;
  161. } else if (*incx == 0) {
  162. info = 9;
  163. }
  164. if (info != 0) {
  165. xerbla_("ZTBMV ", &info);
  166. return 0;
  167. }
  168. /* Quick return if possible. */
  169. if (*n == 0) {
  170. return 0;
  171. }
  172. noconj = lsame_(trans, "T");
  173. nounit = lsame_(diag, "N");
  174. /* Set up the start point in X if the increment is not unity. This */
  175. /* will be ( N - 1 )*INCX too small for descending loops. */
  176. if (*incx <= 0) {
  177. kx = 1 - (*n - 1) * *incx;
  178. } else if (*incx != 1) {
  179. kx = 1;
  180. }
  181. /* Start the operations. In this version the elements of A are */
  182. /* accessed sequentially with one pass through A. */
  183. if (lsame_(trans, "N")) {
  184. /* Form x := A*x. */
  185. if (lsame_(uplo, "U")) {
  186. kplus1 = *k + 1;
  187. if (*incx == 1) {
  188. i__1 = *n;
  189. for (j = 1; j <= i__1; ++j) {
  190. i__2 = j;
  191. if (x[i__2].r != 0. || x[i__2].i != 0.) {
  192. i__2 = j;
  193. temp.r = x[i__2].r, temp.i = x[i__2].i;
  194. l = kplus1 - j;
  195. /* Computing MAX */
  196. i__2 = 1, i__3 = j - *k;
  197. i__4 = j - 1;
  198. for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {
  199. i__2 = i__;
  200. i__3 = i__;
  201. i__5 = l + i__ + j * a_dim1;
  202. z__2.r = temp.r * a[i__5].r - temp.i * a[i__5].i,
  203. z__2.i = temp.r * a[i__5].i + temp.i * a[
  204. i__5].r;
  205. z__1.r = x[i__3].r + z__2.r, z__1.i = x[i__3].i +
  206. z__2.i;
  207. x[i__2].r = z__1.r, x[i__2].i = z__1.i;
  208. /* L10: */
  209. }
  210. if (nounit) {
  211. i__4 = j;
  212. i__2 = j;
  213. i__3 = kplus1 + j * a_dim1;
  214. z__1.r = x[i__2].r * a[i__3].r - x[i__2].i * a[
  215. i__3].i, z__1.i = x[i__2].r * a[i__3].i +
  216. x[i__2].i * a[i__3].r;
  217. x[i__4].r = z__1.r, x[i__4].i = z__1.i;
  218. }
  219. }
  220. /* L20: */
  221. }
  222. } else {
  223. jx = kx;
  224. i__1 = *n;
  225. for (j = 1; j <= i__1; ++j) {
  226. i__4 = jx;
  227. if (x[i__4].r != 0. || x[i__4].i != 0.) {
  228. i__4 = jx;
  229. temp.r = x[i__4].r, temp.i = x[i__4].i;
  230. ix = kx;
  231. l = kplus1 - j;
  232. /* Computing MAX */
  233. i__4 = 1, i__2 = j - *k;
  234. i__3 = j - 1;
  235. for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {
  236. i__4 = ix;
  237. i__2 = ix;
  238. i__5 = l + i__ + j * a_dim1;
  239. z__2.r = temp.r * a[i__5].r - temp.i * a[i__5].i,
  240. z__2.i = temp.r * a[i__5].i + temp.i * a[
  241. i__5].r;
  242. z__1.r = x[i__2].r + z__2.r, z__1.i = x[i__2].i +
  243. z__2.i;
  244. x[i__4].r = z__1.r, x[i__4].i = z__1.i;
  245. ix += *incx;
  246. /* L30: */
  247. }
  248. if (nounit) {
  249. i__3 = jx;
  250. i__4 = jx;
  251. i__2 = kplus1 + j * a_dim1;
  252. z__1.r = x[i__4].r * a[i__2].r - x[i__4].i * a[
  253. i__2].i, z__1.i = x[i__4].r * a[i__2].i +
  254. x[i__4].i * a[i__2].r;
  255. x[i__3].r = z__1.r, x[i__3].i = z__1.i;
  256. }
  257. }
  258. jx += *incx;
  259. if (j > *k) {
  260. kx += *incx;
  261. }
  262. /* L40: */
  263. }
  264. }
  265. } else {
  266. if (*incx == 1) {
  267. for (j = *n; j >= 1; --j) {
  268. i__1 = j;
  269. if (x[i__1].r != 0. || x[i__1].i != 0.) {
  270. i__1 = j;
  271. temp.r = x[i__1].r, temp.i = x[i__1].i;
  272. l = 1 - j;
  273. /* Computing MIN */
  274. i__1 = *n, i__3 = j + *k;
  275. i__4 = j + 1;
  276. for (i__ = min(i__1,i__3); i__ >= i__4; --i__) {
  277. i__1 = i__;
  278. i__3 = i__;
  279. i__2 = l + i__ + j * a_dim1;
  280. z__2.r = temp.r * a[i__2].r - temp.i * a[i__2].i,
  281. z__2.i = temp.r * a[i__2].i + temp.i * a[
  282. i__2].r;
  283. z__1.r = x[i__3].r + z__2.r, z__1.i = x[i__3].i +
  284. z__2.i;
  285. x[i__1].r = z__1.r, x[i__1].i = z__1.i;
  286. /* L50: */
  287. }
  288. if (nounit) {
  289. i__4 = j;
  290. i__1 = j;
  291. i__3 = j * a_dim1 + 1;
  292. z__1.r = x[i__1].r * a[i__3].r - x[i__1].i * a[
  293. i__3].i, z__1.i = x[i__1].r * a[i__3].i +
  294. x[i__1].i * a[i__3].r;
  295. x[i__4].r = z__1.r, x[i__4].i = z__1.i;
  296. }
  297. }
  298. /* L60: */
  299. }
  300. } else {
  301. kx += (*n - 1) * *incx;
  302. jx = kx;
  303. for (j = *n; j >= 1; --j) {
  304. i__4 = jx;
  305. if (x[i__4].r != 0. || x[i__4].i != 0.) {
  306. i__4 = jx;
  307. temp.r = x[i__4].r, temp.i = x[i__4].i;
  308. ix = kx;
  309. l = 1 - j;
  310. /* Computing MIN */
  311. i__4 = *n, i__1 = j + *k;
  312. i__3 = j + 1;
  313. for (i__ = min(i__4,i__1); i__ >= i__3; --i__) {
  314. i__4 = ix;
  315. i__1 = ix;
  316. i__2 = l + i__ + j * a_dim1;
  317. z__2.r = temp.r * a[i__2].r - temp.i * a[i__2].i,
  318. z__2.i = temp.r * a[i__2].i + temp.i * a[
  319. i__2].r;
  320. z__1.r = x[i__1].r + z__2.r, z__1.i = x[i__1].i +
  321. z__2.i;
  322. x[i__4].r = z__1.r, x[i__4].i = z__1.i;
  323. ix -= *incx;
  324. /* L70: */
  325. }
  326. if (nounit) {
  327. i__3 = jx;
  328. i__4 = jx;
  329. i__1 = j * a_dim1 + 1;
  330. z__1.r = x[i__4].r * a[i__1].r - x[i__4].i * a[
  331. i__1].i, z__1.i = x[i__4].r * a[i__1].i +
  332. x[i__4].i * a[i__1].r;
  333. x[i__3].r = z__1.r, x[i__3].i = z__1.i;
  334. }
  335. }
  336. jx -= *incx;
  337. if (*n - j >= *k) {
  338. kx -= *incx;
  339. }
  340. /* L80: */
  341. }
  342. }
  343. }
  344. } else {
  345. /* Form x := A'*x or x := conjg( A' )*x. */
  346. if (lsame_(uplo, "U")) {
  347. kplus1 = *k + 1;
  348. if (*incx == 1) {
  349. for (j = *n; j >= 1; --j) {
  350. i__3 = j;
  351. temp.r = x[i__3].r, temp.i = x[i__3].i;
  352. l = kplus1 - j;
  353. if (noconj) {
  354. if (nounit) {
  355. i__3 = kplus1 + j * a_dim1;
  356. z__1.r = temp.r * a[i__3].r - temp.i * a[i__3].i,
  357. z__1.i = temp.r * a[i__3].i + temp.i * a[
  358. i__3].r;
  359. temp.r = z__1.r, temp.i = z__1.i;
  360. }
  361. /* Computing MAX */
  362. i__4 = 1, i__1 = j - *k;
  363. i__3 = max(i__4,i__1);
  364. for (i__ = j - 1; i__ >= i__3; --i__) {
  365. i__4 = l + i__ + j * a_dim1;
  366. i__1 = i__;
  367. z__2.r = a[i__4].r * x[i__1].r - a[i__4].i * x[
  368. i__1].i, z__2.i = a[i__4].r * x[i__1].i +
  369. a[i__4].i * x[i__1].r;
  370. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  371. z__2.i;
  372. temp.r = z__1.r, temp.i = z__1.i;
  373. /* L90: */
  374. }
  375. } else {
  376. if (nounit) {
  377. d_cnjg(&z__2, &a[kplus1 + j * a_dim1]);
  378. z__1.r = temp.r * z__2.r - temp.i * z__2.i,
  379. z__1.i = temp.r * z__2.i + temp.i *
  380. z__2.r;
  381. temp.r = z__1.r, temp.i = z__1.i;
  382. }
  383. /* Computing MAX */
  384. i__4 = 1, i__1 = j - *k;
  385. i__3 = max(i__4,i__1);
  386. for (i__ = j - 1; i__ >= i__3; --i__) {
  387. d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);
  388. i__4 = i__;
  389. z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i,
  390. z__2.i = z__3.r * x[i__4].i + z__3.i * x[
  391. i__4].r;
  392. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  393. z__2.i;
  394. temp.r = z__1.r, temp.i = z__1.i;
  395. /* L100: */
  396. }
  397. }
  398. i__3 = j;
  399. x[i__3].r = temp.r, x[i__3].i = temp.i;
  400. /* L110: */
  401. }
  402. } else {
  403. kx += (*n - 1) * *incx;
  404. jx = kx;
  405. for (j = *n; j >= 1; --j) {
  406. i__3 = jx;
  407. temp.r = x[i__3].r, temp.i = x[i__3].i;
  408. kx -= *incx;
  409. ix = kx;
  410. l = kplus1 - j;
  411. if (noconj) {
  412. if (nounit) {
  413. i__3 = kplus1 + j * a_dim1;
  414. z__1.r = temp.r * a[i__3].r - temp.i * a[i__3].i,
  415. z__1.i = temp.r * a[i__3].i + temp.i * a[
  416. i__3].r;
  417. temp.r = z__1.r, temp.i = z__1.i;
  418. }
  419. /* Computing MAX */
  420. i__4 = 1, i__1 = j - *k;
  421. i__3 = max(i__4,i__1);
  422. for (i__ = j - 1; i__ >= i__3; --i__) {
  423. i__4 = l + i__ + j * a_dim1;
  424. i__1 = ix;
  425. z__2.r = a[i__4].r * x[i__1].r - a[i__4].i * x[
  426. i__1].i, z__2.i = a[i__4].r * x[i__1].i +
  427. a[i__4].i * x[i__1].r;
  428. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  429. z__2.i;
  430. temp.r = z__1.r, temp.i = z__1.i;
  431. ix -= *incx;
  432. /* L120: */
  433. }
  434. } else {
  435. if (nounit) {
  436. d_cnjg(&z__2, &a[kplus1 + j * a_dim1]);
  437. z__1.r = temp.r * z__2.r - temp.i * z__2.i,
  438. z__1.i = temp.r * z__2.i + temp.i *
  439. z__2.r;
  440. temp.r = z__1.r, temp.i = z__1.i;
  441. }
  442. /* Computing MAX */
  443. i__4 = 1, i__1 = j - *k;
  444. i__3 = max(i__4,i__1);
  445. for (i__ = j - 1; i__ >= i__3; --i__) {
  446. d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);
  447. i__4 = ix;
  448. z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i,
  449. z__2.i = z__3.r * x[i__4].i + z__3.i * x[
  450. i__4].r;
  451. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  452. z__2.i;
  453. temp.r = z__1.r, temp.i = z__1.i;
  454. ix -= *incx;
  455. /* L130: */
  456. }
  457. }
  458. i__3 = jx;
  459. x[i__3].r = temp.r, x[i__3].i = temp.i;
  460. jx -= *incx;
  461. /* L140: */
  462. }
  463. }
  464. } else {
  465. if (*incx == 1) {
  466. i__3 = *n;
  467. for (j = 1; j <= i__3; ++j) {
  468. i__4 = j;
  469. temp.r = x[i__4].r, temp.i = x[i__4].i;
  470. l = 1 - j;
  471. if (noconj) {
  472. if (nounit) {
  473. i__4 = j * a_dim1 + 1;
  474. z__1.r = temp.r * a[i__4].r - temp.i * a[i__4].i,
  475. z__1.i = temp.r * a[i__4].i + temp.i * a[
  476. i__4].r;
  477. temp.r = z__1.r, temp.i = z__1.i;
  478. }
  479. /* Computing MIN */
  480. i__1 = *n, i__2 = j + *k;
  481. i__4 = min(i__1,i__2);
  482. for (i__ = j + 1; i__ <= i__4; ++i__) {
  483. i__1 = l + i__ + j * a_dim1;
  484. i__2 = i__;
  485. z__2.r = a[i__1].r * x[i__2].r - a[i__1].i * x[
  486. i__2].i, z__2.i = a[i__1].r * x[i__2].i +
  487. a[i__1].i * x[i__2].r;
  488. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  489. z__2.i;
  490. temp.r = z__1.r, temp.i = z__1.i;
  491. /* L150: */
  492. }
  493. } else {
  494. if (nounit) {
  495. d_cnjg(&z__2, &a[j * a_dim1 + 1]);
  496. z__1.r = temp.r * z__2.r - temp.i * z__2.i,
  497. z__1.i = temp.r * z__2.i + temp.i *
  498. z__2.r;
  499. temp.r = z__1.r, temp.i = z__1.i;
  500. }
  501. /* Computing MIN */
  502. i__1 = *n, i__2 = j + *k;
  503. i__4 = min(i__1,i__2);
  504. for (i__ = j + 1; i__ <= i__4; ++i__) {
  505. d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);
  506. i__1 = i__;
  507. z__2.r = z__3.r * x[i__1].r - z__3.i * x[i__1].i,
  508. z__2.i = z__3.r * x[i__1].i + z__3.i * x[
  509. i__1].r;
  510. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  511. z__2.i;
  512. temp.r = z__1.r, temp.i = z__1.i;
  513. /* L160: */
  514. }
  515. }
  516. i__4 = j;
  517. x[i__4].r = temp.r, x[i__4].i = temp.i;
  518. /* L170: */
  519. }
  520. } else {
  521. jx = kx;
  522. i__3 = *n;
  523. for (j = 1; j <= i__3; ++j) {
  524. i__4 = jx;
  525. temp.r = x[i__4].r, temp.i = x[i__4].i;
  526. kx += *incx;
  527. ix = kx;
  528. l = 1 - j;
  529. if (noconj) {
  530. if (nounit) {
  531. i__4 = j * a_dim1 + 1;
  532. z__1.r = temp.r * a[i__4].r - temp.i * a[i__4].i,
  533. z__1.i = temp.r * a[i__4].i + temp.i * a[
  534. i__4].r;
  535. temp.r = z__1.r, temp.i = z__1.i;
  536. }
  537. /* Computing MIN */
  538. i__1 = *n, i__2 = j + *k;
  539. i__4 = min(i__1,i__2);
  540. for (i__ = j + 1; i__ <= i__4; ++i__) {
  541. i__1 = l + i__ + j * a_dim1;
  542. i__2 = ix;
  543. z__2.r = a[i__1].r * x[i__2].r - a[i__1].i * x[
  544. i__2].i, z__2.i = a[i__1].r * x[i__2].i +
  545. a[i__1].i * x[i__2].r;
  546. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  547. z__2.i;
  548. temp.r = z__1.r, temp.i = z__1.i;
  549. ix += *incx;
  550. /* L180: */
  551. }
  552. } else {
  553. if (nounit) {
  554. d_cnjg(&z__2, &a[j * a_dim1 + 1]);
  555. z__1.r = temp.r * z__2.r - temp.i * z__2.i,
  556. z__1.i = temp.r * z__2.i + temp.i *
  557. z__2.r;
  558. temp.r = z__1.r, temp.i = z__1.i;
  559. }
  560. /* Computing MIN */
  561. i__1 = *n, i__2 = j + *k;
  562. i__4 = min(i__1,i__2);
  563. for (i__ = j + 1; i__ <= i__4; ++i__) {
  564. d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);
  565. i__1 = ix;
  566. z__2.r = z__3.r * x[i__1].r - z__3.i * x[i__1].i,
  567. z__2.i = z__3.r * x[i__1].i + z__3.i * x[
  568. i__1].r;
  569. z__1.r = temp.r + z__2.r, z__1.i = temp.i +
  570. z__2.i;
  571. temp.r = z__1.r, temp.i = z__1.i;
  572. ix += *incx;
  573. /* L190: */
  574. }
  575. }
  576. i__4 = jx;
  577. x[i__4].r = temp.r, x[i__4].i = temp.i;
  578. jx += *incx;
  579. /* L200: */
  580. }
  581. }
  582. }
  583. }
  584. return 0;
  585. /* End of ZTBMV . */
  586. } /* ztbmv_ */