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

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