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 45 kB

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