ctbsv.c 17 KB

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