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_dblat3c.c 96 kB

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