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.

ctprfb.c 48 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629
  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]/df(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 complex c_b1 = {1.f,0.f};
  487. static complex c_b2 = {0.f,0.f};
  488. /* > \brief \b CTPRFB applies a real or complex "triangular-pentagonal" blocked reflector to a real or complex
  489. matrix, which is composed of two blocks. */
  490. /* =========== DOCUMENTATION =========== */
  491. /* Online html documentation available at */
  492. /* http://www.netlib.org/lapack/explore-html/ */
  493. /* > \htmlonly */
  494. /* > Download CTPRFB + dependencies */
  495. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctprfb.
  496. f"> */
  497. /* > [TGZ]</a> */
  498. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctprfb.
  499. f"> */
  500. /* > [ZIP]</a> */
  501. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctprfb.
  502. f"> */
  503. /* > [TXT]</a> */
  504. /* > \endhtmlonly */
  505. /* Definition: */
  506. /* =========== */
  507. /* SUBROUTINE CTPRFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, */
  508. /* V, LDV, T, LDT, A, LDA, B, LDB, WORK, LDWORK ) */
  509. /* CHARACTER DIRECT, SIDE, STOREV, TRANS */
  510. /* INTEGER K, L, LDA, LDB, LDT, LDV, LDWORK, M, N */
  511. /* COMPLEX A( LDA, * ), B( LDB, * ), T( LDT, * ), */
  512. /* $ V( LDV, * ), WORK( LDWORK, * ) */
  513. /* > \par Purpose: */
  514. /* ============= */
  515. /* > */
  516. /* > \verbatim */
  517. /* > */
  518. /* > CTPRFB applies a complex "triangular-pentagonal" block reflector H or its */
  519. /* > conjugate transpose H**H to a complex matrix C, which is composed of two */
  520. /* > blocks A and B, either from the left or right. */
  521. /* > */
  522. /* > \endverbatim */
  523. /* Arguments: */
  524. /* ========== */
  525. /* > \param[in] SIDE */
  526. /* > \verbatim */
  527. /* > SIDE is CHARACTER*1 */
  528. /* > = 'L': apply H or H**H from the Left */
  529. /* > = 'R': apply H or H**H from the Right */
  530. /* > \endverbatim */
  531. /* > */
  532. /* > \param[in] TRANS */
  533. /* > \verbatim */
  534. /* > TRANS is CHARACTER*1 */
  535. /* > = 'N': apply H (No transpose) */
  536. /* > = 'C': apply H**H (Conjugate transpose) */
  537. /* > \endverbatim */
  538. /* > */
  539. /* > \param[in] DIRECT */
  540. /* > \verbatim */
  541. /* > DIRECT is CHARACTER*1 */
  542. /* > Indicates how H is formed from a product of elementary */
  543. /* > reflectors */
  544. /* > = 'F': H = H(1) H(2) . . . H(k) (Forward) */
  545. /* > = 'B': H = H(k) . . . H(2) H(1) (Backward) */
  546. /* > \endverbatim */
  547. /* > */
  548. /* > \param[in] STOREV */
  549. /* > \verbatim */
  550. /* > STOREV is CHARACTER*1 */
  551. /* > Indicates how the vectors which define the elementary */
  552. /* > reflectors are stored: */
  553. /* > = 'C': Columns */
  554. /* > = 'R': Rows */
  555. /* > \endverbatim */
  556. /* > */
  557. /* > \param[in] M */
  558. /* > \verbatim */
  559. /* > M is INTEGER */
  560. /* > The number of rows of the matrix B. */
  561. /* > M >= 0. */
  562. /* > \endverbatim */
  563. /* > */
  564. /* > \param[in] N */
  565. /* > \verbatim */
  566. /* > N is INTEGER */
  567. /* > The number of columns of the matrix B. */
  568. /* > N >= 0. */
  569. /* > \endverbatim */
  570. /* > */
  571. /* > \param[in] K */
  572. /* > \verbatim */
  573. /* > K is INTEGER */
  574. /* > The order of the matrix T, i.e. the number of elementary */
  575. /* > reflectors whose product defines the block reflector. */
  576. /* > K >= 0. */
  577. /* > \endverbatim */
  578. /* > */
  579. /* > \param[in] L */
  580. /* > \verbatim */
  581. /* > L is INTEGER */
  582. /* > The order of the trapezoidal part of V. */
  583. /* > K >= L >= 0. See Further Details. */
  584. /* > \endverbatim */
  585. /* > */
  586. /* > \param[in] V */
  587. /* > \verbatim */
  588. /* > V is COMPLEX array, dimension */
  589. /* > (LDV,K) if STOREV = 'C' */
  590. /* > (LDV,M) if STOREV = 'R' and SIDE = 'L' */
  591. /* > (LDV,N) if STOREV = 'R' and SIDE = 'R' */
  592. /* > The pentagonal matrix V, which contains the elementary reflectors */
  593. /* > H(1), H(2), ..., H(K). See Further Details. */
  594. /* > \endverbatim */
  595. /* > */
  596. /* > \param[in] LDV */
  597. /* > \verbatim */
  598. /* > LDV is INTEGER */
  599. /* > The leading dimension of the array V. */
  600. /* > If STOREV = 'C' and SIDE = 'L', LDV >= f2cmax(1,M); */
  601. /* > if STOREV = 'C' and SIDE = 'R', LDV >= f2cmax(1,N); */
  602. /* > if STOREV = 'R', LDV >= K. */
  603. /* > \endverbatim */
  604. /* > */
  605. /* > \param[in] T */
  606. /* > \verbatim */
  607. /* > T is COMPLEX array, dimension (LDT,K) */
  608. /* > The triangular K-by-K matrix T in the representation of the */
  609. /* > block reflector. */
  610. /* > \endverbatim */
  611. /* > */
  612. /* > \param[in] LDT */
  613. /* > \verbatim */
  614. /* > LDT is INTEGER */
  615. /* > The leading dimension of the array T. */
  616. /* > LDT >= K. */
  617. /* > \endverbatim */
  618. /* > */
  619. /* > \param[in,out] A */
  620. /* > \verbatim */
  621. /* > A is COMPLEX array, dimension */
  622. /* > (LDA,N) if SIDE = 'L' or (LDA,K) if SIDE = 'R' */
  623. /* > On entry, the K-by-N or M-by-K matrix A. */
  624. /* > On exit, A is overwritten by the corresponding block of */
  625. /* > H*C or H**H*C or C*H or C*H**H. See Further Details. */
  626. /* > \endverbatim */
  627. /* > */
  628. /* > \param[in] LDA */
  629. /* > \verbatim */
  630. /* > LDA is INTEGER */
  631. /* > The leading dimension of the array A. */
  632. /* > If SIDE = 'L', LDA >= f2cmax(1,K); */
  633. /* > If SIDE = 'R', LDA >= f2cmax(1,M). */
  634. /* > \endverbatim */
  635. /* > */
  636. /* > \param[in,out] B */
  637. /* > \verbatim */
  638. /* > B is COMPLEX array, dimension (LDB,N) */
  639. /* > On entry, the M-by-N matrix B. */
  640. /* > On exit, B is overwritten by the corresponding block of */
  641. /* > H*C or H**H*C or C*H or C*H**H. See Further Details. */
  642. /* > \endverbatim */
  643. /* > */
  644. /* > \param[in] LDB */
  645. /* > \verbatim */
  646. /* > LDB is INTEGER */
  647. /* > The leading dimension of the array B. */
  648. /* > LDB >= f2cmax(1,M). */
  649. /* > \endverbatim */
  650. /* > */
  651. /* > \param[out] WORK */
  652. /* > \verbatim */
  653. /* > WORK is COMPLEX array, dimension */
  654. /* > (LDWORK,N) if SIDE = 'L', */
  655. /* > (LDWORK,K) if SIDE = 'R'. */
  656. /* > \endverbatim */
  657. /* > */
  658. /* > \param[in] LDWORK */
  659. /* > \verbatim */
  660. /* > LDWORK is INTEGER */
  661. /* > The leading dimension of the array WORK. */
  662. /* > If SIDE = 'L', LDWORK >= K; */
  663. /* > if SIDE = 'R', LDWORK >= M. */
  664. /* > \endverbatim */
  665. /* Authors: */
  666. /* ======== */
  667. /* > \author Univ. of Tennessee */
  668. /* > \author Univ. of California Berkeley */
  669. /* > \author Univ. of Colorado Denver */
  670. /* > \author NAG Ltd. */
  671. /* > \date December 2016 */
  672. /* > \ingroup complexOTHERauxiliary */
  673. /* > \par Further Details: */
  674. /* ===================== */
  675. /* > */
  676. /* > \verbatim */
  677. /* > */
  678. /* > The matrix C is a composite matrix formed from blocks A and B. */
  679. /* > The block B is of size M-by-N; if SIDE = 'R', A is of size M-by-K, */
  680. /* > and if SIDE = 'L', A is of size K-by-N. */
  681. /* > */
  682. /* > If SIDE = 'R' and DIRECT = 'F', C = [A B]. */
  683. /* > */
  684. /* > If SIDE = 'L' and DIRECT = 'F', C = [A] */
  685. /* > [B]. */
  686. /* > */
  687. /* > If SIDE = 'R' and DIRECT = 'B', C = [B A]. */
  688. /* > */
  689. /* > If SIDE = 'L' and DIRECT = 'B', C = [B] */
  690. /* > [A]. */
  691. /* > */
  692. /* > The pentagonal matrix V is composed of a rectangular block V1 and a */
  693. /* > trapezoidal block V2. The size of the trapezoidal block is determined by */
  694. /* > the parameter L, where 0<=L<=K. If L=K, the V2 block of V is triangular; */
  695. /* > if L=0, there is no trapezoidal block, thus V = V1 is rectangular. */
  696. /* > */
  697. /* > If DIRECT = 'F' and STOREV = 'C': V = [V1] */
  698. /* > [V2] */
  699. /* > - V2 is upper trapezoidal (first L rows of K-by-K upper triangular) */
  700. /* > */
  701. /* > If DIRECT = 'F' and STOREV = 'R': V = [V1 V2] */
  702. /* > */
  703. /* > - V2 is lower trapezoidal (first L columns of K-by-K lower triangular) */
  704. /* > */
  705. /* > If DIRECT = 'B' and STOREV = 'C': V = [V2] */
  706. /* > [V1] */
  707. /* > - V2 is lower trapezoidal (last L rows of K-by-K lower triangular) */
  708. /* > */
  709. /* > If DIRECT = 'B' and STOREV = 'R': V = [V2 V1] */
  710. /* > */
  711. /* > - V2 is upper trapezoidal (last L columns of K-by-K upper triangular) */
  712. /* > */
  713. /* > If STOREV = 'C' and SIDE = 'L', V is M-by-K with V2 L-by-K. */
  714. /* > */
  715. /* > If STOREV = 'C' and SIDE = 'R', V is N-by-K with V2 L-by-K. */
  716. /* > */
  717. /* > If STOREV = 'R' and SIDE = 'L', V is K-by-M with V2 K-by-L. */
  718. /* > */
  719. /* > If STOREV = 'R' and SIDE = 'R', V is K-by-N with V2 K-by-L. */
  720. /* > \endverbatim */
  721. /* > */
  722. /* ===================================================================== */
  723. /* Subroutine */ int ctprfb_(char *side, char *trans, char *direct, char *
  724. storev, integer *m, integer *n, integer *k, integer *l, complex *v,
  725. integer *ldv, complex *t, integer *ldt, complex *a, integer *lda,
  726. complex *b, integer *ldb, complex *work, integer *ldwork)
  727. {
  728. /* System generated locals */
  729. integer a_dim1, a_offset, b_dim1, b_offset, t_dim1, t_offset, v_dim1,
  730. v_offset, work_dim1, work_offset, i__1, i__2, i__3, i__4, i__5;
  731. complex q__1;
  732. /* Local variables */
  733. logical left, backward;
  734. integer i__, j;
  735. extern /* Subroutine */ int cgemm_(char *, char *, integer *, integer *,
  736. integer *, complex *, complex *, integer *, complex *, integer *,
  737. complex *, complex *, integer *);
  738. extern logical lsame_(char *, char *);
  739. logical right;
  740. extern /* Subroutine */ int ctrmm_(char *, char *, char *, char *,
  741. integer *, integer *, complex *, complex *, integer *, complex *,
  742. integer *);
  743. integer kp, mp, np;
  744. logical column, row, forward;
  745. /* -- LAPACK auxiliary routine (version 3.7.0) -- */
  746. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  747. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  748. /* December 2016 */
  749. /* ========================================================================== */
  750. /* Quick return if possible */
  751. /* Parameter adjustments */
  752. v_dim1 = *ldv;
  753. v_offset = 1 + v_dim1 * 1;
  754. v -= v_offset;
  755. t_dim1 = *ldt;
  756. t_offset = 1 + t_dim1 * 1;
  757. t -= t_offset;
  758. a_dim1 = *lda;
  759. a_offset = 1 + a_dim1 * 1;
  760. a -= a_offset;
  761. b_dim1 = *ldb;
  762. b_offset = 1 + b_dim1 * 1;
  763. b -= b_offset;
  764. work_dim1 = *ldwork;
  765. work_offset = 1 + work_dim1 * 1;
  766. work -= work_offset;
  767. /* Function Body */
  768. if (*m <= 0 || *n <= 0 || *k <= 0 || *l < 0) {
  769. return 0;
  770. }
  771. if (lsame_(storev, "C")) {
  772. column = TRUE_;
  773. row = FALSE_;
  774. } else if (lsame_(storev, "R")) {
  775. column = FALSE_;
  776. row = TRUE_;
  777. } else {
  778. column = FALSE_;
  779. row = FALSE_;
  780. }
  781. if (lsame_(side, "L")) {
  782. left = TRUE_;
  783. right = FALSE_;
  784. } else if (lsame_(side, "R")) {
  785. left = FALSE_;
  786. right = TRUE_;
  787. } else {
  788. left = FALSE_;
  789. right = FALSE_;
  790. }
  791. if (lsame_(direct, "F")) {
  792. forward = TRUE_;
  793. backward = FALSE_;
  794. } else if (lsame_(direct, "B")) {
  795. forward = FALSE_;
  796. backward = TRUE_;
  797. } else {
  798. forward = FALSE_;
  799. backward = FALSE_;
  800. }
  801. /* --------------------------------------------------------------------------- */
  802. if (column && forward && left) {
  803. /* --------------------------------------------------------------------------- */
  804. /* Let W = [ I ] (K-by-K) */
  805. /* [ V ] (M-by-K) */
  806. /* Form H C or H**H C where C = [ A ] (K-by-N) */
  807. /* [ B ] (M-by-N) */
  808. /* H = I - W T W**H or H**H = I - W T**H W**H */
  809. /* A = A - T (A + V**H B) or A = A - T**H (A + V**H B) */
  810. /* B = B - V T (A + V**H B) or B = B - V T**H (A + V**H B) */
  811. /* --------------------------------------------------------------------------- */
  812. /* Computing MIN */
  813. i__1 = *m - *l + 1;
  814. mp = f2cmin(i__1,*m);
  815. /* Computing MIN */
  816. i__1 = *l + 1;
  817. kp = f2cmin(i__1,*k);
  818. i__1 = *n;
  819. for (j = 1; j <= i__1; ++j) {
  820. i__2 = *l;
  821. for (i__ = 1; i__ <= i__2; ++i__) {
  822. i__3 = i__ + j * work_dim1;
  823. i__4 = *m - *l + i__ + j * b_dim1;
  824. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  825. }
  826. }
  827. ctrmm_("L", "U", "C", "N", l, n, &c_b1, &v[mp + v_dim1], ldv, &work[
  828. work_offset], ldwork);
  829. i__1 = *m - *l;
  830. cgemm_("C", "N", l, n, &i__1, &c_b1, &v[v_offset], ldv, &b[b_offset],
  831. ldb, &c_b1, &work[work_offset], ldwork);
  832. i__1 = *k - *l;
  833. cgemm_("C", "N", &i__1, n, m, &c_b1, &v[kp * v_dim1 + 1], ldv, &b[
  834. b_offset], ldb, &c_b2, &work[kp + work_dim1], ldwork);
  835. i__1 = *n;
  836. for (j = 1; j <= i__1; ++j) {
  837. i__2 = *k;
  838. for (i__ = 1; i__ <= i__2; ++i__) {
  839. i__3 = i__ + j * work_dim1;
  840. i__4 = i__ + j * work_dim1;
  841. i__5 = i__ + j * a_dim1;
  842. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  843. i__5].i;
  844. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  845. }
  846. }
  847. ctrmm_("L", "U", trans, "N", k, n, &c_b1, &t[t_offset], ldt, &work[
  848. work_offset], ldwork);
  849. i__1 = *n;
  850. for (j = 1; j <= i__1; ++j) {
  851. i__2 = *k;
  852. for (i__ = 1; i__ <= i__2; ++i__) {
  853. i__3 = i__ + j * a_dim1;
  854. i__4 = i__ + j * a_dim1;
  855. i__5 = i__ + j * work_dim1;
  856. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  857. i__5].i;
  858. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  859. }
  860. }
  861. i__1 = *m - *l;
  862. q__1.r = -1.f, q__1.i = 0.f;
  863. cgemm_("N", "N", &i__1, n, k, &q__1, &v[v_offset], ldv, &work[
  864. work_offset], ldwork, &c_b1, &b[b_offset], ldb);
  865. i__1 = *k - *l;
  866. q__1.r = -1.f, q__1.i = 0.f;
  867. cgemm_("N", "N", l, n, &i__1, &q__1, &v[mp + kp * v_dim1], ldv, &work[
  868. kp + work_dim1], ldwork, &c_b1, &b[mp + b_dim1], ldb);
  869. ctrmm_("L", "U", "N", "N", l, n, &c_b1, &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. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  879. i__5].i;
  880. b[i__3].r = q__1.r, b[i__3].i = q__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. ctrmm_("R", "U", "N", "N", m, l, &c_b1, &v[np + v_dim1], ldv, &work[
  909. work_offset], ldwork);
  910. i__1 = *n - *l;
  911. cgemm_("N", "N", m, l, &i__1, &c_b1, &b[b_offset], ldb, &v[v_offset],
  912. ldv, &c_b1, &work[work_offset], ldwork);
  913. i__1 = *k - *l;
  914. cgemm_("N", "N", m, &i__1, n, &c_b1, &b[b_offset], ldb, &v[kp *
  915. v_dim1 + 1], ldv, &c_b2, &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. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  924. i__5].i;
  925. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  926. }
  927. }
  928. ctrmm_("R", "U", trans, "N", m, k, &c_b1, &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. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  938. i__5].i;
  939. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  940. }
  941. }
  942. i__1 = *n - *l;
  943. q__1.r = -1.f, q__1.i = 0.f;
  944. cgemm_("N", "C", m, &i__1, k, &q__1, &work[work_offset], ldwork, &v[
  945. v_offset], ldv, &c_b1, &b[b_offset], ldb);
  946. i__1 = *k - *l;
  947. q__1.r = -1.f, q__1.i = 0.f;
  948. cgemm_("N", "C", m, l, &i__1, &q__1, &work[kp * work_dim1 + 1],
  949. ldwork, &v[np + kp * v_dim1], ldv, &c_b1, &b[np * b_dim1 + 1],
  950. ldb);
  951. ctrmm_("R", "U", "C", "N", m, l, &c_b1, &v[np + v_dim1], ldv, &work[
  952. work_offset], ldwork);
  953. i__1 = *l;
  954. for (j = 1; j <= i__1; ++j) {
  955. i__2 = *m;
  956. for (i__ = 1; i__ <= i__2; ++i__) {
  957. i__3 = i__ + (*n - *l + j) * b_dim1;
  958. i__4 = i__ + (*n - *l + j) * b_dim1;
  959. i__5 = i__ + j * work_dim1;
  960. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  961. i__5].i;
  962. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  963. }
  964. }
  965. /* --------------------------------------------------------------------------- */
  966. } else if (column && backward && left) {
  967. /* --------------------------------------------------------------------------- */
  968. /* Let W = [ V ] (M-by-K) */
  969. /* [ I ] (K-by-K) */
  970. /* Form H C or H**H C where C = [ B ] (M-by-N) */
  971. /* [ A ] (K-by-N) */
  972. /* H = I - W T W**H or H**H = I - W T**H W**H */
  973. /* A = A - T (A + V**H B) or A = A - T**H (A + V**H B) */
  974. /* B = B - V T (A + V**H B) or B = B - V T**H (A + V**H B) */
  975. /* --------------------------------------------------------------------------- */
  976. /* Computing MIN */
  977. i__1 = *l + 1;
  978. mp = f2cmin(i__1,*m);
  979. /* Computing MIN */
  980. i__1 = *k - *l + 1;
  981. kp = f2cmin(i__1,*k);
  982. i__1 = *n;
  983. for (j = 1; j <= i__1; ++j) {
  984. i__2 = *l;
  985. for (i__ = 1; i__ <= i__2; ++i__) {
  986. i__3 = *k - *l + i__ + j * work_dim1;
  987. i__4 = i__ + j * b_dim1;
  988. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  989. }
  990. }
  991. ctrmm_("L", "L", "C", "N", l, n, &c_b1, &v[kp * v_dim1 + 1], ldv, &
  992. work[kp + work_dim1], ldwork);
  993. i__1 = *m - *l;
  994. cgemm_("C", "N", l, n, &i__1, &c_b1, &v[mp + kp * v_dim1], ldv, &b[mp
  995. + b_dim1], ldb, &c_b1, &work[kp + work_dim1], ldwork);
  996. i__1 = *k - *l;
  997. cgemm_("C", "N", &i__1, n, m, &c_b1, &v[v_offset], ldv, &b[b_offset],
  998. ldb, &c_b2, &work[work_offset], ldwork);
  999. i__1 = *n;
  1000. for (j = 1; j <= i__1; ++j) {
  1001. i__2 = *k;
  1002. for (i__ = 1; i__ <= i__2; ++i__) {
  1003. i__3 = i__ + j * work_dim1;
  1004. i__4 = i__ + j * work_dim1;
  1005. i__5 = i__ + j * a_dim1;
  1006. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  1007. i__5].i;
  1008. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  1009. }
  1010. }
  1011. ctrmm_("L", "L", trans, "N", k, n, &c_b1, &t[t_offset], ldt, &work[
  1012. work_offset], ldwork);
  1013. i__1 = *n;
  1014. for (j = 1; j <= i__1; ++j) {
  1015. i__2 = *k;
  1016. for (i__ = 1; i__ <= i__2; ++i__) {
  1017. i__3 = i__ + j * a_dim1;
  1018. i__4 = i__ + j * a_dim1;
  1019. i__5 = i__ + j * work_dim1;
  1020. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  1021. i__5].i;
  1022. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  1023. }
  1024. }
  1025. i__1 = *m - *l;
  1026. q__1.r = -1.f, q__1.i = 0.f;
  1027. cgemm_("N", "N", &i__1, n, k, &q__1, &v[mp + v_dim1], ldv, &work[
  1028. work_offset], ldwork, &c_b1, &b[mp + b_dim1], ldb);
  1029. i__1 = *k - *l;
  1030. q__1.r = -1.f, q__1.i = 0.f;
  1031. cgemm_("N", "N", l, n, &i__1, &q__1, &v[v_offset], ldv, &work[
  1032. work_offset], ldwork, &c_b1, &b[b_offset], ldb);
  1033. ctrmm_("L", "L", "N", "N", l, n, &c_b1, &v[kp * v_dim1 + 1], ldv, &
  1034. work[kp + work_dim1], ldwork);
  1035. i__1 = *n;
  1036. for (j = 1; j <= i__1; ++j) {
  1037. i__2 = *l;
  1038. for (i__ = 1; i__ <= i__2; ++i__) {
  1039. i__3 = i__ + j * b_dim1;
  1040. i__4 = i__ + j * b_dim1;
  1041. i__5 = *k - *l + i__ + j * work_dim1;
  1042. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  1043. i__5].i;
  1044. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  1045. }
  1046. }
  1047. /* --------------------------------------------------------------------------- */
  1048. } else if (column && backward && right) {
  1049. /* --------------------------------------------------------------------------- */
  1050. /* Let W = [ V ] (N-by-K) */
  1051. /* [ I ] (K-by-K) */
  1052. /* Form C H or C H**H where C = [ B A ] (B is M-by-N, A is M-by-K) */
  1053. /* H = I - W T W**H or H**H = I - W T**H W**H */
  1054. /* A = A - (A + B V) T or A = A - (A + B V) T**H */
  1055. /* B = B - (A + B V) T V**H or B = B - (A + B V) T**H V**H */
  1056. /* --------------------------------------------------------------------------- */
  1057. /* Computing MIN */
  1058. i__1 = *l + 1;
  1059. np = f2cmin(i__1,*n);
  1060. /* Computing MIN */
  1061. i__1 = *k - *l + 1;
  1062. kp = f2cmin(i__1,*k);
  1063. i__1 = *l;
  1064. for (j = 1; j <= i__1; ++j) {
  1065. i__2 = *m;
  1066. for (i__ = 1; i__ <= i__2; ++i__) {
  1067. i__3 = i__ + (*k - *l + j) * work_dim1;
  1068. i__4 = i__ + j * b_dim1;
  1069. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1070. }
  1071. }
  1072. ctrmm_("R", "L", "N", "N", m, l, &c_b1, &v[kp * v_dim1 + 1], ldv, &
  1073. work[kp * work_dim1 + 1], ldwork);
  1074. i__1 = *n - *l;
  1075. cgemm_("N", "N", m, l, &i__1, &c_b1, &b[np * b_dim1 + 1], ldb, &v[np
  1076. + kp * v_dim1], ldv, &c_b1, &work[kp * work_dim1 + 1], ldwork);
  1077. i__1 = *k - *l;
  1078. cgemm_("N", "N", m, &i__1, n, &c_b1, &b[b_offset], ldb, &v[v_offset],
  1079. ldv, &c_b2, &work[work_offset], ldwork);
  1080. i__1 = *k;
  1081. for (j = 1; j <= i__1; ++j) {
  1082. i__2 = *m;
  1083. for (i__ = 1; i__ <= i__2; ++i__) {
  1084. i__3 = i__ + j * work_dim1;
  1085. i__4 = i__ + j * work_dim1;
  1086. i__5 = i__ + j * a_dim1;
  1087. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  1088. i__5].i;
  1089. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  1090. }
  1091. }
  1092. ctrmm_("R", "L", trans, "N", m, k, &c_b1, &t[t_offset], ldt, &work[
  1093. work_offset], ldwork);
  1094. i__1 = *k;
  1095. for (j = 1; j <= i__1; ++j) {
  1096. i__2 = *m;
  1097. for (i__ = 1; i__ <= i__2; ++i__) {
  1098. i__3 = i__ + j * a_dim1;
  1099. i__4 = i__ + j * a_dim1;
  1100. i__5 = i__ + j * work_dim1;
  1101. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  1102. i__5].i;
  1103. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  1104. }
  1105. }
  1106. i__1 = *n - *l;
  1107. q__1.r = -1.f, q__1.i = 0.f;
  1108. cgemm_("N", "C", m, &i__1, k, &q__1, &work[work_offset], ldwork, &v[
  1109. np + v_dim1], ldv, &c_b1, &b[np * b_dim1 + 1], ldb);
  1110. i__1 = *k - *l;
  1111. q__1.r = -1.f, q__1.i = 0.f;
  1112. cgemm_("N", "C", m, l, &i__1, &q__1, &work[work_offset], ldwork, &v[
  1113. v_offset], ldv, &c_b1, &b[b_offset], ldb);
  1114. ctrmm_("R", "L", "C", "N", m, l, &c_b1, &v[kp * v_dim1 + 1], ldv, &
  1115. work[kp * work_dim1 + 1], ldwork);
  1116. i__1 = *l;
  1117. for (j = 1; j <= i__1; ++j) {
  1118. i__2 = *m;
  1119. for (i__ = 1; i__ <= i__2; ++i__) {
  1120. i__3 = i__ + j * b_dim1;
  1121. i__4 = i__ + j * b_dim1;
  1122. i__5 = i__ + (*k - *l + j) * work_dim1;
  1123. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  1124. i__5].i;
  1125. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  1126. }
  1127. }
  1128. /* --------------------------------------------------------------------------- */
  1129. } else if (row && forward && left) {
  1130. /* --------------------------------------------------------------------------- */
  1131. /* Let W = [ I V ] ( I is K-by-K, V is K-by-M ) */
  1132. /* Form H C or H**H C where C = [ A ] (K-by-N) */
  1133. /* [ B ] (M-by-N) */
  1134. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1135. /* A = A - T (A + V B) or A = A - T**H (A + V B) */
  1136. /* B = B - V**H T (A + V B) or B = B - V**H T**H (A + V B) */
  1137. /* --------------------------------------------------------------------------- */
  1138. /* Computing MIN */
  1139. i__1 = *m - *l + 1;
  1140. mp = f2cmin(i__1,*m);
  1141. /* Computing MIN */
  1142. i__1 = *l + 1;
  1143. kp = f2cmin(i__1,*k);
  1144. i__1 = *n;
  1145. for (j = 1; j <= i__1; ++j) {
  1146. i__2 = *l;
  1147. for (i__ = 1; i__ <= i__2; ++i__) {
  1148. i__3 = i__ + j * work_dim1;
  1149. i__4 = *m - *l + i__ + j * b_dim1;
  1150. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1151. }
  1152. }
  1153. ctrmm_("L", "L", "N", "N", l, n, &c_b1, &v[mp * v_dim1 + 1], ldv, &
  1154. work[work_offset], ldb);
  1155. i__1 = *m - *l;
  1156. cgemm_("N", "N", l, n, &i__1, &c_b1, &v[v_offset], ldv, &b[b_offset],
  1157. ldb, &c_b1, &work[work_offset], ldwork);
  1158. i__1 = *k - *l;
  1159. cgemm_("N", "N", &i__1, n, m, &c_b1, &v[kp + v_dim1], ldv, &b[
  1160. b_offset], ldb, &c_b2, &work[kp + work_dim1], ldwork);
  1161. i__1 = *n;
  1162. for (j = 1; j <= i__1; ++j) {
  1163. i__2 = *k;
  1164. for (i__ = 1; i__ <= i__2; ++i__) {
  1165. i__3 = i__ + j * work_dim1;
  1166. i__4 = i__ + j * work_dim1;
  1167. i__5 = i__ + j * a_dim1;
  1168. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  1169. i__5].i;
  1170. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  1171. }
  1172. }
  1173. ctrmm_("L", "U", trans, "N", k, n, &c_b1, &t[t_offset], ldt, &work[
  1174. work_offset], ldwork);
  1175. i__1 = *n;
  1176. for (j = 1; j <= i__1; ++j) {
  1177. i__2 = *k;
  1178. for (i__ = 1; i__ <= i__2; ++i__) {
  1179. i__3 = i__ + j * a_dim1;
  1180. i__4 = i__ + j * a_dim1;
  1181. i__5 = i__ + j * work_dim1;
  1182. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  1183. i__5].i;
  1184. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  1185. }
  1186. }
  1187. i__1 = *m - *l;
  1188. q__1.r = -1.f, q__1.i = 0.f;
  1189. cgemm_("C", "N", &i__1, n, k, &q__1, &v[v_offset], ldv, &work[
  1190. work_offset], ldwork, &c_b1, &b[b_offset], ldb);
  1191. i__1 = *k - *l;
  1192. q__1.r = -1.f, q__1.i = 0.f;
  1193. cgemm_("C", "N", l, n, &i__1, &q__1, &v[kp + mp * v_dim1], ldv, &work[
  1194. kp + work_dim1], ldwork, &c_b1, &b[mp + b_dim1], ldb);
  1195. ctrmm_("L", "L", "C", "N", l, n, &c_b1, &v[mp * v_dim1 + 1], ldv, &
  1196. work[work_offset], ldwork);
  1197. i__1 = *n;
  1198. for (j = 1; j <= i__1; ++j) {
  1199. i__2 = *l;
  1200. for (i__ = 1; i__ <= i__2; ++i__) {
  1201. i__3 = *m - *l + i__ + j * b_dim1;
  1202. i__4 = *m - *l + i__ + j * b_dim1;
  1203. i__5 = i__ + j * work_dim1;
  1204. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  1205. i__5].i;
  1206. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  1207. }
  1208. }
  1209. /* --------------------------------------------------------------------------- */
  1210. } else if (row && forward && right) {
  1211. /* --------------------------------------------------------------------------- */
  1212. /* Let W = [ I V ] ( I is K-by-K, V is K-by-N ) */
  1213. /* Form C H or C H**H where C = [ A B ] (A is M-by-K, B is M-by-N) */
  1214. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1215. /* A = A - (A + B V**H) T or A = A - (A + B V**H) T**H */
  1216. /* B = B - (A + B V**H) T V or B = B - (A + B V**H) T**H V */
  1217. /* --------------------------------------------------------------------------- */
  1218. /* Computing MIN */
  1219. i__1 = *n - *l + 1;
  1220. np = f2cmin(i__1,*n);
  1221. /* Computing MIN */
  1222. i__1 = *l + 1;
  1223. kp = f2cmin(i__1,*k);
  1224. i__1 = *l;
  1225. for (j = 1; j <= i__1; ++j) {
  1226. i__2 = *m;
  1227. for (i__ = 1; i__ <= i__2; ++i__) {
  1228. i__3 = i__ + j * work_dim1;
  1229. i__4 = i__ + (*n - *l + j) * b_dim1;
  1230. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1231. }
  1232. }
  1233. ctrmm_("R", "L", "C", "N", m, l, &c_b1, &v[np * v_dim1 + 1], ldv, &
  1234. work[work_offset], ldwork);
  1235. i__1 = *n - *l;
  1236. cgemm_("N", "C", m, l, &i__1, &c_b1, &b[b_offset], ldb, &v[v_offset],
  1237. ldv, &c_b1, &work[work_offset], ldwork);
  1238. i__1 = *k - *l;
  1239. cgemm_("N", "C", m, &i__1, n, &c_b1, &b[b_offset], ldb, &v[kp +
  1240. v_dim1], ldv, &c_b2, &work[kp * work_dim1 + 1], ldwork);
  1241. i__1 = *k;
  1242. for (j = 1; j <= i__1; ++j) {
  1243. i__2 = *m;
  1244. for (i__ = 1; i__ <= i__2; ++i__) {
  1245. i__3 = i__ + j * work_dim1;
  1246. i__4 = i__ + j * work_dim1;
  1247. i__5 = i__ + j * a_dim1;
  1248. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  1249. i__5].i;
  1250. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  1251. }
  1252. }
  1253. ctrmm_("R", "U", trans, "N", m, k, &c_b1, &t[t_offset], ldt, &work[
  1254. work_offset], ldwork);
  1255. i__1 = *k;
  1256. for (j = 1; j <= i__1; ++j) {
  1257. i__2 = *m;
  1258. for (i__ = 1; i__ <= i__2; ++i__) {
  1259. i__3 = i__ + j * a_dim1;
  1260. i__4 = i__ + j * a_dim1;
  1261. i__5 = i__ + j * work_dim1;
  1262. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  1263. i__5].i;
  1264. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  1265. }
  1266. }
  1267. i__1 = *n - *l;
  1268. q__1.r = -1.f, q__1.i = 0.f;
  1269. cgemm_("N", "N", m, &i__1, k, &q__1, &work[work_offset], ldwork, &v[
  1270. v_offset], ldv, &c_b1, &b[b_offset], ldb);
  1271. i__1 = *k - *l;
  1272. q__1.r = -1.f, q__1.i = 0.f;
  1273. cgemm_("N", "N", m, l, &i__1, &q__1, &work[kp * work_dim1 + 1],
  1274. ldwork, &v[kp + np * v_dim1], ldv, &c_b1, &b[np * b_dim1 + 1],
  1275. ldb);
  1276. ctrmm_("R", "L", "N", "N", m, l, &c_b1, &v[np * v_dim1 + 1], ldv, &
  1277. work[work_offset], ldwork);
  1278. i__1 = *l;
  1279. for (j = 1; j <= i__1; ++j) {
  1280. i__2 = *m;
  1281. for (i__ = 1; i__ <= i__2; ++i__) {
  1282. i__3 = i__ + (*n - *l + j) * b_dim1;
  1283. i__4 = i__ + (*n - *l + j) * b_dim1;
  1284. i__5 = i__ + j * work_dim1;
  1285. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  1286. i__5].i;
  1287. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  1288. }
  1289. }
  1290. /* --------------------------------------------------------------------------- */
  1291. } else if (row && backward && left) {
  1292. /* --------------------------------------------------------------------------- */
  1293. /* Let W = [ V I ] ( I is K-by-K, V is K-by-M ) */
  1294. /* Form H C or H**H C where C = [ B ] (M-by-N) */
  1295. /* [ A ] (K-by-N) */
  1296. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1297. /* A = A - T (A + V B) or A = A - T**H (A + V B) */
  1298. /* B = B - V**H T (A + V B) or B = B - V**H T**H (A + V B) */
  1299. /* --------------------------------------------------------------------------- */
  1300. /* Computing MIN */
  1301. i__1 = *l + 1;
  1302. mp = f2cmin(i__1,*m);
  1303. /* Computing MIN */
  1304. i__1 = *k - *l + 1;
  1305. kp = f2cmin(i__1,*k);
  1306. i__1 = *n;
  1307. for (j = 1; j <= i__1; ++j) {
  1308. i__2 = *l;
  1309. for (i__ = 1; i__ <= i__2; ++i__) {
  1310. i__3 = *k - *l + i__ + j * work_dim1;
  1311. i__4 = i__ + j * b_dim1;
  1312. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1313. }
  1314. }
  1315. ctrmm_("L", "U", "N", "N", l, n, &c_b1, &v[kp + v_dim1], ldv, &work[
  1316. kp + work_dim1], ldwork);
  1317. i__1 = *m - *l;
  1318. cgemm_("N", "N", l, n, &i__1, &c_b1, &v[kp + mp * v_dim1], ldv, &b[mp
  1319. + b_dim1], ldb, &c_b1, &work[kp + work_dim1], ldwork);
  1320. i__1 = *k - *l;
  1321. cgemm_("N", "N", &i__1, n, m, &c_b1, &v[v_offset], ldv, &b[b_offset],
  1322. ldb, &c_b2, &work[work_offset], ldwork);
  1323. i__1 = *n;
  1324. for (j = 1; j <= i__1; ++j) {
  1325. i__2 = *k;
  1326. for (i__ = 1; i__ <= i__2; ++i__) {
  1327. i__3 = i__ + j * work_dim1;
  1328. i__4 = i__ + j * work_dim1;
  1329. i__5 = i__ + j * a_dim1;
  1330. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  1331. i__5].i;
  1332. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  1333. }
  1334. }
  1335. ctrmm_("L", "L ", trans, "N", k, n, &c_b1, &t[t_offset], ldt, &work[
  1336. work_offset], ldwork);
  1337. i__1 = *n;
  1338. for (j = 1; j <= i__1; ++j) {
  1339. i__2 = *k;
  1340. for (i__ = 1; i__ <= i__2; ++i__) {
  1341. i__3 = i__ + j * a_dim1;
  1342. i__4 = i__ + j * a_dim1;
  1343. i__5 = i__ + j * work_dim1;
  1344. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  1345. i__5].i;
  1346. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  1347. }
  1348. }
  1349. i__1 = *m - *l;
  1350. q__1.r = -1.f, q__1.i = 0.f;
  1351. cgemm_("C", "N", &i__1, n, k, &q__1, &v[mp * v_dim1 + 1], ldv, &work[
  1352. work_offset], ldwork, &c_b1, &b[mp + b_dim1], ldb);
  1353. i__1 = *k - *l;
  1354. q__1.r = -1.f, q__1.i = 0.f;
  1355. cgemm_("C", "N", l, n, &i__1, &q__1, &v[v_offset], ldv, &work[
  1356. work_offset], ldwork, &c_b1, &b[b_offset], ldb);
  1357. ctrmm_("L", "U", "C", "N", l, n, &c_b1, &v[kp + v_dim1], ldv, &work[
  1358. kp + work_dim1], ldwork);
  1359. i__1 = *n;
  1360. for (j = 1; j <= i__1; ++j) {
  1361. i__2 = *l;
  1362. for (i__ = 1; i__ <= i__2; ++i__) {
  1363. i__3 = i__ + j * b_dim1;
  1364. i__4 = i__ + j * b_dim1;
  1365. i__5 = *k - *l + i__ + j * work_dim1;
  1366. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  1367. i__5].i;
  1368. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  1369. }
  1370. }
  1371. /* --------------------------------------------------------------------------- */
  1372. } else if (row && backward && right) {
  1373. /* --------------------------------------------------------------------------- */
  1374. /* Let W = [ V I ] ( I is K-by-K, V is K-by-N ) */
  1375. /* Form C H or C H**H where C = [ B A ] (A is M-by-K, B is M-by-N) */
  1376. /* H = I - W**H T W or H**H = I - W**H T**H W */
  1377. /* A = A - (A + B V**H) T or A = A - (A + B V**H) T**H */
  1378. /* B = B - (A + B V**H) T V or B = B - (A + B V**H) T**H V */
  1379. /* --------------------------------------------------------------------------- */
  1380. /* Computing MIN */
  1381. i__1 = *l + 1;
  1382. np = f2cmin(i__1,*n);
  1383. /* Computing MIN */
  1384. i__1 = *k - *l + 1;
  1385. kp = f2cmin(i__1,*k);
  1386. i__1 = *l;
  1387. for (j = 1; j <= i__1; ++j) {
  1388. i__2 = *m;
  1389. for (i__ = 1; i__ <= i__2; ++i__) {
  1390. i__3 = i__ + (*k - *l + j) * work_dim1;
  1391. i__4 = i__ + j * b_dim1;
  1392. work[i__3].r = b[i__4].r, work[i__3].i = b[i__4].i;
  1393. }
  1394. }
  1395. ctrmm_("R", "U", "C", "N", m, l, &c_b1, &v[kp + v_dim1], ldv, &work[
  1396. kp * work_dim1 + 1], ldwork);
  1397. i__1 = *n - *l;
  1398. cgemm_("N", "C", m, l, &i__1, &c_b1, &b[np * b_dim1 + 1], ldb, &v[kp
  1399. + np * v_dim1], ldv, &c_b1, &work[kp * work_dim1 + 1], ldwork);
  1400. i__1 = *k - *l;
  1401. cgemm_("N", "C", m, &i__1, n, &c_b1, &b[b_offset], ldb, &v[v_offset],
  1402. ldv, &c_b2, &work[work_offset], ldwork);
  1403. i__1 = *k;
  1404. for (j = 1; j <= i__1; ++j) {
  1405. i__2 = *m;
  1406. for (i__ = 1; i__ <= i__2; ++i__) {
  1407. i__3 = i__ + j * work_dim1;
  1408. i__4 = i__ + j * work_dim1;
  1409. i__5 = i__ + j * a_dim1;
  1410. q__1.r = work[i__4].r + a[i__5].r, q__1.i = work[i__4].i + a[
  1411. i__5].i;
  1412. work[i__3].r = q__1.r, work[i__3].i = q__1.i;
  1413. }
  1414. }
  1415. ctrmm_("R", "L", trans, "N", m, k, &c_b1, &t[t_offset], ldt, &work[
  1416. work_offset], ldwork);
  1417. i__1 = *k;
  1418. for (j = 1; j <= i__1; ++j) {
  1419. i__2 = *m;
  1420. for (i__ = 1; i__ <= i__2; ++i__) {
  1421. i__3 = i__ + j * a_dim1;
  1422. i__4 = i__ + j * a_dim1;
  1423. i__5 = i__ + j * work_dim1;
  1424. q__1.r = a[i__4].r - work[i__5].r, q__1.i = a[i__4].i - work[
  1425. i__5].i;
  1426. a[i__3].r = q__1.r, a[i__3].i = q__1.i;
  1427. }
  1428. }
  1429. i__1 = *n - *l;
  1430. q__1.r = -1.f, q__1.i = 0.f;
  1431. cgemm_("N", "N", m, &i__1, k, &q__1, &work[work_offset], ldwork, &v[
  1432. np * v_dim1 + 1], ldv, &c_b1, &b[np * b_dim1 + 1], ldb);
  1433. i__1 = *k - *l;
  1434. q__1.r = -1.f, q__1.i = 0.f;
  1435. cgemm_("N", "N", m, l, &i__1, &q__1, &work[work_offset], ldwork, &v[
  1436. v_offset], ldv, &c_b1, &b[b_offset], ldb);
  1437. ctrmm_("R", "U", "N", "N", m, l, &c_b1, &v[kp + v_dim1], ldv, &work[
  1438. kp * work_dim1 + 1], ldwork);
  1439. i__1 = *l;
  1440. for (j = 1; j <= i__1; ++j) {
  1441. i__2 = *m;
  1442. for (i__ = 1; i__ <= i__2; ++i__) {
  1443. i__3 = i__ + j * b_dim1;
  1444. i__4 = i__ + j * b_dim1;
  1445. i__5 = i__ + (*k - *l + j) * work_dim1;
  1446. q__1.r = b[i__4].r - work[i__5].r, q__1.i = b[i__4].i - work[
  1447. i__5].i;
  1448. b[i__3].r = q__1.r, b[i__3].i = q__1.i;
  1449. }
  1450. }
  1451. }
  1452. return 0;
  1453. /* End of CTPRFB */
  1454. } /* ctprfb_ */