You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

clarfb.c 35 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266
  1. /* f2c.h -- Standard Fortran to C header file */
  2. /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
  3. - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
  4. #ifndef F2C_INCLUDE
  5. #define F2C_INCLUDE
  6. #include <math.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <stdio.h>
  10. #include <complex.h>
  11. #ifdef complex
  12. #undef complex
  13. #endif
  14. #ifdef I
  15. #undef I
  16. #endif
  17. typedef int integer;
  18. typedef unsigned int uinteger;
  19. typedef char *address;
  20. typedef short int shortint;
  21. typedef float real;
  22. typedef double doublereal;
  23. typedef struct { real r, i; } complex;
  24. typedef struct { doublereal r, i; } doublecomplex;
  25. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  26. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  27. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  28. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  29. #define pCf(z) (*_pCf(z))
  30. #define pCd(z) (*_pCd(z))
  31. typedef int logical;
  32. typedef short int shortlogical;
  33. typedef char logical1;
  34. typedef char integer1;
  35. #define TRUE_ (1)
  36. #define FALSE_ (0)
  37. /* Extern is for use with -E */
  38. #ifndef Extern
  39. #define Extern extern
  40. #endif
  41. /* I/O stuff */
  42. typedef int flag;
  43. typedef int ftnlen;
  44. typedef int ftnint;
  45. /*external read, write*/
  46. typedef struct
  47. { flag cierr;
  48. ftnint ciunit;
  49. flag ciend;
  50. char *cifmt;
  51. ftnint cirec;
  52. } cilist;
  53. /*internal read, write*/
  54. typedef struct
  55. { flag icierr;
  56. char *iciunit;
  57. flag iciend;
  58. char *icifmt;
  59. ftnint icirlen;
  60. ftnint icirnum;
  61. } icilist;
  62. /*open*/
  63. typedef struct
  64. { flag oerr;
  65. ftnint ounit;
  66. char *ofnm;
  67. ftnlen ofnmlen;
  68. char *osta;
  69. char *oacc;
  70. char *ofm;
  71. ftnint orl;
  72. char *oblnk;
  73. } olist;
  74. /*close*/
  75. typedef struct
  76. { flag cerr;
  77. ftnint cunit;
  78. char *csta;
  79. } cllist;
  80. /*rewind, backspace, endfile*/
  81. typedef struct
  82. { flag aerr;
  83. ftnint aunit;
  84. } alist;
  85. /* inquire */
  86. typedef struct
  87. { flag inerr;
  88. ftnint inunit;
  89. char *infile;
  90. ftnlen infilen;
  91. ftnint *inex; /*parameters in standard's order*/
  92. ftnint *inopen;
  93. ftnint *innum;
  94. ftnint *innamed;
  95. char *inname;
  96. ftnlen innamlen;
  97. char *inacc;
  98. ftnlen inacclen;
  99. char *inseq;
  100. ftnlen inseqlen;
  101. char *indir;
  102. ftnlen indirlen;
  103. char *infmt;
  104. ftnlen infmtlen;
  105. char *inform;
  106. ftnint informlen;
  107. char *inunf;
  108. ftnlen inunflen;
  109. ftnint *inrecl;
  110. ftnint *innrec;
  111. char *inblank;
  112. ftnlen inblanklen;
  113. } inlist;
  114. #define VOID void
  115. union Multitype { /* for multiple entry points */
  116. integer1 g;
  117. shortint h;
  118. integer i;
  119. /* longint j; */
  120. real r;
  121. doublereal d;
  122. complex c;
  123. doublecomplex z;
  124. };
  125. typedef union Multitype Multitype;
  126. struct Vardesc { /* for Namelist */
  127. char *name;
  128. char *addr;
  129. ftnlen *dims;
  130. int type;
  131. };
  132. typedef struct Vardesc Vardesc;
  133. struct Namelist {
  134. char *name;
  135. Vardesc **vars;
  136. int nvars;
  137. };
  138. typedef struct Namelist Namelist;
  139. #define abs(x) ((x) >= 0 ? (x) : -(x))
  140. #define dabs(x) (fabs(x))
  141. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  142. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  143. #define dmin(a,b) (f2cmin(a,b))
  144. #define dmax(a,b) (f2cmax(a,b))
  145. #define bit_test(a,b) ((a) >> (b) & 1)
  146. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  147. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  148. #define abort_() { sig_die("Fortran abort routine called", 1); }
  149. #define c_abs(z) (cabsf(Cf(z)))
  150. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  151. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  152. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  153. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  154. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  155. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  156. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  157. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  158. #define d_abs(x) (fabs(*(x)))
  159. #define d_acos(x) (acos(*(x)))
  160. #define d_asin(x) (asin(*(x)))
  161. #define d_atan(x) (atan(*(x)))
  162. #define d_atn2(x, y) (atan2(*(x),*(y)))
  163. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  164. #define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); }
  165. #define d_cos(x) (cos(*(x)))
  166. #define d_cosh(x) (cosh(*(x)))
  167. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  168. #define d_exp(x) (exp(*(x)))
  169. #define d_imag(z) (cimag(Cd(z)))
  170. #define r_imag(z) (cimag(Cf(z)))
  171. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  172. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  173. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  174. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  175. #define d_log(x) (log(*(x)))
  176. #define d_mod(x, y) (fmod(*(x), *(y)))
  177. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  178. #define d_nint(x) u_nint(*(x))
  179. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  180. #define d_sign(a,b) u_sign(*(a),*(b))
  181. #define r_sign(a,b) u_sign(*(a),*(b))
  182. #define d_sin(x) (sin(*(x)))
  183. #define d_sinh(x) (sinh(*(x)))
  184. #define d_sqrt(x) (sqrt(*(x)))
  185. #define d_tan(x) (tan(*(x)))
  186. #define d_tanh(x) (tanh(*(x)))
  187. #define i_abs(x) abs(*(x))
  188. #define i_dnnt(x) ((integer)u_nint(*(x)))
  189. #define i_len(s, n) (n)
  190. #define i_nint(x) ((integer)u_nint(*(x)))
  191. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  192. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  193. #define pow_si(B,E) spow_ui(*(B),*(E))
  194. #define pow_ri(B,E) spow_ui(*(B),*(E))
  195. #define pow_di(B,E) dpow_ui(*(B),*(E))
  196. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  197. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  198. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  199. #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
  200. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  201. #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
  202. #define sig_die(s, kill) { exit(1); }
  203. #define s_stop(s, n) {exit(0);}
  204. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  205. #define z_abs(z) (cabs(Cd(z)))
  206. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  207. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  208. #define myexit_() break;
  209. #define mycycle() continue;
  210. #define myceiling(w) {ceil(w)}
  211. #define myhuge(w) {HUGE_VAL}
  212. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  213. #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  214. /* procedure parameter types for -A and -C++ */
  215. #define F2C_proc_par_types 1
  216. #ifdef __cplusplus
  217. typedef logical (*L_fp)(...);
  218. #else
  219. typedef logical (*L_fp)();
  220. #endif
  221. static float spow_ui(float x, integer n) {
  222. float pow=1.0; unsigned long int u;
  223. if(n != 0) {
  224. if(n < 0) n = -n, x = 1/x;
  225. for(u = n; ; ) {
  226. if(u & 01) pow *= x;
  227. if(u >>= 1) x *= x;
  228. else break;
  229. }
  230. }
  231. return pow;
  232. }
  233. static double dpow_ui(double x, integer n) {
  234. double pow=1.0; unsigned long int u;
  235. if(n != 0) {
  236. if(n < 0) n = -n, x = 1/x;
  237. for(u = n; ; ) {
  238. if(u & 01) pow *= x;
  239. if(u >>= 1) x *= x;
  240. else break;
  241. }
  242. }
  243. return pow;
  244. }
  245. static _Complex float cpow_ui(_Complex float x, integer n) {
  246. _Complex float pow=1.0; unsigned long int u;
  247. if(n != 0) {
  248. if(n < 0) n = -n, x = 1/x;
  249. for(u = n; ; ) {
  250. if(u & 01) pow *= x;
  251. if(u >>= 1) x *= x;
  252. else break;
  253. }
  254. }
  255. return pow;
  256. }
  257. static _Complex double zpow_ui(_Complex double x, integer n) {
  258. _Complex double pow=1.0; unsigned long int u;
  259. if(n != 0) {
  260. if(n < 0) n = -n, x = 1/x;
  261. for(u = n; ; ) {
  262. if(u & 01) pow *= x;
  263. if(u >>= 1) x *= x;
  264. else break;
  265. }
  266. }
  267. return pow;
  268. }
  269. static integer pow_ii(integer x, integer n) {
  270. integer pow; unsigned long int u;
  271. if (n <= 0) {
  272. if (n == 0 || x == 1) pow = 1;
  273. else if (x != -1) pow = x == 0 ? 1/x : 0;
  274. else n = -n;
  275. }
  276. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  277. u = n;
  278. for(pow = 1; ; ) {
  279. if(u & 01) pow *= x;
  280. if(u >>= 1) x *= x;
  281. else break;
  282. }
  283. }
  284. return pow;
  285. }
  286. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  287. {
  288. double m; integer i, mi;
  289. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  290. if (w[i-1]>m) mi=i ,m=w[i-1];
  291. return mi-s+1;
  292. }
  293. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  294. {
  295. float m; integer i, mi;
  296. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  297. if (w[i-1]>m) mi=i ,m=w[i-1];
  298. return mi-s+1;
  299. }
  300. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  301. integer n = *n_, incx = *incx_, incy = *incy_, i;
  302. _Complex float zdotc = 0.0;
  303. if (incx == 1 && incy == 1) {
  304. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  305. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  306. }
  307. } else {
  308. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  309. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  310. }
  311. }
  312. pCf(z) = zdotc;
  313. }
  314. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  315. integer n = *n_, incx = *incx_, incy = *incy_, i;
  316. _Complex double zdotc = 0.0;
  317. if (incx == 1 && incy == 1) {
  318. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  319. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  320. }
  321. } else {
  322. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  323. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  324. }
  325. }
  326. pCd(z) = zdotc;
  327. }
  328. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  329. integer n = *n_, incx = *incx_, incy = *incy_, i;
  330. _Complex float zdotc = 0.0;
  331. if (incx == 1 && incy == 1) {
  332. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  333. zdotc += Cf(&x[i]) * Cf(&y[i]);
  334. }
  335. } else {
  336. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  337. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  338. }
  339. }
  340. pCf(z) = zdotc;
  341. }
  342. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  343. integer n = *n_, incx = *incx_, incy = *incy_, i;
  344. _Complex double zdotc = 0.0;
  345. if (incx == 1 && incy == 1) {
  346. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  347. zdotc += Cd(&x[i]) * Cd(&y[i]);
  348. }
  349. } else {
  350. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  351. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  352. }
  353. }
  354. pCd(z) = zdotc;
  355. }
  356. #endif
  357. /* -- translated by f2c (version 20000121).
  358. You must link the resulting object file with the libraries:
  359. -lf2c -lm (in that order)
  360. */
  361. /* Table of constant values */
  362. static complex c_b1 = {1.f,0.f};
  363. static integer c__1 = 1;
  364. /* > \brief \b CLARFB applies a block reflector or its conjugate-transpose to a general rectangular matrix. */
  365. /* =========== DOCUMENTATION =========== */
  366. /* Online html documentation available at */
  367. /* http://www.netlib.org/lapack/explore-html/ */
  368. /* > \htmlonly */
  369. /* > Download CLARFB + dependencies */
  370. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clarfb.
  371. f"> */
  372. /* > [TGZ]</a> */
  373. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clarfb.
  374. f"> */
  375. /* > [ZIP]</a> */
  376. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clarfb.
  377. f"> */
  378. /* > [TXT]</a> */
  379. /* > \endhtmlonly */
  380. /* Definition: */
  381. /* =========== */
  382. /* SUBROUTINE CLARFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV, */
  383. /* T, LDT, C, LDC, WORK, LDWORK ) */
  384. /* CHARACTER DIRECT, SIDE, STOREV, TRANS */
  385. /* INTEGER K, LDC, LDT, LDV, LDWORK, M, N */
  386. /* COMPLEX C( LDC, * ), T( LDT, * ), V( LDV, * ), */
  387. /* $ WORK( LDWORK, * ) */
  388. /* > \par Purpose: */
  389. /* ============= */
  390. /* > */
  391. /* > \verbatim */
  392. /* > */
  393. /* > CLARFB applies a complex block reflector H or its transpose H**H to a */
  394. /* > complex M-by-N matrix C, from either the left or the right. */
  395. /* > \endverbatim */
  396. /* Arguments: */
  397. /* ========== */
  398. /* > \param[in] SIDE */
  399. /* > \verbatim */
  400. /* > SIDE is CHARACTER*1 */
  401. /* > = 'L': apply H or H**H from the Left */
  402. /* > = 'R': apply H or H**H from the Right */
  403. /* > \endverbatim */
  404. /* > */
  405. /* > \param[in] TRANS */
  406. /* > \verbatim */
  407. /* > TRANS is CHARACTER*1 */
  408. /* > = 'N': apply H (No transpose) */
  409. /* > = 'C': apply H**H (Conjugate transpose) */
  410. /* > \endverbatim */
  411. /* > */
  412. /* > \param[in] DIRECT */
  413. /* > \verbatim */
  414. /* > DIRECT is CHARACTER*1 */
  415. /* > Indicates how H is formed from a product of elementary */
  416. /* > reflectors */
  417. /* > = 'F': H = H(1) H(2) . . . H(k) (Forward) */
  418. /* > = 'B': H = H(k) . . . H(2) H(1) (Backward) */
  419. /* > \endverbatim */
  420. /* > */
  421. /* > \param[in] STOREV */
  422. /* > \verbatim */
  423. /* > STOREV is CHARACTER*1 */
  424. /* > Indicates how the vectors which define the elementary */
  425. /* > reflectors are stored: */
  426. /* > = 'C': Columnwise */
  427. /* > = 'R': Rowwise */
  428. /* > \endverbatim */
  429. /* > */
  430. /* > \param[in] M */
  431. /* > \verbatim */
  432. /* > M is INTEGER */
  433. /* > The number of rows of the matrix C. */
  434. /* > \endverbatim */
  435. /* > */
  436. /* > \param[in] N */
  437. /* > \verbatim */
  438. /* > N is INTEGER */
  439. /* > The number of columns of the matrix C. */
  440. /* > \endverbatim */
  441. /* > */
  442. /* > \param[in] K */
  443. /* > \verbatim */
  444. /* > K is INTEGER */
  445. /* > The order of the matrix T (= the number of elementary */
  446. /* > reflectors whose product defines the block reflector). */
  447. /* > If SIDE = 'L', M >= K >= 0; */
  448. /* > if SIDE = 'R', N >= K >= 0. */
  449. /* > \endverbatim */
  450. /* > */
  451. /* > \param[in] V */
  452. /* > \verbatim */
  453. /* > V is COMPLEX array, dimension */
  454. /* > (LDV,K) if STOREV = 'C' */
  455. /* > (LDV,M) if STOREV = 'R' and SIDE = 'L' */
  456. /* > (LDV,N) if STOREV = 'R' and SIDE = 'R' */
  457. /* > The matrix V. See Further Details. */
  458. /* > \endverbatim */
  459. /* > */
  460. /* > \param[in] LDV */
  461. /* > \verbatim */
  462. /* > LDV is INTEGER */
  463. /* > The leading dimension of the array V. */
  464. /* > If STOREV = 'C' and SIDE = 'L', LDV >= f2cmax(1,M); */
  465. /* > if STOREV = 'C' and SIDE = 'R', LDV >= f2cmax(1,N); */
  466. /* > if STOREV = 'R', LDV >= K. */
  467. /* > \endverbatim */
  468. /* > */
  469. /* > \param[in] T */
  470. /* > \verbatim */
  471. /* > T is COMPLEX array, dimension (LDT,K) */
  472. /* > The triangular K-by-K matrix T in the representation of the */
  473. /* > block reflector. */
  474. /* > \endverbatim */
  475. /* > */
  476. /* > \param[in] LDT */
  477. /* > \verbatim */
  478. /* > LDT is INTEGER */
  479. /* > The leading dimension of the array T. LDT >= K. */
  480. /* > \endverbatim */
  481. /* > */
  482. /* > \param[in,out] C */
  483. /* > \verbatim */
  484. /* > C is COMPLEX array, dimension (LDC,N) */
  485. /* > On entry, the M-by-N matrix C. */
  486. /* > On exit, C is overwritten by H*C or H**H*C or C*H or C*H**H. */
  487. /* > \endverbatim */
  488. /* > */
  489. /* > \param[in] LDC */
  490. /* > \verbatim */
  491. /* > LDC is INTEGER */
  492. /* > The leading dimension of the array C. LDC >= f2cmax(1,M). */
  493. /* > \endverbatim */
  494. /* > */
  495. /* > \param[out] WORK */
  496. /* > \verbatim */
  497. /* > WORK is COMPLEX array, dimension (LDWORK,K) */
  498. /* > \endverbatim */
  499. /* > */
  500. /* > \param[in] LDWORK */
  501. /* > \verbatim */
  502. /* > LDWORK is INTEGER */
  503. /* > The leading dimension of the array WORK. */
  504. /* > If SIDE = 'L', LDWORK >= f2cmax(1,N); */
  505. /* > if SIDE = 'R', LDWORK >= f2cmax(1,M). */
  506. /* > \endverbatim */
  507. /* Authors: */
  508. /* ======== */
  509. /* > \author Univ. of Tennessee */
  510. /* > \author Univ. of California Berkeley */
  511. /* > \author Univ. of Colorado Denver */
  512. /* > \author NAG Ltd. */
  513. /* > \date June 2013 */
  514. /* > \ingroup complexOTHERauxiliary */
  515. /* > \par Further Details: */
  516. /* ===================== */
  517. /* > */
  518. /* > \verbatim */
  519. /* > */
  520. /* > The shape of the matrix V and the storage of the vectors which define */
  521. /* > the H(i) is best illustrated by the following example with n = 5 and */
  522. /* > k = 3. The elements equal to 1 are not stored; the corresponding */
  523. /* > array elements are modified but restored on exit. The rest of the */
  524. /* > array is not used. */
  525. /* > */
  526. /* > DIRECT = 'F' and STOREV = 'C': DIRECT = 'F' and STOREV = 'R': */
  527. /* > */
  528. /* > V = ( 1 ) V = ( 1 v1 v1 v1 v1 ) */
  529. /* > ( v1 1 ) ( 1 v2 v2 v2 ) */
  530. /* > ( v1 v2 1 ) ( 1 v3 v3 ) */
  531. /* > ( v1 v2 v3 ) */
  532. /* > ( v1 v2 v3 ) */
  533. /* > */
  534. /* > DIRECT = 'B' and STOREV = 'C': DIRECT = 'B' and STOREV = 'R': */
  535. /* > */
  536. /* > V = ( v1 v2 v3 ) V = ( v1 v1 1 ) */
  537. /* > ( v1 v2 v3 ) ( v2 v2 v2 1 ) */
  538. /* > ( 1 v2 v3 ) ( v3 v3 v3 v3 1 ) */
  539. /* > ( 1 v3 ) */
  540. /* > ( 1 ) */
  541. /* > \endverbatim */
  542. /* > */
  543. /* ===================================================================== */
  544. /* Subroutine */ int clarfb_(char *side, char *trans, char *direct, char *
  545. storev, integer *m, integer *n, integer *k, complex *v, integer *ldv,
  546. complex *t, integer *ldt, complex *c__, integer *ldc, complex *work,
  547. integer *ldwork)
  548. {
  549. /* System generated locals */
  550. integer c_dim1, c_offset, t_dim1, t_offset, v_dim1, v_offset, work_dim1,
  551. work_offset, i__1, i__2, i__3, i__4, i__5;
  552. complex q__1, q__2;
  553. /* Local variables */
  554. integer i__, j;
  555. extern /* Subroutine */ int cgemm_(char *, char *, integer *, integer *,
  556. integer *, complex *, complex *, integer *, complex *, integer *,
  557. complex *, complex *, integer *);
  558. extern logical lsame_(char *, char *);
  559. extern /* Subroutine */ int ccopy_(integer *, complex *, integer *,
  560. complex *, integer *), ctrmm_(char *, char *, char *, char *,
  561. integer *, integer *, complex *, complex *, integer *, complex *,
  562. integer *), clacgv_(integer *,
  563. complex *, integer *);
  564. char transt[1];
  565. /* -- LAPACK auxiliary routine (version 3.7.0) -- */
  566. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  567. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  568. /* June 2013 */
  569. /* ===================================================================== */
  570. /* Quick return if possible */
  571. /* Parameter adjustments */
  572. v_dim1 = *ldv;
  573. v_offset = 1 + v_dim1 * 1;
  574. v -= v_offset;
  575. t_dim1 = *ldt;
  576. t_offset = 1 + t_dim1 * 1;
  577. t -= t_offset;
  578. c_dim1 = *ldc;
  579. c_offset = 1 + c_dim1 * 1;
  580. c__ -= c_offset;
  581. work_dim1 = *ldwork;
  582. work_offset = 1 + work_dim1 * 1;
  583. work -= work_offset;
  584. /* Function Body */
  585. if (*m <= 0 || *n <= 0) {
  586. return 0;
  587. }
  588. if (lsame_(trans, "N")) {
  589. *(unsigned char *)transt = 'C';
  590. } else {
  591. *(unsigned char *)transt = 'N';
  592. }
  593. if (lsame_(storev, "C")) {
  594. if (lsame_(direct, "F")) {
  595. /* Let V = ( V1 ) (first K rows) */
  596. /* ( V2 ) */
  597. /* where V1 is unit lower triangular. */
  598. if (lsame_(side, "L")) {
  599. /* Form H * C or H**H * C where C = ( C1 ) */
  600. /* ( C2 ) */
  601. /* W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) */
  602. /* W := C1**H */
  603. i__1 = *k;
  604. for (j = 1; j <= i__1; ++j) {
  605. ccopy_(n, &c__[j + c_dim1], ldc, &work[j * work_dim1 + 1],
  606. &c__1);
  607. clacgv_(n, &work[j * work_dim1 + 1], &c__1);
  608. /* L10: */
  609. }
  610. /* W := W * V1 */
  611. ctrmm_("Right", "Lower", "No transpose", "Unit", n, k, &c_b1,
  612. &v[v_offset], ldv, &work[work_offset], ldwork);
  613. if (*m > *k) {
  614. /* W := W + C2**H *V2 */
  615. i__1 = *m - *k;
  616. cgemm_("Conjugate transpose", "No transpose", n, k, &i__1,
  617. &c_b1, &c__[*k + 1 + c_dim1], ldc, &v[*k + 1 +
  618. v_dim1], ldv, &c_b1, &work[work_offset], ldwork);
  619. }
  620. /* W := W * T**H or W * T */
  621. ctrmm_("Right", "Upper", transt, "Non-unit", n, k, &c_b1, &t[
  622. t_offset], ldt, &work[work_offset], ldwork);
  623. /* C := C - V * W**H */
  624. if (*m > *k) {
  625. /* C2 := C2 - V2 * W**H */
  626. i__1 = *m - *k;
  627. q__1.r = -1.f, q__1.i = 0.f;
  628. cgemm_("No transpose", "Conjugate transpose", &i__1, n, k,
  629. &q__1, &v[*k + 1 + v_dim1], ldv, &work[
  630. work_offset], ldwork, &c_b1, &c__[*k + 1 + c_dim1]
  631. , ldc);
  632. }
  633. /* W := W * V1**H */
  634. ctrmm_("Right", "Lower", "Conjugate transpose", "Unit", n, k,
  635. &c_b1, &v[v_offset], ldv, &work[work_offset], ldwork);
  636. /* C1 := C1 - W**H */
  637. i__1 = *k;
  638. for (j = 1; j <= i__1; ++j) {
  639. i__2 = *n;
  640. for (i__ = 1; i__ <= i__2; ++i__) {
  641. i__3 = j + i__ * c_dim1;
  642. i__4 = j + i__ * c_dim1;
  643. r_cnjg(&q__2, &work[i__ + j * work_dim1]);
  644. q__1.r = c__[i__4].r - q__2.r, q__1.i = c__[i__4].i -
  645. q__2.i;
  646. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  647. /* L20: */
  648. }
  649. /* L30: */
  650. }
  651. } else if (lsame_(side, "R")) {
  652. /* Form C * H or C * H**H where C = ( C1 C2 ) */
  653. /* W := C * V = (C1*V1 + C2*V2) (stored in WORK) */
  654. /* W := C1 */
  655. i__1 = *k;
  656. for (j = 1; j <= i__1; ++j) {
  657. ccopy_(m, &c__[j * c_dim1 + 1], &c__1, &work[j *
  658. work_dim1 + 1], &c__1);
  659. /* L40: */
  660. }
  661. /* W := W * V1 */
  662. ctrmm_("Right", "Lower", "No transpose", "Unit", m, k, &c_b1,
  663. &v[v_offset], ldv, &work[work_offset], ldwork);
  664. if (*n > *k) {
  665. /* W := W + C2 * V2 */
  666. i__1 = *n - *k;
  667. cgemm_("No transpose", "No transpose", m, k, &i__1, &c_b1,
  668. &c__[(*k + 1) * c_dim1 + 1], ldc, &v[*k + 1 +
  669. v_dim1], ldv, &c_b1, &work[work_offset], ldwork);
  670. }
  671. /* W := W * T or W * T**H */
  672. ctrmm_("Right", "Upper", trans, "Non-unit", m, k, &c_b1, &t[
  673. t_offset], ldt, &work[work_offset], ldwork);
  674. /* C := C - W * V**H */
  675. if (*n > *k) {
  676. /* C2 := C2 - W * V2**H */
  677. i__1 = *n - *k;
  678. q__1.r = -1.f, q__1.i = 0.f;
  679. cgemm_("No transpose", "Conjugate transpose", m, &i__1, k,
  680. &q__1, &work[work_offset], ldwork, &v[*k + 1 +
  681. v_dim1], ldv, &c_b1, &c__[(*k + 1) * c_dim1 + 1],
  682. ldc);
  683. }
  684. /* W := W * V1**H */
  685. ctrmm_("Right", "Lower", "Conjugate transpose", "Unit", m, k,
  686. &c_b1, &v[v_offset], ldv, &work[work_offset], ldwork);
  687. /* C1 := C1 - W */
  688. i__1 = *k;
  689. for (j = 1; j <= i__1; ++j) {
  690. i__2 = *m;
  691. for (i__ = 1; i__ <= i__2; ++i__) {
  692. i__3 = i__ + j * c_dim1;
  693. i__4 = i__ + j * c_dim1;
  694. i__5 = i__ + j * work_dim1;
  695. q__1.r = c__[i__4].r - work[i__5].r, q__1.i = c__[
  696. i__4].i - work[i__5].i;
  697. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  698. /* L50: */
  699. }
  700. /* L60: */
  701. }
  702. }
  703. } else {
  704. /* Let V = ( V1 ) */
  705. /* ( V2 ) (last K rows) */
  706. /* where V2 is unit upper triangular. */
  707. if (lsame_(side, "L")) {
  708. /* Form H * C or H**H * C where C = ( C1 ) */
  709. /* ( C2 ) */
  710. /* W := C**H * V = (C1**H * V1 + C2**H * V2) (stored in WORK) */
  711. /* W := C2**H */
  712. i__1 = *k;
  713. for (j = 1; j <= i__1; ++j) {
  714. ccopy_(n, &c__[*m - *k + j + c_dim1], ldc, &work[j *
  715. work_dim1 + 1], &c__1);
  716. clacgv_(n, &work[j * work_dim1 + 1], &c__1);
  717. /* L70: */
  718. }
  719. /* W := W * V2 */
  720. ctrmm_("Right", "Upper", "No transpose", "Unit", n, k, &c_b1,
  721. &v[*m - *k + 1 + v_dim1], ldv, &work[work_offset],
  722. ldwork);
  723. if (*m > *k) {
  724. /* W := W + C1**H * V1 */
  725. i__1 = *m - *k;
  726. cgemm_("Conjugate transpose", "No transpose", n, k, &i__1,
  727. &c_b1, &c__[c_offset], ldc, &v[v_offset], ldv, &
  728. c_b1, &work[work_offset], ldwork);
  729. }
  730. /* W := W * T**H or W * T */
  731. ctrmm_("Right", "Lower", transt, "Non-unit", n, k, &c_b1, &t[
  732. t_offset], ldt, &work[work_offset], ldwork);
  733. /* C := C - V * W**H */
  734. if (*m > *k) {
  735. /* C1 := C1 - V1 * W**H */
  736. i__1 = *m - *k;
  737. q__1.r = -1.f, q__1.i = 0.f;
  738. cgemm_("No transpose", "Conjugate transpose", &i__1, n, k,
  739. &q__1, &v[v_offset], ldv, &work[work_offset],
  740. ldwork, &c_b1, &c__[c_offset], ldc);
  741. }
  742. /* W := W * V2**H */
  743. ctrmm_("Right", "Upper", "Conjugate transpose", "Unit", n, k,
  744. &c_b1, &v[*m - *k + 1 + v_dim1], ldv, &work[
  745. work_offset], ldwork);
  746. /* C2 := C2 - W**H */
  747. i__1 = *k;
  748. for (j = 1; j <= i__1; ++j) {
  749. i__2 = *n;
  750. for (i__ = 1; i__ <= i__2; ++i__) {
  751. i__3 = *m - *k + j + i__ * c_dim1;
  752. i__4 = *m - *k + j + i__ * c_dim1;
  753. r_cnjg(&q__2, &work[i__ + j * work_dim1]);
  754. q__1.r = c__[i__4].r - q__2.r, q__1.i = c__[i__4].i -
  755. q__2.i;
  756. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  757. /* L80: */
  758. }
  759. /* L90: */
  760. }
  761. } else if (lsame_(side, "R")) {
  762. /* Form C * H or C * H**H where C = ( C1 C2 ) */
  763. /* W := C * V = (C1*V1 + C2*V2) (stored in WORK) */
  764. /* W := C2 */
  765. i__1 = *k;
  766. for (j = 1; j <= i__1; ++j) {
  767. ccopy_(m, &c__[(*n - *k + j) * c_dim1 + 1], &c__1, &work[
  768. j * work_dim1 + 1], &c__1);
  769. /* L100: */
  770. }
  771. /* W := W * V2 */
  772. ctrmm_("Right", "Upper", "No transpose", "Unit", m, k, &c_b1,
  773. &v[*n - *k + 1 + v_dim1], ldv, &work[work_offset],
  774. ldwork);
  775. if (*n > *k) {
  776. /* W := W + C1 * V1 */
  777. i__1 = *n - *k;
  778. cgemm_("No transpose", "No transpose", m, k, &i__1, &c_b1,
  779. &c__[c_offset], ldc, &v[v_offset], ldv, &c_b1, &
  780. work[work_offset], ldwork)
  781. ;
  782. }
  783. /* W := W * T or W * T**H */
  784. ctrmm_("Right", "Lower", trans, "Non-unit", m, k, &c_b1, &t[
  785. t_offset], ldt, &work[work_offset], ldwork);
  786. /* C := C - W * V**H */
  787. if (*n > *k) {
  788. /* C1 := C1 - W * V1**H */
  789. i__1 = *n - *k;
  790. q__1.r = -1.f, q__1.i = 0.f;
  791. cgemm_("No transpose", "Conjugate transpose", m, &i__1, k,
  792. &q__1, &work[work_offset], ldwork, &v[v_offset],
  793. ldv, &c_b1, &c__[c_offset], ldc);
  794. }
  795. /* W := W * V2**H */
  796. ctrmm_("Right", "Upper", "Conjugate transpose", "Unit", m, k,
  797. &c_b1, &v[*n - *k + 1 + v_dim1], ldv, &work[
  798. work_offset], ldwork);
  799. /* C2 := C2 - W */
  800. i__1 = *k;
  801. for (j = 1; j <= i__1; ++j) {
  802. i__2 = *m;
  803. for (i__ = 1; i__ <= i__2; ++i__) {
  804. i__3 = i__ + (*n - *k + j) * c_dim1;
  805. i__4 = i__ + (*n - *k + j) * c_dim1;
  806. i__5 = i__ + j * work_dim1;
  807. q__1.r = c__[i__4].r - work[i__5].r, q__1.i = c__[
  808. i__4].i - work[i__5].i;
  809. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  810. /* L110: */
  811. }
  812. /* L120: */
  813. }
  814. }
  815. }
  816. } else if (lsame_(storev, "R")) {
  817. if (lsame_(direct, "F")) {
  818. /* Let V = ( V1 V2 ) (V1: first K columns) */
  819. /* where V1 is unit upper triangular. */
  820. if (lsame_(side, "L")) {
  821. /* Form H * C or H**H * C where C = ( C1 ) */
  822. /* ( C2 ) */
  823. /* W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) */
  824. /* W := C1**H */
  825. i__1 = *k;
  826. for (j = 1; j <= i__1; ++j) {
  827. ccopy_(n, &c__[j + c_dim1], ldc, &work[j * work_dim1 + 1],
  828. &c__1);
  829. clacgv_(n, &work[j * work_dim1 + 1], &c__1);
  830. /* L130: */
  831. }
  832. /* W := W * V1**H */
  833. ctrmm_("Right", "Upper", "Conjugate transpose", "Unit", n, k,
  834. &c_b1, &v[v_offset], ldv, &work[work_offset], ldwork);
  835. if (*m > *k) {
  836. /* W := W + C2**H * V2**H */
  837. i__1 = *m - *k;
  838. cgemm_("Conjugate transpose", "Conjugate transpose", n, k,
  839. &i__1, &c_b1, &c__[*k + 1 + c_dim1], ldc, &v[(*k
  840. + 1) * v_dim1 + 1], ldv, &c_b1, &work[work_offset]
  841. , ldwork);
  842. }
  843. /* W := W * T**H or W * T */
  844. ctrmm_("Right", "Upper", transt, "Non-unit", n, k, &c_b1, &t[
  845. t_offset], ldt, &work[work_offset], ldwork);
  846. /* C := C - V**H * W**H */
  847. if (*m > *k) {
  848. /* C2 := C2 - V2**H * W**H */
  849. i__1 = *m - *k;
  850. q__1.r = -1.f, q__1.i = 0.f;
  851. cgemm_("Conjugate transpose", "Conjugate transpose", &
  852. i__1, n, k, &q__1, &v[(*k + 1) * v_dim1 + 1], ldv,
  853. &work[work_offset], ldwork, &c_b1, &c__[*k + 1 +
  854. c_dim1], ldc);
  855. }
  856. /* W := W * V1 */
  857. ctrmm_("Right", "Upper", "No transpose", "Unit", n, k, &c_b1,
  858. &v[v_offset], ldv, &work[work_offset], ldwork);
  859. /* C1 := C1 - W**H */
  860. i__1 = *k;
  861. for (j = 1; j <= i__1; ++j) {
  862. i__2 = *n;
  863. for (i__ = 1; i__ <= i__2; ++i__) {
  864. i__3 = j + i__ * c_dim1;
  865. i__4 = j + i__ * c_dim1;
  866. r_cnjg(&q__2, &work[i__ + j * work_dim1]);
  867. q__1.r = c__[i__4].r - q__2.r, q__1.i = c__[i__4].i -
  868. q__2.i;
  869. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  870. /* L140: */
  871. }
  872. /* L150: */
  873. }
  874. } else if (lsame_(side, "R")) {
  875. /* Form C * H or C * H**H where C = ( C1 C2 ) */
  876. /* W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) */
  877. /* W := C1 */
  878. i__1 = *k;
  879. for (j = 1; j <= i__1; ++j) {
  880. ccopy_(m, &c__[j * c_dim1 + 1], &c__1, &work[j *
  881. work_dim1 + 1], &c__1);
  882. /* L160: */
  883. }
  884. /* W := W * V1**H */
  885. ctrmm_("Right", "Upper", "Conjugate transpose", "Unit", m, k,
  886. &c_b1, &v[v_offset], ldv, &work[work_offset], ldwork);
  887. if (*n > *k) {
  888. /* W := W + C2 * V2**H */
  889. i__1 = *n - *k;
  890. cgemm_("No transpose", "Conjugate transpose", m, k, &i__1,
  891. &c_b1, &c__[(*k + 1) * c_dim1 + 1], ldc, &v[(*k
  892. + 1) * v_dim1 + 1], ldv, &c_b1, &work[work_offset]
  893. , ldwork);
  894. }
  895. /* W := W * T or W * T**H */
  896. ctrmm_("Right", "Upper", trans, "Non-unit", m, k, &c_b1, &t[
  897. t_offset], ldt, &work[work_offset], ldwork);
  898. /* C := C - W * V */
  899. if (*n > *k) {
  900. /* C2 := C2 - W * V2 */
  901. i__1 = *n - *k;
  902. q__1.r = -1.f, q__1.i = 0.f;
  903. cgemm_("No transpose", "No transpose", m, &i__1, k, &q__1,
  904. &work[work_offset], ldwork, &v[(*k + 1) * v_dim1
  905. + 1], ldv, &c_b1, &c__[(*k + 1) * c_dim1 + 1],
  906. ldc);
  907. }
  908. /* W := W * V1 */
  909. ctrmm_("Right", "Upper", "No transpose", "Unit", m, k, &c_b1,
  910. &v[v_offset], ldv, &work[work_offset], ldwork);
  911. /* C1 := C1 - W */
  912. i__1 = *k;
  913. for (j = 1; j <= i__1; ++j) {
  914. i__2 = *m;
  915. for (i__ = 1; i__ <= i__2; ++i__) {
  916. i__3 = i__ + j * c_dim1;
  917. i__4 = i__ + j * c_dim1;
  918. i__5 = i__ + j * work_dim1;
  919. q__1.r = c__[i__4].r - work[i__5].r, q__1.i = c__[
  920. i__4].i - work[i__5].i;
  921. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  922. /* L170: */
  923. }
  924. /* L180: */
  925. }
  926. }
  927. } else {
  928. /* Let V = ( V1 V2 ) (V2: last K columns) */
  929. /* where V2 is unit lower triangular. */
  930. if (lsame_(side, "L")) {
  931. /* Form H * C or H**H * C where C = ( C1 ) */
  932. /* ( C2 ) */
  933. /* W := C**H * V**H = (C1**H * V1**H + C2**H * V2**H) (stored in WORK) */
  934. /* W := C2**H */
  935. i__1 = *k;
  936. for (j = 1; j <= i__1; ++j) {
  937. ccopy_(n, &c__[*m - *k + j + c_dim1], ldc, &work[j *
  938. work_dim1 + 1], &c__1);
  939. clacgv_(n, &work[j * work_dim1 + 1], &c__1);
  940. /* L190: */
  941. }
  942. /* W := W * V2**H */
  943. ctrmm_("Right", "Lower", "Conjugate transpose", "Unit", n, k,
  944. &c_b1, &v[(*m - *k + 1) * v_dim1 + 1], ldv, &work[
  945. work_offset], ldwork);
  946. if (*m > *k) {
  947. /* W := W + C1**H * V1**H */
  948. i__1 = *m - *k;
  949. cgemm_("Conjugate transpose", "Conjugate transpose", n, k,
  950. &i__1, &c_b1, &c__[c_offset], ldc, &v[v_offset],
  951. ldv, &c_b1, &work[work_offset], ldwork);
  952. }
  953. /* W := W * T**H or W * T */
  954. ctrmm_("Right", "Lower", transt, "Non-unit", n, k, &c_b1, &t[
  955. t_offset], ldt, &work[work_offset], ldwork);
  956. /* C := C - V**H * W**H */
  957. if (*m > *k) {
  958. /* C1 := C1 - V1**H * W**H */
  959. i__1 = *m - *k;
  960. q__1.r = -1.f, q__1.i = 0.f;
  961. cgemm_("Conjugate transpose", "Conjugate transpose", &
  962. i__1, n, k, &q__1, &v[v_offset], ldv, &work[
  963. work_offset], ldwork, &c_b1, &c__[c_offset], ldc);
  964. }
  965. /* W := W * V2 */
  966. ctrmm_("Right", "Lower", "No transpose", "Unit", n, k, &c_b1,
  967. &v[(*m - *k + 1) * v_dim1 + 1], ldv, &work[
  968. work_offset], ldwork);
  969. /* C2 := C2 - W**H */
  970. i__1 = *k;
  971. for (j = 1; j <= i__1; ++j) {
  972. i__2 = *n;
  973. for (i__ = 1; i__ <= i__2; ++i__) {
  974. i__3 = *m - *k + j + i__ * c_dim1;
  975. i__4 = *m - *k + j + i__ * c_dim1;
  976. r_cnjg(&q__2, &work[i__ + j * work_dim1]);
  977. q__1.r = c__[i__4].r - q__2.r, q__1.i = c__[i__4].i -
  978. q__2.i;
  979. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  980. /* L200: */
  981. }
  982. /* L210: */
  983. }
  984. } else if (lsame_(side, "R")) {
  985. /* Form C * H or C * H**H where C = ( C1 C2 ) */
  986. /* W := C * V**H = (C1*V1**H + C2*V2**H) (stored in WORK) */
  987. /* W := C2 */
  988. i__1 = *k;
  989. for (j = 1; j <= i__1; ++j) {
  990. ccopy_(m, &c__[(*n - *k + j) * c_dim1 + 1], &c__1, &work[
  991. j * work_dim1 + 1], &c__1);
  992. /* L220: */
  993. }
  994. /* W := W * V2**H */
  995. ctrmm_("Right", "Lower", "Conjugate transpose", "Unit", m, k,
  996. &c_b1, &v[(*n - *k + 1) * v_dim1 + 1], ldv, &work[
  997. work_offset], ldwork);
  998. if (*n > *k) {
  999. /* W := W + C1 * V1**H */
  1000. i__1 = *n - *k;
  1001. cgemm_("No transpose", "Conjugate transpose", m, k, &i__1,
  1002. &c_b1, &c__[c_offset], ldc, &v[v_offset], ldv, &
  1003. c_b1, &work[work_offset], ldwork);
  1004. }
  1005. /* W := W * T or W * T**H */
  1006. ctrmm_("Right", "Lower", trans, "Non-unit", m, k, &c_b1, &t[
  1007. t_offset], ldt, &work[work_offset], ldwork);
  1008. /* C := C - W * V */
  1009. if (*n > *k) {
  1010. /* C1 := C1 - W * V1 */
  1011. i__1 = *n - *k;
  1012. q__1.r = -1.f, q__1.i = 0.f;
  1013. cgemm_("No transpose", "No transpose", m, &i__1, k, &q__1,
  1014. &work[work_offset], ldwork, &v[v_offset], ldv, &
  1015. c_b1, &c__[c_offset], ldc)
  1016. ;
  1017. }
  1018. /* W := W * V2 */
  1019. ctrmm_("Right", "Lower", "No transpose", "Unit", m, k, &c_b1,
  1020. &v[(*n - *k + 1) * v_dim1 + 1], ldv, &work[
  1021. work_offset], ldwork);
  1022. /* C1 := C1 - W */
  1023. i__1 = *k;
  1024. for (j = 1; j <= i__1; ++j) {
  1025. i__2 = *m;
  1026. for (i__ = 1; i__ <= i__2; ++i__) {
  1027. i__3 = i__ + (*n - *k + j) * c_dim1;
  1028. i__4 = i__ + (*n - *k + j) * c_dim1;
  1029. i__5 = i__ + j * work_dim1;
  1030. q__1.r = c__[i__4].r - work[i__5].r, q__1.i = c__[
  1031. i__4].i - work[i__5].i;
  1032. c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
  1033. /* L230: */
  1034. }
  1035. /* L240: */
  1036. }
  1037. }
  1038. }
  1039. }
  1040. return 0;
  1041. /* End of CLARFB */
  1042. } /* clarfb_ */