You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

c_cblat2c.c 117 kB

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