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_cblat2c.c 117 kB

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