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

c_cblat2c.c 113 kB

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