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_cblat3c.c 114 kB

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