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_dblat2c.c 105 kB

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