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.

zlanhf.c 65 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457
  1. #include <math.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <complex.h>
  6. #ifdef complex
  7. #undef complex
  8. #endif
  9. #ifdef I
  10. #undef I
  11. #endif
  12. #if defined(_WIN64)
  13. typedef long long BLASLONG;
  14. typedef unsigned long long BLASULONG;
  15. #else
  16. typedef long BLASLONG;
  17. typedef unsigned long BLASULONG;
  18. #endif
  19. #ifdef LAPACK_ILP64
  20. typedef BLASLONG blasint;
  21. #if defined(_WIN64)
  22. #define blasabs(x) llabs(x)
  23. #else
  24. #define blasabs(x) labs(x)
  25. #endif
  26. #else
  27. typedef int blasint;
  28. #define blasabs(x) abs(x)
  29. #endif
  30. typedef blasint integer;
  31. typedef unsigned int uinteger;
  32. typedef char *address;
  33. typedef short int shortint;
  34. typedef float real;
  35. typedef double doublereal;
  36. typedef struct { real r, i; } complex;
  37. typedef struct { doublereal r, i; } doublecomplex;
  38. #ifdef _MSC_VER
  39. static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
  40. static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
  41. static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
  42. static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
  43. #else
  44. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  46. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  47. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  48. #endif
  49. #define pCf(z) (*_pCf(z))
  50. #define pCd(z) (*_pCd(z))
  51. typedef blasint logical;
  52. typedef char logical1;
  53. typedef char integer1;
  54. #define TRUE_ (1)
  55. #define FALSE_ (0)
  56. /* Extern is for use with -E */
  57. #ifndef Extern
  58. #define Extern extern
  59. #endif
  60. /* I/O stuff */
  61. typedef int flag;
  62. typedef int ftnlen;
  63. typedef int ftnint;
  64. /*external read, write*/
  65. typedef struct
  66. { flag cierr;
  67. ftnint ciunit;
  68. flag ciend;
  69. char *cifmt;
  70. ftnint cirec;
  71. } cilist;
  72. /*internal read, write*/
  73. typedef struct
  74. { flag icierr;
  75. char *iciunit;
  76. flag iciend;
  77. char *icifmt;
  78. ftnint icirlen;
  79. ftnint icirnum;
  80. } icilist;
  81. /*open*/
  82. typedef struct
  83. { flag oerr;
  84. ftnint ounit;
  85. char *ofnm;
  86. ftnlen ofnmlen;
  87. char *osta;
  88. char *oacc;
  89. char *ofm;
  90. ftnint orl;
  91. char *oblnk;
  92. } olist;
  93. /*close*/
  94. typedef struct
  95. { flag cerr;
  96. ftnint cunit;
  97. char *csta;
  98. } cllist;
  99. /*rewind, backspace, endfile*/
  100. typedef struct
  101. { flag aerr;
  102. ftnint aunit;
  103. } alist;
  104. /* inquire */
  105. typedef struct
  106. { flag inerr;
  107. ftnint inunit;
  108. char *infile;
  109. ftnlen infilen;
  110. ftnint *inex; /*parameters in standard's order*/
  111. ftnint *inopen;
  112. ftnint *innum;
  113. ftnint *innamed;
  114. char *inname;
  115. ftnlen innamlen;
  116. char *inacc;
  117. ftnlen inacclen;
  118. char *inseq;
  119. ftnlen inseqlen;
  120. char *indir;
  121. ftnlen indirlen;
  122. char *infmt;
  123. ftnlen infmtlen;
  124. char *inform;
  125. ftnint informlen;
  126. char *inunf;
  127. ftnlen inunflen;
  128. ftnint *inrecl;
  129. ftnint *innrec;
  130. char *inblank;
  131. ftnlen inblanklen;
  132. } inlist;
  133. #define VOID void
  134. union Multitype { /* for multiple entry points */
  135. integer1 g;
  136. shortint h;
  137. integer i;
  138. /* longint j; */
  139. real r;
  140. doublereal d;
  141. complex c;
  142. doublecomplex z;
  143. };
  144. typedef union Multitype Multitype;
  145. struct Vardesc { /* for Namelist */
  146. char *name;
  147. char *addr;
  148. ftnlen *dims;
  149. int type;
  150. };
  151. typedef struct Vardesc Vardesc;
  152. struct Namelist {
  153. char *name;
  154. Vardesc **vars;
  155. int nvars;
  156. };
  157. typedef struct Namelist Namelist;
  158. #define abs(x) ((x) >= 0 ? (x) : -(x))
  159. #define dabs(x) (fabs(x))
  160. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  161. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  162. #define dmin(a,b) (f2cmin(a,b))
  163. #define dmax(a,b) (f2cmax(a,b))
  164. #define bit_test(a,b) ((a) >> (b) & 1)
  165. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  166. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  167. #define abort_() { sig_die("Fortran abort routine called", 1); }
  168. #define c_abs(z) (cabsf(Cf(z)))
  169. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  170. #ifdef _MSC_VER
  171. #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
  172. #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/Cd(b)._Val[1]);}
  173. #else
  174. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  175. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  176. #endif
  177. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  178. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  179. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  180. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  181. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  182. #define d_abs(x) (fabs(*(x)))
  183. #define d_acos(x) (acos(*(x)))
  184. #define d_asin(x) (asin(*(x)))
  185. #define d_atan(x) (atan(*(x)))
  186. #define d_atn2(x, y) (atan2(*(x),*(y)))
  187. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  188. #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
  189. #define d_cos(x) (cos(*(x)))
  190. #define d_cosh(x) (cosh(*(x)))
  191. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  192. #define d_exp(x) (exp(*(x)))
  193. #define d_imag(z) (cimag(Cd(z)))
  194. #define r_imag(z) (cimagf(Cf(z)))
  195. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  196. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  197. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  198. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  199. #define d_log(x) (log(*(x)))
  200. #define d_mod(x, y) (fmod(*(x), *(y)))
  201. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  202. #define d_nint(x) u_nint(*(x))
  203. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  204. #define d_sign(a,b) u_sign(*(a),*(b))
  205. #define r_sign(a,b) u_sign(*(a),*(b))
  206. #define d_sin(x) (sin(*(x)))
  207. #define d_sinh(x) (sinh(*(x)))
  208. #define d_sqrt(x) (sqrt(*(x)))
  209. #define d_tan(x) (tan(*(x)))
  210. #define d_tanh(x) (tanh(*(x)))
  211. #define i_abs(x) abs(*(x))
  212. #define i_dnnt(x) ((integer)u_nint(*(x)))
  213. #define i_len(s, n) (n)
  214. #define i_nint(x) ((integer)u_nint(*(x)))
  215. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  216. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  217. #define pow_si(B,E) spow_ui(*(B),*(E))
  218. #define pow_ri(B,E) spow_ui(*(B),*(E))
  219. #define pow_di(B,E) dpow_ui(*(B),*(E))
  220. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  221. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  222. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  223. #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++ = ' '; }
  224. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  225. #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]; }
  226. #define sig_die(s, kill) { exit(1); }
  227. #define s_stop(s, n) {exit(0);}
  228. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  229. #define z_abs(z) (cabs(Cd(z)))
  230. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  231. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  232. #define myexit_() break;
  233. #define mycycle() continue;
  234. #define myceiling(w) {ceil(w)}
  235. #define myhuge(w) {HUGE_VAL}
  236. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  237. #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  238. /* procedure parameter types for -A and -C++ */
  239. #ifdef __cplusplus
  240. typedef logical (*L_fp)(...);
  241. #else
  242. typedef logical (*L_fp)();
  243. #endif
  244. static float spow_ui(float x, integer n) {
  245. float pow=1.0; unsigned long int u;
  246. if(n != 0) {
  247. if(n < 0) n = -n, x = 1/x;
  248. for(u = n; ; ) {
  249. if(u & 01) pow *= x;
  250. if(u >>= 1) x *= x;
  251. else break;
  252. }
  253. }
  254. return pow;
  255. }
  256. static double dpow_ui(double x, integer n) {
  257. double pow=1.0; unsigned long int u;
  258. if(n != 0) {
  259. if(n < 0) n = -n, x = 1/x;
  260. for(u = n; ; ) {
  261. if(u & 01) pow *= x;
  262. if(u >>= 1) x *= x;
  263. else break;
  264. }
  265. }
  266. return pow;
  267. }
  268. #ifdef _MSC_VER
  269. static _Fcomplex cpow_ui(complex x, integer n) {
  270. complex pow={1.0,0.0}; unsigned long int u;
  271. if(n != 0) {
  272. if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
  273. for(u = n; ; ) {
  274. if(u & 01) pow.r *= x.r, pow.i *= x.i;
  275. if(u >>= 1) x.r *= x.r, x.i *= x.i;
  276. else break;
  277. }
  278. }
  279. _Fcomplex p={pow.r, pow.i};
  280. return p;
  281. }
  282. #else
  283. static _Complex float cpow_ui(_Complex float x, integer n) {
  284. _Complex float pow=1.0; unsigned long int u;
  285. if(n != 0) {
  286. if(n < 0) n = -n, x = 1/x;
  287. for(u = n; ; ) {
  288. if(u & 01) pow *= x;
  289. if(u >>= 1) x *= x;
  290. else break;
  291. }
  292. }
  293. return pow;
  294. }
  295. #endif
  296. #ifdef _MSC_VER
  297. static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
  298. _Dcomplex pow={1.0,0.0}; unsigned long int u;
  299. if(n != 0) {
  300. if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
  301. for(u = n; ; ) {
  302. if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
  303. if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
  304. else break;
  305. }
  306. }
  307. _Dcomplex p = {pow._Val[0], pow._Val[1]};
  308. return p;
  309. }
  310. #else
  311. static _Complex double zpow_ui(_Complex double x, integer n) {
  312. _Complex double pow=1.0; unsigned long int u;
  313. if(n != 0) {
  314. if(n < 0) n = -n, x = 1/x;
  315. for(u = n; ; ) {
  316. if(u & 01) pow *= x;
  317. if(u >>= 1) x *= x;
  318. else break;
  319. }
  320. }
  321. return pow;
  322. }
  323. #endif
  324. static integer pow_ii(integer x, integer n) {
  325. integer pow; unsigned long int u;
  326. if (n <= 0) {
  327. if (n == 0 || x == 1) pow = 1;
  328. else if (x != -1) pow = x == 0 ? 1/x : 0;
  329. else n = -n;
  330. }
  331. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  332. u = n;
  333. for(pow = 1; ; ) {
  334. if(u & 01) pow *= x;
  335. if(u >>= 1) x *= x;
  336. else break;
  337. }
  338. }
  339. return pow;
  340. }
  341. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  342. {
  343. double m; integer i, mi;
  344. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  345. if (w[i-1]>m) mi=i ,m=w[i-1];
  346. return mi-s+1;
  347. }
  348. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  349. {
  350. float m; integer i, mi;
  351. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  352. if (w[i-1]>m) mi=i ,m=w[i-1];
  353. return mi-s+1;
  354. }
  355. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  356. integer n = *n_, incx = *incx_, incy = *incy_, i;
  357. #ifdef _MSC_VER
  358. _Fcomplex zdotc = {0.0, 0.0};
  359. if (incx == 1 && incy == 1) {
  360. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  361. zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
  362. zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
  363. }
  364. } else {
  365. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  366. zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
  367. zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
  368. }
  369. }
  370. pCf(z) = zdotc;
  371. }
  372. #else
  373. _Complex float zdotc = 0.0;
  374. if (incx == 1 && incy == 1) {
  375. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  376. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  377. }
  378. } else {
  379. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  380. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  381. }
  382. }
  383. pCf(z) = zdotc;
  384. }
  385. #endif
  386. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  387. integer n = *n_, incx = *incx_, incy = *incy_, i;
  388. #ifdef _MSC_VER
  389. _Dcomplex zdotc = {0.0, 0.0};
  390. if (incx == 1 && incy == 1) {
  391. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  392. zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
  393. zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
  394. }
  395. } else {
  396. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  397. zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
  398. zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
  399. }
  400. }
  401. pCd(z) = zdotc;
  402. }
  403. #else
  404. _Complex double zdotc = 0.0;
  405. if (incx == 1 && incy == 1) {
  406. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  407. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  408. }
  409. } else {
  410. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  411. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  412. }
  413. }
  414. pCd(z) = zdotc;
  415. }
  416. #endif
  417. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  418. integer n = *n_, incx = *incx_, incy = *incy_, i;
  419. #ifdef _MSC_VER
  420. _Fcomplex zdotc = {0.0, 0.0};
  421. if (incx == 1 && incy == 1) {
  422. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  423. zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
  424. zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
  425. }
  426. } else {
  427. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  428. zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
  429. zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
  430. }
  431. }
  432. pCf(z) = zdotc;
  433. }
  434. #else
  435. _Complex float zdotc = 0.0;
  436. if (incx == 1 && incy == 1) {
  437. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  438. zdotc += Cf(&x[i]) * Cf(&y[i]);
  439. }
  440. } else {
  441. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  442. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  443. }
  444. }
  445. pCf(z) = zdotc;
  446. }
  447. #endif
  448. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  449. integer n = *n_, incx = *incx_, incy = *incy_, i;
  450. #ifdef _MSC_VER
  451. _Dcomplex zdotc = {0.0, 0.0};
  452. if (incx == 1 && incy == 1) {
  453. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  454. zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
  455. zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
  456. }
  457. } else {
  458. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  459. zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
  460. zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
  461. }
  462. }
  463. pCd(z) = zdotc;
  464. }
  465. #else
  466. _Complex double zdotc = 0.0;
  467. if (incx == 1 && incy == 1) {
  468. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  469. zdotc += Cd(&x[i]) * Cd(&y[i]);
  470. }
  471. } else {
  472. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  473. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  474. }
  475. }
  476. pCd(z) = zdotc;
  477. }
  478. #endif
  479. /* -- translated by f2c (version 20000121).
  480. You must link the resulting object file with the libraries:
  481. -lf2c -lm (in that order)
  482. */
  483. /* Table of constant values */
  484. static integer c__1 = 1;
  485. /* > \brief \b ZLANHF returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the ele
  486. ment of largest absolute value of a Hermitian matrix in RFP format. */
  487. /* =========== DOCUMENTATION =========== */
  488. /* Online html documentation available at */
  489. /* http://www.netlib.org/lapack/explore-html/ */
  490. /* > \htmlonly */
  491. /* > Download ZLANHF + dependencies */
  492. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhf.
  493. f"> */
  494. /* > [TGZ]</a> */
  495. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhf.
  496. f"> */
  497. /* > [ZIP]</a> */
  498. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhf.
  499. f"> */
  500. /* > [TXT]</a> */
  501. /* > \endhtmlonly */
  502. /* Definition: */
  503. /* =========== */
  504. /* DOUBLE PRECISION FUNCTION ZLANHF( NORM, TRANSR, UPLO, N, A, WORK ) */
  505. /* CHARACTER NORM, TRANSR, UPLO */
  506. /* INTEGER N */
  507. /* DOUBLE PRECISION WORK( 0: * ) */
  508. /* COMPLEX*16 A( 0: * ) */
  509. /* > \par Purpose: */
  510. /* ============= */
  511. /* > */
  512. /* > \verbatim */
  513. /* > */
  514. /* > ZLANHF returns the value of the one norm, or the Frobenius norm, or */
  515. /* > the infinity norm, or the element of largest absolute value of a */
  516. /* > complex Hermitian matrix A in RFP format. */
  517. /* > \endverbatim */
  518. /* > */
  519. /* > \return ZLANHF */
  520. /* > \verbatim */
  521. /* > */
  522. /* > ZLANHF = ( f2cmax(abs(A(i,j))), NORM = 'M' or 'm' */
  523. /* > ( */
  524. /* > ( norm1(A), NORM = '1', 'O' or 'o' */
  525. /* > ( */
  526. /* > ( normI(A), NORM = 'I' or 'i' */
  527. /* > ( */
  528. /* > ( normF(A), NORM = 'F', 'f', 'E' or 'e' */
  529. /* > */
  530. /* > where norm1 denotes the one norm of a matrix (maximum column sum), */
  531. /* > normI denotes the infinity norm of a matrix (maximum row sum) and */
  532. /* > normF denotes the Frobenius norm of a matrix (square root of sum of */
  533. /* > squares). Note that f2cmax(abs(A(i,j))) is not a matrix norm. */
  534. /* > \endverbatim */
  535. /* Arguments: */
  536. /* ========== */
  537. /* > \param[in] NORM */
  538. /* > \verbatim */
  539. /* > NORM is CHARACTER */
  540. /* > Specifies the value to be returned in ZLANHF as described */
  541. /* > above. */
  542. /* > \endverbatim */
  543. /* > */
  544. /* > \param[in] TRANSR */
  545. /* > \verbatim */
  546. /* > TRANSR is CHARACTER */
  547. /* > Specifies whether the RFP format of A is normal or */
  548. /* > conjugate-transposed format. */
  549. /* > = 'N': RFP format is Normal */
  550. /* > = 'C': RFP format is Conjugate-transposed */
  551. /* > \endverbatim */
  552. /* > */
  553. /* > \param[in] UPLO */
  554. /* > \verbatim */
  555. /* > UPLO is CHARACTER */
  556. /* > On entry, UPLO specifies whether the RFP matrix A came from */
  557. /* > an upper or lower triangular matrix as follows: */
  558. /* > */
  559. /* > UPLO = 'U' or 'u' RFP A came from an upper triangular */
  560. /* > matrix */
  561. /* > */
  562. /* > UPLO = 'L' or 'l' RFP A came from a lower triangular */
  563. /* > matrix */
  564. /* > \endverbatim */
  565. /* > */
  566. /* > \param[in] N */
  567. /* > \verbatim */
  568. /* > N is INTEGER */
  569. /* > The order of the matrix A. N >= 0. When N = 0, ZLANHF is */
  570. /* > set to zero. */
  571. /* > \endverbatim */
  572. /* > */
  573. /* > \param[in] A */
  574. /* > \verbatim */
  575. /* > A is COMPLEX*16 array, dimension ( N*(N+1)/2 ); */
  576. /* > On entry, the matrix A in RFP Format. */
  577. /* > RFP Format is described by TRANSR, UPLO and N as follows: */
  578. /* > If TRANSR='N' then RFP A is (0:N,0:K-1) when N is even; */
  579. /* > K=N/2. RFP A is (0:N-1,0:K) when N is odd; K=N/2. If */
  580. /* > TRANSR = 'C' then RFP is the Conjugate-transpose of RFP A */
  581. /* > as defined when TRANSR = 'N'. The contents of RFP A are */
  582. /* > defined by UPLO as follows: If UPLO = 'U' the RFP A */
  583. /* > contains the ( N*(N+1)/2 ) elements of upper packed A */
  584. /* > either in normal or conjugate-transpose Format. If */
  585. /* > UPLO = 'L' the RFP A contains the ( N*(N+1) /2 ) elements */
  586. /* > of lower packed A either in normal or conjugate-transpose */
  587. /* > Format. The LDA of RFP A is (N+1)/2 when TRANSR = 'C'. When */
  588. /* > TRANSR is 'N' the LDA is N+1 when N is even and is N when */
  589. /* > is odd. See the Note below for more details. */
  590. /* > Unchanged on exit. */
  591. /* > \endverbatim */
  592. /* > */
  593. /* > \param[out] WORK */
  594. /* > \verbatim */
  595. /* > WORK is DOUBLE PRECISION array, dimension (LWORK), */
  596. /* > where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, */
  597. /* > WORK is not referenced. */
  598. /* > \endverbatim */
  599. /* Authors: */
  600. /* ======== */
  601. /* > \author Univ. of Tennessee */
  602. /* > \author Univ. of California Berkeley */
  603. /* > \author Univ. of Colorado Denver */
  604. /* > \author NAG Ltd. */
  605. /* > \date December 2016 */
  606. /* > \ingroup complex16OTHERcomputational */
  607. /* > \par Further Details: */
  608. /* ===================== */
  609. /* > */
  610. /* > \verbatim */
  611. /* > */
  612. /* > We first consider Standard Packed Format when N is even. */
  613. /* > We give an example where N = 6. */
  614. /* > */
  615. /* > AP is Upper AP is Lower */
  616. /* > */
  617. /* > 00 01 02 03 04 05 00 */
  618. /* > 11 12 13 14 15 10 11 */
  619. /* > 22 23 24 25 20 21 22 */
  620. /* > 33 34 35 30 31 32 33 */
  621. /* > 44 45 40 41 42 43 44 */
  622. /* > 55 50 51 52 53 54 55 */
  623. /* > */
  624. /* > */
  625. /* > Let TRANSR = 'N'. RFP holds AP as follows: */
  626. /* > For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last */
  627. /* > three columns of AP upper. The lower triangle A(4:6,0:2) consists of */
  628. /* > conjugate-transpose of the first three columns of AP upper. */
  629. /* > For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first */
  630. /* > three columns of AP lower. The upper triangle A(0:2,0:2) consists of */
  631. /* > conjugate-transpose of the last three columns of AP lower. */
  632. /* > To denote conjugate we place -- above the element. This covers the */
  633. /* > case N even and TRANSR = 'N'. */
  634. /* > */
  635. /* > RFP A RFP A */
  636. /* > */
  637. /* > -- -- -- */
  638. /* > 03 04 05 33 43 53 */
  639. /* > -- -- */
  640. /* > 13 14 15 00 44 54 */
  641. /* > -- */
  642. /* > 23 24 25 10 11 55 */
  643. /* > */
  644. /* > 33 34 35 20 21 22 */
  645. /* > -- */
  646. /* > 00 44 45 30 31 32 */
  647. /* > -- -- */
  648. /* > 01 11 55 40 41 42 */
  649. /* > -- -- -- */
  650. /* > 02 12 22 50 51 52 */
  651. /* > */
  652. /* > Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate- */
  653. /* > transpose of RFP A above. One therefore gets: */
  654. /* > */
  655. /* > */
  656. /* > RFP A RFP A */
  657. /* > */
  658. /* > -- -- -- -- -- -- -- -- -- -- */
  659. /* > 03 13 23 33 00 01 02 33 00 10 20 30 40 50 */
  660. /* > -- -- -- -- -- -- -- -- -- -- */
  661. /* > 04 14 24 34 44 11 12 43 44 11 21 31 41 51 */
  662. /* > -- -- -- -- -- -- -- -- -- -- */
  663. /* > 05 15 25 35 45 55 22 53 54 55 22 32 42 52 */
  664. /* > */
  665. /* > */
  666. /* > We next consider Standard Packed Format when N is odd. */
  667. /* > We give an example where N = 5. */
  668. /* > */
  669. /* > AP is Upper AP is Lower */
  670. /* > */
  671. /* > 00 01 02 03 04 00 */
  672. /* > 11 12 13 14 10 11 */
  673. /* > 22 23 24 20 21 22 */
  674. /* > 33 34 30 31 32 33 */
  675. /* > 44 40 41 42 43 44 */
  676. /* > */
  677. /* > */
  678. /* > Let TRANSR = 'N'. RFP holds AP as follows: */
  679. /* > For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last */
  680. /* > three columns of AP upper. The lower triangle A(3:4,0:1) consists of */
  681. /* > conjugate-transpose of the first two columns of AP upper. */
  682. /* > For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first */
  683. /* > three columns of AP lower. The upper triangle A(0:1,1:2) consists of */
  684. /* > conjugate-transpose of the last two columns of AP lower. */
  685. /* > To denote conjugate we place -- above the element. This covers the */
  686. /* > case N odd and TRANSR = 'N'. */
  687. /* > */
  688. /* > RFP A RFP A */
  689. /* > */
  690. /* > -- -- */
  691. /* > 02 03 04 00 33 43 */
  692. /* > -- */
  693. /* > 12 13 14 10 11 44 */
  694. /* > */
  695. /* > 22 23 24 20 21 22 */
  696. /* > -- */
  697. /* > 00 33 34 30 31 32 */
  698. /* > -- -- */
  699. /* > 01 11 44 40 41 42 */
  700. /* > */
  701. /* > Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate- */
  702. /* > transpose of RFP A above. One therefore gets: */
  703. /* > */
  704. /* > */
  705. /* > RFP A RFP A */
  706. /* > */
  707. /* > -- -- -- -- -- -- -- -- -- */
  708. /* > 02 12 22 00 01 00 10 20 30 40 50 */
  709. /* > -- -- -- -- -- -- -- -- -- */
  710. /* > 03 13 23 33 11 33 11 21 31 41 51 */
  711. /* > -- -- -- -- -- -- -- -- -- */
  712. /* > 04 14 24 34 44 43 44 22 32 42 52 */
  713. /* > \endverbatim */
  714. /* > */
  715. /* ===================================================================== */
  716. doublereal zlanhf_(char *norm, char *transr, char *uplo, integer *n,
  717. doublecomplex *a, doublereal *work)
  718. {
  719. /* System generated locals */
  720. integer i__1, i__2;
  721. doublereal ret_val, d__1;
  722. /* Local variables */
  723. doublereal temp;
  724. integer i__, j, k, l;
  725. doublereal s, scale;
  726. extern logical lsame_(char *, char *);
  727. doublereal value;
  728. integer n1;
  729. doublereal aa;
  730. extern logical disnan_(doublereal *);
  731. extern /* Subroutine */ void zlassq_(integer *, doublecomplex *, integer *,
  732. doublereal *, doublereal *);
  733. integer lda, ifm, noe, ilu;
  734. /* -- LAPACK computational routine (version 3.7.0) -- */
  735. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  736. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  737. /* December 2016 */
  738. /* ===================================================================== */
  739. if (*n == 0) {
  740. ret_val = 0.;
  741. return ret_val;
  742. } else if (*n == 1) {
  743. ret_val = (d__1 = a[0].r, abs(d__1));
  744. return ret_val;
  745. }
  746. /* set noe = 1 if n is odd. if n is even set noe=0 */
  747. noe = 1;
  748. if (*n % 2 == 0) {
  749. noe = 0;
  750. }
  751. /* set ifm = 0 when form='C' or 'c' and 1 otherwise */
  752. ifm = 1;
  753. if (lsame_(transr, "C")) {
  754. ifm = 0;
  755. }
  756. /* set ilu = 0 when uplo='U or 'u' and 1 otherwise */
  757. ilu = 1;
  758. if (lsame_(uplo, "U")) {
  759. ilu = 0;
  760. }
  761. /* set lda = (n+1)/2 when ifm = 0 */
  762. /* set lda = n when ifm = 1 and noe = 1 */
  763. /* set lda = n+1 when ifm = 1 and noe = 0 */
  764. if (ifm == 1) {
  765. if (noe == 1) {
  766. lda = *n;
  767. } else {
  768. /* noe=0 */
  769. lda = *n + 1;
  770. }
  771. } else {
  772. /* ifm=0 */
  773. lda = (*n + 1) / 2;
  774. }
  775. if (lsame_(norm, "M")) {
  776. /* Find f2cmax(abs(A(i,j))). */
  777. k = (*n + 1) / 2;
  778. value = 0.;
  779. if (noe == 1) {
  780. /* n is odd & n = k + k - 1 */
  781. if (ifm == 1) {
  782. /* A is n by k */
  783. if (ilu == 1) {
  784. /* uplo ='L' */
  785. j = 0;
  786. /* -> L(0,0) */
  787. i__1 = j + j * lda;
  788. temp = (d__1 = a[i__1].r, abs(d__1));
  789. if (value < temp || disnan_(&temp)) {
  790. value = temp;
  791. }
  792. i__1 = *n - 1;
  793. for (i__ = 1; i__ <= i__1; ++i__) {
  794. temp = z_abs(&a[i__ + j * lda]);
  795. if (value < temp || disnan_(&temp)) {
  796. value = temp;
  797. }
  798. }
  799. i__1 = k - 1;
  800. for (j = 1; j <= i__1; ++j) {
  801. i__2 = j - 2;
  802. for (i__ = 0; i__ <= i__2; ++i__) {
  803. temp = z_abs(&a[i__ + j * lda]);
  804. if (value < temp || disnan_(&temp)) {
  805. value = temp;
  806. }
  807. }
  808. i__ = j - 1;
  809. /* L(k+j,k+j) */
  810. i__2 = i__ + j * lda;
  811. temp = (d__1 = a[i__2].r, abs(d__1));
  812. if (value < temp || disnan_(&temp)) {
  813. value = temp;
  814. }
  815. i__ = j;
  816. /* -> L(j,j) */
  817. i__2 = i__ + j * lda;
  818. temp = (d__1 = a[i__2].r, abs(d__1));
  819. if (value < temp || disnan_(&temp)) {
  820. value = temp;
  821. }
  822. i__2 = *n - 1;
  823. for (i__ = j + 1; i__ <= i__2; ++i__) {
  824. temp = z_abs(&a[i__ + j * lda]);
  825. if (value < temp || disnan_(&temp)) {
  826. value = temp;
  827. }
  828. }
  829. }
  830. } else {
  831. /* uplo = 'U' */
  832. i__1 = k - 2;
  833. for (j = 0; j <= i__1; ++j) {
  834. i__2 = k + j - 2;
  835. for (i__ = 0; i__ <= i__2; ++i__) {
  836. temp = z_abs(&a[i__ + j * lda]);
  837. if (value < temp || disnan_(&temp)) {
  838. value = temp;
  839. }
  840. }
  841. i__ = k + j - 1;
  842. /* -> U(i,i) */
  843. i__2 = i__ + j * lda;
  844. temp = (d__1 = a[i__2].r, abs(d__1));
  845. if (value < temp || disnan_(&temp)) {
  846. value = temp;
  847. }
  848. ++i__;
  849. /* =k+j; i -> U(j,j) */
  850. i__2 = i__ + j * lda;
  851. temp = (d__1 = a[i__2].r, abs(d__1));
  852. if (value < temp || disnan_(&temp)) {
  853. value = temp;
  854. }
  855. i__2 = *n - 1;
  856. for (i__ = k + j + 1; i__ <= i__2; ++i__) {
  857. temp = z_abs(&a[i__ + j * lda]);
  858. if (value < temp || disnan_(&temp)) {
  859. value = temp;
  860. }
  861. }
  862. }
  863. i__1 = *n - 2;
  864. for (i__ = 0; i__ <= i__1; ++i__) {
  865. temp = z_abs(&a[i__ + j * lda]);
  866. if (value < temp || disnan_(&temp)) {
  867. value = temp;
  868. }
  869. /* j=k-1 */
  870. }
  871. /* i=n-1 -> U(n-1,n-1) */
  872. i__1 = i__ + j * lda;
  873. temp = (d__1 = a[i__1].r, abs(d__1));
  874. if (value < temp || disnan_(&temp)) {
  875. value = temp;
  876. }
  877. }
  878. } else {
  879. /* xpose case; A is k by n */
  880. if (ilu == 1) {
  881. /* uplo ='L' */
  882. i__1 = k - 2;
  883. for (j = 0; j <= i__1; ++j) {
  884. i__2 = j - 1;
  885. for (i__ = 0; i__ <= i__2; ++i__) {
  886. temp = z_abs(&a[i__ + j * lda]);
  887. if (value < temp || disnan_(&temp)) {
  888. value = temp;
  889. }
  890. }
  891. i__ = j;
  892. /* L(i,i) */
  893. i__2 = i__ + j * lda;
  894. temp = (d__1 = a[i__2].r, abs(d__1));
  895. if (value < temp || disnan_(&temp)) {
  896. value = temp;
  897. }
  898. i__ = j + 1;
  899. /* L(j+k,j+k) */
  900. i__2 = i__ + j * lda;
  901. temp = (d__1 = a[i__2].r, abs(d__1));
  902. if (value < temp || disnan_(&temp)) {
  903. value = temp;
  904. }
  905. i__2 = k - 1;
  906. for (i__ = j + 2; i__ <= i__2; ++i__) {
  907. temp = z_abs(&a[i__ + j * lda]);
  908. if (value < temp || disnan_(&temp)) {
  909. value = temp;
  910. }
  911. }
  912. }
  913. j = k - 1;
  914. i__1 = k - 2;
  915. for (i__ = 0; i__ <= i__1; ++i__) {
  916. temp = z_abs(&a[i__ + j * lda]);
  917. if (value < temp || disnan_(&temp)) {
  918. value = temp;
  919. }
  920. }
  921. i__ = k - 1;
  922. /* -> L(i,i) is at A(i,j) */
  923. i__1 = i__ + j * lda;
  924. temp = (d__1 = a[i__1].r, abs(d__1));
  925. if (value < temp || disnan_(&temp)) {
  926. value = temp;
  927. }
  928. i__1 = *n - 1;
  929. for (j = k; j <= i__1; ++j) {
  930. i__2 = k - 1;
  931. for (i__ = 0; i__ <= i__2; ++i__) {
  932. temp = z_abs(&a[i__ + j * lda]);
  933. if (value < temp || disnan_(&temp)) {
  934. value = temp;
  935. }
  936. }
  937. }
  938. } else {
  939. /* uplo = 'U' */
  940. i__1 = k - 2;
  941. for (j = 0; j <= i__1; ++j) {
  942. i__2 = k - 1;
  943. for (i__ = 0; i__ <= i__2; ++i__) {
  944. temp = z_abs(&a[i__ + j * lda]);
  945. if (value < temp || disnan_(&temp)) {
  946. value = temp;
  947. }
  948. }
  949. }
  950. j = k - 1;
  951. /* -> U(j,j) is at A(0,j) */
  952. i__1 = j * lda;
  953. temp = (d__1 = a[i__1].r, abs(d__1));
  954. if (value < temp || disnan_(&temp)) {
  955. value = temp;
  956. }
  957. i__1 = k - 1;
  958. for (i__ = 1; i__ <= i__1; ++i__) {
  959. temp = z_abs(&a[i__ + j * lda]);
  960. if (value < temp || disnan_(&temp)) {
  961. value = temp;
  962. }
  963. }
  964. i__1 = *n - 1;
  965. for (j = k; j <= i__1; ++j) {
  966. i__2 = j - k - 1;
  967. for (i__ = 0; i__ <= i__2; ++i__) {
  968. temp = z_abs(&a[i__ + j * lda]);
  969. if (value < temp || disnan_(&temp)) {
  970. value = temp;
  971. }
  972. }
  973. i__ = j - k;
  974. /* -> U(i,i) at A(i,j) */
  975. i__2 = i__ + j * lda;
  976. temp = (d__1 = a[i__2].r, abs(d__1));
  977. if (value < temp || disnan_(&temp)) {
  978. value = temp;
  979. }
  980. i__ = j - k + 1;
  981. /* U(j,j) */
  982. i__2 = i__ + j * lda;
  983. temp = (d__1 = a[i__2].r, abs(d__1));
  984. if (value < temp || disnan_(&temp)) {
  985. value = temp;
  986. }
  987. i__2 = k - 1;
  988. for (i__ = j - k + 2; i__ <= i__2; ++i__) {
  989. temp = z_abs(&a[i__ + j * lda]);
  990. if (value < temp || disnan_(&temp)) {
  991. value = temp;
  992. }
  993. }
  994. }
  995. }
  996. }
  997. } else {
  998. /* n is even & k = n/2 */
  999. if (ifm == 1) {
  1000. /* A is n+1 by k */
  1001. if (ilu == 1) {
  1002. /* uplo ='L' */
  1003. j = 0;
  1004. /* -> L(k,k) & j=1 -> L(0,0) */
  1005. i__1 = j + j * lda;
  1006. temp = (d__1 = a[i__1].r, abs(d__1));
  1007. if (value < temp || disnan_(&temp)) {
  1008. value = temp;
  1009. }
  1010. i__1 = j + 1 + j * lda;
  1011. temp = (d__1 = a[i__1].r, abs(d__1));
  1012. if (value < temp || disnan_(&temp)) {
  1013. value = temp;
  1014. }
  1015. i__1 = *n;
  1016. for (i__ = 2; i__ <= i__1; ++i__) {
  1017. temp = z_abs(&a[i__ + j * lda]);
  1018. if (value < temp || disnan_(&temp)) {
  1019. value = temp;
  1020. }
  1021. }
  1022. i__1 = k - 1;
  1023. for (j = 1; j <= i__1; ++j) {
  1024. i__2 = j - 1;
  1025. for (i__ = 0; i__ <= i__2; ++i__) {
  1026. temp = z_abs(&a[i__ + j * lda]);
  1027. if (value < temp || disnan_(&temp)) {
  1028. value = temp;
  1029. }
  1030. }
  1031. i__ = j;
  1032. /* L(k+j,k+j) */
  1033. i__2 = i__ + j * lda;
  1034. temp = (d__1 = a[i__2].r, abs(d__1));
  1035. if (value < temp || disnan_(&temp)) {
  1036. value = temp;
  1037. }
  1038. i__ = j + 1;
  1039. /* -> L(j,j) */
  1040. i__2 = i__ + j * lda;
  1041. temp = (d__1 = a[i__2].r, abs(d__1));
  1042. if (value < temp || disnan_(&temp)) {
  1043. value = temp;
  1044. }
  1045. i__2 = *n;
  1046. for (i__ = j + 2; i__ <= i__2; ++i__) {
  1047. temp = z_abs(&a[i__ + j * lda]);
  1048. if (value < temp || disnan_(&temp)) {
  1049. value = temp;
  1050. }
  1051. }
  1052. }
  1053. } else {
  1054. /* uplo = 'U' */
  1055. i__1 = k - 2;
  1056. for (j = 0; j <= i__1; ++j) {
  1057. i__2 = k + j - 1;
  1058. for (i__ = 0; i__ <= i__2; ++i__) {
  1059. temp = z_abs(&a[i__ + j * lda]);
  1060. if (value < temp || disnan_(&temp)) {
  1061. value = temp;
  1062. }
  1063. }
  1064. i__ = k + j;
  1065. /* -> U(i,i) */
  1066. i__2 = i__ + j * lda;
  1067. temp = (d__1 = a[i__2].r, abs(d__1));
  1068. if (value < temp || disnan_(&temp)) {
  1069. value = temp;
  1070. }
  1071. ++i__;
  1072. /* =k+j+1; i -> U(j,j) */
  1073. i__2 = i__ + j * lda;
  1074. temp = (d__1 = a[i__2].r, abs(d__1));
  1075. if (value < temp || disnan_(&temp)) {
  1076. value = temp;
  1077. }
  1078. i__2 = *n;
  1079. for (i__ = k + j + 2; i__ <= i__2; ++i__) {
  1080. temp = z_abs(&a[i__ + j * lda]);
  1081. if (value < temp || disnan_(&temp)) {
  1082. value = temp;
  1083. }
  1084. }
  1085. }
  1086. i__1 = *n - 2;
  1087. for (i__ = 0; i__ <= i__1; ++i__) {
  1088. temp = z_abs(&a[i__ + j * lda]);
  1089. if (value < temp || disnan_(&temp)) {
  1090. value = temp;
  1091. }
  1092. /* j=k-1 */
  1093. }
  1094. /* i=n-1 -> U(n-1,n-1) */
  1095. i__1 = i__ + j * lda;
  1096. temp = (d__1 = a[i__1].r, abs(d__1));
  1097. if (value < temp || disnan_(&temp)) {
  1098. value = temp;
  1099. }
  1100. i__ = *n;
  1101. /* -> U(k-1,k-1) */
  1102. i__1 = i__ + j * lda;
  1103. temp = (d__1 = a[i__1].r, abs(d__1));
  1104. if (value < temp || disnan_(&temp)) {
  1105. value = temp;
  1106. }
  1107. }
  1108. } else {
  1109. /* xpose case; A is k by n+1 */
  1110. if (ilu == 1) {
  1111. /* uplo ='L' */
  1112. j = 0;
  1113. /* -> L(k,k) at A(0,0) */
  1114. i__1 = j + j * lda;
  1115. temp = (d__1 = a[i__1].r, abs(d__1));
  1116. if (value < temp || disnan_(&temp)) {
  1117. value = temp;
  1118. }
  1119. i__1 = k - 1;
  1120. for (i__ = 1; i__ <= i__1; ++i__) {
  1121. temp = z_abs(&a[i__ + j * lda]);
  1122. if (value < temp || disnan_(&temp)) {
  1123. value = temp;
  1124. }
  1125. }
  1126. i__1 = k - 1;
  1127. for (j = 1; j <= i__1; ++j) {
  1128. i__2 = j - 2;
  1129. for (i__ = 0; i__ <= i__2; ++i__) {
  1130. temp = z_abs(&a[i__ + j * lda]);
  1131. if (value < temp || disnan_(&temp)) {
  1132. value = temp;
  1133. }
  1134. }
  1135. i__ = j - 1;
  1136. /* L(i,i) */
  1137. i__2 = i__ + j * lda;
  1138. temp = (d__1 = a[i__2].r, abs(d__1));
  1139. if (value < temp || disnan_(&temp)) {
  1140. value = temp;
  1141. }
  1142. i__ = j;
  1143. /* L(j+k,j+k) */
  1144. i__2 = i__ + j * lda;
  1145. temp = (d__1 = a[i__2].r, abs(d__1));
  1146. if (value < temp || disnan_(&temp)) {
  1147. value = temp;
  1148. }
  1149. i__2 = k - 1;
  1150. for (i__ = j + 1; i__ <= i__2; ++i__) {
  1151. temp = z_abs(&a[i__ + j * lda]);
  1152. if (value < temp || disnan_(&temp)) {
  1153. value = temp;
  1154. }
  1155. }
  1156. }
  1157. j = k;
  1158. i__1 = k - 2;
  1159. for (i__ = 0; i__ <= i__1; ++i__) {
  1160. temp = z_abs(&a[i__ + j * lda]);
  1161. if (value < temp || disnan_(&temp)) {
  1162. value = temp;
  1163. }
  1164. }
  1165. i__ = k - 1;
  1166. /* -> L(i,i) is at A(i,j) */
  1167. i__1 = i__ + j * lda;
  1168. temp = (d__1 = a[i__1].r, abs(d__1));
  1169. if (value < temp || disnan_(&temp)) {
  1170. value = temp;
  1171. }
  1172. i__1 = *n;
  1173. for (j = k + 1; j <= i__1; ++j) {
  1174. i__2 = k - 1;
  1175. for (i__ = 0; i__ <= i__2; ++i__) {
  1176. temp = z_abs(&a[i__ + j * lda]);
  1177. if (value < temp || disnan_(&temp)) {
  1178. value = temp;
  1179. }
  1180. }
  1181. }
  1182. } else {
  1183. /* uplo = 'U' */
  1184. i__1 = k - 1;
  1185. for (j = 0; j <= i__1; ++j) {
  1186. i__2 = k - 1;
  1187. for (i__ = 0; i__ <= i__2; ++i__) {
  1188. temp = z_abs(&a[i__ + j * lda]);
  1189. if (value < temp || disnan_(&temp)) {
  1190. value = temp;
  1191. }
  1192. }
  1193. }
  1194. j = k;
  1195. /* -> U(j,j) is at A(0,j) */
  1196. i__1 = j * lda;
  1197. temp = (d__1 = a[i__1].r, abs(d__1));
  1198. if (value < temp || disnan_(&temp)) {
  1199. value = temp;
  1200. }
  1201. i__1 = k - 1;
  1202. for (i__ = 1; i__ <= i__1; ++i__) {
  1203. temp = z_abs(&a[i__ + j * lda]);
  1204. if (value < temp || disnan_(&temp)) {
  1205. value = temp;
  1206. }
  1207. }
  1208. i__1 = *n - 1;
  1209. for (j = k + 1; j <= i__1; ++j) {
  1210. i__2 = j - k - 2;
  1211. for (i__ = 0; i__ <= i__2; ++i__) {
  1212. temp = z_abs(&a[i__ + j * lda]);
  1213. if (value < temp || disnan_(&temp)) {
  1214. value = temp;
  1215. }
  1216. }
  1217. i__ = j - k - 1;
  1218. /* -> U(i,i) at A(i,j) */
  1219. i__2 = i__ + j * lda;
  1220. temp = (d__1 = a[i__2].r, abs(d__1));
  1221. if (value < temp || disnan_(&temp)) {
  1222. value = temp;
  1223. }
  1224. i__ = j - k;
  1225. /* U(j,j) */
  1226. i__2 = i__ + j * lda;
  1227. temp = (d__1 = a[i__2].r, abs(d__1));
  1228. if (value < temp || disnan_(&temp)) {
  1229. value = temp;
  1230. }
  1231. i__2 = k - 1;
  1232. for (i__ = j - k + 1; i__ <= i__2; ++i__) {
  1233. temp = z_abs(&a[i__ + j * lda]);
  1234. if (value < temp || disnan_(&temp)) {
  1235. value = temp;
  1236. }
  1237. }
  1238. }
  1239. j = *n;
  1240. i__1 = k - 2;
  1241. for (i__ = 0; i__ <= i__1; ++i__) {
  1242. temp = z_abs(&a[i__ + j * lda]);
  1243. if (value < temp || disnan_(&temp)) {
  1244. value = temp;
  1245. }
  1246. }
  1247. i__ = k - 1;
  1248. /* U(k,k) at A(i,j) */
  1249. i__1 = i__ + j * lda;
  1250. temp = (d__1 = a[i__1].r, abs(d__1));
  1251. if (value < temp || disnan_(&temp)) {
  1252. value = temp;
  1253. }
  1254. }
  1255. }
  1256. }
  1257. } else if (lsame_(norm, "I") || lsame_(norm, "O") || *(unsigned char *)norm == '1') {
  1258. /* Find normI(A) ( = norm1(A), since A is Hermitian). */
  1259. if (ifm == 1) {
  1260. /* A is 'N' */
  1261. k = *n / 2;
  1262. if (noe == 1) {
  1263. /* n is odd & A is n by (n+1)/2 */
  1264. if (ilu == 0) {
  1265. /* uplo = 'U' */
  1266. i__1 = k - 1;
  1267. for (i__ = 0; i__ <= i__1; ++i__) {
  1268. work[i__] = 0.;
  1269. }
  1270. i__1 = k;
  1271. for (j = 0; j <= i__1; ++j) {
  1272. s = 0.;
  1273. i__2 = k + j - 1;
  1274. for (i__ = 0; i__ <= i__2; ++i__) {
  1275. aa = z_abs(&a[i__ + j * lda]);
  1276. /* -> A(i,j+k) */
  1277. s += aa;
  1278. work[i__] += aa;
  1279. }
  1280. i__2 = i__ + j * lda;
  1281. aa = (d__1 = a[i__2].r, abs(d__1));
  1282. /* -> A(j+k,j+k) */
  1283. work[j + k] = s + aa;
  1284. if (i__ == k + k) {
  1285. goto L10;
  1286. }
  1287. ++i__;
  1288. i__2 = i__ + j * lda;
  1289. aa = (d__1 = a[i__2].r, abs(d__1));
  1290. /* -> A(j,j) */
  1291. work[j] += aa;
  1292. s = 0.;
  1293. i__2 = k - 1;
  1294. for (l = j + 1; l <= i__2; ++l) {
  1295. ++i__;
  1296. aa = z_abs(&a[i__ + j * lda]);
  1297. /* -> A(l,j) */
  1298. s += aa;
  1299. work[l] += aa;
  1300. }
  1301. work[j] += s;
  1302. }
  1303. L10:
  1304. value = work[0];
  1305. i__1 = *n - 1;
  1306. for (i__ = 1; i__ <= i__1; ++i__) {
  1307. temp = work[i__];
  1308. if (value < temp || disnan_(&temp)) {
  1309. value = temp;
  1310. }
  1311. }
  1312. } else {
  1313. /* ilu = 1 & uplo = 'L' */
  1314. ++k;
  1315. /* k=(n+1)/2 for n odd and ilu=1 */
  1316. i__1 = *n - 1;
  1317. for (i__ = k; i__ <= i__1; ++i__) {
  1318. work[i__] = 0.;
  1319. }
  1320. for (j = k - 1; j >= 0; --j) {
  1321. s = 0.;
  1322. i__1 = j - 2;
  1323. for (i__ = 0; i__ <= i__1; ++i__) {
  1324. aa = z_abs(&a[i__ + j * lda]);
  1325. /* -> A(j+k,i+k) */
  1326. s += aa;
  1327. work[i__ + k] += aa;
  1328. }
  1329. if (j > 0) {
  1330. i__1 = i__ + j * lda;
  1331. aa = (d__1 = a[i__1].r, abs(d__1));
  1332. /* -> A(j+k,j+k) */
  1333. s += aa;
  1334. work[i__ + k] += s;
  1335. /* i=j */
  1336. ++i__;
  1337. }
  1338. i__1 = i__ + j * lda;
  1339. aa = (d__1 = a[i__1].r, abs(d__1));
  1340. /* -> A(j,j) */
  1341. work[j] = aa;
  1342. s = 0.;
  1343. i__1 = *n - 1;
  1344. for (l = j + 1; l <= i__1; ++l) {
  1345. ++i__;
  1346. aa = z_abs(&a[i__ + j * lda]);
  1347. /* -> A(l,j) */
  1348. s += aa;
  1349. work[l] += aa;
  1350. }
  1351. work[j] += s;
  1352. }
  1353. value = work[0];
  1354. i__1 = *n - 1;
  1355. for (i__ = 1; i__ <= i__1; ++i__) {
  1356. temp = work[i__];
  1357. if (value < temp || disnan_(&temp)) {
  1358. value = temp;
  1359. }
  1360. }
  1361. }
  1362. } else {
  1363. /* n is even & A is n+1 by k = n/2 */
  1364. if (ilu == 0) {
  1365. /* uplo = 'U' */
  1366. i__1 = k - 1;
  1367. for (i__ = 0; i__ <= i__1; ++i__) {
  1368. work[i__] = 0.;
  1369. }
  1370. i__1 = k - 1;
  1371. for (j = 0; j <= i__1; ++j) {
  1372. s = 0.;
  1373. i__2 = k + j - 1;
  1374. for (i__ = 0; i__ <= i__2; ++i__) {
  1375. aa = z_abs(&a[i__ + j * lda]);
  1376. /* -> A(i,j+k) */
  1377. s += aa;
  1378. work[i__] += aa;
  1379. }
  1380. i__2 = i__ + j * lda;
  1381. aa = (d__1 = a[i__2].r, abs(d__1));
  1382. /* -> A(j+k,j+k) */
  1383. work[j + k] = s + aa;
  1384. ++i__;
  1385. i__2 = i__ + j * lda;
  1386. aa = (d__1 = a[i__2].r, abs(d__1));
  1387. /* -> A(j,j) */
  1388. work[j] += aa;
  1389. s = 0.;
  1390. i__2 = k - 1;
  1391. for (l = j + 1; l <= i__2; ++l) {
  1392. ++i__;
  1393. aa = z_abs(&a[i__ + j * lda]);
  1394. /* -> A(l,j) */
  1395. s += aa;
  1396. work[l] += aa;
  1397. }
  1398. work[j] += s;
  1399. }
  1400. value = work[0];
  1401. i__1 = *n - 1;
  1402. for (i__ = 1; i__ <= i__1; ++i__) {
  1403. temp = work[i__];
  1404. if (value < temp || disnan_(&temp)) {
  1405. value = temp;
  1406. }
  1407. }
  1408. } else {
  1409. /* ilu = 1 & uplo = 'L' */
  1410. i__1 = *n - 1;
  1411. for (i__ = k; i__ <= i__1; ++i__) {
  1412. work[i__] = 0.;
  1413. }
  1414. for (j = k - 1; j >= 0; --j) {
  1415. s = 0.;
  1416. i__1 = j - 1;
  1417. for (i__ = 0; i__ <= i__1; ++i__) {
  1418. aa = z_abs(&a[i__ + j * lda]);
  1419. /* -> A(j+k,i+k) */
  1420. s += aa;
  1421. work[i__ + k] += aa;
  1422. }
  1423. i__1 = i__ + j * lda;
  1424. aa = (d__1 = a[i__1].r, abs(d__1));
  1425. /* -> A(j+k,j+k) */
  1426. s += aa;
  1427. work[i__ + k] += s;
  1428. /* i=j */
  1429. ++i__;
  1430. i__1 = i__ + j * lda;
  1431. aa = (d__1 = a[i__1].r, abs(d__1));
  1432. /* -> A(j,j) */
  1433. work[j] = aa;
  1434. s = 0.;
  1435. i__1 = *n - 1;
  1436. for (l = j + 1; l <= i__1; ++l) {
  1437. ++i__;
  1438. aa = z_abs(&a[i__ + j * lda]);
  1439. /* -> A(l,j) */
  1440. s += aa;
  1441. work[l] += aa;
  1442. }
  1443. work[j] += s;
  1444. }
  1445. value = work[0];
  1446. i__1 = *n - 1;
  1447. for (i__ = 1; i__ <= i__1; ++i__) {
  1448. temp = work[i__];
  1449. if (value < temp || disnan_(&temp)) {
  1450. value = temp;
  1451. }
  1452. }
  1453. }
  1454. }
  1455. } else {
  1456. /* ifm=0 */
  1457. k = *n / 2;
  1458. if (noe == 1) {
  1459. /* n is odd & A is (n+1)/2 by n */
  1460. if (ilu == 0) {
  1461. /* uplo = 'U' */
  1462. n1 = k;
  1463. /* n/2 */
  1464. ++k;
  1465. /* k is the row size and lda */
  1466. i__1 = *n - 1;
  1467. for (i__ = n1; i__ <= i__1; ++i__) {
  1468. work[i__] = 0.;
  1469. }
  1470. i__1 = n1 - 1;
  1471. for (j = 0; j <= i__1; ++j) {
  1472. s = 0.;
  1473. i__2 = k - 1;
  1474. for (i__ = 0; i__ <= i__2; ++i__) {
  1475. aa = z_abs(&a[i__ + j * lda]);
  1476. /* A(j,n1+i) */
  1477. work[i__ + n1] += aa;
  1478. s += aa;
  1479. }
  1480. work[j] = s;
  1481. }
  1482. /* j=n1=k-1 is special */
  1483. i__1 = j * lda;
  1484. s = (d__1 = a[i__1].r, abs(d__1));
  1485. /* A(k-1,k-1) */
  1486. i__1 = k - 1;
  1487. for (i__ = 1; i__ <= i__1; ++i__) {
  1488. aa = z_abs(&a[i__ + j * lda]);
  1489. /* A(k-1,i+n1) */
  1490. work[i__ + n1] += aa;
  1491. s += aa;
  1492. }
  1493. work[j] += s;
  1494. i__1 = *n - 1;
  1495. for (j = k; j <= i__1; ++j) {
  1496. s = 0.;
  1497. i__2 = j - k - 1;
  1498. for (i__ = 0; i__ <= i__2; ++i__) {
  1499. aa = z_abs(&a[i__ + j * lda]);
  1500. /* A(i,j-k) */
  1501. work[i__] += aa;
  1502. s += aa;
  1503. }
  1504. /* i=j-k */
  1505. i__2 = i__ + j * lda;
  1506. aa = (d__1 = a[i__2].r, abs(d__1));
  1507. /* A(j-k,j-k) */
  1508. s += aa;
  1509. work[j - k] += s;
  1510. ++i__;
  1511. i__2 = i__ + j * lda;
  1512. s = (d__1 = a[i__2].r, abs(d__1));
  1513. /* A(j,j) */
  1514. i__2 = *n - 1;
  1515. for (l = j + 1; l <= i__2; ++l) {
  1516. ++i__;
  1517. aa = z_abs(&a[i__ + j * lda]);
  1518. /* A(j,l) */
  1519. work[l] += aa;
  1520. s += aa;
  1521. }
  1522. work[j] += s;
  1523. }
  1524. value = work[0];
  1525. i__1 = *n - 1;
  1526. for (i__ = 1; i__ <= i__1; ++i__) {
  1527. temp = work[i__];
  1528. if (value < temp || disnan_(&temp)) {
  1529. value = temp;
  1530. }
  1531. }
  1532. } else {
  1533. /* ilu=1 & uplo = 'L' */
  1534. ++k;
  1535. /* k=(n+1)/2 for n odd and ilu=1 */
  1536. i__1 = *n - 1;
  1537. for (i__ = k; i__ <= i__1; ++i__) {
  1538. work[i__] = 0.;
  1539. }
  1540. i__1 = k - 2;
  1541. for (j = 0; j <= i__1; ++j) {
  1542. /* process */
  1543. s = 0.;
  1544. i__2 = j - 1;
  1545. for (i__ = 0; i__ <= i__2; ++i__) {
  1546. aa = z_abs(&a[i__ + j * lda]);
  1547. /* A(j,i) */
  1548. work[i__] += aa;
  1549. s += aa;
  1550. }
  1551. i__2 = i__ + j * lda;
  1552. aa = (d__1 = a[i__2].r, abs(d__1));
  1553. /* i=j so process of A(j,j) */
  1554. s += aa;
  1555. work[j] = s;
  1556. /* is initialised here */
  1557. ++i__;
  1558. /* i=j process A(j+k,j+k) */
  1559. i__2 = i__ + j * lda;
  1560. aa = (d__1 = a[i__2].r, abs(d__1));
  1561. s = aa;
  1562. i__2 = *n - 1;
  1563. for (l = k + j + 1; l <= i__2; ++l) {
  1564. ++i__;
  1565. aa = z_abs(&a[i__ + j * lda]);
  1566. /* A(l,k+j) */
  1567. s += aa;
  1568. work[l] += aa;
  1569. }
  1570. work[k + j] += s;
  1571. }
  1572. /* j=k-1 is special :process col A(k-1,0:k-1) */
  1573. s = 0.;
  1574. i__1 = k - 2;
  1575. for (i__ = 0; i__ <= i__1; ++i__) {
  1576. aa = z_abs(&a[i__ + j * lda]);
  1577. /* A(k,i) */
  1578. work[i__] += aa;
  1579. s += aa;
  1580. }
  1581. /* i=k-1 */
  1582. i__1 = i__ + j * lda;
  1583. aa = (d__1 = a[i__1].r, abs(d__1));
  1584. /* A(k-1,k-1) */
  1585. s += aa;
  1586. work[i__] = s;
  1587. /* done with col j=k+1 */
  1588. i__1 = *n - 1;
  1589. for (j = k; j <= i__1; ++j) {
  1590. /* process col j of A = A(j,0:k-1) */
  1591. s = 0.;
  1592. i__2 = k - 1;
  1593. for (i__ = 0; i__ <= i__2; ++i__) {
  1594. aa = z_abs(&a[i__ + j * lda]);
  1595. /* A(j,i) */
  1596. work[i__] += aa;
  1597. s += aa;
  1598. }
  1599. work[j] += s;
  1600. }
  1601. value = work[0];
  1602. i__1 = *n - 1;
  1603. for (i__ = 1; i__ <= i__1; ++i__) {
  1604. temp = work[i__];
  1605. if (value < temp || disnan_(&temp)) {
  1606. value = temp;
  1607. }
  1608. }
  1609. }
  1610. } else {
  1611. /* n is even & A is k=n/2 by n+1 */
  1612. if (ilu == 0) {
  1613. /* uplo = 'U' */
  1614. i__1 = *n - 1;
  1615. for (i__ = k; i__ <= i__1; ++i__) {
  1616. work[i__] = 0.;
  1617. }
  1618. i__1 = k - 1;
  1619. for (j = 0; j <= i__1; ++j) {
  1620. s = 0.;
  1621. i__2 = k - 1;
  1622. for (i__ = 0; i__ <= i__2; ++i__) {
  1623. aa = z_abs(&a[i__ + j * lda]);
  1624. /* A(j,i+k) */
  1625. work[i__ + k] += aa;
  1626. s += aa;
  1627. }
  1628. work[j] = s;
  1629. }
  1630. /* j=k */
  1631. i__1 = j * lda;
  1632. aa = (d__1 = a[i__1].r, abs(d__1));
  1633. /* A(k,k) */
  1634. s = aa;
  1635. i__1 = k - 1;
  1636. for (i__ = 1; i__ <= i__1; ++i__) {
  1637. aa = z_abs(&a[i__ + j * lda]);
  1638. /* A(k,k+i) */
  1639. work[i__ + k] += aa;
  1640. s += aa;
  1641. }
  1642. work[j] += s;
  1643. i__1 = *n - 1;
  1644. for (j = k + 1; j <= i__1; ++j) {
  1645. s = 0.;
  1646. i__2 = j - 2 - k;
  1647. for (i__ = 0; i__ <= i__2; ++i__) {
  1648. aa = z_abs(&a[i__ + j * lda]);
  1649. /* A(i,j-k-1) */
  1650. work[i__] += aa;
  1651. s += aa;
  1652. }
  1653. /* i=j-1-k */
  1654. i__2 = i__ + j * lda;
  1655. aa = (d__1 = a[i__2].r, abs(d__1));
  1656. /* A(j-k-1,j-k-1) */
  1657. s += aa;
  1658. work[j - k - 1] += s;
  1659. ++i__;
  1660. i__2 = i__ + j * lda;
  1661. aa = (d__1 = a[i__2].r, abs(d__1));
  1662. /* A(j,j) */
  1663. s = aa;
  1664. i__2 = *n - 1;
  1665. for (l = j + 1; l <= i__2; ++l) {
  1666. ++i__;
  1667. aa = z_abs(&a[i__ + j * lda]);
  1668. /* A(j,l) */
  1669. work[l] += aa;
  1670. s += aa;
  1671. }
  1672. work[j] += s;
  1673. }
  1674. /* j=n */
  1675. s = 0.;
  1676. i__1 = k - 2;
  1677. for (i__ = 0; i__ <= i__1; ++i__) {
  1678. aa = z_abs(&a[i__ + j * lda]);
  1679. /* A(i,k-1) */
  1680. work[i__] += aa;
  1681. s += aa;
  1682. }
  1683. /* i=k-1 */
  1684. i__1 = i__ + j * lda;
  1685. aa = (d__1 = a[i__1].r, abs(d__1));
  1686. /* A(k-1,k-1) */
  1687. s += aa;
  1688. work[i__] += s;
  1689. value = work[0];
  1690. i__1 = *n - 1;
  1691. for (i__ = 1; i__ <= i__1; ++i__) {
  1692. temp = work[i__];
  1693. if (value < temp || disnan_(&temp)) {
  1694. value = temp;
  1695. }
  1696. }
  1697. } else {
  1698. /* ilu=1 & uplo = 'L' */
  1699. i__1 = *n - 1;
  1700. for (i__ = k; i__ <= i__1; ++i__) {
  1701. work[i__] = 0.;
  1702. }
  1703. /* j=0 is special :process col A(k:n-1,k) */
  1704. s = (d__1 = a[0].r, abs(d__1));
  1705. /* A(k,k) */
  1706. i__1 = k - 1;
  1707. for (i__ = 1; i__ <= i__1; ++i__) {
  1708. aa = z_abs(&a[i__]);
  1709. /* A(k+i,k) */
  1710. work[i__ + k] += aa;
  1711. s += aa;
  1712. }
  1713. work[k] += s;
  1714. i__1 = k - 1;
  1715. for (j = 1; j <= i__1; ++j) {
  1716. /* process */
  1717. s = 0.;
  1718. i__2 = j - 2;
  1719. for (i__ = 0; i__ <= i__2; ++i__) {
  1720. aa = z_abs(&a[i__ + j * lda]);
  1721. /* A(j-1,i) */
  1722. work[i__] += aa;
  1723. s += aa;
  1724. }
  1725. i__2 = i__ + j * lda;
  1726. aa = (d__1 = a[i__2].r, abs(d__1));
  1727. /* i=j-1 so process of A(j-1,j-1) */
  1728. s += aa;
  1729. work[j - 1] = s;
  1730. /* is initialised here */
  1731. ++i__;
  1732. /* i=j process A(j+k,j+k) */
  1733. i__2 = i__ + j * lda;
  1734. aa = (d__1 = a[i__2].r, abs(d__1));
  1735. s = aa;
  1736. i__2 = *n - 1;
  1737. for (l = k + j + 1; l <= i__2; ++l) {
  1738. ++i__;
  1739. aa = z_abs(&a[i__ + j * lda]);
  1740. /* A(l,k+j) */
  1741. s += aa;
  1742. work[l] += aa;
  1743. }
  1744. work[k + j] += s;
  1745. }
  1746. /* j=k is special :process col A(k,0:k-1) */
  1747. s = 0.;
  1748. i__1 = k - 2;
  1749. for (i__ = 0; i__ <= i__1; ++i__) {
  1750. aa = z_abs(&a[i__ + j * lda]);
  1751. /* A(k,i) */
  1752. work[i__] += aa;
  1753. s += aa;
  1754. }
  1755. /* i=k-1 */
  1756. i__1 = i__ + j * lda;
  1757. aa = (d__1 = a[i__1].r, abs(d__1));
  1758. /* A(k-1,k-1) */
  1759. s += aa;
  1760. work[i__] = s;
  1761. /* done with col j=k+1 */
  1762. i__1 = *n;
  1763. for (j = k + 1; j <= i__1; ++j) {
  1764. /* process col j-1 of A = A(j-1,0:k-1) */
  1765. s = 0.;
  1766. i__2 = k - 1;
  1767. for (i__ = 0; i__ <= i__2; ++i__) {
  1768. aa = z_abs(&a[i__ + j * lda]);
  1769. /* A(j-1,i) */
  1770. work[i__] += aa;
  1771. s += aa;
  1772. }
  1773. work[j - 1] += s;
  1774. }
  1775. value = work[0];
  1776. i__1 = *n - 1;
  1777. for (i__ = 1; i__ <= i__1; ++i__) {
  1778. temp = work[i__];
  1779. if (value < temp || disnan_(&temp)) {
  1780. value = temp;
  1781. }
  1782. }
  1783. }
  1784. }
  1785. }
  1786. } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
  1787. /* Find normF(A). */
  1788. k = (*n + 1) / 2;
  1789. scale = 0.;
  1790. s = 1.;
  1791. if (noe == 1) {
  1792. /* n is odd */
  1793. if (ifm == 1) {
  1794. /* A is normal & A is n by k */
  1795. if (ilu == 0) {
  1796. /* A is upper */
  1797. i__1 = k - 3;
  1798. for (j = 0; j <= i__1; ++j) {
  1799. i__2 = k - j - 2;
  1800. zlassq_(&i__2, &a[k + j + 1 + j * lda], &c__1, &scale,
  1801. &s);
  1802. /* L at A(k,0) */
  1803. }
  1804. i__1 = k - 1;
  1805. for (j = 0; j <= i__1; ++j) {
  1806. i__2 = k + j - 1;
  1807. zlassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
  1808. /* trap U at A(0,0) */
  1809. }
  1810. s += s;
  1811. /* double s for the off diagonal elements */
  1812. l = k - 1;
  1813. /* -> U(k,k) at A(k-1,0) */
  1814. i__1 = k - 2;
  1815. for (i__ = 0; i__ <= i__1; ++i__) {
  1816. i__2 = l;
  1817. aa = a[i__2].r;
  1818. /* U(k+i,k+i) */
  1819. if (aa != 0.) {
  1820. if (scale < aa) {
  1821. /* Computing 2nd power */
  1822. d__1 = scale / aa;
  1823. s = s * (d__1 * d__1) + 1.;
  1824. scale = aa;
  1825. } else {
  1826. /* Computing 2nd power */
  1827. d__1 = aa / scale;
  1828. s += d__1 * d__1;
  1829. }
  1830. }
  1831. i__2 = l + 1;
  1832. aa = a[i__2].r;
  1833. /* U(i,i) */
  1834. if (aa != 0.) {
  1835. if (scale < aa) {
  1836. /* Computing 2nd power */
  1837. d__1 = scale / aa;
  1838. s = s * (d__1 * d__1) + 1.;
  1839. scale = aa;
  1840. } else {
  1841. /* Computing 2nd power */
  1842. d__1 = aa / scale;
  1843. s += d__1 * d__1;
  1844. }
  1845. }
  1846. l = l + lda + 1;
  1847. }
  1848. i__1 = l;
  1849. aa = a[i__1].r;
  1850. /* U(n-1,n-1) */
  1851. if (aa != 0.) {
  1852. if (scale < aa) {
  1853. /* Computing 2nd power */
  1854. d__1 = scale / aa;
  1855. s = s * (d__1 * d__1) + 1.;
  1856. scale = aa;
  1857. } else {
  1858. /* Computing 2nd power */
  1859. d__1 = aa / scale;
  1860. s += d__1 * d__1;
  1861. }
  1862. }
  1863. } else {
  1864. /* ilu=1 & A is lower */
  1865. i__1 = k - 1;
  1866. for (j = 0; j <= i__1; ++j) {
  1867. i__2 = *n - j - 1;
  1868. zlassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
  1869. ;
  1870. /* trap L at A(0,0) */
  1871. }
  1872. i__1 = k - 2;
  1873. for (j = 1; j <= i__1; ++j) {
  1874. zlassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
  1875. /* U at A(0,1) */
  1876. }
  1877. s += s;
  1878. /* double s for the off diagonal elements */
  1879. aa = a[0].r;
  1880. /* L(0,0) at A(0,0) */
  1881. if (aa != 0.) {
  1882. if (scale < aa) {
  1883. /* Computing 2nd power */
  1884. d__1 = scale / aa;
  1885. s = s * (d__1 * d__1) + 1.;
  1886. scale = aa;
  1887. } else {
  1888. /* Computing 2nd power */
  1889. d__1 = aa / scale;
  1890. s += d__1 * d__1;
  1891. }
  1892. }
  1893. l = lda;
  1894. /* -> L(k,k) at A(0,1) */
  1895. i__1 = k - 1;
  1896. for (i__ = 1; i__ <= i__1; ++i__) {
  1897. i__2 = l;
  1898. aa = a[i__2].r;
  1899. /* L(k-1+i,k-1+i) */
  1900. if (aa != 0.) {
  1901. if (scale < aa) {
  1902. /* Computing 2nd power */
  1903. d__1 = scale / aa;
  1904. s = s * (d__1 * d__1) + 1.;
  1905. scale = aa;
  1906. } else {
  1907. /* Computing 2nd power */
  1908. d__1 = aa / scale;
  1909. s += d__1 * d__1;
  1910. }
  1911. }
  1912. i__2 = l + 1;
  1913. aa = a[i__2].r;
  1914. /* L(i,i) */
  1915. if (aa != 0.) {
  1916. if (scale < aa) {
  1917. /* Computing 2nd power */
  1918. d__1 = scale / aa;
  1919. s = s * (d__1 * d__1) + 1.;
  1920. scale = aa;
  1921. } else {
  1922. /* Computing 2nd power */
  1923. d__1 = aa / scale;
  1924. s += d__1 * d__1;
  1925. }
  1926. }
  1927. l = l + lda + 1;
  1928. }
  1929. }
  1930. } else {
  1931. /* A is xpose & A is k by n */
  1932. if (ilu == 0) {
  1933. /* A**H is upper */
  1934. i__1 = k - 2;
  1935. for (j = 1; j <= i__1; ++j) {
  1936. zlassq_(&j, &a[(k + j) * lda], &c__1, &scale, &s);
  1937. /* U at A(0,k) */
  1938. }
  1939. i__1 = k - 2;
  1940. for (j = 0; j <= i__1; ++j) {
  1941. zlassq_(&k, &a[j * lda], &c__1, &scale, &s);
  1942. /* k by k-1 rect. at A(0,0) */
  1943. }
  1944. i__1 = k - 2;
  1945. for (j = 0; j <= i__1; ++j) {
  1946. i__2 = k - j - 1;
  1947. zlassq_(&i__2, &a[j + 1 + (j + k - 1) * lda], &c__1, &
  1948. scale, &s);
  1949. /* L at A(0,k-1) */
  1950. }
  1951. s += s;
  1952. /* double s for the off diagonal elements */
  1953. l = k * lda - lda;
  1954. /* -> U(k-1,k-1) at A(0,k-1) */
  1955. i__1 = l;
  1956. aa = a[i__1].r;
  1957. /* U(k-1,k-1) */
  1958. if (aa != 0.) {
  1959. if (scale < aa) {
  1960. /* Computing 2nd power */
  1961. d__1 = scale / aa;
  1962. s = s * (d__1 * d__1) + 1.;
  1963. scale = aa;
  1964. } else {
  1965. /* Computing 2nd power */
  1966. d__1 = aa / scale;
  1967. s += d__1 * d__1;
  1968. }
  1969. }
  1970. l += lda;
  1971. /* -> U(0,0) at A(0,k) */
  1972. i__1 = *n - 1;
  1973. for (j = k; j <= i__1; ++j) {
  1974. i__2 = l;
  1975. aa = a[i__2].r;
  1976. /* -> U(j-k,j-k) */
  1977. if (aa != 0.) {
  1978. if (scale < aa) {
  1979. /* Computing 2nd power */
  1980. d__1 = scale / aa;
  1981. s = s * (d__1 * d__1) + 1.;
  1982. scale = aa;
  1983. } else {
  1984. /* Computing 2nd power */
  1985. d__1 = aa / scale;
  1986. s += d__1 * d__1;
  1987. }
  1988. }
  1989. i__2 = l + 1;
  1990. aa = a[i__2].r;
  1991. /* -> U(j,j) */
  1992. if (aa != 0.) {
  1993. if (scale < aa) {
  1994. /* Computing 2nd power */
  1995. d__1 = scale / aa;
  1996. s = s * (d__1 * d__1) + 1.;
  1997. scale = aa;
  1998. } else {
  1999. /* Computing 2nd power */
  2000. d__1 = aa / scale;
  2001. s += d__1 * d__1;
  2002. }
  2003. }
  2004. l = l + lda + 1;
  2005. }
  2006. } else {
  2007. /* A**H is lower */
  2008. i__1 = k - 1;
  2009. for (j = 1; j <= i__1; ++j) {
  2010. zlassq_(&j, &a[j * lda], &c__1, &scale, &s);
  2011. /* U at A(0,0) */
  2012. }
  2013. i__1 = *n - 1;
  2014. for (j = k; j <= i__1; ++j) {
  2015. zlassq_(&k, &a[j * lda], &c__1, &scale, &s);
  2016. /* k by k-1 rect. at A(0,k) */
  2017. }
  2018. i__1 = k - 3;
  2019. for (j = 0; j <= i__1; ++j) {
  2020. i__2 = k - j - 2;
  2021. zlassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
  2022. ;
  2023. /* L at A(1,0) */
  2024. }
  2025. s += s;
  2026. /* double s for the off diagonal elements */
  2027. l = 0;
  2028. /* -> L(0,0) at A(0,0) */
  2029. i__1 = k - 2;
  2030. for (i__ = 0; i__ <= i__1; ++i__) {
  2031. i__2 = l;
  2032. aa = a[i__2].r;
  2033. /* L(i,i) */
  2034. if (aa != 0.) {
  2035. if (scale < aa) {
  2036. /* Computing 2nd power */
  2037. d__1 = scale / aa;
  2038. s = s * (d__1 * d__1) + 1.;
  2039. scale = aa;
  2040. } else {
  2041. /* Computing 2nd power */
  2042. d__1 = aa / scale;
  2043. s += d__1 * d__1;
  2044. }
  2045. }
  2046. i__2 = l + 1;
  2047. aa = a[i__2].r;
  2048. /* L(k+i,k+i) */
  2049. if (aa != 0.) {
  2050. if (scale < aa) {
  2051. /* Computing 2nd power */
  2052. d__1 = scale / aa;
  2053. s = s * (d__1 * d__1) + 1.;
  2054. scale = aa;
  2055. } else {
  2056. /* Computing 2nd power */
  2057. d__1 = aa / scale;
  2058. s += d__1 * d__1;
  2059. }
  2060. }
  2061. l = l + lda + 1;
  2062. }
  2063. /* L-> k-1 + (k-1)*lda or L(k-1,k-1) at A(k-1,k-1) */
  2064. i__1 = l;
  2065. aa = a[i__1].r;
  2066. /* L(k-1,k-1) at A(k-1,k-1) */
  2067. if (aa != 0.) {
  2068. if (scale < aa) {
  2069. /* Computing 2nd power */
  2070. d__1 = scale / aa;
  2071. s = s * (d__1 * d__1) + 1.;
  2072. scale = aa;
  2073. } else {
  2074. /* Computing 2nd power */
  2075. d__1 = aa / scale;
  2076. s += d__1 * d__1;
  2077. }
  2078. }
  2079. }
  2080. }
  2081. } else {
  2082. /* n is even */
  2083. if (ifm == 1) {
  2084. /* A is normal */
  2085. if (ilu == 0) {
  2086. /* A is upper */
  2087. i__1 = k - 2;
  2088. for (j = 0; j <= i__1; ++j) {
  2089. i__2 = k - j - 1;
  2090. zlassq_(&i__2, &a[k + j + 2 + j * lda], &c__1, &scale,
  2091. &s);
  2092. /* L at A(k+1,0) */
  2093. }
  2094. i__1 = k - 1;
  2095. for (j = 0; j <= i__1; ++j) {
  2096. i__2 = k + j;
  2097. zlassq_(&i__2, &a[j * lda], &c__1, &scale, &s);
  2098. /* trap U at A(0,0) */
  2099. }
  2100. s += s;
  2101. /* double s for the off diagonal elements */
  2102. l = k;
  2103. /* -> U(k,k) at A(k,0) */
  2104. i__1 = k - 1;
  2105. for (i__ = 0; i__ <= i__1; ++i__) {
  2106. i__2 = l;
  2107. aa = a[i__2].r;
  2108. /* U(k+i,k+i) */
  2109. if (aa != 0.) {
  2110. if (scale < aa) {
  2111. /* Computing 2nd power */
  2112. d__1 = scale / aa;
  2113. s = s * (d__1 * d__1) + 1.;
  2114. scale = aa;
  2115. } else {
  2116. /* Computing 2nd power */
  2117. d__1 = aa / scale;
  2118. s += d__1 * d__1;
  2119. }
  2120. }
  2121. i__2 = l + 1;
  2122. aa = a[i__2].r;
  2123. /* U(i,i) */
  2124. if (aa != 0.) {
  2125. if (scale < aa) {
  2126. /* Computing 2nd power */
  2127. d__1 = scale / aa;
  2128. s = s * (d__1 * d__1) + 1.;
  2129. scale = aa;
  2130. } else {
  2131. /* Computing 2nd power */
  2132. d__1 = aa / scale;
  2133. s += d__1 * d__1;
  2134. }
  2135. }
  2136. l = l + lda + 1;
  2137. }
  2138. } else {
  2139. /* ilu=1 & A is lower */
  2140. i__1 = k - 1;
  2141. for (j = 0; j <= i__1; ++j) {
  2142. i__2 = *n - j - 1;
  2143. zlassq_(&i__2, &a[j + 2 + j * lda], &c__1, &scale, &s)
  2144. ;
  2145. /* trap L at A(1,0) */
  2146. }
  2147. i__1 = k - 1;
  2148. for (j = 1; j <= i__1; ++j) {
  2149. zlassq_(&j, &a[j * lda], &c__1, &scale, &s);
  2150. /* U at A(0,0) */
  2151. }
  2152. s += s;
  2153. /* double s for the off diagonal elements */
  2154. l = 0;
  2155. /* -> L(k,k) at A(0,0) */
  2156. i__1 = k - 1;
  2157. for (i__ = 0; i__ <= i__1; ++i__) {
  2158. i__2 = l;
  2159. aa = a[i__2].r;
  2160. /* L(k-1+i,k-1+i) */
  2161. if (aa != 0.) {
  2162. if (scale < aa) {
  2163. /* Computing 2nd power */
  2164. d__1 = scale / aa;
  2165. s = s * (d__1 * d__1) + 1.;
  2166. scale = aa;
  2167. } else {
  2168. /* Computing 2nd power */
  2169. d__1 = aa / scale;
  2170. s += d__1 * d__1;
  2171. }
  2172. }
  2173. i__2 = l + 1;
  2174. aa = a[i__2].r;
  2175. /* L(i,i) */
  2176. if (aa != 0.) {
  2177. if (scale < aa) {
  2178. /* Computing 2nd power */
  2179. d__1 = scale / aa;
  2180. s = s * (d__1 * d__1) + 1.;
  2181. scale = aa;
  2182. } else {
  2183. /* Computing 2nd power */
  2184. d__1 = aa / scale;
  2185. s += d__1 * d__1;
  2186. }
  2187. }
  2188. l = l + lda + 1;
  2189. }
  2190. }
  2191. } else {
  2192. /* A is xpose */
  2193. if (ilu == 0) {
  2194. /* A**H is upper */
  2195. i__1 = k - 1;
  2196. for (j = 1; j <= i__1; ++j) {
  2197. zlassq_(&j, &a[(k + 1 + j) * lda], &c__1, &scale, &s);
  2198. /* U at A(0,k+1) */
  2199. }
  2200. i__1 = k - 1;
  2201. for (j = 0; j <= i__1; ++j) {
  2202. zlassq_(&k, &a[j * lda], &c__1, &scale, &s);
  2203. /* k by k rect. at A(0,0) */
  2204. }
  2205. i__1 = k - 2;
  2206. for (j = 0; j <= i__1; ++j) {
  2207. i__2 = k - j - 1;
  2208. zlassq_(&i__2, &a[j + 1 + (j + k) * lda], &c__1, &
  2209. scale, &s);
  2210. /* L at A(0,k) */
  2211. }
  2212. s += s;
  2213. /* double s for the off diagonal elements */
  2214. l = k * lda;
  2215. /* -> U(k,k) at A(0,k) */
  2216. i__1 = l;
  2217. aa = a[i__1].r;
  2218. /* U(k,k) */
  2219. if (aa != 0.) {
  2220. if (scale < aa) {
  2221. /* Computing 2nd power */
  2222. d__1 = scale / aa;
  2223. s = s * (d__1 * d__1) + 1.;
  2224. scale = aa;
  2225. } else {
  2226. /* Computing 2nd power */
  2227. d__1 = aa / scale;
  2228. s += d__1 * d__1;
  2229. }
  2230. }
  2231. l += lda;
  2232. /* -> U(0,0) at A(0,k+1) */
  2233. i__1 = *n - 1;
  2234. for (j = k + 1; j <= i__1; ++j) {
  2235. i__2 = l;
  2236. aa = a[i__2].r;
  2237. /* -> U(j-k-1,j-k-1) */
  2238. if (aa != 0.) {
  2239. if (scale < aa) {
  2240. /* Computing 2nd power */
  2241. d__1 = scale / aa;
  2242. s = s * (d__1 * d__1) + 1.;
  2243. scale = aa;
  2244. } else {
  2245. /* Computing 2nd power */
  2246. d__1 = aa / scale;
  2247. s += d__1 * d__1;
  2248. }
  2249. }
  2250. i__2 = l + 1;
  2251. aa = a[i__2].r;
  2252. /* -> U(j,j) */
  2253. if (aa != 0.) {
  2254. if (scale < aa) {
  2255. /* Computing 2nd power */
  2256. d__1 = scale / aa;
  2257. s = s * (d__1 * d__1) + 1.;
  2258. scale = aa;
  2259. } else {
  2260. /* Computing 2nd power */
  2261. d__1 = aa / scale;
  2262. s += d__1 * d__1;
  2263. }
  2264. }
  2265. l = l + lda + 1;
  2266. }
  2267. /* L=k-1+n*lda */
  2268. /* -> U(k-1,k-1) at A(k-1,n) */
  2269. i__1 = l;
  2270. aa = a[i__1].r;
  2271. /* U(k,k) */
  2272. if (aa != 0.) {
  2273. if (scale < aa) {
  2274. /* Computing 2nd power */
  2275. d__1 = scale / aa;
  2276. s = s * (d__1 * d__1) + 1.;
  2277. scale = aa;
  2278. } else {
  2279. /* Computing 2nd power */
  2280. d__1 = aa / scale;
  2281. s += d__1 * d__1;
  2282. }
  2283. }
  2284. } else {
  2285. /* A**H is lower */
  2286. i__1 = k - 1;
  2287. for (j = 1; j <= i__1; ++j) {
  2288. zlassq_(&j, &a[(j + 1) * lda], &c__1, &scale, &s);
  2289. /* U at A(0,1) */
  2290. }
  2291. i__1 = *n;
  2292. for (j = k + 1; j <= i__1; ++j) {
  2293. zlassq_(&k, &a[j * lda], &c__1, &scale, &s);
  2294. /* k by k rect. at A(0,k+1) */
  2295. }
  2296. i__1 = k - 2;
  2297. for (j = 0; j <= i__1; ++j) {
  2298. i__2 = k - j - 1;
  2299. zlassq_(&i__2, &a[j + 1 + j * lda], &c__1, &scale, &s)
  2300. ;
  2301. /* L at A(0,0) */
  2302. }
  2303. s += s;
  2304. /* double s for the off diagonal elements */
  2305. l = 0;
  2306. /* -> L(k,k) at A(0,0) */
  2307. i__1 = l;
  2308. aa = a[i__1].r;
  2309. /* L(k,k) at A(0,0) */
  2310. if (aa != 0.) {
  2311. if (scale < aa) {
  2312. /* Computing 2nd power */
  2313. d__1 = scale / aa;
  2314. s = s * (d__1 * d__1) + 1.;
  2315. scale = aa;
  2316. } else {
  2317. /* Computing 2nd power */
  2318. d__1 = aa / scale;
  2319. s += d__1 * d__1;
  2320. }
  2321. }
  2322. l = lda;
  2323. /* -> L(0,0) at A(0,1) */
  2324. i__1 = k - 2;
  2325. for (i__ = 0; i__ <= i__1; ++i__) {
  2326. i__2 = l;
  2327. aa = a[i__2].r;
  2328. /* L(i,i) */
  2329. if (aa != 0.) {
  2330. if (scale < aa) {
  2331. /* Computing 2nd power */
  2332. d__1 = scale / aa;
  2333. s = s * (d__1 * d__1) + 1.;
  2334. scale = aa;
  2335. } else {
  2336. /* Computing 2nd power */
  2337. d__1 = aa / scale;
  2338. s += d__1 * d__1;
  2339. }
  2340. }
  2341. i__2 = l + 1;
  2342. aa = a[i__2].r;
  2343. /* L(k+i+1,k+i+1) */
  2344. if (aa != 0.) {
  2345. if (scale < aa) {
  2346. /* Computing 2nd power */
  2347. d__1 = scale / aa;
  2348. s = s * (d__1 * d__1) + 1.;
  2349. scale = aa;
  2350. } else {
  2351. /* Computing 2nd power */
  2352. d__1 = aa / scale;
  2353. s += d__1 * d__1;
  2354. }
  2355. }
  2356. l = l + lda + 1;
  2357. }
  2358. /* L-> k - 1 + k*lda or L(k-1,k-1) at A(k-1,k) */
  2359. i__1 = l;
  2360. aa = a[i__1].r;
  2361. /* L(k-1,k-1) at A(k-1,k) */
  2362. if (aa != 0.) {
  2363. if (scale < aa) {
  2364. /* Computing 2nd power */
  2365. d__1 = scale / aa;
  2366. s = s * (d__1 * d__1) + 1.;
  2367. scale = aa;
  2368. } else {
  2369. /* Computing 2nd power */
  2370. d__1 = aa / scale;
  2371. s += d__1 * d__1;
  2372. }
  2373. }
  2374. }
  2375. }
  2376. }
  2377. value = scale * sqrt(s);
  2378. }
  2379. ret_val = value;
  2380. return ret_val;
  2381. /* End of ZLANHF */
  2382. } /* zlanhf_ */