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_zblat2c.c 119 kB

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