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.

stprfb.c 40 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355
  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 real c_b12 = 1.f;
  363. static real c_b20 = 0.f;
  364. static real c_b27 = -1.f;
  365. /* > \brief \b STPRFB applies a real or complex "triangular-pentagonal" blocked reflector to a real or complex
  366. matrix, which is composed of two blocks. */
  367. /* =========== DOCUMENTATION =========== */
  368. /* Online html documentation available at */
  369. /* http://www.netlib.org/lapack/explore-html/ */
  370. /* > \htmlonly */
  371. /* > Download STPRFB + dependencies */
  372. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stprfb.
  373. f"> */
  374. /* > [TGZ]</a> */
  375. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stprfb.
  376. f"> */
  377. /* > [ZIP]</a> */
  378. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stprfb.
  379. f"> */
  380. /* > [TXT]</a> */
  381. /* > \endhtmlonly */
  382. /* Definition: */
  383. /* =========== */
  384. /* SUBROUTINE STPRFB( SIDE, TRANS, DIRECT, STOREV, M, N, K, L, */
  385. /* V, LDV, T, LDT, A, LDA, B, LDB, WORK, LDWORK ) */
  386. /* CHARACTER DIRECT, SIDE, STOREV, TRANS */
  387. /* INTEGER K, L, LDA, LDB, LDT, LDV, LDWORK, M, N */
  388. /* REAL A( LDA, * ), B( LDB, * ), T( LDT, * ), */
  389. /* $ V( LDV, * ), WORK( LDWORK, * ) */
  390. /* > \par Purpose: */
  391. /* ============= */
  392. /* > */
  393. /* > \verbatim */
  394. /* > */
  395. /* > STPRFB applies a real "triangular-pentagonal" block reflector H or its */
  396. /* > conjugate transpose H^H to a real matrix C, which is composed of two */
  397. /* > blocks A and B, either from the left or right. */
  398. /* > */
  399. /* > \endverbatim */
  400. /* Arguments: */
  401. /* ========== */
  402. /* > \param[in] SIDE */
  403. /* > \verbatim */
  404. /* > SIDE is CHARACTER*1 */
  405. /* > = 'L': apply H or H^H from the Left */
  406. /* > = 'R': apply H or H^H from the Right */
  407. /* > \endverbatim */
  408. /* > */
  409. /* > \param[in] TRANS */
  410. /* > \verbatim */
  411. /* > TRANS is CHARACTER*1 */
  412. /* > = 'N': apply H (No transpose) */
  413. /* > = 'C': apply H^H (Conjugate transpose) */
  414. /* > \endverbatim */
  415. /* > */
  416. /* > \param[in] DIRECT */
  417. /* > \verbatim */
  418. /* > DIRECT is CHARACTER*1 */
  419. /* > Indicates how H is formed from a product of elementary */
  420. /* > reflectors */
  421. /* > = 'F': H = H(1) H(2) . . . H(k) (Forward) */
  422. /* > = 'B': H = H(k) . . . H(2) H(1) (Backward) */
  423. /* > \endverbatim */
  424. /* > */
  425. /* > \param[in] STOREV */
  426. /* > \verbatim */
  427. /* > STOREV is CHARACTER*1 */
  428. /* > Indicates how the vectors which define the elementary */
  429. /* > reflectors are stored: */
  430. /* > = 'C': Columns */
  431. /* > = 'R': Rows */
  432. /* > \endverbatim */
  433. /* > */
  434. /* > \param[in] M */
  435. /* > \verbatim */
  436. /* > M is INTEGER */
  437. /* > The number of rows of the matrix B. */
  438. /* > M >= 0. */
  439. /* > \endverbatim */
  440. /* > */
  441. /* > \param[in] N */
  442. /* > \verbatim */
  443. /* > N is INTEGER */
  444. /* > The number of columns of the matrix B. */
  445. /* > N >= 0. */
  446. /* > \endverbatim */
  447. /* > */
  448. /* > \param[in] K */
  449. /* > \verbatim */
  450. /* > K is INTEGER */
  451. /* > The order of the matrix T, i.e. the number of elementary */
  452. /* > reflectors whose product defines the block reflector. */
  453. /* > K >= 0. */
  454. /* > \endverbatim */
  455. /* > */
  456. /* > \param[in] L */
  457. /* > \verbatim */
  458. /* > L is INTEGER */
  459. /* > The order of the trapezoidal part of V. */
  460. /* > K >= L >= 0. See Further Details. */
  461. /* > \endverbatim */
  462. /* > */
  463. /* > \param[in] V */
  464. /* > \verbatim */
  465. /* > V is REAL array, dimension */
  466. /* > (LDV,K) if STOREV = 'C' */
  467. /* > (LDV,M) if STOREV = 'R' and SIDE = 'L' */
  468. /* > (LDV,N) if STOREV = 'R' and SIDE = 'R' */
  469. /* > The pentagonal matrix V, which contains the elementary reflectors */
  470. /* > H(1), H(2), ..., H(K). See Further Details. */
  471. /* > \endverbatim */
  472. /* > */
  473. /* > \param[in] LDV */
  474. /* > \verbatim */
  475. /* > LDV is INTEGER */
  476. /* > The leading dimension of the array V. */
  477. /* > If STOREV = 'C' and SIDE = 'L', LDV >= f2cmax(1,M); */
  478. /* > if STOREV = 'C' and SIDE = 'R', LDV >= f2cmax(1,N); */
  479. /* > if STOREV = 'R', LDV >= K. */
  480. /* > \endverbatim */
  481. /* > */
  482. /* > \param[in] T */
  483. /* > \verbatim */
  484. /* > T is REAL array, dimension (LDT,K) */
  485. /* > The triangular K-by-K matrix T in the representation of the */
  486. /* > block reflector. */
  487. /* > \endverbatim */
  488. /* > */
  489. /* > \param[in] LDT */
  490. /* > \verbatim */
  491. /* > LDT is INTEGER */
  492. /* > The leading dimension of the array T. */
  493. /* > LDT >= K. */
  494. /* > \endverbatim */
  495. /* > */
  496. /* > \param[in,out] A */
  497. /* > \verbatim */
  498. /* > A is REAL array, dimension */
  499. /* > (LDA,N) if SIDE = 'L' or (LDA,K) if SIDE = 'R' */
  500. /* > On entry, the K-by-N or M-by-K matrix A. */
  501. /* > On exit, A is overwritten by the corresponding block of */
  502. /* > H*C or H^H*C or C*H or C*H^H. See Further Details. */
  503. /* > \endverbatim */
  504. /* > */
  505. /* > \param[in] LDA */
  506. /* > \verbatim */
  507. /* > LDA is INTEGER */
  508. /* > The leading dimension of the array A. */
  509. /* > If SIDE = 'L', LDA >= f2cmax(1,K); */
  510. /* > If SIDE = 'R', LDA >= f2cmax(1,M). */
  511. /* > \endverbatim */
  512. /* > */
  513. /* > \param[in,out] B */
  514. /* > \verbatim */
  515. /* > B is REAL array, dimension (LDB,N) */
  516. /* > On entry, the M-by-N matrix B. */
  517. /* > On exit, B is overwritten by the corresponding block of */
  518. /* > H*C or H^H*C or C*H or C*H^H. See Further Details. */
  519. /* > \endverbatim */
  520. /* > */
  521. /* > \param[in] LDB */
  522. /* > \verbatim */
  523. /* > LDB is INTEGER */
  524. /* > The leading dimension of the array B. */
  525. /* > LDB >= f2cmax(1,M). */
  526. /* > \endverbatim */
  527. /* > */
  528. /* > \param[out] WORK */
  529. /* > \verbatim */
  530. /* > WORK is REAL array, dimension */
  531. /* > (LDWORK,N) if SIDE = 'L', */
  532. /* > (LDWORK,K) if SIDE = 'R'. */
  533. /* > \endverbatim */
  534. /* > */
  535. /* > \param[in] LDWORK */
  536. /* > \verbatim */
  537. /* > LDWORK is INTEGER */
  538. /* > The leading dimension of the array WORK. */
  539. /* > If SIDE = 'L', LDWORK >= K; */
  540. /* > if SIDE = 'R', LDWORK >= M. */
  541. /* > \endverbatim */
  542. /* Authors: */
  543. /* ======== */
  544. /* > \author Univ. of Tennessee */
  545. /* > \author Univ. of California Berkeley */
  546. /* > \author Univ. of Colorado Denver */
  547. /* > \author NAG Ltd. */
  548. /* > \date December 2016 */
  549. /* > \ingroup realOTHERauxiliary */
  550. /* > \par Further Details: */
  551. /* ===================== */
  552. /* > */
  553. /* > \verbatim */
  554. /* > */
  555. /* > The matrix C is a composite matrix formed from blocks A and B. */
  556. /* > The block B is of size M-by-N; if SIDE = 'R', A is of size M-by-K, */
  557. /* > and if SIDE = 'L', A is of size K-by-N. */
  558. /* > */
  559. /* > If SIDE = 'R' and DIRECT = 'F', C = [A B]. */
  560. /* > */
  561. /* > If SIDE = 'L' and DIRECT = 'F', C = [A] */
  562. /* > [B]. */
  563. /* > */
  564. /* > If SIDE = 'R' and DIRECT = 'B', C = [B A]. */
  565. /* > */
  566. /* > If SIDE = 'L' and DIRECT = 'B', C = [B] */
  567. /* > [A]. */
  568. /* > */
  569. /* > The pentagonal matrix V is composed of a rectangular block V1 and a */
  570. /* > trapezoidal block V2. The size of the trapezoidal block is determined by */
  571. /* > the parameter L, where 0<=L<=K. If L=K, the V2 block of V is triangular; */
  572. /* > if L=0, there is no trapezoidal block, thus V = V1 is rectangular. */
  573. /* > */
  574. /* > If DIRECT = 'F' and STOREV = 'C': V = [V1] */
  575. /* > [V2] */
  576. /* > - V2 is upper trapezoidal (first L rows of K-by-K upper triangular) */
  577. /* > */
  578. /* > If DIRECT = 'F' and STOREV = 'R': V = [V1 V2] */
  579. /* > */
  580. /* > - V2 is lower trapezoidal (first L columns of K-by-K lower triangular) */
  581. /* > */
  582. /* > If DIRECT = 'B' and STOREV = 'C': V = [V2] */
  583. /* > [V1] */
  584. /* > - V2 is lower trapezoidal (last L rows of K-by-K lower triangular) */
  585. /* > */
  586. /* > If DIRECT = 'B' and STOREV = 'R': V = [V2 V1] */
  587. /* > */
  588. /* > - V2 is upper trapezoidal (last L columns of K-by-K upper triangular) */
  589. /* > */
  590. /* > If STOREV = 'C' and SIDE = 'L', V is M-by-K with V2 L-by-K. */
  591. /* > */
  592. /* > If STOREV = 'C' and SIDE = 'R', V is N-by-K with V2 L-by-K. */
  593. /* > */
  594. /* > If STOREV = 'R' and SIDE = 'L', V is K-by-M with V2 K-by-L. */
  595. /* > */
  596. /* > If STOREV = 'R' and SIDE = 'R', V is K-by-N with V2 K-by-L. */
  597. /* > \endverbatim */
  598. /* > */
  599. /* ===================================================================== */
  600. /* Subroutine */ int stprfb_(char *side, char *trans, char *direct, char *
  601. storev, integer *m, integer *n, integer *k, integer *l, real *v,
  602. integer *ldv, real *t, integer *ldt, real *a, integer *lda, real *b,
  603. integer *ldb, real *work, integer *ldwork)
  604. {
  605. /* System generated locals */
  606. integer a_dim1, a_offset, b_dim1, b_offset, t_dim1, t_offset, v_dim1,
  607. v_offset, work_dim1, work_offset, i__1, i__2;
  608. /* Local variables */
  609. logical left, backward;
  610. integer i__, j;
  611. extern logical lsame_(char *, char *);
  612. extern /* Subroutine */ int sgemm_(char *, char *, integer *, integer *,
  613. integer *, real *, real *, integer *, real *, integer *, real *,
  614. real *, integer *);
  615. logical right;
  616. extern /* Subroutine */ int strmm_(char *, char *, char *, char *,
  617. integer *, integer *, real *, real *, integer *, real *, integer *
  618. );
  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. work[i__ + j * work_dim1] = b[*m - *l + i__ + j * b_dim1];
  699. }
  700. }
  701. strmm_("L", "U", "T", "N", l, n, &c_b12, &v[mp + v_dim1], ldv, &work[
  702. work_offset], ldwork);
  703. i__1 = *m - *l;
  704. sgemm_("T", "N", l, n, &i__1, &c_b12, &v[v_offset], ldv, &b[b_offset],
  705. ldb, &c_b12, &work[work_offset], ldwork);
  706. i__1 = *k - *l;
  707. sgemm_("T", "N", &i__1, n, m, &c_b12, &v[kp * v_dim1 + 1], ldv, &b[
  708. b_offset], ldb, &c_b20, &work[kp + work_dim1], ldwork);
  709. i__1 = *n;
  710. for (j = 1; j <= i__1; ++j) {
  711. i__2 = *k;
  712. for (i__ = 1; i__ <= i__2; ++i__) {
  713. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  714. }
  715. }
  716. strmm_("L", "U", trans, "N", k, n, &c_b12, &t[t_offset], ldt, &work[
  717. work_offset], ldwork);
  718. i__1 = *n;
  719. for (j = 1; j <= i__1; ++j) {
  720. i__2 = *k;
  721. for (i__ = 1; i__ <= i__2; ++i__) {
  722. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  723. }
  724. }
  725. i__1 = *m - *l;
  726. sgemm_("N", "N", &i__1, n, k, &c_b27, &v[v_offset], ldv, &work[
  727. work_offset], ldwork, &c_b12, &b[b_offset], ldb);
  728. i__1 = *k - *l;
  729. sgemm_("N", "N", l, n, &i__1, &c_b27, &v[mp + kp * v_dim1], ldv, &
  730. work[kp + work_dim1], ldwork, &c_b12, &b[mp + b_dim1], ldb);
  731. strmm_("L", "U", "N", "N", l, n, &c_b12, &v[mp + v_dim1], ldv, &work[
  732. work_offset], ldwork);
  733. i__1 = *n;
  734. for (j = 1; j <= i__1; ++j) {
  735. i__2 = *l;
  736. for (i__ = 1; i__ <= i__2; ++i__) {
  737. b[*m - *l + i__ + j * b_dim1] -= work[i__ + j * work_dim1];
  738. }
  739. }
  740. /* --------------------------------------------------------------------------- */
  741. } else if (column && forward && right) {
  742. /* --------------------------------------------------------------------------- */
  743. /* Let W = [ I ] (K-by-K) */
  744. /* [ V ] (N-by-K) */
  745. /* Form C H or C H^H where C = [ A B ] (A is M-by-K, B is M-by-N) */
  746. /* H = I - W T W^H or H^H = I - W T^H W^H */
  747. /* A = A - (A + B V) T or A = A - (A + B V) T^H */
  748. /* B = B - (A + B V) T V^H or B = B - (A + B V) T^H V^H */
  749. /* --------------------------------------------------------------------------- */
  750. /* Computing MIN */
  751. i__1 = *n - *l + 1;
  752. np = f2cmin(i__1,*n);
  753. /* Computing MIN */
  754. i__1 = *l + 1;
  755. kp = f2cmin(i__1,*k);
  756. i__1 = *l;
  757. for (j = 1; j <= i__1; ++j) {
  758. i__2 = *m;
  759. for (i__ = 1; i__ <= i__2; ++i__) {
  760. work[i__ + j * work_dim1] = b[i__ + (*n - *l + j) * b_dim1];
  761. }
  762. }
  763. strmm_("R", "U", "N", "N", m, l, &c_b12, &v[np + v_dim1], ldv, &work[
  764. work_offset], ldwork);
  765. i__1 = *n - *l;
  766. sgemm_("N", "N", m, l, &i__1, &c_b12, &b[b_offset], ldb, &v[v_offset],
  767. ldv, &c_b12, &work[work_offset], ldwork);
  768. i__1 = *k - *l;
  769. sgemm_("N", "N", m, &i__1, n, &c_b12, &b[b_offset], ldb, &v[kp *
  770. v_dim1 + 1], ldv, &c_b20, &work[kp * work_dim1 + 1], ldwork);
  771. i__1 = *k;
  772. for (j = 1; j <= i__1; ++j) {
  773. i__2 = *m;
  774. for (i__ = 1; i__ <= i__2; ++i__) {
  775. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  776. }
  777. }
  778. strmm_("R", "U", trans, "N", m, k, &c_b12, &t[t_offset], ldt, &work[
  779. work_offset], ldwork);
  780. i__1 = *k;
  781. for (j = 1; j <= i__1; ++j) {
  782. i__2 = *m;
  783. for (i__ = 1; i__ <= i__2; ++i__) {
  784. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  785. }
  786. }
  787. i__1 = *n - *l;
  788. sgemm_("N", "T", m, &i__1, k, &c_b27, &work[work_offset], ldwork, &v[
  789. v_offset], ldv, &c_b12, &b[b_offset], ldb);
  790. i__1 = *k - *l;
  791. sgemm_("N", "T", m, l, &i__1, &c_b27, &work[kp * work_dim1 + 1],
  792. ldwork, &v[np + kp * v_dim1], ldv, &c_b12, &b[np * b_dim1 + 1]
  793. , ldb);
  794. strmm_("R", "U", "T", "N", m, l, &c_b12, &v[np + v_dim1], ldv, &work[
  795. work_offset], ldwork);
  796. i__1 = *l;
  797. for (j = 1; j <= i__1; ++j) {
  798. i__2 = *m;
  799. for (i__ = 1; i__ <= i__2; ++i__) {
  800. b[i__ + (*n - *l + j) * b_dim1] -= work[i__ + j * work_dim1];
  801. }
  802. }
  803. /* --------------------------------------------------------------------------- */
  804. } else if (column && backward && left) {
  805. /* --------------------------------------------------------------------------- */
  806. /* Let W = [ V ] (M-by-K) */
  807. /* [ I ] (K-by-K) */
  808. /* Form H C or H^H C where C = [ B ] (M-by-N) */
  809. /* [ A ] (K-by-N) */
  810. /* H = I - W T W^H or H^H = I - W T^H W^H */
  811. /* A = A - T (A + V^H B) or A = A - T^H (A + V^H B) */
  812. /* B = B - V T (A + V^H B) or B = B - V T^H (A + V^H B) */
  813. /* --------------------------------------------------------------------------- */
  814. /* Computing MIN */
  815. i__1 = *l + 1;
  816. mp = f2cmin(i__1,*m);
  817. /* Computing MIN */
  818. i__1 = *k - *l + 1;
  819. kp = f2cmin(i__1,*k);
  820. i__1 = *n;
  821. for (j = 1; j <= i__1; ++j) {
  822. i__2 = *l;
  823. for (i__ = 1; i__ <= i__2; ++i__) {
  824. work[*k - *l + i__ + j * work_dim1] = b[i__ + j * b_dim1];
  825. }
  826. }
  827. strmm_("L", "L", "T", "N", l, n, &c_b12, &v[kp * v_dim1 + 1], ldv, &
  828. work[kp + work_dim1], ldwork);
  829. i__1 = *m - *l;
  830. sgemm_("T", "N", l, n, &i__1, &c_b12, &v[mp + kp * v_dim1], ldv, &b[
  831. mp + b_dim1], ldb, &c_b12, &work[kp + work_dim1], ldwork);
  832. i__1 = *k - *l;
  833. sgemm_("T", "N", &i__1, n, m, &c_b12, &v[v_offset], ldv, &b[b_offset],
  834. ldb, &c_b20, &work[work_offset], 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. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  840. }
  841. }
  842. strmm_("L", "L", trans, "N", k, n, &c_b12, &t[t_offset], ldt, &work[
  843. work_offset], ldwork);
  844. i__1 = *n;
  845. for (j = 1; j <= i__1; ++j) {
  846. i__2 = *k;
  847. for (i__ = 1; i__ <= i__2; ++i__) {
  848. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  849. }
  850. }
  851. i__1 = *m - *l;
  852. sgemm_("N", "N", &i__1, n, k, &c_b27, &v[mp + v_dim1], ldv, &work[
  853. work_offset], ldwork, &c_b12, &b[mp + b_dim1], ldb);
  854. i__1 = *k - *l;
  855. sgemm_("N", "N", l, n, &i__1, &c_b27, &v[v_offset], ldv, &work[
  856. work_offset], ldwork, &c_b12, &b[b_offset], ldb);
  857. strmm_("L", "L", "N", "N", l, n, &c_b12, &v[kp * v_dim1 + 1], ldv, &
  858. work[kp + work_dim1], ldwork);
  859. i__1 = *n;
  860. for (j = 1; j <= i__1; ++j) {
  861. i__2 = *l;
  862. for (i__ = 1; i__ <= i__2; ++i__) {
  863. b[i__ + j * b_dim1] -= work[*k - *l + i__ + j * work_dim1];
  864. }
  865. }
  866. /* --------------------------------------------------------------------------- */
  867. } else if (column && backward && right) {
  868. /* --------------------------------------------------------------------------- */
  869. /* Let W = [ V ] (N-by-K) */
  870. /* [ I ] (K-by-K) */
  871. /* Form C H or C H^H where C = [ B A ] (B is M-by-N, A is M-by-K) */
  872. /* H = I - W T W^H or H^H = I - W T^H W^H */
  873. /* A = A - (A + B V) T or A = A - (A + B V) T^H */
  874. /* B = B - (A + B V) T V^H or B = B - (A + B V) T^H V^H */
  875. /* --------------------------------------------------------------------------- */
  876. /* Computing MIN */
  877. i__1 = *l + 1;
  878. np = f2cmin(i__1,*n);
  879. /* Computing MIN */
  880. i__1 = *k - *l + 1;
  881. kp = f2cmin(i__1,*k);
  882. i__1 = *l;
  883. for (j = 1; j <= i__1; ++j) {
  884. i__2 = *m;
  885. for (i__ = 1; i__ <= i__2; ++i__) {
  886. work[i__ + (*k - *l + j) * work_dim1] = b[i__ + j * b_dim1];
  887. }
  888. }
  889. strmm_("R", "L", "N", "N", m, l, &c_b12, &v[kp * v_dim1 + 1], ldv, &
  890. work[kp * work_dim1 + 1], ldwork);
  891. i__1 = *n - *l;
  892. sgemm_("N", "N", m, l, &i__1, &c_b12, &b[np * b_dim1 + 1], ldb, &v[np
  893. + kp * v_dim1], ldv, &c_b12, &work[kp * work_dim1 + 1],
  894. ldwork);
  895. i__1 = *k - *l;
  896. sgemm_("N", "N", m, &i__1, n, &c_b12, &b[b_offset], ldb, &v[v_offset],
  897. ldv, &c_b20, &work[work_offset], ldwork);
  898. i__1 = *k;
  899. for (j = 1; j <= i__1; ++j) {
  900. i__2 = *m;
  901. for (i__ = 1; i__ <= i__2; ++i__) {
  902. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  903. }
  904. }
  905. strmm_("R", "L", trans, "N", m, k, &c_b12, &t[t_offset], ldt, &work[
  906. work_offset], ldwork);
  907. i__1 = *k;
  908. for (j = 1; j <= i__1; ++j) {
  909. i__2 = *m;
  910. for (i__ = 1; i__ <= i__2; ++i__) {
  911. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  912. }
  913. }
  914. i__1 = *n - *l;
  915. sgemm_("N", "T", m, &i__1, k, &c_b27, &work[work_offset], ldwork, &v[
  916. np + v_dim1], ldv, &c_b12, &b[np * b_dim1 + 1], ldb);
  917. i__1 = *k - *l;
  918. sgemm_("N", "T", m, l, &i__1, &c_b27, &work[work_offset], ldwork, &v[
  919. v_offset], ldv, &c_b12, &b[b_offset], ldb);
  920. strmm_("R", "L", "T", "N", m, l, &c_b12, &v[kp * v_dim1 + 1], ldv, &
  921. work[kp * work_dim1 + 1], ldwork);
  922. i__1 = *l;
  923. for (j = 1; j <= i__1; ++j) {
  924. i__2 = *m;
  925. for (i__ = 1; i__ <= i__2; ++i__) {
  926. b[i__ + j * b_dim1] -= work[i__ + (*k - *l + j) * work_dim1];
  927. }
  928. }
  929. /* --------------------------------------------------------------------------- */
  930. } else if (row && forward && left) {
  931. /* --------------------------------------------------------------------------- */
  932. /* Let W = [ I V ] ( I is K-by-K, V is K-by-M ) */
  933. /* Form H C or H^H C where C = [ A ] (K-by-N) */
  934. /* [ B ] (M-by-N) */
  935. /* H = I - W^H T W or H^H = I - W^H T^H W */
  936. /* A = A - T (A + V B) or A = A - T^H (A + V B) */
  937. /* B = B - V^H T (A + V B) or B = B - V^H T^H (A + V B) */
  938. /* --------------------------------------------------------------------------- */
  939. /* Computing MIN */
  940. i__1 = *m - *l + 1;
  941. mp = f2cmin(i__1,*m);
  942. /* Computing MIN */
  943. i__1 = *l + 1;
  944. kp = f2cmin(i__1,*k);
  945. i__1 = *n;
  946. for (j = 1; j <= i__1; ++j) {
  947. i__2 = *l;
  948. for (i__ = 1; i__ <= i__2; ++i__) {
  949. work[i__ + j * work_dim1] = b[*m - *l + i__ + j * b_dim1];
  950. }
  951. }
  952. strmm_("L", "L", "N", "N", l, n, &c_b12, &v[mp * v_dim1 + 1], ldv, &
  953. work[work_offset], ldb);
  954. i__1 = *m - *l;
  955. sgemm_("N", "N", l, n, &i__1, &c_b12, &v[v_offset], ldv, &b[b_offset],
  956. ldb, &c_b12, &work[work_offset], ldwork);
  957. i__1 = *k - *l;
  958. sgemm_("N", "N", &i__1, n, m, &c_b12, &v[kp + v_dim1], ldv, &b[
  959. b_offset], ldb, &c_b20, &work[kp + work_dim1], ldwork);
  960. i__1 = *n;
  961. for (j = 1; j <= i__1; ++j) {
  962. i__2 = *k;
  963. for (i__ = 1; i__ <= i__2; ++i__) {
  964. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  965. }
  966. }
  967. strmm_("L", "U", trans, "N", k, n, &c_b12, &t[t_offset], ldt, &work[
  968. work_offset], ldwork);
  969. i__1 = *n;
  970. for (j = 1; j <= i__1; ++j) {
  971. i__2 = *k;
  972. for (i__ = 1; i__ <= i__2; ++i__) {
  973. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  974. }
  975. }
  976. i__1 = *m - *l;
  977. sgemm_("T", "N", &i__1, n, k, &c_b27, &v[v_offset], ldv, &work[
  978. work_offset], ldwork, &c_b12, &b[b_offset], ldb);
  979. i__1 = *k - *l;
  980. sgemm_("T", "N", l, n, &i__1, &c_b27, &v[kp + mp * v_dim1], ldv, &
  981. work[kp + work_dim1], ldwork, &c_b12, &b[mp + b_dim1], ldb);
  982. strmm_("L", "L", "T", "N", l, n, &c_b12, &v[mp * v_dim1 + 1], ldv, &
  983. work[work_offset], ldwork);
  984. i__1 = *n;
  985. for (j = 1; j <= i__1; ++j) {
  986. i__2 = *l;
  987. for (i__ = 1; i__ <= i__2; ++i__) {
  988. b[*m - *l + i__ + j * b_dim1] -= work[i__ + j * work_dim1];
  989. }
  990. }
  991. /* --------------------------------------------------------------------------- */
  992. } else if (row && forward && right) {
  993. /* --------------------------------------------------------------------------- */
  994. /* Let W = [ I V ] ( I is K-by-K, V is K-by-N ) */
  995. /* Form C H or C H^H where C = [ A B ] (A is M-by-K, B is M-by-N) */
  996. /* H = I - W^H T W or H^H = I - W^H T^H W */
  997. /* A = A - (A + B V^H) T or A = A - (A + B V^H) T^H */
  998. /* B = B - (A + B V^H) T V or B = B - (A + B V^H) T^H V */
  999. /* --------------------------------------------------------------------------- */
  1000. /* Computing MIN */
  1001. i__1 = *n - *l + 1;
  1002. np = f2cmin(i__1,*n);
  1003. /* Computing MIN */
  1004. i__1 = *l + 1;
  1005. kp = f2cmin(i__1,*k);
  1006. i__1 = *l;
  1007. for (j = 1; j <= i__1; ++j) {
  1008. i__2 = *m;
  1009. for (i__ = 1; i__ <= i__2; ++i__) {
  1010. work[i__ + j * work_dim1] = b[i__ + (*n - *l + j) * b_dim1];
  1011. }
  1012. }
  1013. strmm_("R", "L", "T", "N", m, l, &c_b12, &v[np * v_dim1 + 1], ldv, &
  1014. work[work_offset], ldwork);
  1015. i__1 = *n - *l;
  1016. sgemm_("N", "T", m, l, &i__1, &c_b12, &b[b_offset], ldb, &v[v_offset],
  1017. ldv, &c_b12, &work[work_offset], ldwork);
  1018. i__1 = *k - *l;
  1019. sgemm_("N", "T", m, &i__1, n, &c_b12, &b[b_offset], ldb, &v[kp +
  1020. v_dim1], ldv, &c_b20, &work[kp * work_dim1 + 1], ldwork);
  1021. i__1 = *k;
  1022. for (j = 1; j <= i__1; ++j) {
  1023. i__2 = *m;
  1024. for (i__ = 1; i__ <= i__2; ++i__) {
  1025. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  1026. }
  1027. }
  1028. strmm_("R", "U", trans, "N", m, k, &c_b12, &t[t_offset], ldt, &work[
  1029. work_offset], ldwork);
  1030. i__1 = *k;
  1031. for (j = 1; j <= i__1; ++j) {
  1032. i__2 = *m;
  1033. for (i__ = 1; i__ <= i__2; ++i__) {
  1034. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  1035. }
  1036. }
  1037. i__1 = *n - *l;
  1038. sgemm_("N", "N", m, &i__1, k, &c_b27, &work[work_offset], ldwork, &v[
  1039. v_offset], ldv, &c_b12, &b[b_offset], ldb);
  1040. i__1 = *k - *l;
  1041. sgemm_("N", "N", m, l, &i__1, &c_b27, &work[kp * work_dim1 + 1],
  1042. ldwork, &v[kp + np * v_dim1], ldv, &c_b12, &b[np * b_dim1 + 1]
  1043. , ldb);
  1044. strmm_("R", "L", "N", "N", m, l, &c_b12, &v[np * v_dim1 + 1], ldv, &
  1045. work[work_offset], ldwork);
  1046. i__1 = *l;
  1047. for (j = 1; j <= i__1; ++j) {
  1048. i__2 = *m;
  1049. for (i__ = 1; i__ <= i__2; ++i__) {
  1050. b[i__ + (*n - *l + j) * b_dim1] -= work[i__ + j * work_dim1];
  1051. }
  1052. }
  1053. /* --------------------------------------------------------------------------- */
  1054. } else if (row && backward && left) {
  1055. /* --------------------------------------------------------------------------- */
  1056. /* Let W = [ V I ] ( I is K-by-K, V is K-by-M ) */
  1057. /* Form H C or H^H C where C = [ B ] (M-by-N) */
  1058. /* [ A ] (K-by-N) */
  1059. /* H = I - W^H T W or H^H = I - W^H T^H W */
  1060. /* A = A - T (A + V B) or A = A - T^H (A + V B) */
  1061. /* B = B - V^H T (A + V B) or B = B - V^H T^H (A + V B) */
  1062. /* --------------------------------------------------------------------------- */
  1063. /* Computing MIN */
  1064. i__1 = *l + 1;
  1065. mp = f2cmin(i__1,*m);
  1066. /* Computing MIN */
  1067. i__1 = *k - *l + 1;
  1068. kp = f2cmin(i__1,*k);
  1069. i__1 = *n;
  1070. for (j = 1; j <= i__1; ++j) {
  1071. i__2 = *l;
  1072. for (i__ = 1; i__ <= i__2; ++i__) {
  1073. work[*k - *l + i__ + j * work_dim1] = b[i__ + j * b_dim1];
  1074. }
  1075. }
  1076. strmm_("L", "U", "N", "N", l, n, &c_b12, &v[kp + v_dim1], ldv, &work[
  1077. kp + work_dim1], ldwork);
  1078. i__1 = *m - *l;
  1079. sgemm_("N", "N", l, n, &i__1, &c_b12, &v[kp + mp * v_dim1], ldv, &b[
  1080. mp + b_dim1], ldb, &c_b12, &work[kp + work_dim1], ldwork);
  1081. i__1 = *k - *l;
  1082. sgemm_("N", "N", &i__1, n, m, &c_b12, &v[v_offset], ldv, &b[b_offset],
  1083. ldb, &c_b20, &work[work_offset], ldwork);
  1084. i__1 = *n;
  1085. for (j = 1; j <= i__1; ++j) {
  1086. i__2 = *k;
  1087. for (i__ = 1; i__ <= i__2; ++i__) {
  1088. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  1089. }
  1090. }
  1091. strmm_("L", "L ", trans, "N", k, n, &c_b12, &t[t_offset], ldt, &work[
  1092. work_offset], ldwork);
  1093. i__1 = *n;
  1094. for (j = 1; j <= i__1; ++j) {
  1095. i__2 = *k;
  1096. for (i__ = 1; i__ <= i__2; ++i__) {
  1097. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  1098. }
  1099. }
  1100. i__1 = *m - *l;
  1101. sgemm_("T", "N", &i__1, n, k, &c_b27, &v[mp * v_dim1 + 1], ldv, &work[
  1102. work_offset], ldwork, &c_b12, &b[mp + b_dim1], ldb);
  1103. i__1 = *k - *l;
  1104. sgemm_("T", "N", l, n, &i__1, &c_b27, &v[v_offset], ldv, &work[
  1105. work_offset], ldwork, &c_b12, &b[b_offset], ldb);
  1106. strmm_("L", "U", "T", "N", l, n, &c_b12, &v[kp + v_dim1], ldv, &work[
  1107. kp + work_dim1], ldwork);
  1108. i__1 = *n;
  1109. for (j = 1; j <= i__1; ++j) {
  1110. i__2 = *l;
  1111. for (i__ = 1; i__ <= i__2; ++i__) {
  1112. b[i__ + j * b_dim1] -= work[*k - *l + i__ + j * work_dim1];
  1113. }
  1114. }
  1115. /* --------------------------------------------------------------------------- */
  1116. } else if (row && backward && right) {
  1117. /* --------------------------------------------------------------------------- */
  1118. /* Let W = [ V I ] ( I is K-by-K, V is K-by-N ) */
  1119. /* Form C H or C H^H where C = [ B A ] (A is M-by-K, B is M-by-N) */
  1120. /* H = I - W^H T W or H^H = I - W^H T^H W */
  1121. /* A = A - (A + B V^H) T or A = A - (A + B V^H) T^H */
  1122. /* B = B - (A + B V^H) T V or B = B - (A + B V^H) T^H V */
  1123. /* --------------------------------------------------------------------------- */
  1124. /* Computing MIN */
  1125. i__1 = *l + 1;
  1126. np = f2cmin(i__1,*n);
  1127. /* Computing MIN */
  1128. i__1 = *k - *l + 1;
  1129. kp = f2cmin(i__1,*k);
  1130. i__1 = *l;
  1131. for (j = 1; j <= i__1; ++j) {
  1132. i__2 = *m;
  1133. for (i__ = 1; i__ <= i__2; ++i__) {
  1134. work[i__ + (*k - *l + j) * work_dim1] = b[i__ + j * b_dim1];
  1135. }
  1136. }
  1137. strmm_("R", "U", "T", "N", m, l, &c_b12, &v[kp + v_dim1], ldv, &work[
  1138. kp * work_dim1 + 1], ldwork);
  1139. i__1 = *n - *l;
  1140. sgemm_("N", "T", m, l, &i__1, &c_b12, &b[np * b_dim1 + 1], ldb, &v[kp
  1141. + np * v_dim1], ldv, &c_b12, &work[kp * work_dim1 + 1],
  1142. ldwork);
  1143. i__1 = *k - *l;
  1144. sgemm_("N", "T", m, &i__1, n, &c_b12, &b[b_offset], ldb, &v[v_offset],
  1145. ldv, &c_b20, &work[work_offset], ldwork);
  1146. i__1 = *k;
  1147. for (j = 1; j <= i__1; ++j) {
  1148. i__2 = *m;
  1149. for (i__ = 1; i__ <= i__2; ++i__) {
  1150. work[i__ + j * work_dim1] += a[i__ + j * a_dim1];
  1151. }
  1152. }
  1153. strmm_("R", "L", trans, "N", m, k, &c_b12, &t[t_offset], ldt, &work[
  1154. work_offset], ldwork);
  1155. i__1 = *k;
  1156. for (j = 1; j <= i__1; ++j) {
  1157. i__2 = *m;
  1158. for (i__ = 1; i__ <= i__2; ++i__) {
  1159. a[i__ + j * a_dim1] -= work[i__ + j * work_dim1];
  1160. }
  1161. }
  1162. i__1 = *n - *l;
  1163. sgemm_("N", "N", m, &i__1, k, &c_b27, &work[work_offset], ldwork, &v[
  1164. np * v_dim1 + 1], ldv, &c_b12, &b[np * b_dim1 + 1], ldb);
  1165. i__1 = *k - *l;
  1166. sgemm_("N", "N", m, l, &i__1, &c_b27, &work[work_offset], ldwork, &v[
  1167. v_offset], ldv, &c_b12, &b[b_offset], ldb);
  1168. strmm_("R", "U", "N", "N", m, l, &c_b12, &v[kp + v_dim1], ldv, &work[
  1169. kp * work_dim1 + 1], ldwork);
  1170. i__1 = *l;
  1171. for (j = 1; j <= i__1; ++j) {
  1172. i__2 = *m;
  1173. for (i__ = 1; i__ <= i__2; ++i__) {
  1174. b[i__ + j * b_dim1] -= work[i__ + (*k - *l + j) * work_dim1];
  1175. }
  1176. }
  1177. }
  1178. return 0;
  1179. /* End of STPRFB */
  1180. } /* stprfb_ */