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 113 kB

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