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_cblat1c.c 40 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019
  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. /* Common Block Declarations */
  224. struct {
  225. integer icase, n, incx, incy, mode;
  226. logical pass;
  227. } combla_;
  228. #define combla_1 combla_
  229. /* Table of constant values */
  230. static integer c__1 = 1;
  231. static integer c__5 = 5;
  232. static real c_b43 = (float)1.;
  233. /* Main program */ int main(void)
  234. {
  235. /* Initialized data */
  236. static real sfac = (float)9.765625e-4;
  237. /* Local variables */
  238. extern /* Subroutine */ int check1_(real*), check2_(real*);
  239. static integer ic;
  240. extern /* Subroutine */ int header_(void);
  241. /* Test program for the COMPLEX Level 1 CBLAS. */
  242. /* Based upon the original CBLAS test routine together with: */
  243. /* F06GAF Example Program Text */
  244. /* .. Parameters .. */
  245. /* .. Scalars in Common .. */
  246. /* .. Local Scalars .. */
  247. /* .. External Subroutines .. */
  248. /* .. Common blocks .. */
  249. /* .. Data statements .. */
  250. /* .. Executable Statements .. */
  251. printf("Complex CBLAS Test Program Results\n");
  252. for (ic = 1; ic <= 10; ++ic) {
  253. combla_1.icase = ic;
  254. header_();
  255. /* Initialize PASS, INCX, INCY, and MODE for a new case. */
  256. /* The value 9999 for INCX, INCY or MODE will appear in the */
  257. /* detailed output, if any, for cases that do not involve */
  258. /* these parameters. */
  259. combla_1.pass = TRUE_;
  260. combla_1.incx = 9999;
  261. combla_1.incy = 9999;
  262. combla_1.mode = 9999;
  263. if (combla_1.icase <= 5) {
  264. check2_(&sfac);
  265. } else if (combla_1.icase >= 6) {
  266. check1_(&sfac);
  267. }
  268. /* -- Print */
  269. if (combla_1.pass) {
  270. printf(" ----- PASS -----\n");
  271. }
  272. /* L20: */
  273. }
  274. exit(0);
  275. } /* MAIN__ */
  276. /* Subroutine */ int header_(void)
  277. {
  278. /* Initialized data */
  279. static char l[15][13] = {"CBLAS_CDOTC " , "CBLAS_CDOTU " , "CBLAS_CAXPY " ,
  280. "CBLAS_CCOPY " , "CBLAS_CSWAP " , "CBLAS_SCNRM2" , "CBLAS_SCASUM" , "CBLAS_CSCAL " ,
  281. "CBLAS_CSSCAL" , "CBLAS_ICAMAX" };
  282. /* Format strings */
  283. /* Builtin functions */
  284. integer s_wsfe(void), do_fio(void), e_wsfe(void);
  285. /* .. Parameters .. */
  286. /* .. Scalars in Common .. */
  287. /* .. Local Arrays .. */
  288. /* .. Common blocks .. */
  289. /* .. Data statements .. */
  290. /* .. Executable Statements .. */
  291. printf("Test of subprogram number %3d %15s", combla_1.icase, l[combla_1.icase - 1]);
  292. return 0;
  293. } /* header_ */
  294. /* Subroutine */ int check1_(real* sfac)
  295. {
  296. /* Initialized data */
  297. static real strue2[5] = { (float)0.,(float).5,(float).6,(float).7,(float)
  298. .7 };
  299. static real strue4[5] = { (float)0.,(float).7,(float)1.,(float)1.3,(float)
  300. 1.7 };
  301. static complex ctrue5[80] /* was [8][5][2] */ = { {(float).1,(float).1},
  302. {(float)1.,(float)2.},{(float)1.,(float)2.},{(float)1.,(float)2.},
  303. {(float)1.,(float)2.},{(float)1.,(float)2.},{(float)1.,(float)2.},
  304. {(float)1.,(float)2.},{(float)-.16,(float)-.37},{(float)3.,(float)
  305. 4.},{(float)3.,(float)4.},{(float)3.,(float)4.},{(float)3.,(float)
  306. 4.},{(float)3.,(float)4.},{(float)3.,(float)4.},{(float)3.,(float)
  307. 4.},{(float)-.17,(float)-.19},{(float).13,(float)-.39},{(float)5.,
  308. (float)6.},{(float)5.,(float)6.},{(float)5.,(float)6.},{(float)5.,
  309. (float)6.},{(float)5.,(float)6.},{(float)5.,(float)6.},{(float)
  310. .11,(float)-.03},{(float)-.17,(float).46},{(float)-.17,(float)
  311. -.19},{(float)7.,(float)8.},{(float)7.,(float)8.},{(float)7.,(
  312. float)8.},{(float)7.,(float)8.},{(float)7.,(float)8.},{(float).19,
  313. (float)-.17},{(float).32,(float).09},{(float).23,(float)-.24},{(
  314. float).18,(float).01},{(float)2.,(float)3.},{(float)2.,(float)3.},
  315. {(float)2.,(float)3.},{(float)2.,(float)3.},{(float).1,(float).1},
  316. {(float)4.,(float)5.},{(float)4.,(float)5.},{(float)4.,(float)5.},
  317. {(float)4.,(float)5.},{(float)4.,(float)5.},{(float)4.,(float)5.},
  318. {(float)4.,(float)5.},{(float)-.16,(float)-.37},{(float)6.,(float)
  319. 7.},{(float)6.,(float)7.},{(float)6.,(float)7.},{(float)6.,(float)
  320. 7.},{(float)6.,(float)7.},{(float)6.,(float)7.},{(float)6.,(float)
  321. 7.},{(float)-.17,(float)-.19},{(float)8.,(float)9.},{(float).13,(
  322. float)-.39},{(float)2.,(float)5.},{(float)2.,(float)5.},{(float)
  323. 2.,(float)5.},{(float)2.,(float)5.},{(float)2.,(float)5.},{(float)
  324. .11,(float)-.03},{(float)3.,(float)6.},{(float)-.17,(float).46},{(
  325. float)4.,(float)7.},{(float)-.17,(float)-.19},{(float)7.,(float)
  326. 2.},{(float)7.,(float)2.},{(float)7.,(float)2.},{(float).19,(
  327. float)-.17},{(float)5.,(float)8.},{(float).32,(float).09},{(float)
  328. 6.,(float)9.},{(float).23,(float)-.24},{(float)8.,(float)3.},{(
  329. float).18,(float).01},{(float)9.,(float)4.} };
  330. static complex ctrue6[80] /* was [8][5][2] */ = { {(float).1,(float).1},
  331. {(float)1.,(float)2.},{(float)1.,(float)2.},{(float)1.,(float)2.},
  332. {(float)1.,(float)2.},{(float)1.,(float)2.},{(float)1.,(float)2.},
  333. {(float)1.,(float)2.},{(float).09,(float)-.12},{(float)3.,(float)
  334. 4.},{(float)3.,(float)4.},{(float)3.,(float)4.},{(float)3.,(float)
  335. 4.},{(float)3.,(float)4.},{(float)3.,(float)4.},{(float)3.,(float)
  336. 4.},{(float).03,(float)-.09},{(float).15,(float)-.03},{(float)5.,(
  337. float)6.},{(float)5.,(float)6.},{(float)5.,(float)6.},{(float)5.,(
  338. float)6.},{(float)5.,(float)6.},{(float)5.,(float)6.},{(float).03,
  339. (float).03},{(float)-.18,(float).03},{(float).03,(float)-.09},{(
  340. float)7.,(float)8.},{(float)7.,(float)8.},{(float)7.,(float)8.},{(
  341. float)7.,(float)8.},{(float)7.,(float)8.},{(float).09,(float).03},
  342. {(float).03,(float).12},{(float).12,(float).03},{(float).03,(
  343. float).06},{(float)2.,(float)3.},{(float)2.,(float)3.},{(float)2.,
  344. (float)3.},{(float)2.,(float)3.},{(float).1,(float).1},{(float)4.,
  345. (float)5.},{(float)4.,(float)5.},{(float)4.,(float)5.},{(float)4.,
  346. (float)5.},{(float)4.,(float)5.},{(float)4.,(float)5.},{(float)4.,
  347. (float)5.},{(float).09,(float)-.12},{(float)6.,(float)7.},{(float)
  348. 6.,(float)7.},{(float)6.,(float)7.},{(float)6.,(float)7.},{(float)
  349. 6.,(float)7.},{(float)6.,(float)7.},{(float)6.,(float)7.},{(float)
  350. .03,(float)-.09},{(float)8.,(float)9.},{(float).15,(float)-.03},{(
  351. float)2.,(float)5.},{(float)2.,(float)5.},{(float)2.,(float)5.},{(
  352. float)2.,(float)5.},{(float)2.,(float)5.},{(float).03,(float).03},
  353. {(float)3.,(float)6.},{(float)-.18,(float).03},{(float)4.,(float)
  354. 7.},{(float).03,(float)-.09},{(float)7.,(float)2.},{(float)7.,(
  355. float)2.},{(float)7.,(float)2.},{(float).09,(float).03},{(float)
  356. 5.,(float)8.},{(float).03,(float).12},{(float)6.,(float)9.},{(
  357. float).12,(float).03},{(float)8.,(float)3.},{(float).03,(float)
  358. .06},{(float)9.,(float)4.} };
  359. static integer itrue3[5] = { 0,1,2,2,2 };
  360. static real sa = (float).3;
  361. static complex ca = {(float).4,(float)-.7};
  362. static complex cv[80] /* was [8][5][2] */ = { {(float).1,(float).1},
  363. {(float)1.,(float)2.},{(float)1.,(float)2.},{(float)1.,(float)2.},
  364. {(float)1.,(float)2.},{(float)1.,(float)2.},{(float)1.,(float)2.},
  365. {(float)1.,(float)2.},{(float).3,(float)-.4},{(float)3.,(float)4.}
  366. ,{(float)3.,(float)4.},{(float)3.,(float)4.},{(float)3.,(float)4.}
  367. ,{(float)3.,(float)4.},{(float)3.,(float)4.},{(float)3.,(float)4.}
  368. ,{(float).1,(float)-.3},{(float).5,(float)-.1},{(float)5.,(float)
  369. 6.},{(float)5.,(float)6.},{(float)5.,(float)6.},{(float)5.,(float)
  370. 6.},{(float)5.,(float)6.},{(float)5.,(float)6.},{(float).1,(float)
  371. .1},{(float)-.6,(float).1},{(float).1,(float)-.3},{(float)7.,(
  372. float)8.},{(float)7.,(float)8.},{(float)7.,(float)8.},{(float)7.,(
  373. float)8.},{(float)7.,(float)8.},{(float).3,(float).1},{(float).1,(
  374. float).4},{(float).4,(float).1},{(float).1,(float).2},{(float)2.,(
  375. float)3.},{(float)2.,(float)3.},{(float)2.,(float)3.},{(float)2.,(
  376. float)3.},{(float).1,(float).1},{(float)4.,(float)5.},{(float)4.,(
  377. float)5.},{(float)4.,(float)5.},{(float)4.,(float)5.},{(float)4.,(
  378. float)5.},{(float)4.,(float)5.},{(float)4.,(float)5.},{(float).3,(
  379. float)-.4},{(float)6.,(float)7.},{(float)6.,(float)7.},{(float)6.,
  380. (float)7.},{(float)6.,(float)7.},{(float)6.,(float)7.},{(float)6.,
  381. (float)7.},{(float)6.,(float)7.},{(float).1,(float)-.3},{(float)
  382. 8.,(float)9.},{(float).5,(float)-.1},{(float)2.,(float)5.},{(
  383. float)2.,(float)5.},{(float)2.,(float)5.},{(float)2.,(float)5.},{(
  384. float)2.,(float)5.},{(float).1,(float).1},{(float)3.,(float)6.},{(
  385. float)-.6,(float).1},{(float)4.,(float)7.},{(float).1,(float)-.3},
  386. {(float)7.,(float)2.},{(float)7.,(float)2.},{(float)7.,(float)2.},
  387. {(float).3,(float).1},{(float)5.,(float)8.},{(float).1,(float).4},
  388. {(float)6.,(float)9.},{(float).4,(float).1},{(float)8.,(float)3.},
  389. {(float).1,(float).2},{(float)9.,(float)4.} };
  390. /* System generated locals */
  391. integer i__1, i__2, i__3;
  392. real r__1;
  393. complex q__1;
  394. /* Local variables */
  395. static integer i__;
  396. extern /* Subroutine */ int ctest_(integer*, complex*, complex*, complex*, real*);
  397. static complex mwpcs[5], mwpct[5];
  398. extern /* Subroutine */ int itest1_(integer*, integer*), stest1_(real*,real*,real*,real*);
  399. extern /* Subroutine */ int cscaltest_(integer*, complex*, complex*, integer*);
  400. static complex cx[8];
  401. extern real scnrm2test_(integer*, complex*, integer*);
  402. static integer np1;
  403. extern integer icamaxtest_(integer*, complex*, integer*);
  404. extern /* Subroutine */ int csscaltest_(integer*, real*, complex*, integer*);
  405. extern real scasumtest_(integer*, complex*, integer*);
  406. static integer len;
  407. /* .. Parameters .. */
  408. /* .. Scalar Arguments .. */
  409. /* .. Scalars in Common .. */
  410. /* .. Local Scalars .. */
  411. /* .. Local Arrays .. */
  412. /* .. External Functions .. */
  413. /* .. External Subroutines .. */
  414. /* .. Intrinsic Functions .. */
  415. /* .. Common blocks .. */
  416. /* .. Data statements .. */
  417. /* .. Executable Statements .. */
  418. for (combla_1.incx = 1; combla_1.incx <= 2; ++combla_1.incx) {
  419. for (np1 = 1; np1 <= 5; ++np1) {
  420. combla_1.n = np1 - 1;
  421. len = f2cmax(combla_1.n,1) << 1;
  422. /* .. Set vector arguments .. */
  423. i__1 = len;
  424. for (i__ = 1; i__ <= i__1; ++i__) {
  425. i__2 = i__ - 1;
  426. i__3 = i__ + (np1 + combla_1.incx * 5 << 3) - 49;
  427. cx[i__2].r = cv[i__3].r, cx[i__2].i = cv[i__3].i;
  428. /* L20: */
  429. }
  430. if (combla_1.icase == 6) {
  431. /* .. SCNRM2TEST .. */
  432. r__1 = scnrm2test_(&combla_1.n, cx, &combla_1.incx);
  433. stest1_(&r__1, &strue2[np1 - 1], &strue2[np1 - 1], sfac);
  434. } else if (combla_1.icase == 7) {
  435. /* .. SCASUMTEST .. */
  436. r__1 = scasumtest_(&combla_1.n, cx, &combla_1.incx);
  437. stest1_(&r__1, &strue4[np1 - 1], &strue4[np1 - 1], sfac);
  438. } else if (combla_1.icase == 8) {
  439. /* .. CSCAL .. */
  440. cscaltest_(&combla_1.n, &ca, cx, &combla_1.incx);
  441. ctest_(&len, cx, &ctrue5[(np1 + combla_1.incx * 5 << 3) - 48],
  442. &ctrue5[(np1 + combla_1.incx * 5 << 3) - 48], sfac);
  443. } else if (combla_1.icase == 9) {
  444. /* .. CSSCALTEST .. */
  445. csscaltest_(&combla_1.n, &sa, cx, &combla_1.incx);
  446. ctest_(&len, cx, &ctrue6[(np1 + combla_1.incx * 5 << 3) - 48],
  447. &ctrue6[(np1 + combla_1.incx * 5 << 3) - 48], sfac);
  448. } else if (combla_1.icase == 10) {
  449. /* .. ICAMAXTEST .. */
  450. i__1 = icamaxtest_(&combla_1.n, cx, &combla_1.incx);
  451. itest1_(&i__1, &itrue3[np1 - 1]);
  452. } else {
  453. fprintf(stderr,"Shouldn't be here in CHECK1\n");
  454. exit(0);
  455. }
  456. /* L40: */
  457. }
  458. /* L60: */
  459. }
  460. combla_1.incx = 1;
  461. if (combla_1.icase == 8) {
  462. /* CSCAL */
  463. /* Add a test for alpha equal to zero. */
  464. ca.r = (float)0., ca.i = (float)0.;
  465. for (i__ = 1; i__ <= 5; ++i__) {
  466. i__1 = i__ - 1;
  467. mwpct[i__1].r = (float)0., mwpct[i__1].i = (float)0.;
  468. i__1 = i__ - 1;
  469. mwpcs[i__1].r = (float)1., mwpcs[i__1].i = (float)1.;
  470. /* L80: */
  471. }
  472. cscaltest_(&c__5, &ca, cx, &combla_1.incx);
  473. ctest_(&c__5, cx, mwpct, mwpcs, sfac);
  474. } else if (combla_1.icase == 9) {
  475. /* CSSCALTEST */
  476. /* Add a test for alpha equal to zero. */
  477. sa = (float)0.;
  478. for (i__ = 1; i__ <= 5; ++i__) {
  479. i__1 = i__ - 1;
  480. mwpct[i__1].r = (float)0., mwpct[i__1].i = (float)0.;
  481. i__1 = i__ - 1;
  482. mwpcs[i__1].r = (float)1., mwpcs[i__1].i = (float)1.;
  483. /* L100: */
  484. }
  485. csscaltest_(&c__5, &sa, cx, &combla_1.incx);
  486. ctest_(&c__5, cx, mwpct, mwpcs, sfac);
  487. /* Add a test for alpha equal to one. */
  488. sa = (float)1.;
  489. for (i__ = 1; i__ <= 5; ++i__) {
  490. i__1 = i__ - 1;
  491. i__2 = i__ - 1;
  492. mwpct[i__1].r = cx[i__2].r, mwpct[i__1].i = cx[i__2].i;
  493. i__1 = i__ - 1;
  494. i__2 = i__ - 1;
  495. mwpcs[i__1].r = cx[i__2].r, mwpcs[i__1].i = cx[i__2].i;
  496. /* L120: */
  497. }
  498. csscaltest_(&c__5, &sa, cx, &combla_1.incx);
  499. ctest_(&c__5, cx, mwpct, mwpcs, sfac);
  500. /* Add a test for alpha equal to minus one. */
  501. sa = (float)-1.;
  502. for (i__ = 1; i__ <= 5; ++i__) {
  503. i__1 = i__ - 1;
  504. i__2 = i__ - 1;
  505. q__1.r = -cx[i__2].r, q__1.i = -cx[i__2].i;
  506. mwpct[i__1].r = q__1.r, mwpct[i__1].i = q__1.i;
  507. i__1 = i__ - 1;
  508. i__2 = i__ - 1;
  509. q__1.r = -cx[i__2].r, q__1.i = -cx[i__2].i;
  510. mwpcs[i__1].r = q__1.r, mwpcs[i__1].i = q__1.i;
  511. /* L140: */
  512. }
  513. csscaltest_(&c__5, &sa, cx, &combla_1.incx);
  514. ctest_(&c__5, cx, mwpct, mwpcs, sfac);
  515. }
  516. return 0;
  517. } /* check1_ */
  518. /* Subroutine */ int check2_(real* sfac)
  519. {
  520. /* Initialized data */
  521. static complex ca = {(float).4,(float)-.7};
  522. static integer incxs[4] = { 1,2,-2,-1 };
  523. static integer incys[4] = { 1,-2,1,-2 };
  524. static integer lens[8] /* was [4][2] */ = { 1,1,2,4,1,1,3,7 };
  525. static integer ns[4] = { 0,1,2,4 };
  526. static complex cx1[7] = { {(float).7,(float)-.8},{(float)-.4,(float)-.7},{
  527. (float)-.1,(float)-.9},{(float).2,(float)-.8},{(float)-.9,(float)
  528. -.4},{(float).1,(float).4},{(float)-.6,(float).6} };
  529. static complex cy1[7] = { {(float).6,(float)-.6},{(float)-.9,(float).5},{(
  530. float).7,(float)-.6},{(float).1,(float)-.5},{(float)-.1,(float)
  531. -.2},{(float)-.5,(float)-.3},{(float).8,(float)-.7} };
  532. static complex ct8[112] /* was [7][4][4] */ = { {(float).6,(float)-.6}
  533. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  534. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  535. ,{(float).32,(float)-1.41},{(float)0.,(float)0.},{(float)0.,(
  536. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  537. float)0.},{(float)0.,(float)0.},{(float).32,(float)-1.41},{(float)
  538. -1.55,(float).5},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  539. float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  540. float).32,(float)-1.41},{(float)-1.55,(float).5},{(float).03,(
  541. float)-.89},{(float)-.38,(float)-.96},{(float)0.,(float)0.},{(
  542. float)0.,(float)0.},{(float)0.,(float)0.},{(float).6,(float)-.6},{
  543. (float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{
  544. (float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{
  545. (float).32,(float)-1.41},{(float)0.,(float)0.},{(float)0.,(float)
  546. 0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)
  547. 0.},{(float)0.,(float)0.},{(float)-.07,(float)-.89},{(float)-.9,(
  548. float).5},{(float).42,(float)-1.41},{(float)0.,(float)0.},{(float)
  549. 0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)
  550. .78,(float).06},{(float)-.9,(float).5},{(float).06,(float)-.13},{(
  551. float).1,(float)-.5},{(float)-.77,(float)-.49},{(float)-.5,(float)
  552. -.3},{(float).52,(float)-1.51},{(float).6,(float)-.6},{(float)0.,(
  553. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  554. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float).32,
  555. (float)-1.41},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)
  556. 0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)
  557. 0.,(float)0.},{(float)-.07,(float)-.89},{(float)-1.18,(float)-.31}
  558. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  559. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float).78,(float)
  560. .06},{(float)-1.54,(float).97},{(float).03,(float)-.89},{(float)
  561. -.18,(float)-1.31},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  562. float)0.,(float)0.},{(float).6,(float)-.6},{(float)0.,(float)0.},{
  563. (float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{
  564. (float)0.,(float)0.},{(float)0.,(float)0.},{(float).32,(float)
  565. -1.41},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  566. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  567. float)0.},{(float).32,(float)-1.41},{(float)-.9,(float).5},{(
  568. float).05,(float)-.6},{(float)0.,(float)0.},{(float)0.,(float)0.},
  569. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float).32,(float)
  570. -1.41},{(float)-.9,(float).5},{(float).05,(float)-.6},{(float).1,(
  571. float)-.5},{(float)-.77,(float)-.49},{(float)-.5,(float)-.3},{(
  572. float).32,(float)-1.16} };
  573. static complex ct7[16] /* was [4][4] */ = { {(float)0.,(float)0.},{(
  574. float)-.06,(float)-.9},{(float).65,(float)-.47},{(float)-.34,(
  575. float)-1.22},{(float)0.,(float)0.},{(float)-.06,(float)-.9},{(
  576. float)-.59,(float)-1.46},{(float)-1.04,(float)-.04},{(float)0.,(
  577. float)0.},{(float)-.06,(float)-.9},{(float)-.83,(float).59},{(
  578. float).07,(float)-.37},{(float)0.,(float)0.},{(float)-.06,(float)
  579. -.9},{(float)-.76,(float)-1.15},{(float)-1.33,(float)-1.82} };
  580. static complex ct6[16] /* was [4][4] */ = { {(float)0.,(float)0.},{(
  581. float).9,(float).06},{(float).91,(float)-.77},{(float)1.8,(float)
  582. -.1},{(float)0.,(float)0.},{(float).9,(float).06},{(float)1.45,(
  583. float).74},{(float).2,(float).9},{(float)0.,(float)0.},{(float).9,
  584. (float).06},{(float)-.55,(float).23},{(float).83,(float)-.39},{(
  585. float)0.,(float)0.},{(float).9,(float).06},{(float)1.04,(float)
  586. .79},{(float)1.95,(float)1.22} };
  587. static complex ct10x[112] /* was [7][4][4] */ = { {(float).7,(float)-.8}
  588. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  589. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  590. ,{(float).6,(float)-.6},{(float)0.,(float)0.},{(float)0.,(float)
  591. 0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)
  592. 0.},{(float)0.,(float)0.},{(float).6,(float)-.6},{(float)-.9,(
  593. float).5},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  594. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float).6,(
  595. float)-.6},{(float)-.9,(float).5},{(float).7,(float)-.6},{(float)
  596. .1,(float)-.5},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  597. float)0.,(float)0.},{(float).7,(float)-.8},{(float)0.,(float)0.},{
  598. (float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{
  599. (float)0.,(float)0.},{(float)0.,(float)0.},{(float).6,(float)-.6},
  600. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},
  601. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},
  602. {(float).7,(float)-.6},{(float)-.4,(float)-.7},{(float).6,(float)
  603. -.6},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  604. float)0.},{(float)0.,(float)0.},{(float).8,(float)-.7},{(float)
  605. -.4,(float)-.7},{(float)-.1,(float)-.2},{(float).2,(float)-.8},{(
  606. float).7,(float)-.6},{(float).1,(float).4},{(float).6,(float)-.6},
  607. {(float).7,(float)-.8},{(float)0.,(float)0.},{(float)0.,(float)0.}
  608. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  609. ,{(float)0.,(float)0.},{(float).6,(float)-.6},{(float)0.,(float)
  610. 0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)
  611. 0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)-.9,(
  612. float).5},{(float)-.4,(float)-.7},{(float).6,(float)-.6},{(float)
  613. 0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)
  614. 0.,(float)0.},{(float).1,(float)-.5},{(float)-.4,(float)-.7},{(
  615. float).7,(float)-.6},{(float).2,(float)-.8},{(float)-.9,(float).5}
  616. ,{(float).1,(float).4},{(float).6,(float)-.6},{(float).7,(float)
  617. -.8},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  618. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  619. float)0.},{(float).6,(float)-.6},{(float)0.,(float)0.},{(float)0.,
  620. (float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,
  621. (float)0.},{(float)0.,(float)0.},{(float).6,(float)-.6},{(float)
  622. .7,(float)-.6},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  623. float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  624. float).6,(float)-.6},{(float).7,(float)-.6},{(float)-.1,(float)
  625. -.2},{(float).8,(float)-.7},{(float)0.,(float)0.},{(float)0.,(
  626. float)0.},{(float)0.,(float)0.} };
  627. static complex ct10y[112] /* was [7][4][4] */ = { {(float).6,(float)-.6}
  628. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  629. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  630. ,{(float).7,(float)-.8},{(float)0.,(float)0.},{(float)0.,(float)
  631. 0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)
  632. 0.},{(float)0.,(float)0.},{(float).7,(float)-.8},{(float)-.4,(
  633. float)-.7},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,
  634. (float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float).7,
  635. (float)-.8},{(float)-.4,(float)-.7},{(float)-.1,(float)-.9},{(
  636. float).2,(float)-.8},{(float)0.,(float)0.},{(float)0.,(float)0.},{
  637. (float)0.,(float)0.},{(float).6,(float)-.6},{(float)0.,(float)0.},
  638. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},
  639. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float).7,(float)-.8}
  640. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  641. ,{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.}
  642. ,{(float)-.1,(float)-.9},{(float)-.9,(float).5},{(float).7,(float)
  643. -.8},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  644. float)0.},{(float)0.,(float)0.},{(float)-.6,(float).6},{(float)
  645. -.9,(float).5},{(float)-.9,(float)-.4},{(float).1,(float)-.5},{(
  646. float)-.1,(float)-.9},{(float)-.5,(float)-.3},{(float).7,(float)
  647. -.8},{(float).6,(float)-.6},{(float)0.,(float)0.},{(float)0.,(
  648. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  649. float)0.},{(float)0.,(float)0.},{(float).7,(float)-.8},{(float)0.,
  650. (float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,
  651. (float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)
  652. -.1,(float)-.9},{(float).7,(float)-.8},{(float)0.,(float)0.},{(
  653. float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  654. float)0.,(float)0.},{(float)-.6,(float).6},{(float)-.9,(float)-.4}
  655. ,{(float)-.1,(float)-.9},{(float).7,(float)-.8},{(float)0.,(float)
  656. 0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float).6,(float)
  657. -.6},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  658. float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(
  659. float)0.},{(float).7,(float)-.8},{(float)0.,(float)0.},{(float)0.,
  660. (float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,
  661. (float)0.},{(float)0.,(float)0.},{(float).7,(float)-.8},{(float)
  662. -.9,(float).5},{(float)-.4,(float)-.7},{(float)0.,(float)0.},{(
  663. float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  664. float).7,(float)-.8},{(float)-.9,(float).5},{(float)-.4,(float)
  665. -.7},{(float).1,(float)-.5},{(float)-.1,(float)-.9},{(float)-.5,(
  666. float)-.3},{(float).2,(float)-.8} };
  667. static complex csize1[4] = { {(float)0.,(float)0.},{(float).9,(float).9},{
  668. (float)1.63,(float)1.73},{(float)2.9,(float)2.78} };
  669. static complex csize3[14] = { {(float)0.,(float)0.},{(float)0.,(float)0.},
  670. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},
  671. {(float)0.,(float)0.},{(float)0.,(float)0.},{(float)1.17,(float)
  672. 1.17},{(float)1.17,(float)1.17},{(float)1.17,(float)1.17},{(float)
  673. 1.17,(float)1.17},{(float)1.17,(float)1.17},{(float)1.17,(float)
  674. 1.17},{(float)1.17,(float)1.17} };
  675. static complex csize2[14] /* was [7][2] */ = { {(float)0.,(float)0.},{(
  676. float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  677. float)0.,(float)0.},{(float)0.,(float)0.},{(float)0.,(float)0.},{(
  678. float)1.54,(float)1.54},{(float)1.54,(float)1.54},{(float)1.54,(
  679. float)1.54},{(float)1.54,(float)1.54},{(float)1.54,(float)1.54},{(
  680. float)1.54,(float)1.54},{(float)1.54,(float)1.54} };
  681. /* System generated locals */
  682. integer i__1, i__2;
  683. /* Local variables */
  684. static complex cdot[1];
  685. static integer lenx, leny, i__;
  686. static complex ctemp;
  687. extern /* Subroutine */ int ctest_(integer*, complex*, complex*, complex*, real*);
  688. static integer ksize;
  689. extern /* Subroutine */ int cdotctest_(integer*, complex*, integer*, complex*, integer*,complex*), ccopytest_(integer*, complex*, integer*, complex*, integer*), cdotutest_(integer*, complex*, integer*, complex*, integer*, complex*),
  690. cswaptest_(integer*, complex*, integer*, complex*, integer*), caxpytest_(integer*, complex*, complex*, integer*, complex*, integer*);
  691. static integer ki, kn;
  692. static complex cx[7], cy[7];
  693. static integer mx, my;
  694. /* .. Parameters .. */
  695. /* .. Scalar Arguments .. */
  696. /* .. Scalars in Common .. */
  697. /* .. Local Scalars .. */
  698. /* .. Local Arrays .. */
  699. /* .. External Functions .. */
  700. /* .. External Subroutines .. */
  701. /* .. Intrinsic Functions .. */
  702. /* .. Common blocks .. */
  703. /* .. Data statements .. */
  704. /* .. Executable Statements .. */
  705. for (ki = 1; ki <= 4; ++ki) {
  706. combla_1.incx = incxs[ki - 1];
  707. combla_1.incy = incys[ki - 1];
  708. mx = abs(combla_1.incx);
  709. my = abs(combla_1.incy);
  710. for (kn = 1; kn <= 4; ++kn) {
  711. combla_1.n = ns[kn - 1];
  712. ksize = f2cmin(2,kn);
  713. lenx = lens[kn + (mx << 2) - 5];
  714. leny = lens[kn + (my << 2) - 5];
  715. /* .. initialize all argument arrays .. */
  716. for (i__ = 1; i__ <= 7; ++i__) {
  717. i__1 = i__ - 1;
  718. i__2 = i__ - 1;
  719. cx[i__1].r = cx1[i__2].r, cx[i__1].i = cx1[i__2].i;
  720. i__1 = i__ - 1;
  721. i__2 = i__ - 1;
  722. cy[i__1].r = cy1[i__2].r, cy[i__1].i = cy1[i__2].i;
  723. /* L20: */
  724. }
  725. if (combla_1.icase == 1) {
  726. /* .. CDOTCTEST .. */
  727. cdotctest_(&combla_1.n, cx, &combla_1.incx, cy, &
  728. combla_1.incy, &ctemp);
  729. cdot[0].r = ctemp.r, cdot[0].i = ctemp.i;
  730. ctest_(&c__1, cdot, &ct6[kn + (ki << 2) - 5], &csize1[kn - 1],
  731. sfac);
  732. } else if (combla_1.icase == 2) {
  733. /* .. CDOTUTEST .. */
  734. cdotutest_(&combla_1.n, cx, &combla_1.incx, cy, &
  735. combla_1.incy, &ctemp);
  736. cdot[0].r = ctemp.r, cdot[0].i = ctemp.i;
  737. ctest_(&c__1, cdot, &ct7[kn + (ki << 2) - 5], &csize1[kn - 1],
  738. sfac);
  739. } else if (combla_1.icase == 3) {
  740. /* .. CAXPYTEST .. */
  741. caxpytest_(&combla_1.n, &ca, cx, &combla_1.incx, cy, &
  742. combla_1.incy);
  743. ctest_(&leny, cy, &ct8[(kn + (ki << 2)) * 7 - 35], &csize2[
  744. ksize * 7 - 7], sfac);
  745. } else if (combla_1.icase == 4) {
  746. /* .. CCOPYTEST .. */
  747. ccopytest_(&combla_1.n, cx, &combla_1.incx, cy, &
  748. combla_1.incy);
  749. ctest_(&leny, cy, &ct10y[(kn + (ki << 2)) * 7 - 35], csize3, &
  750. c_b43);
  751. } else if (combla_1.icase == 5) {
  752. /* .. CSWAPTEST .. */
  753. cswaptest_(&combla_1.n, cx, &combla_1.incx, cy, &
  754. combla_1.incy);
  755. ctest_(&lenx, cx, &ct10x[(kn + (ki << 2)) * 7 - 35], csize3, &
  756. c_b43);
  757. ctest_(&leny, cy, &ct10y[(kn + (ki << 2)) * 7 - 35], csize3, &
  758. c_b43);
  759. } else {
  760. fprintf(stderr,"Shouldn't be here in CHECK2\n");
  761. exit(0);
  762. }
  763. /* L40: */
  764. }
  765. /* L60: */
  766. }
  767. return 0;
  768. } /* check2_ */
  769. /* Subroutine */ int stest_(integer* len, real* scomp, real* strue, real* ssize,real* sfac)
  770. {
  771. /* System generated locals */
  772. integer i__1;
  773. real r__1, r__2, r__3, r__4, r__5;
  774. /* Local variables */
  775. static integer i__;
  776. extern doublereal sdiff_(real*, real*);
  777. static real sd;
  778. /* ********************************* STEST ************************** */
  779. /* THIS SUBR COMPARES ARRAYS SCOMP() AND STRUE() OF LENGTH LEN TO */
  780. /* SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE */
  781. /* NEGLIGIBLE. */
  782. /* C. L. LAWSON, JPL, 1974 DEC 10 */
  783. /* .. Parameters .. */
  784. /* .. Scalar Arguments .. */
  785. /* .. Array Arguments .. */
  786. /* .. Scalars in Common .. */
  787. /* .. Local Scalars .. */
  788. /* .. External Functions .. */
  789. /* .. Intrinsic Functions .. */
  790. /* .. Common blocks .. */
  791. /* .. Executable Statements .. */
  792. /* Parameter adjustments */
  793. --ssize;
  794. --strue;
  795. --scomp;
  796. /* Function Body */
  797. i__1 = *len;
  798. for (i__ = 1; i__ <= i__1; ++i__) {
  799. sd = scomp[i__] - strue[i__];
  800. r__4 = (r__1 = ssize[i__], dabs(r__1)) + (r__2 = *sfac * sd, dabs(
  801. r__2));
  802. r__5 = (r__3 = ssize[i__], dabs(r__3));
  803. if (sdiff_(&r__4, &r__5) == (float)0.) {
  804. goto L40;
  805. }
  806. /* HERE SCOMP(I) IS NOT CLOSE TO STRUE(I). */
  807. if (! combla_1.pass) {
  808. goto L20;
  809. }
  810. /* PRINT FAIL MESSAGE AND HEADER. */
  811. combla_1.pass = FALSE_;
  812. printf(" FAIL\n");
  813. printf("CASE N INCX INCY MODE I COMP(I) TRUE(I) DIFFERENCE SIZE(I)\n");
  814. L20:
  815. printf("%4d %3d %5d %5d %5d %3d %36.8e %36.8e %12.4e %12.4e\n",combla_1.icase, combla_1.n, combla_1.incx, combla_1.incy,
  816. combla_1.mode, i__, scomp[i__], strue[i__], sd, ssize[i__]);
  817. L40:
  818. ;
  819. }
  820. return 0;
  821. } /* stest_ */
  822. /* Subroutine */ int stest1_(real* scomp1, real* strue1, real* ssize, real* sfac)
  823. {
  824. static real scomp[1], strue[1];
  825. extern /* Subroutine */ int stest_(integer*, real*, real*, real*, real*);
  826. /* ************************* STEST1 ***************************** */
  827. /* THIS IS AN INTERFACE SUBROUTINE TO ACCOMMODATE THE FORTRAN */
  828. /* REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE */
  829. /* ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT. */
  830. /* C.L. LAWSON, JPL, 1978 DEC 6 */
  831. /* .. Scalar Arguments .. */
  832. /* .. Array Arguments .. */
  833. /* .. Local Arrays .. */
  834. /* .. External Subroutines .. */
  835. /* .. Executable Statements .. */
  836. /* Parameter adjustments */
  837. --ssize;
  838. /* Function Body */
  839. scomp[0] = *scomp1;
  840. strue[0] = *strue1;
  841. stest_(&c__1, scomp, strue, &ssize[1], sfac);
  842. return 0;
  843. } /* stest1_ */
  844. doublereal sdiff_(real* sa, real* sb)
  845. {
  846. /* System generated locals */
  847. real ret_val;
  848. /* ********************************* SDIFF ************************** */
  849. /* COMPUTES DIFFERENCE OF TWO NUMBERS. C. L. LAWSON, JPL 1974 FEB 15 */
  850. /* .. Scalar Arguments .. */
  851. /* .. Executable Statements .. */
  852. ret_val = *sa - *sb;
  853. return ret_val;
  854. } /* sdiff_ */
  855. /* Subroutine */ int ctest_(integer* len, complex* ccomp, complex* ctrue, complex* csize, real* sfac)
  856. {
  857. /* System generated locals */
  858. integer i__1, i__2;
  859. /* Builtin functions */
  860. // double r_imag();
  861. /* Local variables */
  862. static integer i__;
  863. static real scomp[20], ssize[20], strue[20];
  864. extern /* Subroutine */ int stest_(integer*, real*,real*,real*,real*);
  865. /* **************************** CTEST ***************************** */
  866. /* C.L. LAWSON, JPL, 1978 DEC 6 */
  867. /* .. Scalar Arguments .. */
  868. /* .. Array Arguments .. */
  869. /* .. Local Scalars .. */
  870. /* .. Local Arrays .. */
  871. /* .. External Subroutines .. */
  872. /* .. Intrinsic Functions .. */
  873. /* .. Executable Statements .. */
  874. /* Parameter adjustments */
  875. --csize;
  876. --ctrue;
  877. --ccomp;
  878. /* Function Body */
  879. i__1 = *len;
  880. for (i__ = 1; i__ <= i__1; ++i__) {
  881. i__2 = i__;
  882. scomp[(i__ << 1) - 2] = ccomp[i__2].r;
  883. scomp[(i__ << 1) - 1] = r_imag(&ccomp[i__]);
  884. i__2 = i__;
  885. strue[(i__ << 1) - 2] = ctrue[i__2].r;
  886. strue[(i__ << 1) - 1] = r_imag(&ctrue[i__]);
  887. i__2 = i__;
  888. ssize[(i__ << 1) - 2] = csize[i__2].r;
  889. ssize[(i__ << 1) - 1] = r_imag(&csize[i__]);
  890. /* L20: */
  891. }
  892. i__1 = *len << 1;
  893. stest_(&i__1, scomp, strue, ssize, sfac);
  894. return 0;
  895. } /* ctest_ */
  896. /* Subroutine */ int itest1_(integer* icomp, integer* itrue)
  897. {
  898. /* Local variables */
  899. static integer id;
  900. /* ********************************* ITEST1 ************************* */
  901. /* THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR */
  902. /* EQUALITY. */
  903. /* C. L. LAWSON, JPL, 1974 DEC 10 */
  904. /* .. Parameters .. */
  905. /* .. Scalar Arguments .. */
  906. /* .. Scalars in Common .. */
  907. /* .. Local Scalars .. */
  908. /* .. Common blocks .. */
  909. /* .. Executable Statements .. */
  910. if (*icomp == *itrue) {
  911. goto L40;
  912. }
  913. /* HERE ICOMP IS NOT EQUAL TO ITRUE. */
  914. if (! combla_1.pass) {
  915. goto L20;
  916. }
  917. /* PRINT FAIL MESSAGE AND HEADER. */
  918. combla_1.pass = FALSE_;
  919. printf(" FAIL\n");
  920. printf(" CASE N INCX INCY MODE COMP TRUE DIFFERENCE\n");
  921. L20:
  922. id = *icomp - *itrue;
  923. printf("%4d %3d %5d %5d %5d %36d %36d %12d\n",combla_1.icase, combla_1.n, combla_1.incx, combla_1.incy,
  924. combla_1.mode, *icomp, *itrue, id);
  925. L40:
  926. return 0;
  927. } /* itest1_ */