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_sblat2c.c 109 kB

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