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.

c_zblat3c_3m.c 120 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951
  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. #include "common.h"
  13. typedef blasint integer;
  14. typedef unsigned int uinteger;
  15. typedef char *address;
  16. typedef short int shortint;
  17. typedef float real;
  18. typedef double doublereal;
  19. typedef struct { real r, i; } complex;
  20. typedef struct { doublereal r, i; } doublecomplex;
  21. #ifdef _MSC_VER
  22. static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
  23. static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
  24. #else
  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 double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  28. #endif
  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. #ifdef _MSC_VER
  152. #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]);}
  153. #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]);}
  154. #else
  155. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  156. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  157. #endif
  158. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  159. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  160. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  161. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  162. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  163. #define d_abs(x) (fabs(*(x)))
  164. #define d_acos(x) (acos(*(x)))
  165. #define d_asin(x) (asin(*(x)))
  166. #define d_atan(x) (atan(*(x)))
  167. #define d_atn2(x, y) (atan2(*(x),*(y)))
  168. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  169. #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
  170. #define d_cos(x) (cos(*(x)))
  171. #define d_cosh(x) (cosh(*(x)))
  172. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  173. #define d_exp(x) (exp(*(x)))
  174. #define d_imag(z) (cimag(Cd(z)))
  175. #define r_imag(z) (cimagf(Cf(z)))
  176. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  177. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  178. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  179. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  180. #define d_log(x) (log(*(x)))
  181. #define d_mod(x, y) (fmod(*(x), *(y)))
  182. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  183. #define d_nint(x) u_nint(*(x))
  184. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  185. #define d_sign(a,b) u_sign(*(a),*(b))
  186. #define r_sign(a,b) u_sign(*(a),*(b))
  187. #define d_sin(x) (sin(*(x)))
  188. #define d_sinh(x) (sinh(*(x)))
  189. #define d_sqrt(x) (sqrt(*(x)))
  190. #define d_tan(x) (tan(*(x)))
  191. #define d_tanh(x) (tanh(*(x)))
  192. #define i_abs(x) abs(*(x))
  193. #define i_dnnt(x) ((integer)u_nint(*(x)))
  194. #define i_len(s, n) (n)
  195. #define i_nint(x) ((integer)u_nint(*(x)))
  196. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  197. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  198. #define pow_si(B,E) spow_ui(*(B),*(E))
  199. #define pow_ri(B,E) spow_ui(*(B),*(E))
  200. #define pow_di(B,E) dpow_ui(*(B),*(E))
  201. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  202. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  203. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  204. #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++ = ' '; }
  205. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  206. #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]; }
  207. #define sig_die(s, kill) { exit(1); }
  208. #define s_stop(s, n) {exit(0);}
  209. #define z_abs(z) (cabs(Cd(z)))
  210. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  211. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  212. #define myexit_() break;
  213. #define mycycle_() continue;
  214. #define myceiling_(w) {ceil(w)}
  215. #define myhuge_(w) {HUGE_VAL}
  216. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  217. #define mymaxloc_(w,s,e,n) dmaxloc_(w,*(s),*(e),n)
  218. /* procedure parameter types for -A and -C++ */
  219. #define F2C_proc_par_types 1
  220. /* Common Block Declarations */
  221. struct {
  222. integer infot, noutc;
  223. logical ok, lerr;
  224. } infoc_;
  225. #define infoc_1 infoc_
  226. struct {
  227. char srnamt[12];
  228. } srnamc_;
  229. #define srnamc_1 srnamc_
  230. /* Table of constant values */
  231. static doublecomplex c_b1 = {0.,0.};
  232. static doublecomplex c_b2 = {1.,0.};
  233. static integer c__1 = 1;
  234. static integer c__65 = 65;
  235. static doublereal c_b92 = 1.;
  236. static integer c__6 = 6;
  237. static logical c_true = TRUE_;
  238. static integer c__0 = 0;
  239. static logical c_false = FALSE_;
  240. /* Main program MAIN__() */ int main(void)
  241. {
  242. /* Initialized data */
  243. static char snames[9][13] = { "cblas_zgemm3m ", "cblas_zhemm ", "cblas_zsymm ", "cblas_ztrmm ",
  244. "cblas_ztrsm ", "cblas_zherk ", "cblas_zsyrk ", "cblas_zher2k", "cblas_zsyr2k"};
  245. /* System generated locals */
  246. integer i__1, i__2, i__3, i__4, i__5;
  247. doublereal d__1;
  248. /* Builtin functions */
  249. integer s_rsle(void), do_lio(void), e_rsle(void), f_open(void), s_wsfe(void), do_fio(void),
  250. e_wsfe(void), s_wsle(void), e_wsle(void), s_rsfe(void), e_rsfe(void);
  251. /* Local variables */
  252. static integer nalf, idim[9];
  253. static logical same;
  254. static integer nbet, ntra;
  255. static logical rewi;
  256. extern /* Subroutine */ int zchk1_(char*, doublereal*, doublereal*, integer*, integer*, logical*, logical*, logical*, integer*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublereal*, integer*, ftnlen);
  257. extern /* Subroutine */ int zchk2_(char*, doublereal*, doublereal*, integer*, integer*, logical*, logical*, logical*, integer*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublereal*, integer*, ftnlen);
  258. extern /* Subroutine */ int zchk3_(char*, doublereal*, doublereal*, integer*, integer*, logical*, logical*, logical*, integer*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublereal*, doublecomplex*, integer*, ftnlen);
  259. extern /* Subroutine */ int zchk4_(char*, doublereal*, doublereal*, integer*, integer*, logical*, logical*, logical*, integer*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublereal*, integer*, ftnlen);
  260. extern /* Subroutine */ int zchk5_(char*, doublereal*, doublereal*, integer*, integer*, logical*, logical*, logical*, integer*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublecomplex*, doublereal*, doublecomplex*, integer*, ftnlen);
  261. static doublecomplex c__[4225] /* was [65][65] */;
  262. static doublereal g[65];
  263. static integer i__, j;
  264. extern doublereal ddiff_(doublereal*, doublereal*);
  265. static integer n;
  266. static logical fatal;
  267. static doublecomplex w[130];
  268. static logical trace;
  269. static integer nidim;
  270. extern /* Subroutine */ int zmmch_(char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublereal*, doublecomplex*, integer*, doublereal*, doublereal*, logical*, integer*, logical*, ftnlen, ftnlen);
  271. static char snaps[32];
  272. static integer isnum;
  273. static logical ltest[9];
  274. static doublecomplex aa[4225], ab[8450] /* was [65][130] */, bb[4225],
  275. cc[4225], as[4225], bs[4225], cs[4225], ct[65];
  276. static logical sfatal, corder;
  277. static char snamet[12], transa[1], transb[1];
  278. static doublereal thresh;
  279. static logical rorder;
  280. static integer layout;
  281. static logical ltestt, tsterr;
  282. extern /* Subroutine */ int cz3chke_(char*, ftnlen);
  283. static doublecomplex alf[7], bet[7];
  284. static doublereal eps, err;
  285. extern logical lze_(doublecomplex*, doublecomplex*, integer*);
  286. char tmpchar;
  287. /* Test program for the COMPLEX*16 Level 3 Blas. */
  288. /* The program must be driven by a short data file. The first 13 records */
  289. /* of the file are read using list-directed input, the last 9 records */
  290. /* are read using the format ( A12,L2 ). An annotated example of a data */
  291. /* file can be obtained by deleting the first 3 characters from the */
  292. /* following 22 lines: */
  293. /* 'CBLAT3.SNAP' NAME OF SNAPSHOT OUTPUT FILE */
  294. /* -1 UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0) */
  295. /* F LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD. */
  296. /* F LOGICAL FLAG, T TO STOP ON FAILURES. */
  297. /* T LOGICAL FLAG, T TO TEST ERROR EXITS. */
  298. /* 2 0 TO TEST COLUMN-MAJOR, 1 TO TEST ROW-MAJOR, 2 TO TEST BOTH */
  299. /* 16.0 THRESHOLD VALUE OF TEST RATIO */
  300. /* 6 NUMBER OF VALUES OF N */
  301. /* 0 1 2 3 5 9 VALUES OF N */
  302. /* 3 NUMBER OF VALUES OF ALPHA */
  303. /* (0.0,0.0) (1.0,0.0) (0.7,-0.9) VALUES OF ALPHA */
  304. /* 3 NUMBER OF VALUES OF BETA */
  305. /* (0.0,0.0) (1.0,0.0) (1.3,-1.1) VALUES OF BETA */
  306. /* ZGEMM T PUT F FOR NO TEST. SAME COLUMNS. */
  307. /* ZHEMM T PUT F FOR NO TEST. SAME COLUMNS. */
  308. /* ZSYMM T PUT F FOR NO TEST. SAME COLUMNS. */
  309. /* ZTRMM T PUT F FOR NO TEST. SAME COLUMNS. */
  310. /* ZTRSM T PUT F FOR NO TEST. SAME COLUMNS. */
  311. /* ZHERK T PUT F FOR NO TEST. SAME COLUMNS. */
  312. /* ZSYRK T PUT F FOR NO TEST. SAME COLUMNS. */
  313. /* ZHER2K T PUT F FOR NO TEST. SAME COLUMNS. */
  314. /* ZSYR2K T PUT F FOR NO TEST. SAME COLUMNS. */
  315. /* See: */
  316. /* Dongarra J. J., Du Croz J. J., Duff I. S. and Hammarling S. */
  317. /* A Set of Level 3 Basic Linear Algebra Subprograms. */
  318. /* Technical Memorandum No.88 (Revision 1), Mathematics and */
  319. /* Computer Science Division, Argonne National Laboratory, 9700 */
  320. /* South Cass Avenue, Argonne, Illinois 60439, US. */
  321. /* -- Written on 8-February-1989. */
  322. /* Jack Dongarra, Argonne National Laboratory. */
  323. /* Iain Duff, AERE Harwell. */
  324. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  325. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  326. /* .. Parameters .. */
  327. /* .. Local Scalars .. */
  328. /* .. Local Arrays .. */
  329. /* .. External Functions .. */
  330. /* .. External Subroutines .. */
  331. /* .. Intrinsic Functions .. */
  332. /* .. Scalars in Common .. */
  333. /* .. Common blocks .. */
  334. /* .. Data statements .. */
  335. /* .. Executable Statements .. */
  336. infoc_1.noutc = 6;
  337. /* Read name and unit number for snapshot output file and open file. */
  338. char line[80];
  339. fgets(line,80,stdin);
  340. sscanf(line,"'%s'",snaps);
  341. fgets(line,80,stdin);
  342. #ifdef USE64BITINT
  343. sscanf(line,"%ld",&ntra);
  344. #else
  345. sscanf(line,"%d",&ntra);
  346. #endif
  347. trace = ntra >= 0;
  348. if (trace) {
  349. /* o__1.oerr = 0;
  350. o__1.ounit = ntra;
  351. o__1.ofnmlen = 32;
  352. o__1.ofnm = snaps;
  353. o__1.orl = 0;
  354. o__1.osta = "NEW";
  355. o__1.oacc = 0;
  356. o__1.ofm = 0;
  357. o__1.oblnk = 0;
  358. f_open(&o__1);*/
  359. }
  360. /* Read the flag that directs rewinding of the snapshot file. */
  361. fgets(line,80,stdin);
  362. sscanf(line,"%d",&rewi);
  363. rewi = rewi && trace;
  364. /* Read the flag that directs stopping on any failure. */
  365. fgets(line,80,stdin);
  366. sscanf(line,"%c",&tmpchar);
  367. sfatal=FALSE_;
  368. if (tmpchar=='T')sfatal=TRUE_;
  369. /* Read the flag that indicates whether error exits are to be tested. */
  370. fgets(line,80,stdin);
  371. sscanf(line,"%c",&tmpchar);
  372. tsterr=FALSE_;
  373. if (tmpchar=='T')tsterr=TRUE_;
  374. /* Read the flag that indicates whether row-major data layout to be tested. */
  375. fgets(line,80,stdin);
  376. sscanf(line,"%d",&layout);
  377. /* Read the threshold value of the test ratio */
  378. fgets(line,80,stdin);
  379. sscanf(line,"%lf",&thresh);
  380. /* Read and check the parameter values for the tests. */
  381. /* Values of N */
  382. fgets(line,80,stdin);
  383. #ifdef USE64BITINT
  384. sscanf(line,"%d",&nidim);
  385. #else
  386. sscanf(line,"%d",&nidim);
  387. #endif
  388. if (nidim < 1 || nidim > 9) {
  389. fprintf(stderr,"NUMBER OF VALUES OF N IS LESS THAN 1 OR GREATER THAN 9");
  390. goto L220;
  391. }
  392. fgets(line,80,stdin);
  393. #ifdef USE64BITINT
  394. sscanf(line,"%ld %ld %ld %ld %ld %ld %ld %ld %ld",&idim[0],&idim[1],&idim[2],
  395. &idim[3],&idim[4],&idim[5],&idim[6],&idim[7],&idim[8]);
  396. #else
  397. sscanf(line,"%d %d %d %d %d %d %d %d %d",&idim[0],&idim[1],&idim[2],
  398. &idim[3],&idim[4],&idim[5],&idim[6],&idim[7],&idim[8]);
  399. #endif
  400. i__1 = nidim;
  401. for (i__ = 1; i__ <= i__1; ++i__) {
  402. if (idim[i__ - 1] < 0 || idim[i__ - 1] > 65) {
  403. fprintf(stderr,"VALUE OF N IS LESS THAN 0 OR GREATER THAN 65\n");
  404. goto L220;
  405. }
  406. /* L10: */
  407. }
  408. /* Values of ALPHA */
  409. fgets(line,80,stdin);
  410. #ifdef USE64BITINT
  411. sscanf(line,"%ld",&nalf);
  412. #else
  413. sscanf(line,"%d",&nalf);
  414. #endif
  415. if (nalf < 1 || nalf > 7) {
  416. fprintf(stderr,"VALUE OF ALPHA IS LESS THAN 0 OR GREATER THAN 7\n");
  417. goto L220;
  418. }
  419. fgets(line,80,stdin);
  420. sscanf(line,"(%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf)",&alf[0].r,&alf[0].i,&alf[1].r,&alf[1].i,&alf[2].r,&alf[2].i,&alf[3].r,&alf[3].i,
  421. &alf[4].r,&alf[4].i,&alf[5].r,&alf[5].i,&alf[6].r,&alf[6].i);
  422. /* Values of BETA */
  423. fgets(line,80,stdin);
  424. #ifdef USE64BITINT
  425. sscanf(line,"%ld",&nbet);
  426. #else
  427. sscanf(line,"%d",&nbet);
  428. #endif
  429. if (nalf < 1 || nbet > 7) {
  430. fprintf(stderr,"VALUE OF BETA IS LESS THAN 0 OR GREATER THAN 7\n");
  431. goto L220;
  432. }
  433. fgets(line,80,stdin);
  434. sscanf(line,"(%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf) (%lf,%lf)",&bet[0].r,&bet[0].i,&bet[1].r,&bet[1].i,&bet[2].r,&bet[2].i,&bet[3].r,&bet[3].i,
  435. &bet[4].r,&bet[4].i,&bet[5].r,&bet[5].i,&bet[6].r,&bet[6].i);
  436. /* Report values of parameters. */
  437. printf("TESTS OF THE DOUBLE PRECISION COMPLEX LEVEL 3 BLAS\nTHE FOLLOWING PARAMETER VALUES WILL BE USED:\n");
  438. printf(" FOR N");
  439. for (i__ =1; i__ <=nidim;++i__) printf(" %d",idim[i__-1]);
  440. printf("\n");
  441. printf(" FOR ALPHA");
  442. for (i__ =1; i__ <=nalf;++i__) printf(" (%lf,%lf)",alf[i__-1].r,alf[i__-1].i);
  443. printf("\n");
  444. printf(" FOR BETA");
  445. for (i__ =1; i__ <=nbet;++i__) printf(" (%lf,%lf)",bet[i__-1].r,bet[i__-1].i);
  446. printf("\n");
  447. if (! tsterr) {
  448. printf(" ERROR-EXITS WILL NOT BE TESTED\n");
  449. }
  450. printf("ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LESS THAN %lf\n",thresh);
  451. rorder = FALSE_;
  452. corder = FALSE_;
  453. if (layout == 2) {
  454. rorder = TRUE_;
  455. corder = TRUE_;
  456. printf("COLUMN-MAJOR AND ROW-MAJOR DATA LAYOUTS ARE TESTED\n");
  457. } else if (layout == 1) {
  458. rorder = TRUE_;
  459. printf("ROW-MAJOR DATA LAYOUT IS TESTED\n");
  460. } else if (layout == 0) {
  461. corder = TRUE_;
  462. printf("COLUMN-MAJOR DATA LAYOUT IS TESTED\n");
  463. }
  464. /* Read names of subroutines and flags which indicate */
  465. /* whether they are to be tested. */
  466. for (i__ = 1; i__ <= 9; ++i__) {
  467. ltest[i__ - 1] = FALSE_;
  468. /* L20: */
  469. }
  470. L30:
  471. if (! fgets(line,80,stdin)) {
  472. goto L60;
  473. }
  474. i__1 = sscanf(line,"%12c %c",snamet,&tmpchar);
  475. ltestt=FALSE_;
  476. if (tmpchar=='T')ltestt=TRUE_;
  477. if (i__1 < 2) {
  478. goto L60;
  479. }
  480. for (i__ = 1; i__ <= 9; ++i__) {
  481. if (s_cmp(snamet, snames[i__ - 1] , (ftnlen)12, (ftnlen)12) ==
  482. 0) {
  483. goto L50;
  484. }
  485. /* L40: */
  486. }
  487. printf("SUBPROGRAM NAME %s NOT RECOGNIZED\n****** TESTS ABANDONED ******\n",snamet);
  488. exit(1);
  489. L50:
  490. ltest[i__ - 1] = ltestt;
  491. goto L30;
  492. L60:
  493. /* cl__1.cerr = 0;
  494. cl__1.cunit = 5;
  495. cl__1.csta = 0;
  496. f_clos(&cl__1);*/
  497. /* Compute EPS (the machine precision). */
  498. eps = 1.;
  499. L70:
  500. d__1 = eps + 1.;
  501. if (ddiff_(&d__1, &c_b92) == 0.) {
  502. goto L80;
  503. }
  504. eps *= .5;
  505. goto L70;
  506. L80:
  507. eps += eps;
  508. printf("RELATIVE MACHINE PRECISION IS TAKEN TO BE %9.1g\n",eps);
  509. /* Check the reliability of ZMMCH using exact data. */
  510. n = 32;
  511. i__1 = n;
  512. for (j = 1; j <= i__1; ++j) {
  513. i__2 = n;
  514. for (i__ = 1; i__ <= i__2; ++i__) {
  515. i__3 = i__ + j * 65 - 66;
  516. /* Computing MAX */
  517. i__5 = i__ - j + 1;
  518. i__4 = f2cmax(i__5,0);
  519. ab[i__3].r = (doublereal) i__4, ab[i__3].i = 0.;
  520. /* L90: */
  521. }
  522. i__2 = j + 4224;
  523. ab[i__2].r = (doublereal) j, ab[i__2].i = 0.;
  524. i__2 = (j + 65) * 65 - 65;
  525. ab[i__2].r = (doublereal) j, ab[i__2].i = 0.;
  526. i__2 = j - 1;
  527. c__[i__2].r = 0., c__[i__2].i = 0.;
  528. /* L100: */
  529. }
  530. i__1 = n;
  531. for (j = 1; j <= i__1; ++j) {
  532. i__2 = j - 1;
  533. i__3 = j * ((j + 1) * j) / 2 - (j + 1) * j * (j - 1) / 3;
  534. cc[i__2].r = (doublereal) i__3, cc[i__2].i = 0.;
  535. /* L110: */
  536. }
  537. /* CC holds the exact result. On exit from ZMMCH CT holds */
  538. /* the result computed by ZMMCH. */
  539. *(unsigned char *)transa = 'N';
  540. *(unsigned char *)transb = 'N';
  541. zmmch_(transa, transb, &n, &c__1, &n, &c_b2, ab, &c__65, &ab[4225], &
  542. c__65, &c_b1, c__, &c__65, ct, g, cc, &c__65, &eps, &err, &fatal,
  543. &c__6, &c_true, (ftnlen)1, (ftnlen)1);
  544. same = lze_(cc, ct, &n);
  545. if (! same || err != 0.) {
  546. printf("ERROR IN ZMMCH - IN-LINE DOT PRODUCTS ARE BEING EVALUATED WRONGLY\n");
  547. printf("ZMMCH WAS CALLED WITH TRANSA = %s AND TRANSB = %s\n", transa,transb);
  548. printf("AND RETURNED SAME = %c AND ERR = %12.3f.\n",(same==FALSE_? 'F':'T'),err);
  549. printf("THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.\n");
  550. printf("****** TESTS ABANDONED ******\n");
  551. exit(1);
  552. }
  553. *(unsigned char *)transb = 'C';
  554. zmmch_(transa, transb, &n, &c__1, &n, &c_b2, ab, &c__65, &ab[4225], &
  555. c__65, &c_b1, c__, &c__65, ct, g, cc, &c__65, &eps, &err, &fatal,
  556. &c__6, &c_true, (ftnlen)1, (ftnlen)1);
  557. same = lze_(cc, ct, &n);
  558. if (! same || err != 0.) {
  559. printf("ERROR IN ZMMCH - IN-LINE DOT PRODUCTS ARE BEING EVALUATED WRONGLY\n");
  560. printf("ZMMCH WAS CALLED WITH TRANSA = %s AND TRANSB = %s\n", transa,transb);
  561. printf("AND RETURNED SAME = %c AND ERR = %12.3f.\n",(same==FALSE_? 'F':'T'),err);
  562. printf("THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.\n");
  563. printf("****** TESTS ABANDONED ******\n");
  564. exit(1);
  565. }
  566. i__1 = n;
  567. for (j = 1; j <= i__1; ++j) {
  568. i__2 = j + 4224;
  569. i__3 = n - j + 1;
  570. ab[i__2].r = (doublereal) i__3, ab[i__2].i = 0.;
  571. i__2 = (j + 65) * 65 - 65;
  572. i__3 = n - j + 1;
  573. ab[i__2].r = (doublereal) i__3, ab[i__2].i = 0.;
  574. /* L120: */
  575. }
  576. i__1 = n;
  577. for (j = 1; j <= i__1; ++j) {
  578. i__2 = n - j;
  579. i__3 = j * ((j + 1) * j) / 2 - (j + 1) * j * (j - 1) / 3;
  580. cc[i__2].r = (doublereal) i__3, cc[i__2].i = 0.;
  581. /* L130: */
  582. }
  583. *(unsigned char *)transa = 'C';
  584. *(unsigned char *)transb = 'N';
  585. zmmch_(transa, transb, &n, &c__1, &n, &c_b2, ab, &c__65, &ab[4225], &
  586. c__65, &c_b1, c__, &c__65, ct, g, cc, &c__65, &eps, &err, &fatal,
  587. &c__6, &c_true, (ftnlen)1, (ftnlen)1);
  588. same = lze_(cc, ct, &n);
  589. if (! same || err != 0.) {
  590. printf("ERROR IN ZMMCH - IN-LINE DOT PRODUCTS ARE BEING EVALUATED WRONGLY\n");
  591. printf("ZMMCH WAS CALLED WITH TRANSA = %s AND TRANSB = %s\n", transa,transb);
  592. printf("AND RETURNED SAME = %c AND ERR = %12.3f.\n",(same==FALSE_? 'F':'T'),err);
  593. printf("THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.\n");
  594. printf("****** TESTS ABANDONED ******\n");
  595. exit(1);
  596. }
  597. *(unsigned char *)transb = 'C';
  598. zmmch_(transa, transb, &n, &c__1, &n, &c_b2, ab, &c__65, &ab[4225], &
  599. c__65, &c_b1, c__, &c__65, ct, g, cc, &c__65, &eps, &err, &fatal,
  600. &c__6, &c_true, (ftnlen)1, (ftnlen)1);
  601. same = lze_(cc, ct, &n);
  602. if (! same || err != 0.) {
  603. printf("ERROR IN ZMMCH - IN-LINE DOT PRODUCTS ARE BEING EVALUATED WRONGLY\n");
  604. printf("ZMMCH WAS CALLED WITH TRANSA = %s AND TRANSB = %s\n", transa,transb);
  605. printf("AND RETURNED SAME = %c AND ERR = %12.3f.\n",(same==FALSE_? 'F':'T'),err);
  606. printf("THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.\n");
  607. printf("****** TESTS ABANDONED ******\n");
  608. exit(1);
  609. }
  610. /* Test each subroutine in turn. */
  611. for (isnum = 1; isnum <= 9; ++isnum) {
  612. if (! ltest[isnum - 1]) {
  613. /* Subprogram is not to be tested. */
  614. printf("%12s WAS NOT TESTED\n",snames[isnum-1]);
  615. } else {
  616. s_copy(srnamc_1.srnamt, snames[isnum - 1], (ftnlen)12, (
  617. ftnlen)12);
  618. /* Test error exits. */
  619. if (tsterr) {
  620. cz3chke_(snames[isnum - 1], (ftnlen)12);
  621. }
  622. /* Test computations. */
  623. infoc_1.infot = 0;
  624. infoc_1.ok = TRUE_;
  625. fatal = FALSE_;
  626. switch ((int)isnum) {
  627. case 1: goto L140;
  628. case 2: goto L150;
  629. case 3: goto L150;
  630. case 4: goto L160;
  631. case 5: goto L160;
  632. case 6: goto L170;
  633. case 7: goto L170;
  634. case 8: goto L180;
  635. case 9: goto L180;
  636. }
  637. /* Test ZGEMM, 01. */
  638. L140:
  639. if (corder) {
  640. zchk1_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  641. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  642. nbet, bet, &c__65, ab, aa, as, &ab[4225], bb, bs, c__,
  643. cc, cs, ct, g, &c__0, (ftnlen)12);
  644. }
  645. if (rorder) {
  646. zchk1_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  647. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  648. nbet, bet, &c__65, ab, aa, as, &ab[4225], bb, bs, c__,
  649. cc, cs, ct, g, &c__1, (ftnlen)12);
  650. }
  651. goto L190;
  652. /* Test ZHEMM, 02, ZSYMM, 03. */
  653. L150:
  654. if (corder) {
  655. zchk2_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  656. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  657. nbet, bet, &c__65, ab, aa, as, &ab[4225], bb, bs, c__,
  658. cc, cs, ct, g, &c__0, (ftnlen)12);
  659. }
  660. if (rorder) {
  661. zchk2_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  662. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  663. nbet, bet, &c__65, ab, aa, as, &ab[4225], bb, bs, c__,
  664. cc, cs, ct, g, &c__1, (ftnlen)12);
  665. }
  666. goto L190;
  667. /* Test ZTRMM, 04, ZTRSM, 05. */
  668. L160:
  669. if (corder) {
  670. zchk3_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  671. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  672. c__65, ab, aa, as, &ab[4225], bb, bs, ct, g, c__, &
  673. c__0, (ftnlen)12);
  674. }
  675. if (rorder) {
  676. zchk3_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  677. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  678. c__65, ab, aa, as, &ab[4225], bb, bs, ct, g, c__, &
  679. c__1, (ftnlen)12);
  680. }
  681. goto L190;
  682. /* Test ZHERK, 06, ZSYRK, 07. */
  683. L170:
  684. if (corder) {
  685. zchk4_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  686. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  687. nbet, bet, &c__65, ab, aa, as, &ab[4225], bb, bs, c__,
  688. cc, cs, ct, g, &c__0, (ftnlen)12);
  689. }
  690. if (rorder) {
  691. zchk4_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  692. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  693. nbet, bet, &c__65, ab, aa, as, &ab[4225], bb, bs, c__,
  694. cc, cs, ct, g, &c__1, (ftnlen)12);
  695. }
  696. goto L190;
  697. /* Test ZHER2K, 08, ZSYR2K, 09. */
  698. L180:
  699. if (corder) {
  700. zchk5_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  701. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  702. nbet, bet, &c__65, ab, aa, as, bb, bs, c__, cc, cs,
  703. ct, g, w, &c__0, (ftnlen)12);
  704. }
  705. if (rorder) {
  706. zchk5_(snames[isnum - 1], &eps, &thresh, &c__6, &ntra,
  707. &trace, &rewi, &fatal, &nidim, idim, &nalf, alf, &
  708. nbet, bet, &c__65, ab, aa, as, bb, bs, c__, cc, cs,
  709. ct, g, w, &c__1, (ftnlen)12);
  710. }
  711. goto L190;
  712. L190:
  713. if (fatal && sfatal) {
  714. goto L210;
  715. }
  716. }
  717. /* L200: */
  718. }
  719. printf("\nEND OF TESTS\n");
  720. goto L230;
  721. L210:
  722. printf("\n****** FATAL ERROR - TESTS ABANDONED ******\n");
  723. goto L230;
  724. L220:
  725. printf("AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM\n");
  726. printf("****** TESTS ABANDONED ******\n");
  727. L230:
  728. if (trace) {
  729. /* cl__1.cerr = 0;
  730. cl__1.cunit = ntra;
  731. cl__1.csta = 0;
  732. f_clos(&cl__1);*/
  733. }
  734. /* cl__1.cerr = 0;
  735. cl__1.cunit = 6;
  736. cl__1.csta = 0;
  737. f_clos(&cl__1);*/
  738. exit(0);
  739. /* End of ZBLAT3. */
  740. } /* MAIN__ */
  741. /* Subroutine */ int zchk1_(char* sname, doublereal* eps, doublereal* thresh, integer* nout, integer* ntra, logical* trace, logical* rewi, logical* fatal, integer* nidim, integer* idim, integer* nalf, doublecomplex* alf, integer* nbet, doublecomplex* bet, integer* nmax, doublecomplex* a, doublecomplex* aa, doublecomplex* as, doublecomplex* b, doublecomplex* bb, doublecomplex* bs, doublecomplex* c__, doublecomplex* cc, doublecomplex* cs, doublecomplex* ct, doublereal* g, integer* iorder, ftnlen sname_len)
  742. {
  743. /* Initialized data */
  744. static char ich[3+1] = "NTC";
  745. /* System generated locals */
  746. integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
  747. i__3, i__4, i__5, i__6, i__7, i__8;
  748. /* Local variables */
  749. static doublecomplex beta;
  750. static integer ldas, ldbs, ldcs;
  751. static logical same, null;
  752. static integer i__, k, m, n;
  753. static doublecomplex alpha;
  754. static logical isame[13], trana, tranb;
  755. extern /* Subroutine */ int zmake_(char*, char*, char*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, logical*, doublecomplex*, ftnlen, ftnlen, ftnlen);
  756. static integer nargs;
  757. extern /* Subroutine */ int zmmch_(char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublereal*, doublecomplex*, integer*, doublereal*, doublereal*, logical*, integer*, logical*, ftnlen, ftnlen);
  758. static logical reset;
  759. static integer ia, ib;
  760. extern /* Subroutine */ int zprcn1_(integer*, integer*, char*, integer*, char*, char*, integer*, integer*, integer*, doublecomplex*, integer*, integer*, doublecomplex*, integer*, ftnlen, ftnlen, ftnlen);
  761. static integer ma, mb, na, nb, nc, ik, im, in, ks, ms, ns;
  762. extern /* Subroutine */ void czgemm3m_(integer*, char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  763. static char tranas[1], tranbs[1], transa[1], transb[1];
  764. static doublereal errmax;
  765. extern logical lzeres_(char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  766. static integer ica, icb, laa, lbb, lda, lcc, ldb, ldc;
  767. static doublecomplex als, bls;
  768. static doublereal err;
  769. extern logical lze_(doublecomplex*, doublecomplex*, integer*);
  770. /* Tests ZGEMM. */
  771. /* Auxiliary routine for test program for Level 3 Blas. */
  772. /* -- Written on 8-February-1989. */
  773. /* Jack Dongarra, Argonne National Laboratory. */
  774. /* Iain Duff, AERE Harwell. */
  775. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  776. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  777. /* .. Parameters .. */
  778. /* .. Scalar Arguments .. */
  779. /* .. Array Arguments .. */
  780. /* .. Local Scalars .. */
  781. /* .. Local Arrays .. */
  782. /* .. External Functions .. */
  783. /* .. External Subroutines .. */
  784. /* .. Intrinsic Functions .. */
  785. /* .. Scalars in Common .. */
  786. /* .. Common blocks .. */
  787. /* .. Data statements .. */
  788. /* Parameter adjustments */
  789. --idim;
  790. --alf;
  791. --bet;
  792. --g;
  793. --ct;
  794. --cs;
  795. --cc;
  796. c_dim1 = *nmax;
  797. c_offset = 1 + c_dim1 * 1;
  798. c__ -= c_offset;
  799. --bs;
  800. --bb;
  801. b_dim1 = *nmax;
  802. b_offset = 1 + b_dim1 * 1;
  803. b -= b_offset;
  804. --as;
  805. --aa;
  806. a_dim1 = *nmax;
  807. a_offset = 1 + a_dim1 * 1;
  808. a -= a_offset;
  809. /* Function Body */
  810. /* .. Executable Statements .. */
  811. nargs = 13;
  812. nc = 0;
  813. reset = TRUE_;
  814. errmax = 0.;
  815. i__1 = *nidim;
  816. for (im = 1; im <= i__1; ++im) {
  817. m = idim[im];
  818. i__2 = *nidim;
  819. for (in = 1; in <= i__2; ++in) {
  820. n = idim[in];
  821. /* Set LDC to 1 more than minimum value if room. */
  822. ldc = m;
  823. if (ldc < *nmax) {
  824. ++ldc;
  825. }
  826. /* Skip tests if not enough room. */
  827. if (ldc > *nmax) {
  828. goto L100;
  829. }
  830. lcc = ldc * n;
  831. null = n <= 0 || m <= 0;
  832. i__3 = *nidim;
  833. for (ik = 1; ik <= i__3; ++ik) {
  834. k = idim[ik];
  835. for (ica = 1; ica <= 3; ++ica) {
  836. *(unsigned char *)transa = *(unsigned char *)&ich[ica - 1]
  837. ;
  838. trana = *(unsigned char *)transa == 'T' || *(unsigned
  839. char *)transa == 'C';
  840. if (trana) {
  841. ma = k;
  842. na = m;
  843. } else {
  844. ma = m;
  845. na = k;
  846. }
  847. /* Set LDA to 1 more than minimum value if room. */
  848. lda = ma;
  849. if (lda < *nmax) {
  850. ++lda;
  851. }
  852. /* Skip tests if not enough room. */
  853. if (lda > *nmax) {
  854. goto L80;
  855. }
  856. laa = lda * na;
  857. /* Generate the matrix A. */
  858. zmake_("ge", " ", " ", &ma, &na, &a[a_offset], nmax, &aa[
  859. 1], &lda, &reset, &c_b1, (ftnlen)2, (ftnlen)1, (
  860. ftnlen)1);
  861. for (icb = 1; icb <= 3; ++icb) {
  862. *(unsigned char *)transb = *(unsigned char *)&ich[icb
  863. - 1];
  864. tranb = *(unsigned char *)transb == 'T' || *(unsigned
  865. char *)transb == 'C';
  866. if (tranb) {
  867. mb = n;
  868. nb = k;
  869. } else {
  870. mb = k;
  871. nb = n;
  872. }
  873. /* Set LDB to 1 more than minimum value if room. */
  874. ldb = mb;
  875. if (ldb < *nmax) {
  876. ++ldb;
  877. }
  878. /* Skip tests if not enough room. */
  879. if (ldb > *nmax) {
  880. goto L70;
  881. }
  882. lbb = ldb * nb;
  883. /* Generate the matrix B. */
  884. zmake_("ge", " ", " ", &mb, &nb, &b[b_offset], nmax, &
  885. bb[1], &ldb, &reset, &c_b1, (ftnlen)2, (
  886. ftnlen)1, (ftnlen)1);
  887. i__4 = *nalf;
  888. for (ia = 1; ia <= i__4; ++ia) {
  889. i__5 = ia;
  890. alpha.r = alf[i__5].r, alpha.i = alf[i__5].i;
  891. i__5 = *nbet;
  892. for (ib = 1; ib <= i__5; ++ib) {
  893. i__6 = ib;
  894. beta.r = bet[i__6].r, beta.i = bet[i__6].i;
  895. /* Generate the matrix C. */
  896. zmake_("ge", " ", " ", &m, &n, &c__[c_offset],
  897. nmax, &cc[1], &ldc, &reset, &c_b1, (
  898. ftnlen)2, (ftnlen)1, (ftnlen)1);
  899. ++nc;
  900. /* Save every datum before calling the */
  901. /* subroutine. */
  902. *(unsigned char *)tranas = *(unsigned char *)
  903. transa;
  904. *(unsigned char *)tranbs = *(unsigned char *)
  905. transb;
  906. ms = m;
  907. ns = n;
  908. ks = k;
  909. als.r = alpha.r, als.i = alpha.i;
  910. i__6 = laa;
  911. for (i__ = 1; i__ <= i__6; ++i__) {
  912. i__7 = i__;
  913. i__8 = i__;
  914. as[i__7].r = aa[i__8].r, as[i__7].i = aa[
  915. i__8].i;
  916. /* L10: */
  917. }
  918. ldas = lda;
  919. i__6 = lbb;
  920. for (i__ = 1; i__ <= i__6; ++i__) {
  921. i__7 = i__;
  922. i__8 = i__;
  923. bs[i__7].r = bb[i__8].r, bs[i__7].i = bb[
  924. i__8].i;
  925. /* L20: */
  926. }
  927. ldbs = ldb;
  928. bls.r = beta.r, bls.i = beta.i;
  929. i__6 = lcc;
  930. for (i__ = 1; i__ <= i__6; ++i__) {
  931. i__7 = i__;
  932. i__8 = i__;
  933. cs[i__7].r = cc[i__8].r, cs[i__7].i = cc[
  934. i__8].i;
  935. /* L30: */
  936. }
  937. ldcs = ldc;
  938. /* Call the subroutine. */
  939. if (*trace) {
  940. zprcn1_(ntra, &nc, sname, iorder, transa,
  941. transb, &m, &n, &k, &alpha, &lda,
  942. &ldb, &beta, &ldc, (ftnlen)12, (
  943. ftnlen)1, (ftnlen)1);
  944. }
  945. if (*rewi) {
  946. /* al__1.aerr = 0;
  947. al__1.aunit = *ntra;
  948. f_rew(&al__1);*/
  949. }
  950. czgemm3m_(iorder, transa, transb, &m, &n, &k, &
  951. alpha, &aa[1], &lda, &bb[1], &ldb, &
  952. beta, &cc[1], &ldc, (ftnlen)1, (
  953. ftnlen)1);
  954. /* Check if error-exit was taken incorrectly. */
  955. if (! infoc_1.ok) {
  956. printf(" *** FATAL ERROR - ERROR-CALL MYEXIT TAKEN ON VALID CALL\n");
  957. *fatal = TRUE_;
  958. goto L120;
  959. }
  960. /* See what data changed inside subroutines. */
  961. isame[0] = *(unsigned char *)transa == *(
  962. unsigned char *)tranas;
  963. isame[1] = *(unsigned char *)transb == *(
  964. unsigned char *)tranbs;
  965. isame[2] = ms == m;
  966. isame[3] = ns == n;
  967. isame[4] = ks == k;
  968. isame[5] = als.r == alpha.r && als.i ==
  969. alpha.i;
  970. isame[6] = lze_(&as[1], &aa[1], &laa);
  971. isame[7] = ldas == lda;
  972. isame[8] = lze_(&bs[1], &bb[1], &lbb);
  973. isame[9] = ldbs == ldb;
  974. isame[10] = bls.r == beta.r && bls.i ==
  975. beta.i;
  976. if (null) {
  977. isame[11] = lze_(&cs[1], &cc[1], &lcc);
  978. } else {
  979. isame[11] = lzeres_("ge", " ", &m, &n, &
  980. cs[1], &cc[1], &ldc, (ftnlen)2, (
  981. ftnlen)1);
  982. }
  983. isame[12] = ldcs == ldc;
  984. /* If data was incorrectly changed, report */
  985. /* and return. */
  986. same = TRUE_;
  987. i__6 = nargs;
  988. for (i__ = 1; i__ <= i__6; ++i__) {
  989. same = same && isame[i__ - 1];
  990. if (! isame[i__ - 1]) {
  991. printf(" ******* FATAL ERROR - PARAMETER NUMBER %d WAS CHANGED INCORRECTLY *******\n",i__);
  992. }
  993. /* L40: */
  994. }
  995. if (! same) {
  996. *fatal = TRUE_;
  997. goto L120;
  998. }
  999. if (! null) {
  1000. /* Check the result. */
  1001. zmmch_(transa, transb, &m, &n, &k, &alpha,
  1002. &a[a_offset], nmax, &b[b_offset],
  1003. nmax, &beta, &c__[c_offset],
  1004. nmax, &ct[1], &g[1], &cc[1], &ldc,
  1005. eps, &err, fatal, nout, &c_true,
  1006. (ftnlen)1, (ftnlen)1);
  1007. errmax = f2cmax(errmax,err);
  1008. /* If got really bad answer, report and */
  1009. /* return. */
  1010. if (*fatal) {
  1011. goto L120;
  1012. }
  1013. }
  1014. /* L50: */
  1015. }
  1016. /* L60: */
  1017. }
  1018. L70:
  1019. ;
  1020. }
  1021. L80:
  1022. ;
  1023. }
  1024. /* L90: */
  1025. }
  1026. L100:
  1027. ;
  1028. }
  1029. /* L110: */
  1030. }
  1031. /* Report result. */
  1032. if (errmax < *thresh) {
  1033. if (*iorder == 0) {
  1034. printf("%s PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  1035. }
  1036. if (*iorder == 1) {
  1037. printf("%s PASSED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  1038. }
  1039. } else {
  1040. if (*iorder == 0) {
  1041. printf("%s COMPLETED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  1042. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  1043. }
  1044. if (*iorder == 1) {
  1045. printf("%s COMPLETED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  1046. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  1047. }
  1048. }
  1049. goto L130;
  1050. L120:
  1051. printf(" ******* %s FAILED ON CALL NUMBER:\n",sname);
  1052. zprcn1_(nout, &nc, sname, iorder, transa, transb, &m, &n, &k, &alpha, &
  1053. lda, &ldb, &beta, &ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1);
  1054. L130:
  1055. return 0;
  1056. /* 9995 FORMAT( 1X, I6, ': ', A12,'(''', A1, ''',''', A1, ''',', */
  1057. /* $ 3( I3, ',' ), '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, */
  1058. /* $ ',(', F4.1, ',', F4.1, '), C,', I3, ').' ) */
  1059. /* End of ZCHK1. */
  1060. } /* zchk1_ */
  1061. /* Subroutine */ int zprcn1_(integer* nout, integer* nc, char* sname, integer* iorder, char* transa, char* transb, integer* m, integer* n, integer* k, doublecomplex* alpha, integer* lda, integer* ldb, doublecomplex* beta, integer* ldc, ftnlen sname_len, ftnlen transa_len, ftnlen transb_len)
  1062. {
  1063. /* Local variables */
  1064. static char crc[14], cta[14], ctb[14];
  1065. if (*(unsigned char *)transa == 'N') {
  1066. s_copy(cta, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  1067. } else if (*(unsigned char *)transa == 'T') {
  1068. s_copy(cta, " CblasTrans", (ftnlen)14, (ftnlen)14);
  1069. } else {
  1070. s_copy(cta, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  1071. }
  1072. if (*(unsigned char *)transb == 'N') {
  1073. s_copy(ctb, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  1074. } else if (*(unsigned char *)transb == 'T') {
  1075. s_copy(ctb, " CblasTrans", (ftnlen)14, (ftnlen)14);
  1076. } else {
  1077. s_copy(ctb, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  1078. }
  1079. if (*iorder == 1) {
  1080. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  1081. } else {
  1082. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  1083. }
  1084. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cta,ctb);
  1085. printf("%d %d %d (%4.1lf,%4.1lf) , A, %d, B, %d, (%4.1lf,%4.1lf) , C, %d.\n",*m,*n,*k,alpha->r,alpha->i,*lda,*ldb,beta->r,beta->i,*ldc);
  1086. return 0;
  1087. } /* zprcn1_ */
  1088. /* Subroutine */ int zchk2_(char* sname, doublereal* eps, doublereal* thresh, integer* nout, integer* ntra, logical* trace, logical* rewi, logical* fatal, integer* nidim, integer* idim, integer* nalf, doublecomplex* alf, integer* nbet, doublecomplex* bet, integer* nmax, doublecomplex* a, doublecomplex* aa, doublecomplex* as, doublecomplex* b, doublecomplex* bb, doublecomplex* bs, doublecomplex* c__, doublecomplex* cc, doublecomplex* cs, doublecomplex* ct, doublereal* g, integer* iorder, ftnlen sname_len)
  1089. {
  1090. /* Initialized data */
  1091. static char ichs[2+1] = "LR";
  1092. static char ichu[2+1] = "UL";
  1093. /* System generated locals */
  1094. integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
  1095. i__3, i__4, i__5, i__6, i__7;
  1096. /* Local variables */
  1097. static doublecomplex beta;
  1098. static integer ldas, ldbs, ldcs;
  1099. static logical same;
  1100. static char side[1];
  1101. static logical isconj, left, null;
  1102. static char uplo[1];
  1103. static integer i__, m, n;
  1104. static doublecomplex alpha;
  1105. static logical isame[13];
  1106. static char sides[1];
  1107. extern /* Subroutine */ int zmake_(char*, char*, char*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, logical*, doublecomplex*, ftnlen, ftnlen, ftnlen);
  1108. static integer nargs;
  1109. extern /* Subroutine */ int zmmch_(char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublereal*, doublecomplex*, integer*, doublereal*, doublereal*, logical*, integer*, logical*, ftnlen, ftnlen);
  1110. static logical reset;
  1111. static char uplos[1];
  1112. static integer ia, ib;
  1113. extern /* Subroutine */ int zprcn2_(integer*, integer*, char*, integer*, char*, char*, integer*, integer*, doublecomplex*, integer*, integer*, doublecomplex*, integer*, ftnlen, ftnlen, ftnlen);
  1114. static integer na, nc, im, in, ms, ns;
  1115. extern /* Subroutine */ void czhemm_(integer*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  1116. static doublereal errmax;
  1117. extern logical lzeres_(char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  1118. extern /* Subroutine */ void czsymm_(integer*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  1119. static integer laa, lbb, lda, lcc, ldb, ldc, ics;
  1120. static doublecomplex als, bls;
  1121. static integer icu;
  1122. static doublereal err;
  1123. extern logical lze_(doublecomplex*, doublecomplex*, integer*);
  1124. /* Tests ZHEMM and ZSYMM. */
  1125. /* Auxiliary routine for test program for Level 3 Blas. */
  1126. /* -- Written on 8-February-1989. */
  1127. /* Jack Dongarra, Argonne National Laboratory. */
  1128. /* Iain Duff, AERE Harwell. */
  1129. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  1130. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  1131. /* .. Parameters .. */
  1132. /* .. Scalar Arguments .. */
  1133. /* .. Array Arguments .. */
  1134. /* .. Local Scalars .. */
  1135. /* .. Local Arrays .. */
  1136. /* .. External Functions .. */
  1137. /* .. External Subroutines .. */
  1138. /* .. Intrinsic Functions .. */
  1139. /* .. Scalars in Common .. */
  1140. /* .. Common blocks .. */
  1141. /* .. Data statements .. */
  1142. /* Parameter adjustments */
  1143. --idim;
  1144. --alf;
  1145. --bet;
  1146. --g;
  1147. --ct;
  1148. --cs;
  1149. --cc;
  1150. c_dim1 = *nmax;
  1151. c_offset = 1 + c_dim1 * 1;
  1152. c__ -= c_offset;
  1153. --bs;
  1154. --bb;
  1155. b_dim1 = *nmax;
  1156. b_offset = 1 + b_dim1 * 1;
  1157. b -= b_offset;
  1158. --as;
  1159. --aa;
  1160. a_dim1 = *nmax;
  1161. a_offset = 1 + a_dim1 * 1;
  1162. a -= a_offset;
  1163. /* Function Body */
  1164. /* .. Executable Statements .. */
  1165. isconj = s_cmp(sname + 7, "he", (ftnlen)2, (ftnlen)2) == 0;
  1166. nargs = 12;
  1167. nc = 0;
  1168. reset = TRUE_;
  1169. errmax = 0.;
  1170. i__1 = *nidim;
  1171. for (im = 1; im <= i__1; ++im) {
  1172. m = idim[im];
  1173. i__2 = *nidim;
  1174. for (in = 1; in <= i__2; ++in) {
  1175. n = idim[in];
  1176. /* Set LDC to 1 more than minimum value if room. */
  1177. ldc = m;
  1178. if (ldc < *nmax) {
  1179. ++ldc;
  1180. }
  1181. /* Skip tests if not enough room. */
  1182. if (ldc > *nmax) {
  1183. goto L90;
  1184. }
  1185. lcc = ldc * n;
  1186. null = n <= 0 || m <= 0;
  1187. /* Set LDB to 1 more than minimum value if room. */
  1188. ldb = m;
  1189. if (ldb < *nmax) {
  1190. ++ldb;
  1191. }
  1192. /* Skip tests if not enough room. */
  1193. if (ldb > *nmax) {
  1194. goto L90;
  1195. }
  1196. lbb = ldb * n;
  1197. /* Generate the matrix B. */
  1198. zmake_("ge", " ", " ", &m, &n, &b[b_offset], nmax, &bb[1], &ldb, &
  1199. reset, &c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)1);
  1200. for (ics = 1; ics <= 2; ++ics) {
  1201. *(unsigned char *)side = *(unsigned char *)&ichs[ics - 1];
  1202. left = *(unsigned char *)side == 'L';
  1203. if (left) {
  1204. na = m;
  1205. } else {
  1206. na = n;
  1207. }
  1208. /* Set LDA to 1 more than minimum value if room. */
  1209. lda = na;
  1210. if (lda < *nmax) {
  1211. ++lda;
  1212. }
  1213. /* Skip tests if not enough room. */
  1214. if (lda > *nmax) {
  1215. goto L80;
  1216. }
  1217. laa = lda * na;
  1218. for (icu = 1; icu <= 2; ++icu) {
  1219. *(unsigned char *)uplo = *(unsigned char *)&ichu[icu - 1];
  1220. /* Generate the hermitian or symmetric matrix A. */
  1221. zmake_(sname + 7, uplo, " ", &na, &na, &a[a_offset], nmax,
  1222. &aa[1], &lda, &reset, &c_b1, (ftnlen)2, (ftnlen)
  1223. 1, (ftnlen)1);
  1224. i__3 = *nalf;
  1225. for (ia = 1; ia <= i__3; ++ia) {
  1226. i__4 = ia;
  1227. alpha.r = alf[i__4].r, alpha.i = alf[i__4].i;
  1228. i__4 = *nbet;
  1229. for (ib = 1; ib <= i__4; ++ib) {
  1230. i__5 = ib;
  1231. beta.r = bet[i__5].r, beta.i = bet[i__5].i;
  1232. /* Generate the matrix C. */
  1233. zmake_("ge", " ", " ", &m, &n, &c__[c_offset],
  1234. nmax, &cc[1], &ldc, &reset, &c_b1, (
  1235. ftnlen)2, (ftnlen)1, (ftnlen)1);
  1236. ++nc;
  1237. /* Save every datum before calling the */
  1238. /* subroutine. */
  1239. *(unsigned char *)sides = *(unsigned char *)side;
  1240. *(unsigned char *)uplos = *(unsigned char *)uplo;
  1241. ms = m;
  1242. ns = n;
  1243. als.r = alpha.r, als.i = alpha.i;
  1244. i__5 = laa;
  1245. for (i__ = 1; i__ <= i__5; ++i__) {
  1246. i__6 = i__;
  1247. i__7 = i__;
  1248. as[i__6].r = aa[i__7].r, as[i__6].i = aa[i__7]
  1249. .i;
  1250. /* L10: */
  1251. }
  1252. ldas = lda;
  1253. i__5 = lbb;
  1254. for (i__ = 1; i__ <= i__5; ++i__) {
  1255. i__6 = i__;
  1256. i__7 = i__;
  1257. bs[i__6].r = bb[i__7].r, bs[i__6].i = bb[i__7]
  1258. .i;
  1259. /* L20: */
  1260. }
  1261. ldbs = ldb;
  1262. bls.r = beta.r, bls.i = beta.i;
  1263. i__5 = lcc;
  1264. for (i__ = 1; i__ <= i__5; ++i__) {
  1265. i__6 = i__;
  1266. i__7 = i__;
  1267. cs[i__6].r = cc[i__7].r, cs[i__6].i = cc[i__7]
  1268. .i;
  1269. /* L30: */
  1270. }
  1271. ldcs = ldc;
  1272. /* Call the subroutine. */
  1273. if (*trace) {
  1274. zprcn2_(ntra, &nc, sname, iorder, side, uplo,
  1275. &m, &n, &alpha, &lda, &ldb, &beta, &
  1276. ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1)
  1277. ;
  1278. }
  1279. if (*rewi) {
  1280. /* al__1.aerr = 0;
  1281. al__1.aunit = *ntra;
  1282. f_rew(&al__1);*/
  1283. }
  1284. if (isconj) {
  1285. czhemm_(iorder, side, uplo, &m, &n, &alpha, &
  1286. aa[1], &lda, &bb[1], &ldb, &beta, &cc[
  1287. 1], &ldc, (ftnlen)1, (ftnlen)1);
  1288. } else {
  1289. czsymm_(iorder, side, uplo, &m, &n, &alpha, &
  1290. aa[1], &lda, &bb[1], &ldb, &beta, &cc[
  1291. 1], &ldc, (ftnlen)1, (ftnlen)1);
  1292. }
  1293. /* Check if error-exit was taken incorrectly. */
  1294. if (! infoc_1.ok) {
  1295. printf("*** FATAL ERROR - ERROR-CALL MYEXIT TAKEN ON VALID CALL\n");
  1296. *fatal = TRUE_;
  1297. goto L110;
  1298. }
  1299. /* See what data changed inside subroutines. */
  1300. isame[0] = *(unsigned char *)sides == *(unsigned
  1301. char *)side;
  1302. isame[1] = *(unsigned char *)uplos == *(unsigned
  1303. char *)uplo;
  1304. isame[2] = ms == m;
  1305. isame[3] = ns == n;
  1306. isame[4] = als.r == alpha.r && als.i == alpha.i;
  1307. isame[5] = lze_(&as[1], &aa[1], &laa);
  1308. isame[6] = ldas == lda;
  1309. isame[7] = lze_(&bs[1], &bb[1], &lbb);
  1310. isame[8] = ldbs == ldb;
  1311. isame[9] = bls.r == beta.r && bls.i == beta.i;
  1312. if (null) {
  1313. isame[10] = lze_(&cs[1], &cc[1], &lcc);
  1314. } else {
  1315. isame[10] = lzeres_("ge", " ", &m, &n, &cs[1],
  1316. &cc[1], &ldc, (ftnlen)2, (ftnlen)1);
  1317. }
  1318. isame[11] = ldcs == ldc;
  1319. /* If data was incorrectly changed, report and */
  1320. /* return. */
  1321. same = TRUE_;
  1322. i__5 = nargs;
  1323. for (i__ = 1; i__ <= i__5; ++i__) {
  1324. same = same && isame[i__ - 1];
  1325. if (! isame[i__ - 1]) {
  1326. printf(" ******* FATAL ERROR - PARAMETER NUMBER %d WAS CHANGED INCORRECTLY *******\n",i__);
  1327. }
  1328. /* L40: */
  1329. }
  1330. if (! same) {
  1331. *fatal = TRUE_;
  1332. goto L110;
  1333. }
  1334. if (! null) {
  1335. /* Check the result. */
  1336. if (left) {
  1337. zmmch_("N", "N", &m, &n, &m, &alpha, &a[
  1338. a_offset], nmax, &b[b_offset],
  1339. nmax, &beta, &c__[c_offset], nmax,
  1340. &ct[1], &g[1], &cc[1], &ldc, eps,
  1341. &err, fatal, nout, &c_true, (
  1342. ftnlen)1, (ftnlen)1);
  1343. } else {
  1344. zmmch_("N", "N", &m, &n, &n, &alpha, &b[
  1345. b_offset], nmax, &a[a_offset],
  1346. nmax, &beta, &c__[c_offset], nmax,
  1347. &ct[1], &g[1], &cc[1], &ldc, eps,
  1348. &err, fatal, nout, &c_true, (
  1349. ftnlen)1, (ftnlen)1);
  1350. }
  1351. errmax = f2cmax(errmax,err);
  1352. /* If got really bad answer, report and */
  1353. /* return. */
  1354. if (*fatal) {
  1355. goto L110;
  1356. }
  1357. }
  1358. /* L50: */
  1359. }
  1360. /* L60: */
  1361. }
  1362. /* L70: */
  1363. }
  1364. L80:
  1365. ;
  1366. }
  1367. L90:
  1368. ;
  1369. }
  1370. /* L100: */
  1371. }
  1372. /* Report result. */
  1373. if (errmax < *thresh) {
  1374. if (*iorder == 0) {
  1375. printf("%s PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  1376. }
  1377. if (*iorder == 1) {
  1378. printf("%s PASSED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  1379. }
  1380. } else {
  1381. if (*iorder == 0) {
  1382. printf("%s COMPLETED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  1383. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  1384. }
  1385. if (*iorder == 1) {
  1386. printf("%s COMPLETED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  1387. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  1388. }
  1389. }
  1390. goto L120;
  1391. L110:
  1392. printf(" ******* %s FAILED ON CALL NUMBER:\n",sname);
  1393. zprcn2_(nout, &nc, sname, iorder, side, uplo, &m, &n, &alpha, &lda, &ldb,
  1394. &beta, &ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1);
  1395. L120:
  1396. return 0;
  1397. /* 9995 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ), */
  1398. /* $ '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1, */
  1399. /* $ ',', F4.1, '), C,', I3, ') .' ) */
  1400. /* End of ZCHK2. */
  1401. } /* zchk2_ */
  1402. /* Subroutine */ int zprcn2_(integer* nout, integer* nc, char* sname, integer* iorder, char* side, char* uplo, integer* m, integer* n, doublecomplex* alpha, integer* lda, integer* ldb, doublecomplex* beta, integer* ldc, ftnlen sname_len, ftnlen side_len, ftnlen uplo_len)
  1403. {
  1404. /* Local variables */
  1405. static char cs[14], cu[14], crc[14];
  1406. if (*(unsigned char *)side == 'L') {
  1407. s_copy(cs, " CblasLeft", (ftnlen)14, (ftnlen)14);
  1408. } else {
  1409. s_copy(cs, " CblasRight", (ftnlen)14, (ftnlen)14);
  1410. }
  1411. if (*(unsigned char *)uplo == 'U') {
  1412. s_copy(cu, " CblasUpper", (ftnlen)14, (ftnlen)14);
  1413. } else {
  1414. s_copy(cu, " CblasLower", (ftnlen)14, (ftnlen)14);
  1415. }
  1416. if (*iorder == 1) {
  1417. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  1418. } else {
  1419. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  1420. }
  1421. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cs,cu);
  1422. printf("%d %d (%4.1lf,%4.1lf) , A, %d, B, %d, (%4.1lf,%4.1lf) , C, %d.\n",*m,*n,alpha->r,alpha->i,*lda,*ldb,beta->r,beta->i,*ldc);
  1423. return 0;
  1424. } /* zprcn2_ */
  1425. /* Subroutine */ int zchk3_(char* sname, doublereal* eps, doublereal* thresh, integer* nout, integer* ntra, logical* trace, logical* rewi, logical* fatal, integer* nidim, integer* idim, integer* nalf, doublecomplex* alf, integer* nmax, doublecomplex* a, doublecomplex* aa, doublecomplex* as, doublecomplex* b, doublecomplex* bb, doublecomplex* bs, doublecomplex* ct, doublereal* g, doublecomplex* c__, integer* iorder, ftnlen sname_len)
  1426. {
  1427. /* Initialized data */
  1428. static char ichu[2+1] = "UL";
  1429. static char icht[3+1] = "NTC";
  1430. static char ichd[2+1] = "UN";
  1431. static char ichs[2+1] = "LR";
  1432. /* System generated locals */
  1433. integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
  1434. i__3, i__4, i__5, i__6, i__7;
  1435. doublecomplex z__1;
  1436. /* Local variables */
  1437. static char diag[1];
  1438. static integer ldas, ldbs;
  1439. static logical same;
  1440. static char side[1];
  1441. static logical left, null;
  1442. static char uplo[1];
  1443. static integer i__, j, m, n;
  1444. static doublecomplex alpha;
  1445. static char diags[1];
  1446. static logical isame[13];
  1447. static char sides[1];
  1448. extern /* Subroutine */ int zmake_(char*, char*, char*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, logical*, doublecomplex*, ftnlen, ftnlen, ftnlen);
  1449. static integer nargs;
  1450. extern /* Subroutine */ int zmmch_(char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublereal*, doublecomplex*, integer*, doublereal*, doublereal*, logical*, integer*, logical*, ftnlen, ftnlen);
  1451. static logical reset;
  1452. static char uplos[1];
  1453. static integer ia, na;
  1454. extern /* Subroutine */ int zprcn3_(integer*, integer*, char*, integer*, char*, char*, char*, char*, integer*, integer*, doublecomplex*, integer*, integer*, ftnlen, ftnlen, ftnlen, ftnlen, ftnlen);
  1455. static integer nc, im, in, ms, ns;
  1456. static char tranas[1], transa[1];
  1457. static doublereal errmax;
  1458. extern logical lzeres_(char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  1459. extern /* Subroutine */ void cztrmm_(integer*, char*, char*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, ftnlen, ftnlen, ftnlen, ftnlen);
  1460. extern /* Subroutine */ void cztrsm_(integer*, char*, char*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, ftnlen, ftnlen, ftnlen, ftnlen);
  1461. static integer laa, icd, lbb, lda, ldb, ics;
  1462. static doublecomplex als;
  1463. static integer ict, icu;
  1464. static doublereal err;
  1465. extern logical lze_(doublecomplex*, doublecomplex*, integer*);
  1466. /* Tests ZTRMM and ZTRSM. */
  1467. /* Auxiliary routine for test program for Level 3 Blas. */
  1468. /* -- Written on 8-February-1989. */
  1469. /* Jack Dongarra, Argonne National Laboratory. */
  1470. /* Iain Duff, AERE Harwell. */
  1471. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  1472. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  1473. /* .. Parameters .. */
  1474. /* .. Scalar Arguments .. */
  1475. /* .. Array Arguments .. */
  1476. /* .. Local Scalars .. */
  1477. /* .. Local Arrays .. */
  1478. /* .. External Functions .. */
  1479. /* .. External Subroutines .. */
  1480. /* .. Intrinsic Functions .. */
  1481. /* .. Scalars in Common .. */
  1482. /* .. Common blocks .. */
  1483. /* .. Data statements .. */
  1484. /* Parameter adjustments */
  1485. --idim;
  1486. --alf;
  1487. c_dim1 = *nmax;
  1488. c_offset = 1 + c_dim1 * 1;
  1489. c__ -= c_offset;
  1490. --g;
  1491. --ct;
  1492. --bs;
  1493. --bb;
  1494. b_dim1 = *nmax;
  1495. b_offset = 1 + b_dim1 * 1;
  1496. b -= b_offset;
  1497. --as;
  1498. --aa;
  1499. a_dim1 = *nmax;
  1500. a_offset = 1 + a_dim1 * 1;
  1501. a -= a_offset;
  1502. /* Function Body */
  1503. /* .. Executable Statements .. */
  1504. nargs = 11;
  1505. nc = 0;
  1506. reset = TRUE_;
  1507. errmax = 0.;
  1508. /* Set up zero matrix for ZMMCH. */
  1509. i__1 = *nmax;
  1510. for (j = 1; j <= i__1; ++j) {
  1511. i__2 = *nmax;
  1512. for (i__ = 1; i__ <= i__2; ++i__) {
  1513. i__3 = i__ + j * c_dim1;
  1514. c__[i__3].r = 0., c__[i__3].i = 0.;
  1515. /* L10: */
  1516. }
  1517. /* L20: */
  1518. }
  1519. i__1 = *nidim;
  1520. for (im = 1; im <= i__1; ++im) {
  1521. m = idim[im];
  1522. i__2 = *nidim;
  1523. for (in = 1; in <= i__2; ++in) {
  1524. n = idim[in];
  1525. /* Set LDB to 1 more than minimum value if room. */
  1526. ldb = m;
  1527. if (ldb < *nmax) {
  1528. ++ldb;
  1529. }
  1530. /* Skip tests if not enough room. */
  1531. if (ldb > *nmax) {
  1532. goto L130;
  1533. }
  1534. lbb = ldb * n;
  1535. null = m <= 0 || n <= 0;
  1536. for (ics = 1; ics <= 2; ++ics) {
  1537. *(unsigned char *)side = *(unsigned char *)&ichs[ics - 1];
  1538. left = *(unsigned char *)side == 'L';
  1539. if (left) {
  1540. na = m;
  1541. } else {
  1542. na = n;
  1543. }
  1544. /* Set LDA to 1 more than minimum value if room. */
  1545. lda = na;
  1546. if (lda < *nmax) {
  1547. ++lda;
  1548. }
  1549. /* Skip tests if not enough room. */
  1550. if (lda > *nmax) {
  1551. goto L130;
  1552. }
  1553. laa = lda * na;
  1554. for (icu = 1; icu <= 2; ++icu) {
  1555. *(unsigned char *)uplo = *(unsigned char *)&ichu[icu - 1];
  1556. for (ict = 1; ict <= 3; ++ict) {
  1557. *(unsigned char *)transa = *(unsigned char *)&icht[
  1558. ict - 1];
  1559. for (icd = 1; icd <= 2; ++icd) {
  1560. *(unsigned char *)diag = *(unsigned char *)&ichd[
  1561. icd - 1];
  1562. i__3 = *nalf;
  1563. for (ia = 1; ia <= i__3; ++ia) {
  1564. i__4 = ia;
  1565. alpha.r = alf[i__4].r, alpha.i = alf[i__4].i;
  1566. /* Generate the matrix A. */
  1567. zmake_("tr", uplo, diag, &na, &na, &a[
  1568. a_offset], nmax, &aa[1], &lda, &reset,
  1569. &c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)
  1570. 1);
  1571. /* Generate the matrix B. */
  1572. zmake_("ge", " ", " ", &m, &n, &b[b_offset],
  1573. nmax, &bb[1], &ldb, &reset, &c_b1, (
  1574. ftnlen)2, (ftnlen)1, (ftnlen)1);
  1575. ++nc;
  1576. /* Save every datum before calling the */
  1577. /* subroutine. */
  1578. *(unsigned char *)sides = *(unsigned char *)
  1579. side;
  1580. *(unsigned char *)uplos = *(unsigned char *)
  1581. uplo;
  1582. *(unsigned char *)tranas = *(unsigned char *)
  1583. transa;
  1584. *(unsigned char *)diags = *(unsigned char *)
  1585. diag;
  1586. ms = m;
  1587. ns = n;
  1588. als.r = alpha.r, als.i = alpha.i;
  1589. i__4 = laa;
  1590. for (i__ = 1; i__ <= i__4; ++i__) {
  1591. i__5 = i__;
  1592. i__6 = i__;
  1593. as[i__5].r = aa[i__6].r, as[i__5].i = aa[
  1594. i__6].i;
  1595. /* L30: */
  1596. }
  1597. ldas = lda;
  1598. i__4 = lbb;
  1599. for (i__ = 1; i__ <= i__4; ++i__) {
  1600. i__5 = i__;
  1601. i__6 = i__;
  1602. bs[i__5].r = bb[i__6].r, bs[i__5].i = bb[
  1603. i__6].i;
  1604. /* L40: */
  1605. }
  1606. ldbs = ldb;
  1607. /* Call the subroutine. */
  1608. if (s_cmp(sname + 9, "mm", (ftnlen)2, (ftnlen)
  1609. 2) == 0) {
  1610. if (*trace) {
  1611. zprcn3_(ntra, &nc, sname, iorder,
  1612. side, uplo, transa, diag, &m,
  1613. &n, &alpha, &lda, &ldb, (
  1614. ftnlen)12, (ftnlen)1, (ftnlen)
  1615. 1, (ftnlen)1, (ftnlen)1);
  1616. }
  1617. if (*rewi) {
  1618. /* al__1.aerr = 0;
  1619. al__1.aunit = *ntra;
  1620. f_rew(&al__1);*/
  1621. }
  1622. cztrmm_(iorder, side, uplo, transa, diag,
  1623. &m, &n, &alpha, &aa[1], &lda, &bb[
  1624. 1], &ldb, (ftnlen)1, (ftnlen)1, (
  1625. ftnlen)1, (ftnlen)1);
  1626. } else if (s_cmp(sname + 9, "sm", (ftnlen)2, (
  1627. ftnlen)2) == 0) {
  1628. if (*trace) {
  1629. zprcn3_(ntra, &nc, sname, iorder,
  1630. side, uplo, transa, diag, &m,
  1631. &n, &alpha, &lda, &ldb, (
  1632. ftnlen)12, (ftnlen)1, (ftnlen)
  1633. 1, (ftnlen)1, (ftnlen)1);
  1634. }
  1635. if (*rewi) {
  1636. /* al__1.aerr = 0;
  1637. al__1.aunit = *ntra;
  1638. f_rew(&al__1);*/
  1639. }
  1640. cztrsm_(iorder, side, uplo, transa, diag,
  1641. &m, &n, &alpha, &aa[1], &lda, &bb[
  1642. 1], &ldb, (ftnlen)1, (ftnlen)1, (
  1643. ftnlen)1, (ftnlen)1);
  1644. }
  1645. /* Check if error-exit was taken incorrectly. */
  1646. if (! infoc_1.ok) {
  1647. printf("*** FATAL ERROR - ERROR-CALL MYEXIT TAKEN ON VALID CALL\n");
  1648. *fatal = TRUE_;
  1649. goto L150;
  1650. }
  1651. /* See what data changed inside subroutines. */
  1652. isame[0] = *(unsigned char *)sides == *(
  1653. unsigned char *)side;
  1654. isame[1] = *(unsigned char *)uplos == *(
  1655. unsigned char *)uplo;
  1656. isame[2] = *(unsigned char *)tranas == *(
  1657. unsigned char *)transa;
  1658. isame[3] = *(unsigned char *)diags == *(
  1659. unsigned char *)diag;
  1660. isame[4] = ms == m;
  1661. isame[5] = ns == n;
  1662. isame[6] = als.r == alpha.r && als.i ==
  1663. alpha.i;
  1664. isame[7] = lze_(&as[1], &aa[1], &laa);
  1665. isame[8] = ldas == lda;
  1666. if (null) {
  1667. isame[9] = lze_(&bs[1], &bb[1], &lbb);
  1668. } else {
  1669. isame[9] = lzeres_("ge", " ", &m, &n, &bs[
  1670. 1], &bb[1], &ldb, (ftnlen)2, (
  1671. ftnlen)1);
  1672. }
  1673. isame[10] = ldbs == ldb;
  1674. /* If data was incorrectly changed, report and */
  1675. /* return. */
  1676. same = TRUE_;
  1677. i__4 = nargs;
  1678. for (i__ = 1; i__ <= i__4; ++i__) {
  1679. same = same && isame[i__ - 1];
  1680. if (! isame[i__ - 1]) {
  1681. printf(" ******* FATAL ERROR - PARAMETER NUMBER %d WAS CHANGED INCORRECTLY *******\n",i__);
  1682. }
  1683. /* L50: */
  1684. }
  1685. if (! same) {
  1686. *fatal = TRUE_;
  1687. goto L150;
  1688. }
  1689. if (! null) {
  1690. if (s_cmp(sname + 9, "mm", (ftnlen)2, (
  1691. ftnlen)2) == 0) {
  1692. /* Check the result. */
  1693. if (left) {
  1694. zmmch_(transa, "N", &m, &n, &m, &
  1695. alpha, &a[a_offset], nmax,
  1696. &b[b_offset], nmax, &
  1697. c_b1, &c__[c_offset],
  1698. nmax, &ct[1], &g[1], &bb[
  1699. 1], &ldb, eps, &err,
  1700. fatal, nout, &c_true, (
  1701. ftnlen)1, (ftnlen)1);
  1702. } else {
  1703. zmmch_("N", transa, &m, &n, &n, &
  1704. alpha, &b[b_offset], nmax,
  1705. &a[a_offset], nmax, &
  1706. c_b1, &c__[c_offset],
  1707. nmax, &ct[1], &g[1], &bb[
  1708. 1], &ldb, eps, &err,
  1709. fatal, nout, &c_true, (
  1710. ftnlen)1, (ftnlen)1);
  1711. }
  1712. } else if (s_cmp(sname + 9, "sm", (ftnlen)
  1713. 2, (ftnlen)2) == 0) {
  1714. /* Compute approximation to original */
  1715. /* matrix. */
  1716. i__4 = n;
  1717. for (j = 1; j <= i__4; ++j) {
  1718. i__5 = m;
  1719. for (i__ = 1; i__ <= i__5; ++i__)
  1720. {
  1721. i__6 = i__ + j * c_dim1;
  1722. i__7 = i__ + (j - 1) * ldb;
  1723. c__[i__6].r = bb[i__7].r, c__[i__6].i = bb[i__7].i;
  1724. i__6 = i__ + (j - 1) * ldb;
  1725. i__7 = i__ + j * b_dim1;
  1726. z__1.r = alpha.r * b[i__7].r - alpha.i * b[i__7].i,
  1727. z__1.i = alpha.r * b[i__7].i + alpha.i * b[
  1728. i__7].r;
  1729. bb[i__6].r = z__1.r, bb[i__6].i = z__1.i;
  1730. /* L60: */
  1731. }
  1732. /* L70: */
  1733. }
  1734. if (left) {
  1735. zmmch_(transa, "N", &m, &n, &m, &
  1736. c_b2, &a[a_offset], nmax,
  1737. &c__[c_offset], nmax, &
  1738. c_b1, &b[b_offset], nmax,
  1739. &ct[1], &g[1], &bb[1], &
  1740. ldb, eps, &err, fatal,
  1741. nout, &c_false, (ftnlen)1,
  1742. (ftnlen)1);
  1743. } else {
  1744. zmmch_("N", transa, &m, &n, &n, &
  1745. c_b2, &c__[c_offset],
  1746. nmax, &a[a_offset], nmax,
  1747. &c_b1, &b[b_offset], nmax,
  1748. &ct[1], &g[1], &bb[1], &
  1749. ldb, eps, &err, fatal,
  1750. nout, &c_false, (ftnlen)1,
  1751. (ftnlen)1);
  1752. }
  1753. }
  1754. errmax = f2cmax(errmax,err);
  1755. /* If got really bad answer, report and */
  1756. /* return. */
  1757. if (*fatal) {
  1758. goto L150;
  1759. }
  1760. }
  1761. /* L80: */
  1762. }
  1763. /* L90: */
  1764. }
  1765. /* L100: */
  1766. }
  1767. /* L110: */
  1768. }
  1769. /* L120: */
  1770. }
  1771. L130:
  1772. ;
  1773. }
  1774. /* L140: */
  1775. }
  1776. /* Report result. */
  1777. if (errmax < *thresh) {
  1778. if (*iorder == 0) {
  1779. printf("%s PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  1780. }
  1781. if (*iorder == 1) {
  1782. printf("%s PASSED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  1783. }
  1784. } else {
  1785. if (*iorder == 0) {
  1786. printf("%s COMPLETED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  1787. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  1788. }
  1789. if (*iorder == 1) {
  1790. printf("%s COMPLETED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  1791. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  1792. }
  1793. }
  1794. goto L160;
  1795. L150:
  1796. printf(" ******* %s FAILED ON CALL NUMBER:\n",sname);
  1797. if (*trace) {
  1798. zprcn3_(ntra, &nc, sname, iorder, side, uplo, transa, diag, &m, &n, &
  1799. alpha, &lda, &ldb, (ftnlen)12, (ftnlen)1, (ftnlen)1, (ftnlen)
  1800. 1, (ftnlen)1);
  1801. }
  1802. L160:
  1803. return 0;
  1804. /* 9995 FORMAT(1X, I6, ': ', A12,'(', 4( '''', A1, ''',' ), 2( I3, ',' ), */
  1805. /* $ '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ') ', */
  1806. /* $ ' .' ) */
  1807. /* End of ZCHK3. */
  1808. } /* zchk3_ */
  1809. /* Subroutine */ int zprcn3_(integer* nout, integer* nc, char* sname, integer* iorder, char* side, char* uplo, char* transa, char* diag, integer* m, integer* n, doublecomplex* alpha, integer* lda, integer* ldb, ftnlen sname_len, ftnlen side_len, ftnlen uplo_len, ftnlen transa_len, ftnlen diag_len)
  1810. {
  1811. /* Local variables */
  1812. static char ca[14], cd[14], cs[14], cu[14], crc[14];
  1813. if (*(unsigned char *)side == 'L') {
  1814. s_copy(cs, " CblasLeft", (ftnlen)14, (ftnlen)14);
  1815. } else {
  1816. s_copy(cs, " CblasRight", (ftnlen)14, (ftnlen)14);
  1817. }
  1818. if (*(unsigned char *)uplo == 'U') {
  1819. s_copy(cu, " CblasUpper", (ftnlen)14, (ftnlen)14);
  1820. } else {
  1821. s_copy(cu, " CblasLower", (ftnlen)14, (ftnlen)14);
  1822. }
  1823. if (*(unsigned char *)transa == 'N') {
  1824. s_copy(ca, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  1825. } else if (*(unsigned char *)transa == 'T') {
  1826. s_copy(ca, " CblasTrans", (ftnlen)14, (ftnlen)14);
  1827. } else {
  1828. s_copy(ca, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  1829. }
  1830. if (*(unsigned char *)diag == 'N') {
  1831. s_copy(cd, " CblasNonUnit", (ftnlen)14, (ftnlen)14);
  1832. } else {
  1833. s_copy(cd, " CblasUnit", (ftnlen)14, (ftnlen)14);
  1834. }
  1835. if (*iorder == 1) {
  1836. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  1837. } else {
  1838. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  1839. }
  1840. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cs,cu);
  1841. printf(" %s %s %d %d (%4.1lf,%4.1lf) A %d B %d\n",ca,cd,*m,*n,alpha->r,alpha->i,*lda,*ldb);
  1842. return 0;
  1843. } /* zprcn3_ */
  1844. /* Subroutine */ int zchk4_(char* sname, doublereal* eps, doublereal* thresh, integer* nout, integer* ntra, logical* trace, logical* rewi, logical* fatal, integer* nidim, integer* idim, integer* nalf, doublecomplex* alf, integer* nbet, doublecomplex* bet, integer* nmax, doublecomplex* a, doublecomplex* aa, doublecomplex* as, doublecomplex* b, doublecomplex* bb, doublecomplex* bs, doublecomplex* c__, doublecomplex* cc, doublecomplex* cs, doublecomplex* ct, doublereal* g, integer* iorder, ftnlen sname_len)
  1845. {
  1846. /* Initialized data */
  1847. static char icht[2+1] = "NC";
  1848. static char ichu[2+1] = "UL";
  1849. /* System generated locals */
  1850. integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
  1851. i__3, i__4, i__5, i__6, i__7;
  1852. doublecomplex z__1;
  1853. /* Local variables */
  1854. static doublecomplex beta;
  1855. static integer ldas, ldcs;
  1856. static logical same, isconj;
  1857. static doublecomplex bets;
  1858. static doublereal rals;
  1859. static logical tran, null;
  1860. static char uplo[1];
  1861. static integer i__, j, k, n;
  1862. static doublecomplex alpha;
  1863. static doublereal rbeta;
  1864. static logical isame[13];
  1865. extern /* Subroutine */ int zmake_(char*, char*, char*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, logical*, doublecomplex*, ftnlen, ftnlen, ftnlen);
  1866. static integer nargs;
  1867. extern /* Subroutine */ int zmmch_(char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublereal*, doublecomplex*, integer*, doublereal*, doublereal*, logical*, integer*, logical*, ftnlen, ftnlen);
  1868. static doublereal rbets;
  1869. static logical reset;
  1870. static char trans[1];
  1871. static logical upper;
  1872. static char uplos[1];
  1873. static integer ia, ib, jc, ma, na;
  1874. extern /* Subroutine */ int zprcn4_(integer*, integer*, char*, integer*, char*, char*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, ftnlen, ftnlen, ftnlen);
  1875. static integer nc;
  1876. extern /* Subroutine */ int zprcn6_(integer*, integer*, char*, integer*, char*, char*, integer*, integer*, doublereal*, integer*, doublereal*, integer*, ftnlen, ftnlen, ftnlen);
  1877. static integer ik, in, jj, lj, ks, ns;
  1878. static doublereal ralpha;
  1879. extern /* Subroutine */ int czherk_(integer*, char*, char*, integer*, integer*, doublereal*, doublecomplex*, integer*, doublereal*, doublecomplex*, integer*, ftnlen, ftnlen);
  1880. static doublereal errmax;
  1881. extern logical lzeres_(char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  1882. static char transs[1], transt[1];
  1883. extern /* Subroutine */ int czsyrk_(integer*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  1884. static integer laa, lda, lcc, ldc;
  1885. static doublecomplex als;
  1886. static integer ict, icu;
  1887. static doublereal err;
  1888. extern logical lze_(doublecomplex*, doublecomplex*, integer*);
  1889. /* Tests ZHERK and ZSYRK. */
  1890. /* Auxiliary routine for test program for Level 3 Blas. */
  1891. /* -- Written on 8-February-1989. */
  1892. /* Jack Dongarra, Argonne National Laboratory. */
  1893. /* Iain Duff, AERE Harwell. */
  1894. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  1895. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  1896. /* .. Parameters .. */
  1897. /* .. Scalar Arguments .. */
  1898. /* .. Array Arguments .. */
  1899. /* .. Local Scalars .. */
  1900. /* .. Local Arrays .. */
  1901. /* .. External Functions .. */
  1902. /* .. External Subroutines .. */
  1903. /* .. Intrinsic Functions .. */
  1904. /* .. Scalars in Common .. */
  1905. /* .. Common blocks .. */
  1906. /* .. Data statements .. */
  1907. /* Parameter adjustments */
  1908. --idim;
  1909. --alf;
  1910. --bet;
  1911. --g;
  1912. --ct;
  1913. --cs;
  1914. --cc;
  1915. c_dim1 = *nmax;
  1916. c_offset = 1 + c_dim1 * 1;
  1917. c__ -= c_offset;
  1918. --bs;
  1919. --bb;
  1920. b_dim1 = *nmax;
  1921. b_offset = 1 + b_dim1 * 1;
  1922. b -= b_offset;
  1923. --as;
  1924. --aa;
  1925. a_dim1 = *nmax;
  1926. a_offset = 1 + a_dim1 * 1;
  1927. a -= a_offset;
  1928. /* Function Body */
  1929. /* .. Executable Statements .. */
  1930. isconj = s_cmp(sname + 7, "he", (ftnlen)2, (ftnlen)2) == 0;
  1931. nargs = 10;
  1932. nc = 0;
  1933. reset = TRUE_;
  1934. errmax = 0.;
  1935. rals = 1.;
  1936. rbets = 1.;
  1937. i__1 = *nidim;
  1938. for (in = 1; in <= i__1; ++in) {
  1939. n = idim[in];
  1940. /* Set LDC to 1 more than minimum value if room. */
  1941. ldc = n;
  1942. if (ldc < *nmax) {
  1943. ++ldc;
  1944. }
  1945. /* Skip tests if not enough room. */
  1946. if (ldc > *nmax) {
  1947. goto L100;
  1948. }
  1949. lcc = ldc * n;
  1950. i__2 = *nidim;
  1951. for (ik = 1; ik <= i__2; ++ik) {
  1952. k = idim[ik];
  1953. for (ict = 1; ict <= 2; ++ict) {
  1954. *(unsigned char *)trans = *(unsigned char *)&icht[ict - 1];
  1955. tran = *(unsigned char *)trans == 'C';
  1956. if (tran && ! isconj) {
  1957. *(unsigned char *)trans = 'T';
  1958. }
  1959. if (tran) {
  1960. ma = k;
  1961. na = n;
  1962. } else {
  1963. ma = n;
  1964. na = k;
  1965. }
  1966. /* Set LDA to 1 more than minimum value if room. */
  1967. lda = ma;
  1968. if (lda < *nmax) {
  1969. ++lda;
  1970. }
  1971. /* Skip tests if not enough room. */
  1972. if (lda > *nmax) {
  1973. goto L80;
  1974. }
  1975. laa = lda * na;
  1976. /* Generate the matrix A. */
  1977. zmake_("ge", " ", " ", &ma, &na, &a[a_offset], nmax, &aa[1], &
  1978. lda, &reset, &c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)1);
  1979. for (icu = 1; icu <= 2; ++icu) {
  1980. *(unsigned char *)uplo = *(unsigned char *)&ichu[icu - 1];
  1981. upper = *(unsigned char *)uplo == 'U';
  1982. i__3 = *nalf;
  1983. for (ia = 1; ia <= i__3; ++ia) {
  1984. i__4 = ia;
  1985. alpha.r = alf[i__4].r, alpha.i = alf[i__4].i;
  1986. if (isconj) {
  1987. ralpha = alpha.r;
  1988. z__1.r = ralpha, z__1.i = 0.;
  1989. alpha.r = z__1.r, alpha.i = z__1.i;
  1990. }
  1991. i__4 = *nbet;
  1992. for (ib = 1; ib <= i__4; ++ib) {
  1993. i__5 = ib;
  1994. beta.r = bet[i__5].r, beta.i = bet[i__5].i;
  1995. if (isconj) {
  1996. rbeta = beta.r;
  1997. z__1.r = rbeta, z__1.i = 0.;
  1998. beta.r = z__1.r, beta.i = z__1.i;
  1999. }
  2000. null = n <= 0;
  2001. if (isconj) {
  2002. null = null ||( (k <= 0 || ralpha == 0.) &&
  2003. rbeta == 1.);
  2004. }
  2005. /* Generate the matrix C. */
  2006. zmake_(sname + 7, uplo, " ", &n, &n, &c__[
  2007. c_offset], nmax, &cc[1], &ldc, &reset, &
  2008. c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)1);
  2009. ++nc;
  2010. /* Save every datum before calling the subroutine. */
  2011. *(unsigned char *)uplos = *(unsigned char *)uplo;
  2012. *(unsigned char *)transs = *(unsigned char *)
  2013. trans;
  2014. ns = n;
  2015. ks = k;
  2016. if (isconj) {
  2017. rals = ralpha;
  2018. } else {
  2019. als.r = alpha.r, als.i = alpha.i;
  2020. }
  2021. i__5 = laa;
  2022. for (i__ = 1; i__ <= i__5; ++i__) {
  2023. i__6 = i__;
  2024. i__7 = i__;
  2025. as[i__6].r = aa[i__7].r, as[i__6].i = aa[i__7]
  2026. .i;
  2027. /* L10: */
  2028. }
  2029. ldas = lda;
  2030. if (isconj) {
  2031. rbets = rbeta;
  2032. } else {
  2033. bets.r = beta.r, bets.i = beta.i;
  2034. }
  2035. i__5 = lcc;
  2036. for (i__ = 1; i__ <= i__5; ++i__) {
  2037. i__6 = i__;
  2038. i__7 = i__;
  2039. cs[i__6].r = cc[i__7].r, cs[i__6].i = cc[i__7]
  2040. .i;
  2041. /* L20: */
  2042. }
  2043. ldcs = ldc;
  2044. /* Call the subroutine. */
  2045. if (isconj) {
  2046. if (*trace) {
  2047. zprcn6_(ntra, &nc, sname, iorder, uplo,
  2048. trans, &n, &k, &ralpha, &lda, &
  2049. rbeta, &ldc, (ftnlen)12, (ftnlen)
  2050. 1, (ftnlen)1);
  2051. }
  2052. if (*rewi) {
  2053. /* al__1.aerr = 0;
  2054. al__1.aunit = *ntra;
  2055. f_rew(&al__1);*/
  2056. }
  2057. czherk_(iorder, uplo, trans, &n, &k, &ralpha,
  2058. &aa[1], &lda, &rbeta, &cc[1], &ldc, (
  2059. ftnlen)1, (ftnlen)1);
  2060. } else {
  2061. if (*trace) {
  2062. zprcn4_(ntra, &nc, sname, iorder, uplo,
  2063. trans, &n, &k, &alpha, &lda, &
  2064. beta, &ldc, (ftnlen)12, (ftnlen)1,
  2065. (ftnlen)1);
  2066. }
  2067. if (*rewi) {
  2068. /* al__1.aerr = 0;
  2069. al__1.aunit = *ntra;
  2070. f_rew(&al__1);*/
  2071. }
  2072. czsyrk_(iorder, uplo, trans, &n, &k, &alpha, &
  2073. aa[1], &lda, &beta, &cc[1], &ldc, (
  2074. ftnlen)1, (ftnlen)1);
  2075. }
  2076. /* Check if error-exit was taken incorrectly. */
  2077. if (! infoc_1.ok) {
  2078. printf("*** FATAL ERROR - ERROR-CALL MYEXIT TAKEN ON VALID CALL\n");
  2079. *fatal = TRUE_;
  2080. goto L120;
  2081. }
  2082. /* See what data changed inside subroutines. */
  2083. isame[0] = *(unsigned char *)uplos == *(unsigned
  2084. char *)uplo;
  2085. isame[1] = *(unsigned char *)transs == *(unsigned
  2086. char *)trans;
  2087. isame[2] = ns == n;
  2088. isame[3] = ks == k;
  2089. if (isconj) {
  2090. isame[4] = rals == ralpha;
  2091. } else {
  2092. isame[4] = als.r == alpha.r && als.i ==
  2093. alpha.i;
  2094. }
  2095. isame[5] = lze_(&as[1], &aa[1], &laa);
  2096. isame[6] = ldas == lda;
  2097. if (isconj) {
  2098. isame[7] = rbets == rbeta;
  2099. } else {
  2100. isame[7] = bets.r == beta.r && bets.i ==
  2101. beta.i;
  2102. }
  2103. if (null) {
  2104. isame[8] = lze_(&cs[1], &cc[1], &lcc);
  2105. } else {
  2106. isame[8] = lzeres_(sname + 7, uplo, &n, &n, &
  2107. cs[1], &cc[1], &ldc, (ftnlen)2, (
  2108. ftnlen)1);
  2109. }
  2110. isame[9] = ldcs == ldc;
  2111. /* If data was incorrectly changed, report and */
  2112. /* return. */
  2113. same = TRUE_;
  2114. i__5 = nargs;
  2115. for (i__ = 1; i__ <= i__5; ++i__) {
  2116. same = same && isame[i__ - 1];
  2117. if (! isame[i__ - 1]) {
  2118. printf(" ******* FATAL ERROR - PARAMETER NUMBER %d WAS CHANGED INCORRECTLY *******\n",i__);
  2119. }
  2120. /* L30: */
  2121. }
  2122. if (! same) {
  2123. *fatal = TRUE_;
  2124. goto L120;
  2125. }
  2126. if (! null) {
  2127. /* Check the result column by column. */
  2128. if (isconj) {
  2129. *(unsigned char *)transt = 'C';
  2130. } else {
  2131. *(unsigned char *)transt = 'T';
  2132. }
  2133. jc = 1;
  2134. i__5 = n;
  2135. for (j = 1; j <= i__5; ++j) {
  2136. if (upper) {
  2137. jj = 1;
  2138. lj = j;
  2139. } else {
  2140. jj = j;
  2141. lj = n - j + 1;
  2142. }
  2143. if (tran) {
  2144. zmmch_(transt, "N", &lj, &c__1, &k, &
  2145. alpha, &a[jj * a_dim1 + 1],
  2146. nmax, &a[j * a_dim1 + 1],
  2147. nmax, &beta, &c__[jj + j *
  2148. c_dim1], nmax, &ct[1], &g[1],
  2149. &cc[jc], &ldc, eps, &err,
  2150. fatal, nout, &c_true, (ftnlen)
  2151. 1, (ftnlen)1);
  2152. } else {
  2153. zmmch_("N", transt, &lj, &c__1, &k, &
  2154. alpha, &a[jj + a_dim1], nmax,
  2155. &a[j + a_dim1], nmax, &beta, &
  2156. c__[jj + j * c_dim1], nmax, &
  2157. ct[1], &g[1], &cc[jc], &ldc,
  2158. eps, &err, fatal, nout, &
  2159. c_true, (ftnlen)1, (ftnlen)1);
  2160. }
  2161. if (upper) {
  2162. jc += ldc;
  2163. } else {
  2164. jc = jc + ldc + 1;
  2165. }
  2166. errmax = f2cmax(errmax,err);
  2167. /* If got really bad answer, report and */
  2168. /* return. */
  2169. if (*fatal) {
  2170. goto L110;
  2171. }
  2172. /* L40: */
  2173. }
  2174. }
  2175. /* L50: */
  2176. }
  2177. /* L60: */
  2178. }
  2179. /* L70: */
  2180. }
  2181. L80:
  2182. ;
  2183. }
  2184. /* L90: */
  2185. }
  2186. L100:
  2187. ;
  2188. }
  2189. /* Report result. */
  2190. if (errmax < *thresh) {
  2191. if (*iorder == 0) {
  2192. printf("%s PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  2193. }
  2194. if (*iorder == 1) {
  2195. printf("%s PASSED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  2196. }
  2197. } else {
  2198. if (*iorder == 0) {
  2199. printf("%s COMPLETED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  2200. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  2201. }
  2202. if (*iorder == 1) {
  2203. printf("%s COMPLETED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  2204. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  2205. }
  2206. }
  2207. goto L130;
  2208. L110:
  2209. if (n > 1) {
  2210. printf(" THESE ARE THE RESULTS FOR COLUMN %d:\n",j);
  2211. }
  2212. L120:
  2213. printf(" ******* %s FAILED ON CALL NUMBER:\n",sname);
  2214. if (isconj) {
  2215. zprcn6_(nout, &nc, sname, iorder, uplo, trans, &n, &k, &ralpha, &lda,
  2216. &rbeta, &ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1);
  2217. } else {
  2218. zprcn4_(nout, &nc, sname, iorder, uplo, trans, &n, &k, &alpha, &lda, &
  2219. beta, &ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1);
  2220. }
  2221. L130:
  2222. return 0;
  2223. /* 9994 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ), */
  2224. /* $ F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ') ', */
  2225. /* $ ' .' ) */
  2226. /* 9993 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ), */
  2227. /* $ '(', F4.1, ',', F4.1, ') , A,', I3, ',(', F4.1, ',', F4.1, */
  2228. /* $ '), C,', I3, ') .' ) */
  2229. /* End of CCHK4. */
  2230. } /* zchk4_ */
  2231. /* Subroutine */ int zprcn4_(integer* nout, integer* nc, char* sname, integer* iorder, char* uplo, char* transa, integer* n, integer* k, doublecomplex* alpha, integer* lda, doublecomplex* beta, integer* ldc, ftnlen sname_len, ftnlen uplo_len, ftnlen transa_len)
  2232. {
  2233. /* Local variables */
  2234. static char ca[14], cu[14], crc[14];
  2235. if (*(unsigned char *)uplo == 'U') {
  2236. s_copy(cu, " CblasUpper", (ftnlen)14, (ftnlen)14);
  2237. } else {
  2238. s_copy(cu, " CblasLower", (ftnlen)14, (ftnlen)14);
  2239. }
  2240. if (*(unsigned char *)transa == 'N') {
  2241. s_copy(ca, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  2242. } else if (*(unsigned char *)transa == 'T') {
  2243. s_copy(ca, " CblasTrans", (ftnlen)14, (ftnlen)14);
  2244. } else {
  2245. s_copy(ca, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  2246. }
  2247. if (*iorder == 1) {
  2248. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  2249. } else {
  2250. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  2251. }
  2252. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cu,ca);
  2253. printf("( %d %d (%4.1lf,%4.1lf) A %d (%4.1lf,%4.1lf) C %d\n",*n,*k,alpha->r,alpha->i,*lda,beta->r,beta->i,*ldc);
  2254. return 0;
  2255. } /* zprcn4_ */
  2256. /* Subroutine */ int zprcn6_(integer* nout, integer* nc, char* sname, integer* iorder, char* uplo, char* transa, integer* n, integer* k, doublereal* alpha, integer* lda, doublereal* beta, integer* ldc, ftnlen sname_len, ftnlen uplo_len, ftnlen transa_len)
  2257. {
  2258. /* Local variables */
  2259. static char ca[14], cu[14], crc[14];
  2260. if (*(unsigned char *)uplo == 'U') {
  2261. s_copy(cu, " CblasUpper", (ftnlen)14, (ftnlen)14);
  2262. } else {
  2263. s_copy(cu, " CblasLower", (ftnlen)14, (ftnlen)14);
  2264. }
  2265. if (*(unsigned char *)transa == 'N') {
  2266. s_copy(ca, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  2267. } else if (*(unsigned char *)transa == 'T') {
  2268. s_copy(ca, " CblasTrans", (ftnlen)14, (ftnlen)14);
  2269. } else {
  2270. s_copy(ca, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  2271. }
  2272. if (*iorder == 1) {
  2273. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  2274. } else {
  2275. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  2276. }
  2277. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cu,ca);
  2278. printf("( %d %d %4.1lf A %d %4.1lf C %d\n",*n,*k,*alpha,*lda,*beta,*ldc);
  2279. return 0;
  2280. } /* zprcn6_ */
  2281. /* Subroutine */ int zchk5_(char* sname, doublereal* eps, doublereal* thresh, integer* nout, integer* ntra, logical* trace, logical* rewi, logical* fatal, integer* nidim, integer* idim, integer* nalf, doublecomplex* alf, integer* nbet, doublecomplex* bet, integer* nmax, doublecomplex* ab, doublecomplex* aa, doublecomplex* as, doublecomplex* bb, doublecomplex* bs, doublecomplex* c__, doublecomplex* cc, doublecomplex* cs, doublecomplex* ct, doublereal* g, doublecomplex* w, integer* iorder, ftnlen sname_len)
  2282. {
  2283. /* Initialized data */
  2284. static char icht[2+1] = "NC";
  2285. static char ichu[2+1] = "UL";
  2286. /* System generated locals */
  2287. integer c_dim1, c_offset, i__1, i__2, i__3, i__4, i__5, i__6, i__7, i__8;
  2288. doublecomplex z__1, z__2;
  2289. /* Local variables */
  2290. static integer jjab;
  2291. static doublecomplex beta;
  2292. static integer ldas, ldbs, ldcs;
  2293. static logical same, isconj;
  2294. static doublecomplex bets;
  2295. static logical tran, null;
  2296. static char uplo[1];
  2297. static integer i__, j, k, n;
  2298. static doublecomplex alpha;
  2299. static doublereal rbeta;
  2300. static logical isame[13];
  2301. extern /* Subroutine */ int zmake_(char*, char*, char*, integer*, integer*, doublecomplex*, integer*, doublecomplex*, integer*, logical*, doublecomplex*, ftnlen, ftnlen, ftnlen);
  2302. static integer nargs;
  2303. extern /* Subroutine */ int zmmch_(char*, char*, integer*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, doublereal*, doublecomplex*, integer*, doublereal*, doublereal*, logical*, integer*, logical*, ftnlen, ftnlen);
  2304. static doublereal rbets;
  2305. static logical reset;
  2306. static char trans[1];
  2307. static logical upper;
  2308. static char uplos[1];
  2309. static integer ia, ib, jc, ma, na, nc;
  2310. extern /* Subroutine */ int zprcn5_(integer*, integer*, char*, integer*, char*, char*, integer*, integer*, doublecomplex*, integer*, integer*, doublecomplex*, integer*, ftnlen, ftnlen, ftnlen);
  2311. extern /* Subroutine */ int zprcn7_(integer*, integer*, char*, integer*, char*, char*, integer*, integer*, doublecomplex*, integer*, integer*, doublereal*, integer*, ftnlen, ftnlen, ftnlen);
  2312. static integer ik, in, jj, lj, ks, ns;
  2313. static doublereal errmax;
  2314. extern logical lzeres_(char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  2315. static char transs[1], transt[1];
  2316. extern /* Subroutine */ int czher2k_(integer*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublereal*, doublecomplex*, integer*, ftnlen, ftnlen);
  2317. static integer laa, lbb, lda, lcc, ldb, ldc;
  2318. static doublecomplex als;
  2319. static integer ict, icu;
  2320. extern /* Subroutine */ int czsyr2k_(integer*, char*, char*, integer*, integer*, doublecomplex*, doublecomplex*, integer*, doublecomplex*, integer*, doublecomplex*, doublecomplex*, integer*, ftnlen, ftnlen);
  2321. static doublereal err;
  2322. extern logical lze_(doublecomplex*, doublecomplex*, integer*);
  2323. /* Tests ZHER2K and ZSYR2K. */
  2324. /* Auxiliary routine for test program for Level 3 Blas. */
  2325. /* -- Written on 8-February-1989. */
  2326. /* Jack Dongarra, Argonne National Laboratory. */
  2327. /* Iain Duff, AERE Harwell. */
  2328. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  2329. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  2330. /* .. Parameters .. */
  2331. /* .. Scalar Arguments .. */
  2332. /* .. Array Arguments .. */
  2333. /* .. Local Scalars .. */
  2334. /* .. Local Arrays .. */
  2335. /* .. External Functions .. */
  2336. /* .. External Subroutines .. */
  2337. /* .. Intrinsic Functions .. */
  2338. /* .. Scalars in Common .. */
  2339. /* .. Common blocks .. */
  2340. /* .. Data statements .. */
  2341. /* Parameter adjustments */
  2342. --idim;
  2343. --alf;
  2344. --bet;
  2345. --w;
  2346. --g;
  2347. --ct;
  2348. --cs;
  2349. --cc;
  2350. c_dim1 = *nmax;
  2351. c_offset = 1 + c_dim1 * 1;
  2352. c__ -= c_offset;
  2353. --bs;
  2354. --bb;
  2355. --as;
  2356. --aa;
  2357. --ab;
  2358. /* Function Body */
  2359. /* .. Executable Statements .. */
  2360. isconj = s_cmp(sname + 7, "he", (ftnlen)2, (ftnlen)2) == 0;
  2361. nargs = 12;
  2362. nc = 0;
  2363. reset = TRUE_;
  2364. errmax = 0.;
  2365. i__1 = *nidim;
  2366. for (in = 1; in <= i__1; ++in) {
  2367. n = idim[in];
  2368. /* Set LDC to 1 more than minimum value if room. */
  2369. ldc = n;
  2370. if (ldc < *nmax) {
  2371. ++ldc;
  2372. }
  2373. /* Skip tests if not enough room. */
  2374. if (ldc > *nmax) {
  2375. goto L130;
  2376. }
  2377. lcc = ldc * n;
  2378. i__2 = *nidim;
  2379. for (ik = 1; ik <= i__2; ++ik) {
  2380. k = idim[ik];
  2381. for (ict = 1; ict <= 2; ++ict) {
  2382. *(unsigned char *)trans = *(unsigned char *)&icht[ict - 1];
  2383. tran = *(unsigned char *)trans == 'C';
  2384. if (tran && ! isconj) {
  2385. *(unsigned char *)trans = 'T';
  2386. }
  2387. if (tran) {
  2388. ma = k;
  2389. na = n;
  2390. } else {
  2391. ma = n;
  2392. na = k;
  2393. }
  2394. /* Set LDA to 1 more than minimum value if room. */
  2395. lda = ma;
  2396. if (lda < *nmax) {
  2397. ++lda;
  2398. }
  2399. /* Skip tests if not enough room. */
  2400. if (lda > *nmax) {
  2401. goto L110;
  2402. }
  2403. laa = lda * na;
  2404. /* Generate the matrix A. */
  2405. if (tran) {
  2406. i__3 = *nmax << 1;
  2407. zmake_("ge", " ", " ", &ma, &na, &ab[1], &i__3, &aa[1], &
  2408. lda, &reset, &c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)
  2409. 1);
  2410. } else {
  2411. zmake_("ge", " ", " ", &ma, &na, &ab[1], nmax, &aa[1], &
  2412. lda, &reset, &c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)
  2413. 1);
  2414. }
  2415. /* Generate the matrix B. */
  2416. ldb = lda;
  2417. lbb = laa;
  2418. if (tran) {
  2419. i__3 = *nmax << 1;
  2420. zmake_("ge", " ", " ", &ma, &na, &ab[k + 1], &i__3, &bb[1]
  2421. , &ldb, &reset, &c_b1, (ftnlen)2, (ftnlen)1, (
  2422. ftnlen)1);
  2423. } else {
  2424. zmake_("ge", " ", " ", &ma, &na, &ab[k * *nmax + 1], nmax,
  2425. &bb[1], &ldb, &reset, &c_b1, (ftnlen)2, (ftnlen)
  2426. 1, (ftnlen)1);
  2427. }
  2428. for (icu = 1; icu <= 2; ++icu) {
  2429. *(unsigned char *)uplo = *(unsigned char *)&ichu[icu - 1];
  2430. upper = *(unsigned char *)uplo == 'U';
  2431. i__3 = *nalf;
  2432. for (ia = 1; ia <= i__3; ++ia) {
  2433. i__4 = ia;
  2434. alpha.r = alf[i__4].r, alpha.i = alf[i__4].i;
  2435. i__4 = *nbet;
  2436. for (ib = 1; ib <= i__4; ++ib) {
  2437. i__5 = ib;
  2438. beta.r = bet[i__5].r, beta.i = bet[i__5].i;
  2439. if (isconj) {
  2440. rbeta = beta.r;
  2441. z__1.r = rbeta, z__1.i = 0.;
  2442. beta.r = z__1.r, beta.i = z__1.i;
  2443. }
  2444. null = n <= 0;
  2445. if (isconj) {
  2446. null = null ||( (k <= 0 || (alpha.r == 0. &&
  2447. alpha.i == 0.)) && rbeta == 1.);
  2448. }
  2449. /* Generate the matrix C. */
  2450. zmake_(sname + 7, uplo, " ", &n, &n, &c__[
  2451. c_offset], nmax, &cc[1], &ldc, &reset, &
  2452. c_b1, (ftnlen)2, (ftnlen)1, (ftnlen)1);
  2453. ++nc;
  2454. /* Save every datum before calling the subroutine. */
  2455. *(unsigned char *)uplos = *(unsigned char *)uplo;
  2456. *(unsigned char *)transs = *(unsigned char *)
  2457. trans;
  2458. ns = n;
  2459. ks = k;
  2460. als.r = alpha.r, als.i = alpha.i;
  2461. i__5 = laa;
  2462. for (i__ = 1; i__ <= i__5; ++i__) {
  2463. i__6 = i__;
  2464. i__7 = i__;
  2465. as[i__6].r = aa[i__7].r, as[i__6].i = aa[i__7]
  2466. .i;
  2467. /* L10: */
  2468. }
  2469. ldas = lda;
  2470. i__5 = lbb;
  2471. for (i__ = 1; i__ <= i__5; ++i__) {
  2472. i__6 = i__;
  2473. i__7 = i__;
  2474. bs[i__6].r = bb[i__7].r, bs[i__6].i = bb[i__7]
  2475. .i;
  2476. /* L20: */
  2477. }
  2478. ldbs = ldb;
  2479. if (isconj) {
  2480. rbets = rbeta;
  2481. } else {
  2482. bets.r = beta.r, bets.i = beta.i;
  2483. }
  2484. i__5 = lcc;
  2485. for (i__ = 1; i__ <= i__5; ++i__) {
  2486. i__6 = i__;
  2487. i__7 = i__;
  2488. cs[i__6].r = cc[i__7].r, cs[i__6].i = cc[i__7]
  2489. .i;
  2490. /* L30: */
  2491. }
  2492. ldcs = ldc;
  2493. /* Call the subroutine. */
  2494. if (isconj) {
  2495. if (*trace) {
  2496. zprcn7_(ntra, &nc, sname, iorder, uplo,
  2497. trans, &n, &k, &alpha, &lda, &ldb,
  2498. &rbeta, &ldc, (ftnlen)12, (
  2499. ftnlen)1, (ftnlen)1);
  2500. }
  2501. if (*rewi) {
  2502. /* al__1.aerr = 0;
  2503. al__1.aunit = *ntra;
  2504. f_rew(&al__1);*/
  2505. }
  2506. czher2k_(iorder, uplo, trans, &n, &k, &alpha,
  2507. &aa[1], &lda, &bb[1], &ldb, &rbeta, &
  2508. cc[1], &ldc, (ftnlen)1, (ftnlen)1);
  2509. } else {
  2510. if (*trace) {
  2511. zprcn5_(ntra, &nc, sname, iorder, uplo,
  2512. trans, &n, &k, &alpha, &lda, &ldb,
  2513. &beta, &ldc, (ftnlen)12, (ftnlen)
  2514. 1, (ftnlen)1);
  2515. }
  2516. if (*rewi) {
  2517. /* al__1.aerr = 0;
  2518. al__1.aunit = *ntra;
  2519. f_rew(&al__1);*/
  2520. }
  2521. czsyr2k_(iorder, uplo, trans, &n, &k, &alpha,
  2522. &aa[1], &lda, &bb[1], &ldb, &beta, &
  2523. cc[1], &ldc, (ftnlen)1, (ftnlen)1);
  2524. }
  2525. /* Check if error-exit was taken incorrectly. */
  2526. if (! infoc_1.ok) {
  2527. printf("*** FATAL ERROR - ERROR-CALL MYEXIT TAKEN ON VALID CALL\n");
  2528. *fatal = TRUE_;
  2529. goto L150;
  2530. }
  2531. /* See what data changed inside subroutines. */
  2532. isame[0] = *(unsigned char *)uplos == *(unsigned
  2533. char *)uplo;
  2534. isame[1] = *(unsigned char *)transs == *(unsigned
  2535. char *)trans;
  2536. isame[2] = ns == n;
  2537. isame[3] = ks == k;
  2538. isame[4] = als.r == alpha.r && als.i == alpha.i;
  2539. isame[5] = lze_(&as[1], &aa[1], &laa);
  2540. isame[6] = ldas == lda;
  2541. isame[7] = lze_(&bs[1], &bb[1], &lbb);
  2542. isame[8] = ldbs == ldb;
  2543. if (isconj) {
  2544. isame[9] = rbets == rbeta;
  2545. } else {
  2546. isame[9] = bets.r == beta.r && bets.i ==
  2547. beta.i;
  2548. }
  2549. if (null) {
  2550. isame[10] = lze_(&cs[1], &cc[1], &lcc);
  2551. } else {
  2552. isame[10] = lzeres_("he", uplo, &n, &n, &cs[1]
  2553. , &cc[1], &ldc, (ftnlen)2, (ftnlen)1);
  2554. }
  2555. isame[11] = ldcs == ldc;
  2556. /* If data was incorrectly changed, report and */
  2557. /* return. */
  2558. same = TRUE_;
  2559. i__5 = nargs;
  2560. for (i__ = 1; i__ <= i__5; ++i__) {
  2561. same = same && isame[i__ - 1];
  2562. if (! isame[i__ - 1]) {
  2563. printf(" ******* FATAL ERROR - PARAMETER NUMBER %d WAS CHANGED INCORRECTLY *******\n",i__);
  2564. }
  2565. /* L40: */
  2566. }
  2567. if (! same) {
  2568. *fatal = TRUE_;
  2569. goto L150;
  2570. }
  2571. if (! null) {
  2572. /* Check the result column by column. */
  2573. if (isconj) {
  2574. *(unsigned char *)transt = 'C';
  2575. } else {
  2576. *(unsigned char *)transt = 'T';
  2577. }
  2578. jjab = 1;
  2579. jc = 1;
  2580. i__5 = n;
  2581. for (j = 1; j <= i__5; ++j) {
  2582. if (upper) {
  2583. jj = 1;
  2584. lj = j;
  2585. } else {
  2586. jj = j;
  2587. lj = n - j + 1;
  2588. }
  2589. if (tran) {
  2590. i__6 = k;
  2591. for (i__ = 1; i__ <= i__6; ++i__) {
  2592. i__7 = i__;
  2593. i__8 = ((j - 1) << 1) * *nmax + k +
  2594. i__;
  2595. z__1.r = alpha.r * ab[i__8].r -
  2596. alpha.i * ab[i__8].i,
  2597. z__1.i = alpha.r * ab[
  2598. i__8].i + alpha.i * ab[
  2599. i__8].r;
  2600. w[i__7].r = z__1.r, w[i__7].i =
  2601. z__1.i;
  2602. if (isconj) {
  2603. i__7 = k + i__;
  2604. d_cnjg(&z__2, &alpha);
  2605. i__8 = ((j - 1) << 1) * *nmax + i__;
  2606. z__1.r = z__2.r * ab[i__8].r - z__2.i * ab[i__8].i,
  2607. z__1.i = z__2.r * ab[i__8].i + z__2.i * ab[
  2608. i__8].r;
  2609. w[i__7].r = z__1.r, w[i__7].i = z__1.i;
  2610. } else {
  2611. i__7 = k + i__;
  2612. i__8 = ((j - 1) << 1) * *nmax + i__;
  2613. z__1.r = alpha.r * ab[i__8].r - alpha.i * ab[i__8]
  2614. .i, z__1.i = alpha.r * ab[i__8].i + alpha.i
  2615. * ab[i__8].r;
  2616. w[i__7].r = z__1.r, w[i__7].i = z__1.i;
  2617. }
  2618. /* L50: */
  2619. }
  2620. i__6 = k << 1;
  2621. i__7 = *nmax << 1;
  2622. i__8 = *nmax << 1;
  2623. zmmch_(transt, "N", &lj, &c__1, &i__6,
  2624. &c_b2, &ab[jjab], &i__7, &w[
  2625. 1], &i__8, &beta, &c__[jj + j
  2626. * c_dim1], nmax, &ct[1], &g[1]
  2627. , &cc[jc], &ldc, eps, &err,
  2628. fatal, nout, &c_true, (ftnlen)
  2629. 1, (ftnlen)1);
  2630. } else {
  2631. i__6 = k;
  2632. for (i__ = 1; i__ <= i__6; ++i__) {
  2633. if (isconj) {
  2634. i__7 = i__;
  2635. d_cnjg(&z__2, &ab[(k + i__ - 1) * *nmax + j]);
  2636. z__1.r = alpha.r * z__2.r - alpha.i * z__2.i,
  2637. z__1.i = alpha.r * z__2.i + alpha.i *
  2638. z__2.r;
  2639. w[i__7].r = z__1.r, w[i__7].i = z__1.i;
  2640. i__7 = k + i__;
  2641. i__8 = (i__ - 1) * *nmax + j;
  2642. z__2.r = alpha.r * ab[i__8].r - alpha.i * ab[i__8]
  2643. .i, z__2.i = alpha.r * ab[i__8].i + alpha.i
  2644. * ab[i__8].r;
  2645. d_cnjg(&z__1, &z__2);
  2646. w[i__7].r = z__1.r, w[i__7].i = z__1.i;
  2647. } else {
  2648. i__7 = i__;
  2649. i__8 = (k + i__ - 1) * *nmax + j;
  2650. z__1.r = alpha.r * ab[i__8].r - alpha.i * ab[i__8]
  2651. .i, z__1.i = alpha.r * ab[i__8].i + alpha.i
  2652. * ab[i__8].r;
  2653. w[i__7].r = z__1.r, w[i__7].i = z__1.i;
  2654. i__7 = k + i__;
  2655. i__8 = (i__ - 1) * *nmax + j;
  2656. z__1.r = alpha.r * ab[i__8].r - alpha.i * ab[i__8]
  2657. .i, z__1.i = alpha.r * ab[i__8].i + alpha.i
  2658. * ab[i__8].r;
  2659. w[i__7].r = z__1.r, w[i__7].i = z__1.i;
  2660. }
  2661. /* L60: */
  2662. }
  2663. i__6 = k << 1;
  2664. i__7 = *nmax << 1;
  2665. zmmch_("N", "N", &lj, &c__1, &i__6, &
  2666. c_b2, &ab[jj], nmax, &w[1], &
  2667. i__7, &beta, &c__[jj + j *
  2668. c_dim1], nmax, &ct[1], &g[1],
  2669. &cc[jc], &ldc, eps, &err,
  2670. fatal, nout, &c_true, (ftnlen)
  2671. 1, (ftnlen)1);
  2672. }
  2673. if (upper) {
  2674. jc += ldc;
  2675. } else {
  2676. jc = jc + ldc + 1;
  2677. if (tran) {
  2678. jjab += *nmax << 1;
  2679. }
  2680. }
  2681. errmax = f2cmax(errmax,err);
  2682. /* If got really bad answer, report and */
  2683. /* return. */
  2684. if (*fatal) {
  2685. goto L140;
  2686. }
  2687. /* L70: */
  2688. }
  2689. }
  2690. /* L80: */
  2691. }
  2692. /* L90: */
  2693. }
  2694. /* L100: */
  2695. }
  2696. L110:
  2697. ;
  2698. }
  2699. /* L120: */
  2700. }
  2701. L130:
  2702. ;
  2703. }
  2704. /* Report result. */
  2705. if (errmax < *thresh) {
  2706. if (*iorder == 0) {
  2707. printf("%s PASSED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  2708. }
  2709. if (*iorder == 1) {
  2710. printf("%s PASSED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)\n",sname,nc);
  2711. }
  2712. } else {
  2713. if (*iorder == 0) {
  2714. printf("%s COMPLETED THE COLUMN-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  2715. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  2716. }
  2717. if (*iorder == 1) {
  2718. printf("%s COMPLETED THE ROW-MAJOR COMPUTATIONAL TESTS (%d CALLS)/n",sname,nc);
  2719. printf("***** BUT WITH MAXIMUM TEST RATIO %8.2f - SUSPECT *******/n",errmax);
  2720. }
  2721. }
  2722. goto L160;
  2723. L140:
  2724. if (n > 1) {
  2725. printf(" THESE ARE THE RESULTS FOR COLUMN %d:\n",j);
  2726. }
  2727. L150:
  2728. printf(" ******* %s FAILED ON CALL NUMBER:\n",sname);
  2729. if (isconj) {
  2730. zprcn7_(nout, &nc, sname, iorder, uplo, trans, &n, &k, &alpha, &lda, &
  2731. ldb, &rbeta, &ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1);
  2732. } else {
  2733. zprcn5_(nout, &nc, sname, iorder, uplo, trans, &n, &k, &alpha, &lda, &
  2734. ldb, &beta, &ldc, (ftnlen)12, (ftnlen)1, (ftnlen)1);
  2735. }
  2736. L160:
  2737. return 0;
  2738. /* 9994 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ), */
  2739. /* $ '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',', F4.1, */
  2740. /* $ ', C,', I3, ') .' ) */
  2741. /* 9993 FORMAT(1X, I6, ': ', A12,'(', 2( '''', A1, ''',' ), 2( I3, ',' ), */
  2742. /* $ '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1, */
  2743. /* $ ',', F4.1, '), C,', I3, ') .' ) */
  2744. /* End of ZCHK5. */
  2745. } /* zchk5_ */
  2746. /* Subroutine */ int zprcn5_(integer* nout, integer* nc, char* sname, integer* iorder, char* uplo, char* transa, integer* n, integer* k, doublecomplex* alpha, integer* lda, integer* ldb, doublecomplex* beta, integer* ldc, ftnlen sname_len, ftnlen uplo_len, ftnlen transa_len)
  2747. {
  2748. /* Local variables */
  2749. static char ca[14], cu[14], crc[14];
  2750. if (*(unsigned char *)uplo == 'U') {
  2751. s_copy(cu, " CblasUpper", (ftnlen)14, (ftnlen)14);
  2752. } else {
  2753. s_copy(cu, " CblasLower", (ftnlen)14, (ftnlen)14);
  2754. }
  2755. if (*(unsigned char *)transa == 'N') {
  2756. s_copy(ca, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  2757. } else if (*(unsigned char *)transa == 'T') {
  2758. s_copy(ca, " CblasTrans", (ftnlen)14, (ftnlen)14);
  2759. } else {
  2760. s_copy(ca, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  2761. }
  2762. if (*iorder == 1) {
  2763. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  2764. } else {
  2765. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  2766. }
  2767. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cu,ca);
  2768. printf("%d %d (%4.1lf,%4.1lf) , A, %d, B, %d, (%4.1lf,%4.1lf) , C, %d.\n",*n,*k,alpha->r,alpha->i,*lda,*ldb,beta->r,beta->i,*ldc);
  2769. return 0;
  2770. } /* zprcn5_ */
  2771. /* Subroutine */ int zprcn7_(integer* nout, integer* nc, char* sname, integer* iorder, char* uplo, char* transa, integer* n, integer* k, doublecomplex* alpha, integer* lda, integer* ldb, doublereal* beta, integer* ldc, ftnlen sname_len, ftnlen uplo_len, ftnlen transa_len)
  2772. {
  2773. /* Local variables */
  2774. static char ca[14], cu[14], crc[14];
  2775. if (*(unsigned char *)uplo == 'U') {
  2776. s_copy(cu, " CblasUpper", (ftnlen)14, (ftnlen)14);
  2777. } else {
  2778. s_copy(cu, " CblasLower", (ftnlen)14, (ftnlen)14);
  2779. }
  2780. if (*(unsigned char *)transa == 'N') {
  2781. s_copy(ca, " CblasNoTrans", (ftnlen)14, (ftnlen)14);
  2782. } else if (*(unsigned char *)transa == 'T') {
  2783. s_copy(ca, " CblasTrans", (ftnlen)14, (ftnlen)14);
  2784. } else {
  2785. s_copy(ca, "CblasConjTrans", (ftnlen)14, (ftnlen)14);
  2786. }
  2787. if (*iorder == 1) {
  2788. s_copy(crc, " CblasRowMajor", (ftnlen)14, (ftnlen)14);
  2789. } else {
  2790. s_copy(crc, " CblasColMajor", (ftnlen)14, (ftnlen)14);
  2791. }
  2792. printf("%6d: %s %s %s %s\n",*nc,sname,crc,cu,ca);
  2793. printf("%d %d (%4.1lf,%4.1lf), A, %d, B, %d, %4.1lf, C, %d.\n",*n,*k,alpha->r,alpha->i,*lda,*ldb,*beta,*ldc);
  2794. return 0;
  2795. } /* zprcn7_ */
  2796. /* Subroutine */ int zmake_(char* type__, char* uplo, char* diag, integer* m, integer* n, doublecomplex* a, integer* nmax, doublecomplex* aa, integer* lda, logical* reset, doublecomplex* transl, ftnlen type_len, ftnlen uplo_len, ftnlen diag_len)
  2797. {
  2798. /* System generated locals */
  2799. integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
  2800. doublereal d__1;
  2801. doublecomplex z__1, z__2;
  2802. /* Local variables */
  2803. static integer ibeg, iend;
  2804. extern /* Double Complex */ VOID zbeg_(doublecomplex*, logical*);
  2805. static logical unit;
  2806. static integer i__, j;
  2807. static logical lower, upper;
  2808. static integer jj;
  2809. static logical gen, her, tri, sym;
  2810. /* Generates values for an M by N matrix A. */
  2811. /* Stores the values in the array AA in the data structure required */
  2812. /* by the routine, with unwanted elements set to rogue value. */
  2813. /* TYPE is 'ge', 'he', 'sy' or 'tr'. */
  2814. /* Auxiliary routine for test program for Level 3 Blas. */
  2815. /* -- Written on 8-February-1989. */
  2816. /* Jack Dongarra, Argonne National Laboratory. */
  2817. /* Iain Duff, AERE Harwell. */
  2818. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  2819. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  2820. /* .. Parameters .. */
  2821. /* .. Scalar Arguments .. */
  2822. /* .. Array Arguments .. */
  2823. /* .. Local Scalars .. */
  2824. /* .. External Functions .. */
  2825. /* .. Intrinsic Functions .. */
  2826. /* .. Executable Statements .. */
  2827. /* Parameter adjustments */
  2828. a_dim1 = *nmax;
  2829. a_offset = 1 + a_dim1 * 1;
  2830. a -= a_offset;
  2831. --aa;
  2832. /* Function Body */
  2833. gen = s_cmp(type__, "ge", (ftnlen)2, (ftnlen)2) == 0;
  2834. her = s_cmp(type__, "he", (ftnlen)2, (ftnlen)2) == 0;
  2835. sym = s_cmp(type__, "sy", (ftnlen)2, (ftnlen)2) == 0;
  2836. tri = s_cmp(type__, "tr", (ftnlen)2, (ftnlen)2) == 0;
  2837. upper = (her || sym || tri) && *(unsigned char *)uplo == 'U';
  2838. lower = (her || sym || tri) && *(unsigned char *)uplo == 'L';
  2839. unit = tri && *(unsigned char *)diag == 'U';
  2840. /* Generate data in array A. */
  2841. i__1 = *n;
  2842. for (j = 1; j <= i__1; ++j) {
  2843. i__2 = *m;
  2844. for (i__ = 1; i__ <= i__2; ++i__) {
  2845. if (gen || (upper && i__ <= j) || (lower && i__ >= j)) {
  2846. i__3 = i__ + j * a_dim1;
  2847. zbeg_(&z__2, reset);
  2848. z__1.r = z__2.r + transl->r, z__1.i = z__2.i + transl->i;
  2849. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  2850. if (i__ != j) {
  2851. /* Set some elements to zero */
  2852. if (*n > 3 && j == *n / 2) {
  2853. i__3 = i__ + j * a_dim1;
  2854. a[i__3].r = 0., a[i__3].i = 0.;
  2855. }
  2856. if (her) {
  2857. i__3 = j + i__ * a_dim1;
  2858. d_cnjg(&z__1, &a[i__ + j * a_dim1]);
  2859. a[i__3].r = z__1.r, a[i__3].i = z__1.i;
  2860. } else if (sym) {
  2861. i__3 = j + i__ * a_dim1;
  2862. i__4 = i__ + j * a_dim1;
  2863. a[i__3].r = a[i__4].r, a[i__3].i = a[i__4].i;
  2864. } else if (tri) {
  2865. i__3 = j + i__ * a_dim1;
  2866. a[i__3].r = 0., a[i__3].i = 0.;
  2867. }
  2868. }
  2869. }
  2870. /* L10: */
  2871. }
  2872. if (her) {
  2873. i__2 = j + j * a_dim1;
  2874. i__3 = j + j * a_dim1;
  2875. d__1 = a[i__3].r;
  2876. z__1.r = d__1, z__1.i = 0.;
  2877. a[i__2].r = z__1.r, a[i__2].i = z__1.i;
  2878. }
  2879. if (tri) {
  2880. i__2 = j + j * a_dim1;
  2881. i__3 = j + j * a_dim1;
  2882. z__1.r = a[i__3].r + 1., z__1.i = a[i__3].i + 0.;
  2883. a[i__2].r = z__1.r, a[i__2].i = z__1.i;
  2884. }
  2885. if (unit) {
  2886. i__2 = j + j * a_dim1;
  2887. a[i__2].r = 1., a[i__2].i = 0.;
  2888. }
  2889. /* L20: */
  2890. }
  2891. /* Store elements in array AS in data structure required by routine. */
  2892. if (s_cmp(type__, "ge", (ftnlen)2, (ftnlen)2) == 0) {
  2893. i__1 = *n;
  2894. for (j = 1; j <= i__1; ++j) {
  2895. i__2 = *m;
  2896. for (i__ = 1; i__ <= i__2; ++i__) {
  2897. i__3 = i__ + (j - 1) * *lda;
  2898. i__4 = i__ + j * a_dim1;
  2899. aa[i__3].r = a[i__4].r, aa[i__3].i = a[i__4].i;
  2900. /* L30: */
  2901. }
  2902. i__2 = *lda;
  2903. for (i__ = *m + 1; i__ <= i__2; ++i__) {
  2904. i__3 = i__ + (j - 1) * *lda;
  2905. aa[i__3].r = -1e10, aa[i__3].i = 1e10;
  2906. /* L40: */
  2907. }
  2908. /* L50: */
  2909. }
  2910. } else if (s_cmp(type__, "he", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(type__,
  2911. "sy", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(type__, "tr", (ftnlen)
  2912. 2, (ftnlen)2) == 0) {
  2913. i__1 = *n;
  2914. for (j = 1; j <= i__1; ++j) {
  2915. if (upper) {
  2916. ibeg = 1;
  2917. if (unit) {
  2918. iend = j - 1;
  2919. } else {
  2920. iend = j;
  2921. }
  2922. } else {
  2923. if (unit) {
  2924. ibeg = j + 1;
  2925. } else {
  2926. ibeg = j;
  2927. }
  2928. iend = *n;
  2929. }
  2930. i__2 = ibeg - 1;
  2931. for (i__ = 1; i__ <= i__2; ++i__) {
  2932. i__3 = i__ + (j - 1) * *lda;
  2933. aa[i__3].r = -1e10, aa[i__3].i = 1e10;
  2934. /* L60: */
  2935. }
  2936. i__2 = iend;
  2937. for (i__ = ibeg; i__ <= i__2; ++i__) {
  2938. i__3 = i__ + (j - 1) * *lda;
  2939. i__4 = i__ + j * a_dim1;
  2940. aa[i__3].r = a[i__4].r, aa[i__3].i = a[i__4].i;
  2941. /* L70: */
  2942. }
  2943. i__2 = *lda;
  2944. for (i__ = iend + 1; i__ <= i__2; ++i__) {
  2945. i__3 = i__ + (j - 1) * *lda;
  2946. aa[i__3].r = -1e10, aa[i__3].i = 1e10;
  2947. /* L80: */
  2948. }
  2949. if (her) {
  2950. jj = j + (j - 1) * *lda;
  2951. i__2 = jj;
  2952. i__3 = jj;
  2953. d__1 = aa[i__3].r;
  2954. z__1.r = d__1, z__1.i = -1e10;
  2955. aa[i__2].r = z__1.r, aa[i__2].i = z__1.i;
  2956. }
  2957. /* L90: */
  2958. }
  2959. }
  2960. return 0;
  2961. /* End of ZMAKE. */
  2962. } /* zmake_ */
  2963. /* Subroutine */ int zmmch_(char* transa, char* transb, integer* m, integer* n, integer* kk, doublecomplex* alpha, doublecomplex* a, integer* lda, doublecomplex* b, integer* ldb, doublecomplex* beta, doublecomplex* c__, integer* ldc, doublecomplex* ct, doublereal* g, doublecomplex* cc, integer* ldcc, doublereal* eps, doublereal* err, logical* fatal, integer* nout, logical* mv, ftnlen transa_len, ftnlen transb_len)
  2964. {
  2965. /* System generated locals */
  2966. integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, cc_dim1,
  2967. cc_offset, i__1, i__2, i__3, i__4, i__5, i__6, i__7;
  2968. doublereal d__1, d__2, d__3, d__4, d__5, d__6;
  2969. doublecomplex z__1, z__2, z__3, z__4;
  2970. double sqrt(double);
  2971. /* Local variables */
  2972. static doublereal erri;
  2973. static integer i__, j, k;
  2974. static logical trana, tranb, ctrana, ctranb;
  2975. /* Checks the results of the computational tests. */
  2976. /* Auxiliary routine for test program for Level 3 Blas. */
  2977. /* -- Written on 8-February-1989. */
  2978. /* Jack Dongarra, Argonne National Laboratory. */
  2979. /* Iain Duff, AERE Harwell. */
  2980. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  2981. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  2982. /* .. Parameters .. */
  2983. /* .. Scalar Arguments .. */
  2984. /* .. Array Arguments .. */
  2985. /* .. Local Scalars .. */
  2986. /* .. Intrinsic Functions .. */
  2987. /* .. Statement Functions .. */
  2988. /* .. Statement Function definitions .. */
  2989. /* .. Executable Statements .. */
  2990. /* Parameter adjustments */
  2991. a_dim1 = *lda;
  2992. a_offset = 1 + a_dim1 * 1;
  2993. a -= a_offset;
  2994. b_dim1 = *ldb;
  2995. b_offset = 1 + b_dim1 * 1;
  2996. b -= b_offset;
  2997. c_dim1 = *ldc;
  2998. c_offset = 1 + c_dim1 * 1;
  2999. c__ -= c_offset;
  3000. --ct;
  3001. --g;
  3002. cc_dim1 = *ldcc;
  3003. cc_offset = 1 + cc_dim1 * 1;
  3004. cc -= cc_offset;
  3005. /* Function Body */
  3006. trana = *(unsigned char *)transa == 'T' || *(unsigned char *)transa ==
  3007. 'C';
  3008. tranb = *(unsigned char *)transb == 'T' || *(unsigned char *)transb ==
  3009. 'C';
  3010. ctrana = *(unsigned char *)transa == 'C';
  3011. ctranb = *(unsigned char *)transb == 'C';
  3012. /* Compute expected result, one column at a time, in CT using data */
  3013. /* in A, B and C. */
  3014. /* Compute gauges in G. */
  3015. i__1 = *n;
  3016. for (j = 1; j <= i__1; ++j) {
  3017. i__2 = *m;
  3018. for (i__ = 1; i__ <= i__2; ++i__) {
  3019. i__3 = i__;
  3020. ct[i__3].r = 0., ct[i__3].i = 0.;
  3021. g[i__] = 0.;
  3022. /* L10: */
  3023. }
  3024. if (! trana && ! tranb) {
  3025. i__2 = *kk;
  3026. for (k = 1; k <= i__2; ++k) {
  3027. i__3 = *m;
  3028. for (i__ = 1; i__ <= i__3; ++i__) {
  3029. i__4 = i__;
  3030. i__5 = i__;
  3031. i__6 = i__ + k * a_dim1;
  3032. i__7 = k + j * b_dim1;
  3033. z__2.r = a[i__6].r * b[i__7].r - a[i__6].i * b[i__7].i,
  3034. z__2.i = a[i__6].r * b[i__7].i + a[i__6].i * b[
  3035. i__7].r;
  3036. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i +
  3037. z__2.i;
  3038. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3039. i__4 = i__ + k * a_dim1;
  3040. i__5 = k + j * b_dim1;
  3041. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 = d_imag(
  3042. &a[i__ + k * a_dim1]), abs(d__2))) * ((d__3 = b[
  3043. i__5].r, abs(d__3)) + (d__4 = d_imag(&b[k + j *
  3044. b_dim1]), abs(d__4)));
  3045. /* L20: */
  3046. }
  3047. /* L30: */
  3048. }
  3049. } else if (trana && ! tranb) {
  3050. if (ctrana) {
  3051. i__2 = *kk;
  3052. for (k = 1; k <= i__2; ++k) {
  3053. i__3 = *m;
  3054. for (i__ = 1; i__ <= i__3; ++i__) {
  3055. i__4 = i__;
  3056. i__5 = i__;
  3057. d_cnjg(&z__3, &a[k + i__ * a_dim1]);
  3058. i__6 = k + j * b_dim1;
  3059. z__2.r = z__3.r * b[i__6].r - z__3.i * b[i__6].i,
  3060. z__2.i = z__3.r * b[i__6].i + z__3.i * b[i__6]
  3061. .r;
  3062. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i +
  3063. z__2.i;
  3064. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3065. i__4 = k + i__ * a_dim1;
  3066. i__5 = k + j * b_dim1;
  3067. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3068. d_imag(&a[k + i__ * a_dim1]), abs(d__2))) * ((
  3069. d__3 = b[i__5].r, abs(d__3)) + (d__4 = d_imag(
  3070. &b[k + j * b_dim1]), abs(d__4)));
  3071. /* L40: */
  3072. }
  3073. /* L50: */
  3074. }
  3075. } else {
  3076. i__2 = *kk;
  3077. for (k = 1; k <= i__2; ++k) {
  3078. i__3 = *m;
  3079. for (i__ = 1; i__ <= i__3; ++i__) {
  3080. i__4 = i__;
  3081. i__5 = i__;
  3082. i__6 = k + i__ * a_dim1;
  3083. i__7 = k + j * b_dim1;
  3084. z__2.r = a[i__6].r * b[i__7].r - a[i__6].i * b[i__7]
  3085. .i, z__2.i = a[i__6].r * b[i__7].i + a[i__6]
  3086. .i * b[i__7].r;
  3087. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i +
  3088. z__2.i;
  3089. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3090. i__4 = k + i__ * a_dim1;
  3091. i__5 = k + j * b_dim1;
  3092. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3093. d_imag(&a[k + i__ * a_dim1]), abs(d__2))) * ((
  3094. d__3 = b[i__5].r, abs(d__3)) + (d__4 = d_imag(
  3095. &b[k + j * b_dim1]), abs(d__4)));
  3096. /* L60: */
  3097. }
  3098. /* L70: */
  3099. }
  3100. }
  3101. } else if (! trana && tranb) {
  3102. if (ctranb) {
  3103. i__2 = *kk;
  3104. for (k = 1; k <= i__2; ++k) {
  3105. i__3 = *m;
  3106. for (i__ = 1; i__ <= i__3; ++i__) {
  3107. i__4 = i__;
  3108. i__5 = i__;
  3109. i__6 = i__ + k * a_dim1;
  3110. d_cnjg(&z__3, &b[j + k * b_dim1]);
  3111. z__2.r = a[i__6].r * z__3.r - a[i__6].i * z__3.i,
  3112. z__2.i = a[i__6].r * z__3.i + a[i__6].i *
  3113. z__3.r;
  3114. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i +
  3115. z__2.i;
  3116. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3117. i__4 = i__ + k * a_dim1;
  3118. i__5 = j + k * b_dim1;
  3119. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3120. d_imag(&a[i__ + k * a_dim1]), abs(d__2))) * ((
  3121. d__3 = b[i__5].r, abs(d__3)) + (d__4 = d_imag(
  3122. &b[j + k * b_dim1]), abs(d__4)));
  3123. /* L80: */
  3124. }
  3125. /* L90: */
  3126. }
  3127. } else {
  3128. i__2 = *kk;
  3129. for (k = 1; k <= i__2; ++k) {
  3130. i__3 = *m;
  3131. for (i__ = 1; i__ <= i__3; ++i__) {
  3132. i__4 = i__;
  3133. i__5 = i__;
  3134. i__6 = i__ + k * a_dim1;
  3135. i__7 = j + k * b_dim1;
  3136. z__2.r = a[i__6].r * b[i__7].r - a[i__6].i * b[i__7]
  3137. .i, z__2.i = a[i__6].r * b[i__7].i + a[i__6]
  3138. .i * b[i__7].r;
  3139. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i +
  3140. z__2.i;
  3141. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3142. i__4 = i__ + k * a_dim1;
  3143. i__5 = j + k * b_dim1;
  3144. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3145. d_imag(&a[i__ + k * a_dim1]), abs(d__2))) * ((
  3146. d__3 = b[i__5].r, abs(d__3)) + (d__4 = d_imag(
  3147. &b[j + k * b_dim1]), abs(d__4)));
  3148. /* L100: */
  3149. }
  3150. /* L110: */
  3151. }
  3152. }
  3153. } else if (trana && tranb) {
  3154. if (ctrana) {
  3155. if (ctranb) {
  3156. i__2 = *kk;
  3157. for (k = 1; k <= i__2; ++k) {
  3158. i__3 = *m;
  3159. for (i__ = 1; i__ <= i__3; ++i__) {
  3160. i__4 = i__;
  3161. i__5 = i__;
  3162. d_cnjg(&z__3, &a[k + i__ * a_dim1]);
  3163. d_cnjg(&z__4, &b[j + k * b_dim1]);
  3164. z__2.r = z__3.r * z__4.r - z__3.i * z__4.i,
  3165. z__2.i = z__3.r * z__4.i + z__3.i *
  3166. z__4.r;
  3167. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i
  3168. + z__2.i;
  3169. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3170. i__4 = k + i__ * a_dim1;
  3171. i__5 = j + k * b_dim1;
  3172. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3173. d_imag(&a[k + i__ * a_dim1]), abs(d__2)))
  3174. * ((d__3 = b[i__5].r, abs(d__3)) + (d__4
  3175. = d_imag(&b[j + k * b_dim1]), abs(d__4)));
  3176. /* L120: */
  3177. }
  3178. /* L130: */
  3179. }
  3180. } else {
  3181. i__2 = *kk;
  3182. for (k = 1; k <= i__2; ++k) {
  3183. i__3 = *m;
  3184. for (i__ = 1; i__ <= i__3; ++i__) {
  3185. i__4 = i__;
  3186. i__5 = i__;
  3187. d_cnjg(&z__3, &a[k + i__ * a_dim1]);
  3188. i__6 = j + k * b_dim1;
  3189. z__2.r = z__3.r * b[i__6].r - z__3.i * b[i__6].i,
  3190. z__2.i = z__3.r * b[i__6].i + z__3.i * b[
  3191. i__6].r;
  3192. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i
  3193. + z__2.i;
  3194. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3195. i__4 = k + i__ * a_dim1;
  3196. i__5 = j + k * b_dim1;
  3197. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3198. d_imag(&a[k + i__ * a_dim1]), abs(d__2)))
  3199. * ((d__3 = b[i__5].r, abs(d__3)) + (d__4
  3200. = d_imag(&b[j + k * b_dim1]), abs(d__4)));
  3201. /* L140: */
  3202. }
  3203. /* L150: */
  3204. }
  3205. }
  3206. } else {
  3207. if (ctranb) {
  3208. i__2 = *kk;
  3209. for (k = 1; k <= i__2; ++k) {
  3210. i__3 = *m;
  3211. for (i__ = 1; i__ <= i__3; ++i__) {
  3212. i__4 = i__;
  3213. i__5 = i__;
  3214. i__6 = k + i__ * a_dim1;
  3215. d_cnjg(&z__3, &b[j + k * b_dim1]);
  3216. z__2.r = a[i__6].r * z__3.r - a[i__6].i * z__3.i,
  3217. z__2.i = a[i__6].r * z__3.i + a[i__6].i *
  3218. z__3.r;
  3219. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i
  3220. + z__2.i;
  3221. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3222. i__4 = k + i__ * a_dim1;
  3223. i__5 = j + k * b_dim1;
  3224. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3225. d_imag(&a[k + i__ * a_dim1]), abs(d__2)))
  3226. * ((d__3 = b[i__5].r, abs(d__3)) + (d__4
  3227. = d_imag(&b[j + k * b_dim1]), abs(d__4)));
  3228. /* L160: */
  3229. }
  3230. /* L170: */
  3231. }
  3232. } else {
  3233. i__2 = *kk;
  3234. for (k = 1; k <= i__2; ++k) {
  3235. i__3 = *m;
  3236. for (i__ = 1; i__ <= i__3; ++i__) {
  3237. i__4 = i__;
  3238. i__5 = i__;
  3239. i__6 = k + i__ * a_dim1;
  3240. i__7 = j + k * b_dim1;
  3241. z__2.r = a[i__6].r * b[i__7].r - a[i__6].i * b[
  3242. i__7].i, z__2.i = a[i__6].r * b[i__7].i +
  3243. a[i__6].i * b[i__7].r;
  3244. z__1.r = ct[i__5].r + z__2.r, z__1.i = ct[i__5].i
  3245. + z__2.i;
  3246. ct[i__4].r = z__1.r, ct[i__4].i = z__1.i;
  3247. i__4 = k + i__ * a_dim1;
  3248. i__5 = j + k * b_dim1;
  3249. g[i__] += ((d__1 = a[i__4].r, abs(d__1)) + (d__2 =
  3250. d_imag(&a[k + i__ * a_dim1]), abs(d__2)))
  3251. * ((d__3 = b[i__5].r, abs(d__3)) + (d__4
  3252. = d_imag(&b[j + k * b_dim1]), abs(d__4)));
  3253. /* L180: */
  3254. }
  3255. /* L190: */
  3256. }
  3257. }
  3258. }
  3259. }
  3260. i__2 = *m;
  3261. for (i__ = 1; i__ <= i__2; ++i__) {
  3262. i__3 = i__;
  3263. i__4 = i__;
  3264. z__2.r = alpha->r * ct[i__4].r - alpha->i * ct[i__4].i, z__2.i =
  3265. alpha->r * ct[i__4].i + alpha->i * ct[i__4].r;
  3266. i__5 = i__ + j * c_dim1;
  3267. z__3.r = beta->r * c__[i__5].r - beta->i * c__[i__5].i, z__3.i =
  3268. beta->r * c__[i__5].i + beta->i * c__[i__5].r;
  3269. z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
  3270. ct[i__3].r = z__1.r, ct[i__3].i = z__1.i;
  3271. i__3 = i__ + j * c_dim1;
  3272. g[i__] = ((d__1 = alpha->r, abs(d__1)) + (d__2 = d_imag(alpha),
  3273. abs(d__2))) * g[i__] + ((d__3 = beta->r, abs(d__3)) + (
  3274. d__4 = d_imag(beta), abs(d__4))) * ((d__5 = c__[i__3].r,
  3275. abs(d__5)) + (d__6 = d_imag(&c__[i__ + j * c_dim1]), abs(
  3276. d__6)));
  3277. /* L200: */
  3278. }
  3279. /* Compute the error ratio for this result. */
  3280. *err = 0.;
  3281. i__2 = *m;
  3282. for (i__ = 1; i__ <= i__2; ++i__) {
  3283. i__3 = i__;
  3284. i__4 = i__ + j * cc_dim1;
  3285. z__2.r = ct[i__3].r - cc[i__4].r, z__2.i = ct[i__3].i - cc[i__4]
  3286. .i;
  3287. z__1.r = z__2.r, z__1.i = z__2.i;
  3288. erri = ((d__1 = z__1.r, abs(d__1)) + (d__2 = d_imag(&z__1), abs(
  3289. d__2))) / *eps;
  3290. if (g[i__] != 0.) {
  3291. erri /= g[i__];
  3292. }
  3293. *err = f2cmax(*err,erri);
  3294. if (*err * sqrt(*eps) >= 1.) {
  3295. goto L230;
  3296. }
  3297. /* L210: */
  3298. }
  3299. /* L220: */
  3300. }
  3301. /* If the loop completes, all results are at least half accurate. */
  3302. goto L250;
  3303. /* Report fatal error. */
  3304. L230:
  3305. *fatal = TRUE_;
  3306. printf(" ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HALF ACCURATE *******\n");
  3307. printf(" EXPECTED RESULT COMPUTED RESULT\n");
  3308. i__1 = *m;
  3309. for (i__ = 1; i__ <= i__1; ++i__) {
  3310. if (*mv) {
  3311. printf("%7d (%15.6g,%15.6g) (%15.6g,%15.6g)\n",i__,ct[i__].r,ct[i__].i,cc[i__+j*cc_dim1].r,cc[i__+j*cc_dim1].i);
  3312. } else {
  3313. printf("%7d (%15.6g,%15.6g) (%15.6g,%15.6g)\n",i__,cc[i__+j*cc_dim1].r,cc[i__+j*cc_dim1].i,ct[i__].r,ct[i__].i);
  3314. }
  3315. /* L240: */
  3316. }
  3317. if (*n > 1) {
  3318. printf(" THESE ARE THE RESULTS FOR COLUMN %d\n",j);
  3319. }
  3320. L250:
  3321. return 0;
  3322. /* End of ZMMCH. */
  3323. } /* zmmch_ */
  3324. logical lze_(doublecomplex* ri, doublecomplex* rj, integer* lr)
  3325. {
  3326. /* System generated locals */
  3327. integer i__1, i__2, i__3;
  3328. logical ret_val;
  3329. /* Local variables */
  3330. static integer i__;
  3331. /* Tests if two arrays are identical. */
  3332. /* Auxiliary routine for test program for Level 3 Blas. */
  3333. /* -- Written on 8-February-1989. */
  3334. /* Jack Dongarra, Argonne National Laboratory. */
  3335. /* Iain Duff, AERE Harwell. */
  3336. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  3337. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  3338. /* .. Scalar Arguments .. */
  3339. /* .. Array Arguments .. */
  3340. /* .. Local Scalars .. */
  3341. /* .. Executable Statements .. */
  3342. /* Parameter adjustments */
  3343. --rj;
  3344. --ri;
  3345. /* Function Body */
  3346. i__1 = *lr;
  3347. for (i__ = 1; i__ <= i__1; ++i__) {
  3348. i__2 = i__;
  3349. i__3 = i__;
  3350. if (ri[i__2].r != rj[i__3].r || ri[i__2].i != rj[i__3].i) {
  3351. goto L20;
  3352. }
  3353. /* L10: */
  3354. }
  3355. ret_val = TRUE_;
  3356. goto L30;
  3357. L20:
  3358. ret_val = FALSE_;
  3359. L30:
  3360. return ret_val;
  3361. /* End of LZE. */
  3362. } /* lze_ */
  3363. logical lzeres_(char* type__, char* uplo, integer* m, integer* n, doublecomplex *aa, doublecomplex* as, integer* lda, ftnlen type_len, ftnlen uplo_len)
  3364. {
  3365. /* System generated locals */
  3366. integer aa_dim1, aa_offset, as_dim1, as_offset, i__1, i__2, i__3, i__4;
  3367. logical ret_val;
  3368. /* Local variables */
  3369. static integer ibeg, iend, i__, j;
  3370. static logical upper;
  3371. /* Tests if selected elements in two arrays are equal. */
  3372. /* TYPE is 'ge' or 'he' or 'sy'. */
  3373. /* Auxiliary routine for test program for Level 3 Blas. */
  3374. /* -- Written on 8-February-1989. */
  3375. /* Jack Dongarra, Argonne National Laboratory. */
  3376. /* Iain Duff, AERE Harwell. */
  3377. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  3378. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  3379. /* .. Scalar Arguments .. */
  3380. /* .. Array Arguments .. */
  3381. /* .. Local Scalars .. */
  3382. /* .. Executable Statements .. */
  3383. /* Parameter adjustments */
  3384. as_dim1 = *lda;
  3385. as_offset = 1 + as_dim1 * 1;
  3386. as -= as_offset;
  3387. aa_dim1 = *lda;
  3388. aa_offset = 1 + aa_dim1 * 1;
  3389. aa -= aa_offset;
  3390. /* Function Body */
  3391. upper = *(unsigned char *)uplo == 'U';
  3392. if (s_cmp(type__, "ge", (ftnlen)2, (ftnlen)2) == 0) {
  3393. i__1 = *n;
  3394. for (j = 1; j <= i__1; ++j) {
  3395. i__2 = *lda;
  3396. for (i__ = *m + 1; i__ <= i__2; ++i__) {
  3397. i__3 = i__ + j * aa_dim1;
  3398. i__4 = i__ + j * as_dim1;
  3399. if (aa[i__3].r != as[i__4].r || aa[i__3].i != as[i__4].i) {
  3400. goto L70;
  3401. }
  3402. /* L10: */
  3403. }
  3404. /* L20: */
  3405. }
  3406. } else if (s_cmp(type__, "he", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(type__,
  3407. "sy", (ftnlen)2, (ftnlen)2) == 0) {
  3408. i__1 = *n;
  3409. for (j = 1; j <= i__1; ++j) {
  3410. if (upper) {
  3411. ibeg = 1;
  3412. iend = j;
  3413. } else {
  3414. ibeg = j;
  3415. iend = *n;
  3416. }
  3417. i__2 = ibeg - 1;
  3418. for (i__ = 1; i__ <= i__2; ++i__) {
  3419. i__3 = i__ + j * aa_dim1;
  3420. i__4 = i__ + j * as_dim1;
  3421. if (aa[i__3].r != as[i__4].r || aa[i__3].i != as[i__4].i) {
  3422. goto L70;
  3423. }
  3424. /* L30: */
  3425. }
  3426. i__2 = *lda;
  3427. for (i__ = iend + 1; i__ <= i__2; ++i__) {
  3428. i__3 = i__ + j * aa_dim1;
  3429. i__4 = i__ + j * as_dim1;
  3430. if (aa[i__3].r != as[i__4].r || aa[i__3].i != as[i__4].i) {
  3431. goto L70;
  3432. }
  3433. /* L40: */
  3434. }
  3435. /* L50: */
  3436. }
  3437. }
  3438. /* 60 CONTINUE */
  3439. ret_val = TRUE_;
  3440. goto L80;
  3441. L70:
  3442. ret_val = FALSE_;
  3443. L80:
  3444. return ret_val;
  3445. /* End of LZERES. */
  3446. } /* lzeres_ */
  3447. /* Double Complex */ VOID zbeg_(doublecomplex* ret_val, logical* reset)
  3448. {
  3449. /* System generated locals */
  3450. doublereal d__1, d__2;
  3451. doublecomplex z__1;
  3452. /* Local variables */
  3453. static integer i__, j, ic, mi, mj;
  3454. /* Generates complex numbers as pairs of random numbers uniformly */
  3455. /* distributed between -0.5 and 0.5. */
  3456. /* Auxiliary routine for test program for Level 3 Blas. */
  3457. /* -- Written on 8-February-1989. */
  3458. /* Jack Dongarra, Argonne National Laboratory. */
  3459. /* Iain Duff, AERE Harwell. */
  3460. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  3461. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  3462. /* .. Scalar Arguments .. */
  3463. /* .. Local Scalars .. */
  3464. /* .. Save statement .. */
  3465. /* .. Intrinsic Functions .. */
  3466. /* .. Executable Statements .. */
  3467. if (*reset) {
  3468. /* Initialize local variables. */
  3469. mi = 891;
  3470. mj = 457;
  3471. i__ = 7;
  3472. j = 7;
  3473. ic = 0;
  3474. *reset = FALSE_;
  3475. }
  3476. /* The sequence of values of I or J is bounded between 1 and 999. */
  3477. /* If initial I or J = 1,2,3,6,7 or 9, the period will be 50. */
  3478. /* If initial I or J = 4 or 8, the period will be 25. */
  3479. /* If initial I or J = 5, the period will be 10. */
  3480. /* IC is used to break up the period by skipping 1 value of I or J */
  3481. /* in 6. */
  3482. ++ic;
  3483. L10:
  3484. i__ *= mi;
  3485. j *= mj;
  3486. i__ -= i__ / 1000 * 1000;
  3487. j -= j / 1000 * 1000;
  3488. if (ic >= 5) {
  3489. ic = 0;
  3490. goto L10;
  3491. }
  3492. d__1 = (i__ - 500) / 1001.;
  3493. d__2 = (j - 500) / 1001.;
  3494. z__1.r = d__1, z__1.i = d__2;
  3495. ret_val->r = z__1.r, ret_val->i = z__1.i;
  3496. return ;
  3497. /* End of ZBEG. */
  3498. } /* zbeg_ */
  3499. doublereal ddiff_(doublereal* x, doublereal* y)
  3500. {
  3501. /* System generated locals */
  3502. doublereal ret_val;
  3503. /* Auxiliary routine for test program for Level 3 Blas. */
  3504. /* -- Written on 8-February-1989. */
  3505. /* Jack Dongarra, Argonne National Laboratory. */
  3506. /* Iain Duff, AERE Harwell. */
  3507. /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
  3508. /* Sven Hammarling, Numerical Algorithms Group Ltd. */
  3509. /* .. Scalar Arguments .. */
  3510. /* .. Executable Statements .. */
  3511. ret_val = *x - *y;
  3512. return ret_val;
  3513. /* End of DDIFF. */
  3514. } /* ddiff_ */
  3515. /* Main program alias */ /*int zblat3_ () { MAIN__ (); }*/