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_cblat3c.c 111 kB

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