ctbmv.c 18 KB

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