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.

ztprfb.c 48 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617
  1. #include <math.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <complex.h>
  6. #ifdef complex
  7. #undef complex
  8. #endif
  9. #ifdef I
  10. #undef I
  11. #endif
  12. #if defined(_WIN64)
  13. typedef long long BLASLONG;
  14. typedef unsigned long long BLASULONG;
  15. #else
  16. typedef long BLASLONG;
  17. typedef unsigned long BLASULONG;
  18. #endif
  19. #ifdef LAPACK_ILP64
  20. typedef BLASLONG blasint;
  21. #if defined(_WIN64)
  22. #define blasabs(x) llabs(x)
  23. #else
  24. #define blasabs(x) labs(x)
  25. #endif
  26. #else
  27. typedef int blasint;
  28. #define blasabs(x) abs(x)
  29. #endif
  30. typedef blasint integer;
  31. typedef unsigned int uinteger;
  32. typedef char *address;
  33. typedef short int shortint;
  34. typedef float real;
  35. typedef double doublereal;
  36. typedef struct { real r, i; } complex;
  37. typedef struct { doublereal r, i; } doublecomplex;
  38. #ifdef _MSC_VER
  39. static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
  40. static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
  41. static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
  42. static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
  43. #else
  44. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  46. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  47. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  48. #endif
  49. #define pCf(z) (*_pCf(z))
  50. #define pCd(z) (*_pCd(z))
  51. typedef int logical;
  52. typedef short int shortlogical;
  53. typedef char logical1;
  54. typedef char integer1;
  55. #define TRUE_ (1)
  56. #define FALSE_ (0)
  57. /* Extern is for use with -E */
  58. #ifndef Extern
  59. #define Extern extern
  60. #endif
  61. /* I/O stuff */
  62. typedef int flag;
  63. typedef int ftnlen;
  64. typedef int ftnint;
  65. /*external read, write*/
  66. typedef struct
  67. { flag cierr;
  68. ftnint ciunit;
  69. flag ciend;
  70. char *cifmt;
  71. ftnint cirec;
  72. } cilist;
  73. /*internal read, write*/
  74. typedef struct
  75. { flag icierr;
  76. char *iciunit;
  77. flag iciend;
  78. char *icifmt;
  79. ftnint icirlen;
  80. ftnint icirnum;
  81. } icilist;
  82. /*open*/
  83. typedef struct
  84. { flag oerr;
  85. ftnint ounit;
  86. char *ofnm;
  87. ftnlen ofnmlen;
  88. char *osta;
  89. char *oacc;
  90. char *ofm;
  91. ftnint orl;
  92. char *oblnk;
  93. } olist;
  94. /*close*/
  95. typedef struct
  96. { flag cerr;
  97. ftnint cunit;
  98. char *csta;
  99. } cllist;
  100. /*rewind, backspace, endfile*/
  101. typedef struct
  102. { flag aerr;
  103. ftnint aunit;
  104. } alist;
  105. /* inquire */
  106. typedef struct
  107. { flag inerr;
  108. ftnint inunit;
  109. char *infile;
  110. ftnlen infilen;
  111. ftnint *inex; /*parameters in standard's order*/
  112. ftnint *inopen;
  113. ftnint *innum;
  114. ftnint *innamed;
  115. char *inname;
  116. ftnlen innamlen;
  117. char *inacc;
  118. ftnlen inacclen;
  119. char *inseq;
  120. ftnlen inseqlen;
  121. char *indir;
  122. ftnlen indirlen;
  123. char *infmt;
  124. ftnlen infmtlen;
  125. char *inform;
  126. ftnint informlen;
  127. char *inunf;
  128. ftnlen inunflen;
  129. ftnint *inrecl;
  130. ftnint *innrec;
  131. char *inblank;
  132. ftnlen inblanklen;
  133. } inlist;
  134. #define VOID void
  135. union Multitype { /* for multiple entry points */
  136. integer1 g;
  137. shortint h;
  138. integer i;
  139. /* longint j; */
  140. real r;
  141. doublereal d;
  142. complex c;
  143. doublecomplex z;
  144. };
  145. typedef union Multitype Multitype;
  146. struct Vardesc { /* for Namelist */
  147. char *name;
  148. char *addr;
  149. ftnlen *dims;
  150. int type;
  151. };
  152. typedef struct Vardesc Vardesc;
  153. struct Namelist {
  154. char *name;
  155. Vardesc **vars;
  156. int nvars;
  157. };
  158. typedef struct Namelist Namelist;
  159. #define abs(x) ((x) >= 0 ? (x) : -(x))
  160. #define dabs(x) (fabs(x))
  161. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  162. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  163. #define dmin(a,b) (f2cmin(a,b))
  164. #define dmax(a,b) (f2cmax(a,b))
  165. #define bit_test(a,b) ((a) >> (b) & 1)
  166. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  167. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  168. #define abort_() { sig_die("Fortran abort routine called", 1); }
  169. #define c_abs(z) (cabsf(Cf(z)))
  170. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  171. #ifdef _MSC_VER
  172. #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
  173. #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/Cd(b)._Val[1]);}
  174. #else
  175. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  176. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  177. #endif
  178. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  179. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  180. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  181. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  182. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  183. #define d_abs(x) (fabs(*(x)))
  184. #define d_acos(x) (acos(*(x)))
  185. #define d_asin(x) (asin(*(x)))
  186. #define d_atan(x) (atan(*(x)))
  187. #define d_atn2(x, y) (atan2(*(x),*(y)))
  188. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  189. #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
  190. #define d_cos(x) (cos(*(x)))
  191. #define d_cosh(x) (cosh(*(x)))
  192. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  193. #define d_exp(x) (exp(*(x)))
  194. #define d_imag(z) (cimag(Cd(z)))
  195. #define r_imag(z) (cimagf(Cf(z)))
  196. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  197. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  198. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  199. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  200. #define d_log(x) (log(*(x)))
  201. #define d_mod(x, y) (fmod(*(x), *(y)))
  202. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  203. #define d_nint(x) u_nint(*(x))
  204. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  205. #define d_sign(a,b) u_sign(*(a),*(b))
  206. #define r_sign(a,b) u_sign(*(a),*(b))
  207. #define d_sin(x) (sin(*(x)))
  208. #define d_sinh(x) (sinh(*(x)))
  209. #define d_sqrt(x) (sqrt(*(x)))
  210. #define d_tan(x) (tan(*(x)))
  211. #define d_tanh(x) (tanh(*(x)))
  212. #define i_abs(x) abs(*(x))
  213. #define i_dnnt(x) ((integer)u_nint(*(x)))
  214. #define i_len(s, n) (n)
  215. #define i_nint(x) ((integer)u_nint(*(x)))
  216. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  217. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  218. #define pow_si(B,E) spow_ui(*(B),*(E))
  219. #define pow_ri(B,E) spow_ui(*(B),*(E))
  220. #define pow_di(B,E) dpow_ui(*(B),*(E))
  221. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  222. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  223. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  224. #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++ = ' '; }
  225. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  226. #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]; }
  227. #define sig_die(s, kill) { exit(1); }
  228. #define s_stop(s, n) {exit(0);}
  229. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  230. #define z_abs(z) (cabs(Cd(z)))
  231. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  232. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  233. #define myexit_() break;
  234. #define mycycle_() continue;
  235. #define myceiling_(w) {ceil(w)}
  236. #define myhuge_(w) {HUGE_VAL}
  237. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  238. #define mymaxloc_(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  239. /* procedure parameter types for -A and -C++ */
  240. #define F2C_proc_par_types 1
  241. #ifdef __cplusplus
  242. typedef logical (*L_fp)(...);
  243. #else
  244. typedef logical (*L_fp)();
  245. #endif
  246. static float spow_ui(float x, integer n) {
  247. float pow=1.0; unsigned long int u;
  248. if(n != 0) {
  249. if(n < 0) n = -n, x = 1/x;
  250. for(u = n; ; ) {
  251. if(u & 01) pow *= x;
  252. if(u >>= 1) x *= x;
  253. else break;
  254. }
  255. }
  256. return pow;
  257. }
  258. static double dpow_ui(double x, integer n) {
  259. double pow=1.0; unsigned long int u;
  260. if(n != 0) {
  261. if(n < 0) n = -n, x = 1/x;
  262. for(u = n; ; ) {
  263. if(u & 01) pow *= x;
  264. if(u >>= 1) x *= x;
  265. else break;
  266. }
  267. }
  268. return pow;
  269. }
  270. #ifdef _MSC_VER
  271. static _Fcomplex cpow_ui(complex x, integer n) {
  272. complex pow={1.0,0.0}; unsigned long int u;
  273. if(n != 0) {
  274. if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
  275. for(u = n; ; ) {
  276. if(u & 01) pow.r *= x.r, pow.i *= x.i;
  277. if(u >>= 1) x.r *= x.r, x.i *= x.i;
  278. else break;
  279. }
  280. }
  281. _Fcomplex p={pow.r, pow.i};
  282. return p;
  283. }
  284. #else
  285. static _Complex float cpow_ui(_Complex float x, integer n) {
  286. _Complex float pow=1.0; unsigned long int u;
  287. if(n != 0) {
  288. if(n < 0) n = -n, x = 1/x;
  289. for(u = n; ; ) {
  290. if(u & 01) pow *= x;
  291. if(u >>= 1) x *= x;
  292. else break;
  293. }
  294. }
  295. return pow;
  296. }
  297. #endif
  298. #ifdef _MSC_VER
  299. static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
  300. _Dcomplex pow={1.0,0.0}; unsigned long int u;
  301. if(n != 0) {
  302. if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
  303. for(u = n; ; ) {
  304. if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
  305. if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
  306. else break;
  307. }
  308. }
  309. _Dcomplex p = {pow._Val[0], pow._Val[1]};
  310. return p;
  311. }
  312. #else
  313. static _Complex double zpow_ui(_Complex double x, integer n) {
  314. _Complex double pow=1.0; unsigned long int u;
  315. if(n != 0) {
  316. if(n < 0) n = -n, x = 1/x;
  317. for(u = n; ; ) {
  318. if(u & 01) pow *= x;
  319. if(u >>= 1) x *= x;
  320. else break;
  321. }
  322. }
  323. return pow;
  324. }
  325. #endif
  326. static integer pow_ii(integer x, integer n) {
  327. integer pow; unsigned long int u;
  328. if (n <= 0) {
  329. if (n == 0 || x == 1) pow = 1;
  330. else if (x != -1) pow = x == 0 ? 1/x : 0;
  331. else n = -n;
  332. }
  333. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  334. u = n;
  335. for(pow = 1; ; ) {
  336. if(u & 01) pow *= x;
  337. if(u >>= 1) x *= x;
  338. else break;
  339. }
  340. }
  341. return pow;
  342. }
  343. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  344. {
  345. double m; integer i, mi;
  346. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  347. if (w[i-1]>m) mi=i ,m=w[i-1];
  348. return mi-s+1;
  349. }
  350. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  351. {
  352. float m; integer i, mi;
  353. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  354. if (w[i-1]>m) mi=i ,m=w[i-1];
  355. return mi-s+1;
  356. }
  357. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  358. integer n = *n_, incx = *incx_, incy = *incy_, i;
  359. #ifdef _MSC_VER
  360. _Fcomplex zdotc = {0.0, 0.0};
  361. if (incx == 1 && incy == 1) {
  362. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  363. zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
  364. zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
  365. }
  366. } else {
  367. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  368. zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
  369. zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
  370. }
  371. }
  372. pCf(z) = zdotc;
  373. }
  374. #else
  375. _Complex float zdotc = 0.0;
  376. if (incx == 1 && incy == 1) {
  377. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  378. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  379. }
  380. } else {
  381. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  382. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  383. }
  384. }
  385. pCf(z) = zdotc;
  386. }
  387. #endif
  388. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  389. integer n = *n_, incx = *incx_, incy = *incy_, i;
  390. #ifdef _MSC_VER
  391. _Dcomplex zdotc = {0.0, 0.0};
  392. if (incx == 1 && incy == 1) {
  393. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  394. zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
  395. zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
  396. }
  397. } else {
  398. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  399. zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
  400. zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
  401. }
  402. }
  403. pCd(z) = zdotc;
  404. }
  405. #else
  406. _Complex double zdotc = 0.0;
  407. if (incx == 1 && incy == 1) {
  408. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  409. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  410. }
  411. } else {
  412. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  413. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  414. }
  415. }
  416. pCd(z) = zdotc;
  417. }
  418. #endif
  419. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  420. integer n = *n_, incx = *incx_, incy = *incy_, i;
  421. #ifdef _MSC_VER
  422. _Fcomplex zdotc = {0.0, 0.0};
  423. if (incx == 1 && incy == 1) {
  424. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  425. zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
  426. zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
  427. }
  428. } else {
  429. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  430. zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
  431. zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
  432. }
  433. }
  434. pCf(z) = zdotc;
  435. }
  436. #else
  437. _Complex float zdotc = 0.0;
  438. if (incx == 1 && incy == 1) {
  439. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  440. zdotc += Cf(&x[i]) * Cf(&y[i]);
  441. }
  442. } else {
  443. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  444. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  445. }
  446. }
  447. pCf(z) = zdotc;
  448. }
  449. #endif
  450. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  451. integer n = *n_, incx = *incx_, incy = *incy_, i;
  452. #ifdef _MSC_VER
  453. _Dcomplex zdotc = {0.0, 0.0};
  454. if (incx == 1 && incy == 1) {
  455. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  456. zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
  457. zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
  458. }
  459. } else {
  460. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  461. zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
  462. zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
  463. }
  464. }
  465. pCd(z) = zdotc;
  466. }
  467. #else
  468. _Complex double zdotc = 0.0;
  469. if (incx == 1 && incy == 1) {
  470. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  471. zdotc += Cd(&x[i]) * Cd(&y[i]);
  472. }
  473. } else {
  474. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  475. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  476. }
  477. }
  478. pCd(z) = zdotc;
  479. }
  480. #endif
  481. /* -- translated by f2c (version 20000121).
  482. You must link the resulting object file with the libraries:
  483. -lf2c -lm (in that order)
  484. */
  485. /* Table of constant values */
  486. static doublecomplex c_b14 = {1.,0.};
  487. static doublecomplex c_b22 = {0.,0.};
  488. static doublecomplex c_b29 = {-1.,0.};
  489. /* > \brief \b ZTPRFB applies a real or complex "triangular-pentagonal" blocked reflector to a real or complex
  490. matrix, which is composed of two blocks. */
  491. /* =========== DOCUMENTATION =========== */
  492. /* Online html documentation available at */
  493. /* http://www.netlib.org/lapack/explore-html/ */
  494. /* > \htmlonly */
  495. /* > Download ZTPRFB + dependencies */
  496. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztprfb.
  497. f"> */
  498. /* > [TGZ]</a> */
  499. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztprfb.
  500. f"> */
  501. /* > [ZIP]</a> */
  502. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztprfb.
  503. f"> */
  504. /* > [TXT]</a> */
  505. /* > \endhtmlonly */
  506. /* Definition: */
  507. /* =========== */
  508. /* SUBROUTINE ZTPRFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, */
  509. /* V, LDV, T, LDT, A, LDA, B, LDB, WORK, LDWORK ) */
  510. /* CHARACTER DIRECT, SIDE, STOREV, TRANS */
  511. /* INTEGER K, L, LDA, LDB, LDT, LDV, LDWORK, M, N */
  512. /* COMPLEX*16 A( LDA, * ), B( LDB, * ), T( LDT, * ), */
  513. /* $ V( LDV, * ), WORK( LDWORK, * ) */
  514. /* > \par Purpose: */
  515. /* ============= */
  516. /* > */
  517. /* > \verbatim */
  518. /* > */
  519. /* > ZTPRFB applies a complex "triangular-pentagonal" block reflector H or its */
  520. /* > conjugate transpose H**H to a complex matrix C, which is composed of two */
  521. /* > blocks A and B, either from the left or right. */
  522. /* > */
  523. /* > \endverbatim */
  524. /* Arguments: */
  525. /* ========== */
  526. /* > \param[in] SIDE */
  527. /* > \verbatim */
  528. /* > SIDE is CHARACTER*1 */
  529. /* > = 'L': apply H or H**H from the Left */
  530. /* > = 'R': apply H or H**H from the Right */
  531. /* > \endverbatim */
  532. /* > */
  533. /* > \param[in] TRANS */
  534. /* > \verbatim */
  535. /* > TRANS is CHARACTER*1 */
  536. /* > = 'N': apply H (No transpose) */
  537. /* > = 'C': apply H**H (Conjugate transpose) */
  538. /* > \endverbatim */
  539. /* > */
  540. /* > \param[in] DIRECT */
  541. /* > \verbatim */
  542. /* > DIRECT is CHARACTER*1 */
  543. /* > Indicates how H is formed from a product of elementary */
  544. /* > reflectors */
  545. /* > = 'F': H = H(1) H(2) . . . H(k) (Forward) */
  546. /* > = 'B': H = H(k) . . . H(2) H(1) (Backward) */
  547. /* > \endverbatim */
  548. /* > */
  549. /* > \param[in] STOREV */
  550. /* > \verbatim */
  551. /* > STOREV is CHARACTER*1 */
  552. /* > Indicates how the vectors which define the elementary */
  553. /* > reflectors are stored: */
  554. /* > = 'C': Columns */
  555. /* > = 'R': Rows */
  556. /* > \endverbatim */
  557. /* > */
  558. /* > \param[in] M */
  559. /* > \verbatim */
  560. /* > M is INTEGER */
  561. /* > The number of rows of the matrix B. */
  562. /* > M >= 0. */
  563. /* > \endverbatim */
  564. /* > */
  565. /* > \param[in] N */
  566. /* > \verbatim */
  567. /* > N is INTEGER */
  568. /* > The number of columns of the matrix B. */
  569. /* > N >= 0. */
  570. /* > \endverbatim */
  571. /* > */
  572. /* > \param[in] K */
  573. /* > \verbatim */
  574. /* > K is INTEGER */
  575. /* > The order of the matrix T, i.e. the number of elementary */
  576. /* > reflectors whose product defines the block reflector. */
  577. /* > K >= 0. */
  578. /* > \endverbatim */
  579. /* > */
  580. /* > \param[in] L */
  581. /* > \verbatim */
  582. /* > L is INTEGER */
  583. /* > The order of the trapezoidal part of V. */
  584. /* > K >= L >= 0. See Further Details. */
  585. /* > \endverbatim */
  586. /* > */
  587. /* > \param[in] V */
  588. /* > \verbatim */
  589. /* > V is COMPLEX*16 array, dimension */
  590. /* > (LDV,K) if STOREV = 'C' */
  591. /* > (LDV,M) if STOREV = 'R' and SIDE = 'L' */
  592. /* > (LDV,N) if STOREV = 'R' and SIDE = 'R' */
  593. /* > The pentagonal matrix V, which contains the elementary reflectors */
  594. /* > H(1), H(2), ..., H(K). See Further Details. */
  595. /* > \endverbatim */
  596. /* > */
  597. /* > \param[in] LDV */
  598. /* > \verbatim */
  599. /* > LDV is INTEGER */
  600. /* > The leading dimension of the array V. */
  601. /* > If STOREV = 'C' and SIDE = 'L', LDV >= f2cmax(1,M); */
  602. /* > if STOREV = 'C' and SIDE = 'R', LDV >= f2cmax(1,N); */
  603. /* > if STOREV = 'R', LDV >= K. */
  604. /* > \endverbatim */
  605. /* > */
  606. /* > \param[in] T */
  607. /* > \verbatim */
  608. /* > T is COMPLEX*16 array, dimension (LDT,K) */
  609. /* > The triangular K-by-K matrix T in the representation of the */
  610. /* > block reflector. */
  611. /* > \endverbatim */
  612. /* > */
  613. /* > \param[in] LDT */
  614. /* > \verbatim */
  615. /* > LDT is INTEGER */
  616. /* > The leading dimension of the array T. */
  617. /* > LDT >= K. */
  618. /* > \endverbatim */
  619. /* > */
  620. /* > \param[in,out] A */
  621. /* > \verbatim */
  622. /* > A is COMPLEX*16 array, dimension */
  623. /* > (LDA,N) if SIDE = 'L' or (LDA,K) if SIDE = 'R' */
  624. /* > On entry, the K-by-N or M-by-K matrix A. */
  625. /* > On exit, A is overwritten by the corresponding block of */
  626. /* > H*C or H**H*C or C*H or C*H**H. See Further Details. */
  627. /* > \endverbatim */
  628. /* > */
  629. /* > \param[in] LDA */
  630. /* > \verbatim */
  631. /* > LDA is INTEGER */
  632. /* > The leading dimension of the array A. */
  633. /* > If SIDE = 'L', LDA >= f2cmax(1,K); */
  634. /* > If SIDE = 'R', LDA >= f2cmax(1,M). */
  635. /* > \endverbatim */
  636. /* > */
  637. /* > \param[in,out] B */
  638. /* > \verbatim */
  639. /* > B is COMPLEX*16 array, dimension (LDB,N) */
  640. /* > On entry, the M-by-N matrix B. */
  641. /* > On exit, B is overwritten by the corresponding block of */
  642. /* > H*C or H**H*C or C*H or C*H**H. See Further Details. */
  643. /* > \endverbatim */
  644. /* > */
  645. /* > \param[in] LDB */
  646. /* > \verbatim */
  647. /* > LDB is INTEGER */
  648. /* > The leading dimension of the array B. */
  649. /* > LDB >= f2cmax(1,M). */
  650. /* > \endverbatim */
  651. /* > */
  652. /* > \param[out] WORK */
  653. /* > \verbatim */
  654. /* > WORK is COMPLEX*16 array, dimension */
  655. /* > (LDWORK,N) if SIDE = 'L', */
  656. /* > (LDWORK,K) if SIDE = 'R'. */
  657. /* > \endverbatim */
  658. /* > */
  659. /* > \param[in] LDWORK */
  660. /* > \verbatim */
  661. /* > LDWORK is INTEGER */
  662. /* > The leading dimension of the array WORK. */
  663. /* > If SIDE = 'L', LDWORK >= K; */
  664. /* > if SIDE = 'R', LDWORK >= M. */
  665. /* > \endverbatim */
  666. /* Authors: */
  667. /* ======== */
  668. /* > \author Univ. of Tennessee */
  669. /* > \author Univ. of California Berkeley */
  670. /* > \author Univ. of Colorado Denver */
  671. /* > \author NAG Ltd. */
  672. /* > \date December 2016 */
  673. /* > \ingroup complex16OTHERauxiliary */
  674. /* > \par Further Details: */
  675. /* ===================== */
  676. /* > */
  677. /* > \verbatim */
  678. /* > */
  679. /* > The matrix C is a composite matrix formed from blocks A and B. */
  680. /* > The block B is of size M-by-N; if SIDE = 'R', A is of size M-by-K, */
  681. /* > and if SIDE = 'L', A is of size K-by-N. */
  682. /* > */
  683. /* > If SIDE = 'R' and DIRECT = 'F', C = [A B]. */
  684. /* > */
  685. /* > If SIDE = 'L' and DIRECT = 'F', C = [A] */
  686. /* > [B]. */
  687. /* > */
  688. /* > If SIDE = 'R' and DIRECT = 'B', C = [B A]. */
  689. /* > */
  690. /* > If SIDE = 'L' and DIRECT = 'B', C = [B] */
  691. /* > [A]. */
  692. /* > */
  693. /* > The pentagonal matrix V is composed of a rectangular block V1 and a */
  694. /* > trapezoidal block V2. The size of the trapezoidal block is determined by */
  695. /* > the parameter L, where 0<=L<=K. If L=K, the V2 block of V is triangular; */
  696. /* > if L=0, there is no trapezoidal block, thus V = V1 is rectangular. */
  697. /* > */
  698. /* > If DIRECT = 'F' and STOREV = 'C': V = [V1] */
  699. /* > [V2] */
  700. /* > - V2 is upper trapezoidal (first L rows of K-by-K upper triangular) */
  701. /* > */
  702. /* > If DIRECT = 'F' and STOREV = 'R': V = [V1 V2] */
  703. /* > */
  704. /* > - V2 is lower trapezoidal (first L columns of K-by-K lower triangular) */
  705. /* > */
  706. /* > If DIRECT = 'B' and STOREV = 'C': V = [V2] */
  707. /* > [V1] */
  708. /* > - V2 is lower trapezoidal (last L rows of K-by-K lower triangular) */
  709. /* > */
  710. /* > If DIRECT = 'B' and STOREV = 'R': V = [V2 V1] */
  711. /* > */
  712. /* > - V2 is upper trapezoidal (last L columns of K-by-K upper triangular) */
  713. /* > */
  714. /* > If STOREV = 'C' and SIDE = 'L', V is M-by-K with V2 L-by-K. */
  715. /* > */
  716. /* > If STOREV = 'C' and SIDE = 'R', V is N-by-K with V2 L-by-K. */
  717. /* > */
  718. /* > If STOREV = 'R' and SIDE = 'L', V is K-by-M with V2 K-by-L. */
  719. /* > */
  720. /* > If STOREV = 'R' and SIDE = 'R', V is K-by-N with V2 K-by-L. */
  721. /* > \endverbatim */
  722. /* > */
  723. /* ===================================================================== */
  724. /* Subroutine */ void ztprfb_(char *side, char *trans, char *direct, char *
  725. storev, integer *m, integer *n, integer *k, integer *l, doublecomplex
  726. *v, integer *ldv, doublecomplex *t, integer *ldt, doublecomplex *a,
  727. integer *lda, doublecomplex *b, integer *ldb, doublecomplex *work,
  728. integer *ldwork)
  729. {
  730. /* System generated locals */
  731. integer a_dim1, a_offset, b_dim1, b_offset, t_dim1, t_offset, v_dim1,
  732. v_offset, work_dim1, work_offset, i__1, i__2, i__3, i__4, i__5;
  733. doublecomplex z__1;
  734. /* Local variables */
  735. logical left, backward;
  736. integer i__, j;
  737. extern logical lsame_(char *, char *);
  738. logical right;
  739. extern /* Subroutine */ void zgemm_(char *, char *, integer *, integer *,
  740. integer *, doublecomplex *, doublecomplex *, integer *,
  741. doublecomplex *, integer *, doublecomplex *, doublecomplex *,
  742. integer *), ztrmm_(char *, char *, char *, char *,
  743. integer *, integer *, doublecomplex *, doublecomplex *, integer *
  744. , doublecomplex *, integer *);
  745. integer kp, mp, np;
  746. logical column, row, forward;
  747. /* -- LAPACK auxiliary routine (version 3.7.0) -- */
  748. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  749. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  750. /* December 2016 */
  751. /* ========================================================================== */
  752. /* Quick return if possible */
  753. /* Parameter adjustments */
  754. v_dim1 = *ldv;
  755. v_offset = 1 + v_dim1 * 1;
  756. v -= v_offset;
  757. t_dim1 = *ldt;
  758. t_offset = 1 + t_dim1 * 1;
  759. t -= t_offset;
  760. a_dim1 = *lda;
  761. a_offset = 1 + a_dim1 * 1;
  762. a -= a_offset;
  763. b_dim1 = *ldb;
  764. b_offset = 1 + b_dim1 * 1;
  765. b -= b_offset;
  766. work_dim1 = *ldwork;
  767. work_offset = 1 + work_dim1 * 1;
  768. work -= work_offset;
  769. /* Function Body */
  770. if (*m <= 0 || *n <= 0 || *k <= 0 || *l < 0) {
  771. return;
  772. }
  773. if (lsame_(storev, "C")) {
  774. column = TRUE_;
  775. row = FALSE_;
  776. } else if (lsame_(storev, "R")) {
  777. column = FALSE_;
  778. row = TRUE_;
  779. } else {
  780. column = FALSE_;
  781. row = FALSE_;
  782. }
  783. if (lsame_(side, "L")) {
  784. left = TRUE_;
  785. right = FALSE_;
  786. } else if (lsame_(side, "R")) {
  787. left = FALSE_;
  788. right = TRUE_;
  789. } else {
  790. left = FALSE_;
  791. right = FALSE_;
  792. }
  793. if (lsame_(direct, "F")) {
  794. forward = TRUE_;
  795. backward = FALSE_;
  796. } else if (lsame_(direct, "B")) {
  797. forward = FALSE_;
  798. backward = TRUE_;
  799. } else {
  800. forward = FALSE_;
  801. backward = FALSE_;
  802. }
  803. /* --------------------------------------------------------------------------- */
  804. if (column && forward && left) {
  805. /* --------------------------------------------------------------------------- */
  806. /* Let W = [ I ] (K-by-K) */
  807. /* [ V ] (M-by-K) */
  808. /* Form H C or H**H C where C = [ A ] (K-by-N) */
  809. /* [ B ] (M-by-N) */
  810. /* H = I - W T W**H or H**H = I - W T**H W**H */
  811. /* A = A - T (A + V**H B) or A = A - T**H (A + V**H B) */
  812. /* B = B - V T (A + V**H B) or B = B - V T**H (A + V**H B) */
  813. /* --------------------------------------------------------------------------- */
  814. /* Computing MIN */
  815. i__1 = *m - *l + 1;
  816. mp = f2cmin(i__1,*m);
  817. /* Computing MIN */
  818. i__1 = *l + 1;
  819. kp = f2cmin(i__1,*k);
  820. i__1 = *n;
  821. for (j = 1; j <= i__1; ++j) {
  822. i__2 = *l;
  823. for (i__ = 1; i__ <= i__2; ++i__) {
  824. i__3 = i__ + j * work_dim1;
  825. i__4 = *m - *l + i__ + j * b_dim1;
  826. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  827. }
  828. }
  829. ztrmm_("L", "U", "C", "N", l, n, &c_b14, &v[mp + v_dim1], ldv, &work[
  830. work_offset], ldwork);
  831. i__1 = *m - *l;
  832. zgemm_("C", "N", l, n, &i__1, &c_b14, &v[v_offset], ldv, &b[b_offset],
  833. ldb, &c_b14, &work[work_offset], ldwork);
  834. i__1 = *k - *l;
  835. zgemm_("C", "N", &i__1, n, m, &c_b14, &v[kp * v_dim1 + 1], ldv, &b[
  836. b_offset], ldb, &c_b22, &work[kp + work_dim1], ldwork);
  837. i__1 = *n;
  838. for (j = 1; j <= i__1; ++j) {
  839. i__2 = *k;
  840. for (i__ = 1; i__ <= i__2; ++i__) {
  841. i__3 = i__ + j * work_dim1;
  842. i__4 = i__ + j * work_dim1;
  843. i__5 = i__ + j * a_dim1;
  844. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  845. i__5].i;
  846. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  847. }
  848. }
  849. ztrmm_("L", "U", trans, "N", k, n, &c_b14, &t[t_offset], ldt, &work[
  850. work_offset], ldwork);
  851. i__1 = *n;
  852. for (j = 1; j <= i__1; ++j) {
  853. i__2 = *k;
  854. for (i__ = 1; i__ <= i__2; ++i__) {
  855. i__3 = i__ + j * a_dim1;
  856. i__4 = i__ + j * a_dim1;
  857. i__5 = i__ + j * work_dim1;
  858. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  859. i__5].i;
  860. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  861. }
  862. }
  863. i__1 = *m - *l;
  864. zgemm_("N", "N", &i__1, n, k, &c_b29, &v[v_offset], ldv, &work[
  865. work_offset], ldwork, &c_b14, &b[b_offset], ldb);
  866. i__1 = *k - *l;
  867. zgemm_("N", "N", l, n, &i__1, &c_b29, &v[mp + kp * v_dim1], ldv, &
  868. work[kp + work_dim1], ldwork, &c_b14, &b[mp + b_dim1], ldb);
  869. ztrmm_("L", "U", "N", "N", l, n, &c_b14, &v[mp + v_dim1], ldv, &work[
  870. work_offset], ldwork);
  871. i__1 = *n;
  872. for (j = 1; j <= i__1; ++j) {
  873. i__2 = *l;
  874. for (i__ = 1; i__ <= i__2; ++i__) {
  875. i__3 = *m - *l + i__ + j * b_dim1;
  876. i__4 = *m - *l + i__ + j * b_dim1;
  877. i__5 = i__ + j * work_dim1;
  878. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  879. i__5].i;
  880. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  881. }
  882. }
  883. /* --------------------------------------------------------------------------- */
  884. } else if (column && forward && right) {
  885. /* --------------------------------------------------------------------------- */
  886. /* Let W = [ I ] (K-by-K) */
  887. /* [ V ] (N-by-K) */
  888. /* Form C H or C H**H where C = [ A B ] (A is M-by-K, B is M-by-N) */
  889. /* H = I - W T W**H or H**H = I - W T**H W**H */
  890. /* A = A - (A + B V) T or A = A - (A + B V) T**H */
  891. /* B = B - (A + B V) T V**H or B = B - (A + B V) T**H V**H */
  892. /* --------------------------------------------------------------------------- */
  893. /* Computing MIN */
  894. i__1 = *n - *l + 1;
  895. np = f2cmin(i__1,*n);
  896. /* Computing MIN */
  897. i__1 = *l + 1;
  898. kp = f2cmin(i__1,*k);
  899. i__1 = *l;
  900. for (j = 1; j <= i__1; ++j) {
  901. i__2 = *m;
  902. for (i__ = 1; i__ <= i__2; ++i__) {
  903. i__3 = i__ + j * work_dim1;
  904. i__4 = i__ + (*n - *l + j) * b_dim1;
  905. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  906. }
  907. }
  908. ztrmm_("R", "U", "N", "N", m, l, &c_b14, &v[np + v_dim1], ldv, &work[
  909. work_offset], ldwork);
  910. i__1 = *n - *l;
  911. zgemm_("N", "N", m, l, &i__1, &c_b14, &b[b_offset], ldb, &v[v_offset],
  912. ldv, &c_b14, &work[work_offset], ldwork);
  913. i__1 = *k - *l;
  914. zgemm_("N", "N", m, &i__1, n, &c_b14, &b[b_offset], ldb, &v[kp *
  915. v_dim1 + 1], ldv, &c_b22, &work[kp * work_dim1 + 1], ldwork);
  916. i__1 = *k;
  917. for (j = 1; j <= i__1; ++j) {
  918. i__2 = *m;
  919. for (i__ = 1; i__ <= i__2; ++i__) {
  920. i__3 = i__ + j * work_dim1;
  921. i__4 = i__ + j * work_dim1;
  922. i__5 = i__ + j * a_dim1;
  923. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  924. i__5].i;
  925. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  926. }
  927. }
  928. ztrmm_("R", "U", trans, "N", m, k, &c_b14, &t[t_offset], ldt, &work[
  929. work_offset], ldwork);
  930. i__1 = *k;
  931. for (j = 1; j <= i__1; ++j) {
  932. i__2 = *m;
  933. for (i__ = 1; i__ <= i__2; ++i__) {
  934. i__3 = i__ + j * a_dim1;
  935. i__4 = i__ + j * a_dim1;
  936. i__5 = i__ + j * work_dim1;
  937. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  938. i__5].i;
  939. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  940. }
  941. }
  942. i__1 = *n - *l;
  943. zgemm_("N", "C", m, &i__1, k, &c_b29, &work[work_offset], ldwork, &v[
  944. v_offset], ldv, &c_b14, &b[b_offset], ldb);
  945. i__1 = *k - *l;
  946. zgemm_("N", "C", m, l, &i__1, &c_b29, &work[kp * work_dim1 + 1],
  947. ldwork, &v[np + kp * v_dim1], ldv, &c_b14, &b[np * b_dim1 + 1]
  948. , ldb);
  949. ztrmm_("R", "U", "C", "N", m, l, &c_b14, &v[np + v_dim1], ldv, &work[
  950. work_offset], ldwork);
  951. i__1 = *l;
  952. for (j = 1; j <= i__1; ++j) {
  953. i__2 = *m;
  954. for (i__ = 1; i__ <= i__2; ++i__) {
  955. i__3 = i__ + (*n - *l + j) * b_dim1;
  956. i__4 = i__ + (*n - *l + j) * b_dim1;
  957. i__5 = i__ + j * work_dim1;
  958. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  959. i__5].i;
  960. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  961. }
  962. }
  963. /* --------------------------------------------------------------------------- */
  964. } else if (column && backward && left) {
  965. /* --------------------------------------------------------------------------- */
  966. /* Let W = [ V ] (M-by-K) */
  967. /* [ I ] (K-by-K) */
  968. /* Form H C or H**H C where C = [ B ] (M-by-N) */
  969. /* [ A ] (K-by-N) */
  970. /* H = I - W T W**H or H**H = I - W T**H W**H */
  971. /* A = A - T (A + V**H B) or A = A - T**H (A + V**H B) */
  972. /* B = B - V T (A + V**H B) or B = B - V T**H (A + V**H B) */
  973. /* --------------------------------------------------------------------------- */
  974. /* Computing MIN */
  975. i__1 = *l + 1;
  976. mp = f2cmin(i__1,*m);
  977. /* Computing MIN */
  978. i__1 = *k - *l + 1;
  979. kp = f2cmin(i__1,*k);
  980. i__1 = *n;
  981. for (j = 1; j <= i__1; ++j) {
  982. i__2 = *l;
  983. for (i__ = 1; i__ <= i__2; ++i__) {
  984. i__3 = *k - *l + i__ + j * work_dim1;
  985. i__4 = i__ + j * b_dim1;
  986. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  987. }
  988. }
  989. ztrmm_("L", "L", "C", "N", l, n, &c_b14, &v[kp * v_dim1 + 1], ldv, &
  990. work[kp + work_dim1], ldwork);
  991. i__1 = *m - *l;
  992. zgemm_("C", "N", l, n, &i__1, &c_b14, &v[mp + kp * v_dim1], ldv, &b[
  993. mp + b_dim1], ldb, &c_b14, &work[kp + work_dim1], ldwork);
  994. i__1 = *k - *l;
  995. zgemm_("C", "N", &i__1, n, m, &c_b14, &v[v_offset], ldv, &b[b_offset],
  996. ldb, &c_b22, &work[work_offset], ldwork);
  997. i__1 = *n;
  998. for (j = 1; j <= i__1; ++j) {
  999. i__2 = *k;
  1000. for (i__ = 1; i__ <= i__2; ++i__) {
  1001. i__3 = i__ + j * work_dim1;
  1002. i__4 = i__ + j * work_dim1;
  1003. i__5 = i__ + j * a_dim1;
  1004. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  1005. i__5].i;
  1006. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  1007. }
  1008. }
  1009. ztrmm_("L", "L", trans, "N", k, n, &c_b14, &t[t_offset], ldt, &work[
  1010. work_offset], ldwork);
  1011. i__1 = *n;
  1012. for (j = 1; j <= i__1; ++j) {
  1013. i__2 = *k;
  1014. for (i__ = 1; i__ <= i__2; ++i__) {
  1015. i__3 = i__ + j * a_dim1;
  1016. i__4 = i__ + j * a_dim1;
  1017. i__5 = i__ + j * work_dim1;
  1018. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  1019. i__5].i;
  1020. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  1021. }
  1022. }
  1023. i__1 = *m - *l;
  1024. zgemm_("N", "N", &i__1, n, k, &c_b29, &v[mp + v_dim1], ldv, &work[
  1025. work_offset], ldwork, &c_b14, &b[mp + b_dim1], ldb);
  1026. i__1 = *k - *l;
  1027. zgemm_("N", "N", l, n, &i__1, &c_b29, &v[v_offset], ldv, &work[
  1028. work_offset], ldwork, &c_b14, &b[b_offset], ldb);
  1029. ztrmm_("L", "L", "N", "N", l, n, &c_b14, &v[kp * v_dim1 + 1], ldv, &
  1030. work[kp + work_dim1], ldwork);
  1031. i__1 = *n;
  1032. for (j = 1; j <= i__1; ++j) {
  1033. i__2 = *l;
  1034. for (i__ = 1; i__ <= i__2; ++i__) {
  1035. i__3 = i__ + j * b_dim1;
  1036. i__4 = i__ + j * b_dim1;
  1037. i__5 = *k - *l + i__ + j * work_dim1;
  1038. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  1039. i__5].i;
  1040. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  1041. }
  1042. }
  1043. /* --------------------------------------------------------------------------- */
  1044. } else if (column && backward && right) {
  1045. /* --------------------------------------------------------------------------- */
  1046. /* Let W = [ V ] (N-by-K) */
  1047. /* [ I ] (K-by-K) */
  1048. /* Form C H or C H**H where C = [ B A ] (B is M-by-N, A is M-by-K) */
  1049. /* H = I - W T W**H or H**H = I - W T**H W**H */
  1050. /* A = A - (A + B V) T or A = A - (A + B V) T**H */
  1051. /* B = B - (A + B V) T V**H or B = B - (A + B V) T**H V**H */
  1052. /* --------------------------------------------------------------------------- */
  1053. /* Computing MIN */
  1054. i__1 = *l + 1;
  1055. np = f2cmin(i__1,*n);
  1056. /* Computing MIN */
  1057. i__1 = *k - *l + 1;
  1058. kp = f2cmin(i__1,*k);
  1059. i__1 = *l;
  1060. for (j = 1; j <= i__1; ++j) {
  1061. i__2 = *m;
  1062. for (i__ = 1; i__ <= i__2; ++i__) {
  1063. i__3 = i__ + (*k - *l + j) * work_dim1;
  1064. i__4 = i__ + j * b_dim1;
  1065. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1066. }
  1067. }
  1068. ztrmm_("R", "L", "N", "N", m, l, &c_b14, &v[kp * v_dim1 + 1], ldv, &
  1069. work[kp * work_dim1 + 1], ldwork);
  1070. i__1 = *n - *l;
  1071. zgemm_("N", "N", m, l, &i__1, &c_b14, &b[np * b_dim1 + 1], ldb, &v[np
  1072. + kp * v_dim1], ldv, &c_b14, &work[kp * work_dim1 + 1],
  1073. ldwork);
  1074. i__1 = *k - *l;
  1075. zgemm_("N", "N", m, &i__1, n, &c_b14, &b[b_offset], ldb, &v[v_offset],
  1076. ldv, &c_b22, &work[work_offset], ldwork);
  1077. i__1 = *k;
  1078. for (j = 1; j <= i__1; ++j) {
  1079. i__2 = *m;
  1080. for (i__ = 1; i__ <= i__2; ++i__) {
  1081. i__3 = i__ + j * work_dim1;
  1082. i__4 = i__ + j * work_dim1;
  1083. i__5 = i__ + j * a_dim1;
  1084. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  1085. i__5].i;
  1086. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  1087. }
  1088. }
  1089. ztrmm_("R", "L", trans, "N", m, k, &c_b14, &t[t_offset], ldt, &work[
  1090. work_offset], ldwork);
  1091. i__1 = *k;
  1092. for (j = 1; j <= i__1; ++j) {
  1093. i__2 = *m;
  1094. for (i__ = 1; i__ <= i__2; ++i__) {
  1095. i__3 = i__ + j * a_dim1;
  1096. i__4 = i__ + j * a_dim1;
  1097. i__5 = i__ + j * work_dim1;
  1098. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  1099. i__5].i;
  1100. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  1101. }
  1102. }
  1103. i__1 = *n - *l;
  1104. zgemm_("N", "C", m, &i__1, k, &c_b29, &work[work_offset], ldwork, &v[
  1105. np + v_dim1], ldv, &c_b14, &b[np * b_dim1 + 1], ldb);
  1106. i__1 = *k - *l;
  1107. zgemm_("N", "C", m, l, &i__1, &c_b29, &work[work_offset], ldwork, &v[
  1108. v_offset], ldv, &c_b14, &b[b_offset], ldb);
  1109. ztrmm_("R", "L", "C", "N", m, l, &c_b14, &v[kp * v_dim1 + 1], ldv, &
  1110. work[kp * work_dim1 + 1], ldwork);
  1111. i__1 = *l;
  1112. for (j = 1; j <= i__1; ++j) {
  1113. i__2 = *m;
  1114. for (i__ = 1; i__ <= i__2; ++i__) {
  1115. i__3 = i__ + j * b_dim1;
  1116. i__4 = i__ + j * b_dim1;
  1117. i__5 = i__ + (*k - *l + j) * work_dim1;
  1118. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  1119. i__5].i;
  1120. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  1121. }
  1122. }
  1123. /* --------------------------------------------------------------------------- */
  1124. } else if (row && forward && left) {
  1125. /* --------------------------------------------------------------------------- */
  1126. /* Let W = [ I V ] ( I is K-by-K, V is K-by-M ) */
  1127. /* Form H C or H**H C where C = [ A ] (K-by-N) */
  1128. /* [ B ] (M-by-N) */
  1129. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1130. /* A = A - T (A + V B) or A = A - T**H (A + V B) */
  1131. /* B = B - V**H T (A + V B) or B = B - V**H T**H (A + V B) */
  1132. /* --------------------------------------------------------------------------- */
  1133. /* Computing MIN */
  1134. i__1 = *m - *l + 1;
  1135. mp = f2cmin(i__1,*m);
  1136. /* Computing MIN */
  1137. i__1 = *l + 1;
  1138. kp = f2cmin(i__1,*k);
  1139. i__1 = *n;
  1140. for (j = 1; j <= i__1; ++j) {
  1141. i__2 = *l;
  1142. for (i__ = 1; i__ <= i__2; ++i__) {
  1143. i__3 = i__ + j * work_dim1;
  1144. i__4 = *m - *l + i__ + j * b_dim1;
  1145. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1146. }
  1147. }
  1148. ztrmm_("L", "L", "N", "N", l, n, &c_b14, &v[mp * v_dim1 + 1], ldv, &
  1149. work[work_offset], ldb);
  1150. i__1 = *m - *l;
  1151. zgemm_("N", "N", l, n, &i__1, &c_b14, &v[v_offset], ldv, &b[b_offset],
  1152. ldb, &c_b14, &work[work_offset], ldwork);
  1153. i__1 = *k - *l;
  1154. zgemm_("N", "N", &i__1, n, m, &c_b14, &v[kp + v_dim1], ldv, &b[
  1155. b_offset], ldb, &c_b22, &work[kp + work_dim1], ldwork);
  1156. i__1 = *n;
  1157. for (j = 1; j <= i__1; ++j) {
  1158. i__2 = *k;
  1159. for (i__ = 1; i__ <= i__2; ++i__) {
  1160. i__3 = i__ + j * work_dim1;
  1161. i__4 = i__ + j * work_dim1;
  1162. i__5 = i__ + j * a_dim1;
  1163. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  1164. i__5].i;
  1165. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  1166. }
  1167. }
  1168. ztrmm_("L", "U", trans, "N", k, n, &c_b14, &t[t_offset], ldt, &work[
  1169. work_offset], ldwork);
  1170. i__1 = *n;
  1171. for (j = 1; j <= i__1; ++j) {
  1172. i__2 = *k;
  1173. for (i__ = 1; i__ <= i__2; ++i__) {
  1174. i__3 = i__ + j * a_dim1;
  1175. i__4 = i__ + j * a_dim1;
  1176. i__5 = i__ + j * work_dim1;
  1177. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  1178. i__5].i;
  1179. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  1180. }
  1181. }
  1182. i__1 = *m - *l;
  1183. zgemm_("C", "N", &i__1, n, k, &c_b29, &v[v_offset], ldv, &work[
  1184. work_offset], ldwork, &c_b14, &b[b_offset], ldb);
  1185. i__1 = *k - *l;
  1186. zgemm_("C", "N", l, n, &i__1, &c_b29, &v[kp + mp * v_dim1], ldv, &
  1187. work[kp + work_dim1], ldwork, &c_b14, &b[mp + b_dim1], ldb);
  1188. ztrmm_("L", "L", "C", "N", l, n, &c_b14, &v[mp * v_dim1 + 1], ldv, &
  1189. work[work_offset], ldwork);
  1190. i__1 = *n;
  1191. for (j = 1; j <= i__1; ++j) {
  1192. i__2 = *l;
  1193. for (i__ = 1; i__ <= i__2; ++i__) {
  1194. i__3 = *m - *l + i__ + j * b_dim1;
  1195. i__4 = *m - *l + i__ + j * b_dim1;
  1196. i__5 = i__ + j * work_dim1;
  1197. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  1198. i__5].i;
  1199. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  1200. }
  1201. }
  1202. /* --------------------------------------------------------------------------- */
  1203. } else if (row && forward && right) {
  1204. /* --------------------------------------------------------------------------- */
  1205. /* Let W = [ I V ] ( I is K-by-K, V is K-by-N ) */
  1206. /* Form C H or C H**H where C = [ A B ] (A is M-by-K, B is M-by-N) */
  1207. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1208. /* A = A - (A + B V**H) T or A = A - (A + B V**H) T**H */
  1209. /* B = B - (A + B V**H) T V or B = B - (A + B V**H) T**H V */
  1210. /* --------------------------------------------------------------------------- */
  1211. /* Computing MIN */
  1212. i__1 = *n - *l + 1;
  1213. np = f2cmin(i__1,*n);
  1214. /* Computing MIN */
  1215. i__1 = *l + 1;
  1216. kp = f2cmin(i__1,*k);
  1217. i__1 = *l;
  1218. for (j = 1; j <= i__1; ++j) {
  1219. i__2 = *m;
  1220. for (i__ = 1; i__ <= i__2; ++i__) {
  1221. i__3 = i__ + j * work_dim1;
  1222. i__4 = i__ + (*n - *l + j) * b_dim1;
  1223. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1224. }
  1225. }
  1226. ztrmm_("R", "L", "C", "N", m, l, &c_b14, &v[np * v_dim1 + 1], ldv, &
  1227. work[work_offset], ldwork);
  1228. i__1 = *n - *l;
  1229. zgemm_("N", "C", m, l, &i__1, &c_b14, &b[b_offset], ldb, &v[v_offset],
  1230. ldv, &c_b14, &work[work_offset], ldwork);
  1231. i__1 = *k - *l;
  1232. zgemm_("N", "C", m, &i__1, n, &c_b14, &b[b_offset], ldb, &v[kp +
  1233. v_dim1], ldv, &c_b22, &work[kp * work_dim1 + 1], ldwork);
  1234. i__1 = *k;
  1235. for (j = 1; j <= i__1; ++j) {
  1236. i__2 = *m;
  1237. for (i__ = 1; i__ <= i__2; ++i__) {
  1238. i__3 = i__ + j * work_dim1;
  1239. i__4 = i__ + j * work_dim1;
  1240. i__5 = i__ + j * a_dim1;
  1241. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  1242. i__5].i;
  1243. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  1244. }
  1245. }
  1246. ztrmm_("R", "U", trans, "N", m, k, &c_b14, &t[t_offset], ldt, &work[
  1247. work_offset], ldwork);
  1248. i__1 = *k;
  1249. for (j = 1; j <= i__1; ++j) {
  1250. i__2 = *m;
  1251. for (i__ = 1; i__ <= i__2; ++i__) {
  1252. i__3 = i__ + j * a_dim1;
  1253. i__4 = i__ + j * a_dim1;
  1254. i__5 = i__ + j * work_dim1;
  1255. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  1256. i__5].i;
  1257. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  1258. }
  1259. }
  1260. i__1 = *n - *l;
  1261. zgemm_("N", "N", m, &i__1, k, &c_b29, &work[work_offset], ldwork, &v[
  1262. v_offset], ldv, &c_b14, &b[b_offset], ldb);
  1263. i__1 = *k - *l;
  1264. zgemm_("N", "N", m, l, &i__1, &c_b29, &work[kp * work_dim1 + 1],
  1265. ldwork, &v[kp + np * v_dim1], ldv, &c_b14, &b[np * b_dim1 + 1]
  1266. , ldb);
  1267. ztrmm_("R", "L", "N", "N", m, l, &c_b14, &v[np * v_dim1 + 1], ldv, &
  1268. work[work_offset], ldwork);
  1269. i__1 = *l;
  1270. for (j = 1; j <= i__1; ++j) {
  1271. i__2 = *m;
  1272. for (i__ = 1; i__ <= i__2; ++i__) {
  1273. i__3 = i__ + (*n - *l + j) * b_dim1;
  1274. i__4 = i__ + (*n - *l + j) * b_dim1;
  1275. i__5 = i__ + j * work_dim1;
  1276. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  1277. i__5].i;
  1278. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  1279. }
  1280. }
  1281. /* --------------------------------------------------------------------------- */
  1282. } else if (row && backward && left) {
  1283. /* --------------------------------------------------------------------------- */
  1284. /* Let W = [ V I ] ( I is K-by-K, V is K-by-M ) */
  1285. /* Form H C or H**H C where C = [ B ] (M-by-N) */
  1286. /* [ A ] (K-by-N) */
  1287. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1288. /* A = A - T (A + V B) or A = A - T**H (A + V B) */
  1289. /* B = B - V**H T (A + V B) or B = B - V**H T**H (A + V B) */
  1290. /* --------------------------------------------------------------------------- */
  1291. /* Computing MIN */
  1292. i__1 = *l + 1;
  1293. mp = f2cmin(i__1,*m);
  1294. /* Computing MIN */
  1295. i__1 = *k - *l + 1;
  1296. kp = f2cmin(i__1,*k);
  1297. i__1 = *n;
  1298. for (j = 1; j <= i__1; ++j) {
  1299. i__2 = *l;
  1300. for (i__ = 1; i__ <= i__2; ++i__) {
  1301. i__3 = *k - *l + i__ + j * work_dim1;
  1302. i__4 = i__ + j * b_dim1;
  1303. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1304. }
  1305. }
  1306. ztrmm_("L", "U", "N", "N", l, n, &c_b14, &v[kp + v_dim1], ldv, &work[
  1307. kp + work_dim1], ldwork);
  1308. i__1 = *m - *l;
  1309. zgemm_("N", "N", l, n, &i__1, &c_b14, &v[kp + mp * v_dim1], ldv, &b[
  1310. mp + b_dim1], ldb, &c_b14, &work[kp + work_dim1], ldwork);
  1311. i__1 = *k - *l;
  1312. zgemm_("N", "N", &i__1, n, m, &c_b14, &v[v_offset], ldv, &b[b_offset],
  1313. ldb, &c_b22, &work[work_offset], ldwork);
  1314. i__1 = *n;
  1315. for (j = 1; j <= i__1; ++j) {
  1316. i__2 = *k;
  1317. for (i__ = 1; i__ <= i__2; ++i__) {
  1318. i__3 = i__ + j * work_dim1;
  1319. i__4 = i__ + j * work_dim1;
  1320. i__5 = i__ + j * a_dim1;
  1321. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  1322. i__5].i;
  1323. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  1324. }
  1325. }
  1326. ztrmm_("L", "L ", trans, "N", k, n, &c_b14, &t[t_offset], ldt, &work[
  1327. work_offset], ldwork);
  1328. i__1 = *n;
  1329. for (j = 1; j <= i__1; ++j) {
  1330. i__2 = *k;
  1331. for (i__ = 1; i__ <= i__2; ++i__) {
  1332. i__3 = i__ + j * a_dim1;
  1333. i__4 = i__ + j * a_dim1;
  1334. i__5 = i__ + j * work_dim1;
  1335. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  1336. i__5].i;
  1337. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  1338. }
  1339. }
  1340. i__1 = *m - *l;
  1341. zgemm_("C", "N", &i__1, n, k, &c_b29, &v[mp * v_dim1 + 1], ldv, &work[
  1342. work_offset], ldwork, &c_b14, &b[mp + b_dim1], ldb);
  1343. i__1 = *k - *l;
  1344. zgemm_("C", "N", l, n, &i__1, &c_b29, &v[v_offset], ldv, &work[
  1345. work_offset], ldwork, &c_b14, &b[b_offset], ldb);
  1346. ztrmm_("L", "U", "C", "N", l, n, &c_b14, &v[kp + v_dim1], ldv, &work[
  1347. kp + work_dim1], ldwork);
  1348. i__1 = *n;
  1349. for (j = 1; j <= i__1; ++j) {
  1350. i__2 = *l;
  1351. for (i__ = 1; i__ <= i__2; ++i__) {
  1352. i__3 = i__ + j * b_dim1;
  1353. i__4 = i__ + j * b_dim1;
  1354. i__5 = *k - *l + i__ + j * work_dim1;
  1355. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  1356. i__5].i;
  1357. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  1358. }
  1359. }
  1360. /* --------------------------------------------------------------------------- */
  1361. } else if (row && backward && right) {
  1362. /* --------------------------------------------------------------------------- */
  1363. /* Let W = [ V I ] ( I is K-by-K, V is K-by-N ) */
  1364. /* Form C H or C H**H where C = [ B A ] (A is M-by-K, B is M-by-N) */
  1365. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1366. /* A = A - (A + B V**H) T or A = A - (A + B V**H) T**H */
  1367. /* B = B - (A + B V**H) T V or B = B - (A + B V**H) T**H V */
  1368. /* --------------------------------------------------------------------------- */
  1369. /* Computing MIN */
  1370. i__1 = *l + 1;
  1371. np = f2cmin(i__1,*n);
  1372. /* Computing MIN */
  1373. i__1 = *k - *l + 1;
  1374. kp = f2cmin(i__1,*k);
  1375. i__1 = *l;
  1376. for (j = 1; j <= i__1; ++j) {
  1377. i__2 = *m;
  1378. for (i__ = 1; i__ <= i__2; ++i__) {
  1379. i__3 = i__ + (*k - *l + j) * work_dim1;
  1380. i__4 = i__ + j * b_dim1;
  1381. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1382. }
  1383. }
  1384. ztrmm_("R", "U", "C", "N", m, l, &c_b14, &v[kp + v_dim1], ldv, &work[
  1385. kp * work_dim1 + 1], ldwork);
  1386. i__1 = *n - *l;
  1387. zgemm_("N", "C", m, l, &i__1, &c_b14, &b[np * b_dim1 + 1], ldb, &v[kp
  1388. + np * v_dim1], ldv, &c_b14, &work[kp * work_dim1 + 1],
  1389. ldwork);
  1390. i__1 = *k - *l;
  1391. zgemm_("N", "C", m, &i__1, n, &c_b14, &b[b_offset], ldb, &v[v_offset],
  1392. ldv, &c_b22, &work[work_offset], ldwork);
  1393. i__1 = *k;
  1394. for (j = 1; j <= i__1; ++j) {
  1395. i__2 = *m;
  1396. for (i__ = 1; i__ <= i__2; ++i__) {
  1397. i__3 = i__ + j * work_dim1;
  1398. i__4 = i__ + j * work_dim1;
  1399. i__5 = i__ + j * a_dim1;
  1400. z__1.r = work[i__4].r + a[i__5].r, z__1.i = work[i__4].i + a[
  1401. i__5].i;
  1402. work[i__3].r = z__1.r, work[i__3].i = z__1.i;
  1403. }
  1404. }
  1405. ztrmm_("R", "L", trans, "N", m, k, &c_b14, &t[t_offset], ldt, &work[
  1406. work_offset], ldwork);
  1407. i__1 = *k;
  1408. for (j = 1; j <= i__1; ++j) {
  1409. i__2 = *m;
  1410. for (i__ = 1; i__ <= i__2; ++i__) {
  1411. i__3 = i__ + j * a_dim1;
  1412. i__4 = i__ + j * a_dim1;
  1413. i__5 = i__ + j * work_dim1;
  1414. z__1.r = a[i__4].r - work[i__5].r, z__1.i = a[i__4].i - work[
  1415. i__5].i;
  1416. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  1417. }
  1418. }
  1419. i__1 = *n - *l;
  1420. zgemm_("N", "N", m, &i__1, k, &c_b29, &work[work_offset], ldwork, &v[
  1421. np * v_dim1 + 1], ldv, &c_b14, &b[np * b_dim1 + 1], ldb);
  1422. i__1 = *k - *l;
  1423. zgemm_("N", "N", m, l, &i__1, &c_b29, &work[work_offset], ldwork, &v[
  1424. v_offset], ldv, &c_b14, &b[b_offset], ldb);
  1425. ztrmm_("R", "U", "N", "N", m, l, &c_b14, &v[kp + v_dim1], ldv, &work[
  1426. kp * work_dim1 + 1], ldwork);
  1427. i__1 = *l;
  1428. for (j = 1; j <= i__1; ++j) {
  1429. i__2 = *m;
  1430. for (i__ = 1; i__ <= i__2; ++i__) {
  1431. i__3 = i__ + j * b_dim1;
  1432. i__4 = i__ + j * b_dim1;
  1433. i__5 = i__ + (*k - *l + j) * work_dim1;
  1434. z__1.r = b[i__4].r - work[i__5].r, z__1.i = b[i__4].i - work[
  1435. i__5].i;
  1436. b[i__3].r = z__1.r, b[i__3].i = z__1.i;
  1437. }
  1438. }
  1439. }
  1440. return;
  1441. /* End of ZTPRFB */
  1442. } /* ztprfb_ */