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_sblat1c.c 36 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138
  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. typedef int logical;
  22. typedef short int shortlogical;
  23. typedef char logical1;
  24. typedef char integer1;
  25. #define TRUE_ (1)
  26. #define FALSE_ (0)
  27. /* Extern is for use with -E */
  28. #ifndef Extern
  29. #define Extern extern
  30. #endif
  31. /* I/O stuff */
  32. typedef int flag;
  33. typedef int ftnlen;
  34. typedef int ftnint;
  35. /*external read, write*/
  36. typedef struct
  37. { flag cierr;
  38. ftnint ciunit;
  39. flag ciend;
  40. char *cifmt;
  41. ftnint cirec;
  42. } cilist;
  43. /*internal read, write*/
  44. typedef struct
  45. { flag icierr;
  46. char *iciunit;
  47. flag iciend;
  48. char *icifmt;
  49. ftnint icirlen;
  50. ftnint icirnum;
  51. } icilist;
  52. /*open*/
  53. typedef struct
  54. { flag oerr;
  55. ftnint ounit;
  56. char *ofnm;
  57. ftnlen ofnmlen;
  58. char *osta;
  59. char *oacc;
  60. char *ofm;
  61. ftnint orl;
  62. char *oblnk;
  63. } olist;
  64. /*close*/
  65. typedef struct
  66. { flag cerr;
  67. ftnint cunit;
  68. char *csta;
  69. } cllist;
  70. /*rewind, backspace, endfile*/
  71. typedef struct
  72. { flag aerr;
  73. ftnint aunit;
  74. } alist;
  75. /* inquire */
  76. typedef struct
  77. { flag inerr;
  78. ftnint inunit;
  79. char *infile;
  80. ftnlen infilen;
  81. ftnint *inex; /*parameters in standard's order*/
  82. ftnint *inopen;
  83. ftnint *innum;
  84. ftnint *innamed;
  85. char *inname;
  86. ftnlen innamlen;
  87. char *inacc;
  88. ftnlen inacclen;
  89. char *inseq;
  90. ftnlen inseqlen;
  91. char *indir;
  92. ftnlen indirlen;
  93. char *infmt;
  94. ftnlen infmtlen;
  95. char *inform;
  96. ftnint informlen;
  97. char *inunf;
  98. ftnlen inunflen;
  99. ftnint *inrecl;
  100. ftnint *innrec;
  101. char *inblank;
  102. ftnlen inblanklen;
  103. } inlist;
  104. #define VOID void
  105. union Multitype { /* for multiple entry points */
  106. integer1 g;
  107. shortint h;
  108. integer i;
  109. /* longint j; */
  110. real r;
  111. doublereal d;
  112. complex c;
  113. doublecomplex z;
  114. };
  115. typedef union Multitype Multitype;
  116. struct Vardesc { /* for Namelist */
  117. char *name;
  118. char *addr;
  119. ftnlen *dims;
  120. int type;
  121. };
  122. typedef struct Vardesc Vardesc;
  123. struct Namelist {
  124. char *name;
  125. Vardesc **vars;
  126. int nvars;
  127. };
  128. typedef struct Namelist Namelist;
  129. #define abs(x) ((x) >= 0 ? (x) : -(x))
  130. #define dabs(x) (fabs(x))
  131. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  132. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  133. #define dmin(a,b) (f2cmin(a,b))
  134. #define dmax(a,b) (f2cmax(a,b))
  135. #define bit_test(a,b) ((a) >> (b) & 1)
  136. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  137. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  138. #define abort_() { sig_die("Fortran abort routine called", 1); }
  139. #define c_abs(z) (cabsf(Cf(z)))
  140. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  141. #ifdef _MSC_VER
  142. #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]);}
  143. #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]);}
  144. #else
  145. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  146. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  147. #endif
  148. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  149. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  150. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  151. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  152. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  153. #define d_abs(x) (fabs(*(x)))
  154. #define d_acos(x) (acos(*(x)))
  155. #define d_asin(x) (asin(*(x)))
  156. #define d_atan(x) (atan(*(x)))
  157. #define d_atn2(x, y) (atan2(*(x),*(y)))
  158. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  159. #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
  160. #define d_cos(x) (cos(*(x)))
  161. #define d_cosh(x) (cosh(*(x)))
  162. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  163. #define d_exp(x) (exp(*(x)))
  164. #define d_imag(z) (cimag(Cd(z)))
  165. #define r_imag(z) (cimagf(Cf(z)))
  166. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  167. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  168. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  169. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  170. #define d_log(x) (log(*(x)))
  171. #define d_mod(x, y) (fmod(*(x), *(y)))
  172. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  173. #define d_nint(x) u_nint(*(x))
  174. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  175. #define d_sign(a,b) u_sign(*(a),*(b))
  176. #define r_sign(a,b) u_sign(*(a),*(b))
  177. #define d_sin(x) (sin(*(x)))
  178. #define d_sinh(x) (sinh(*(x)))
  179. #define d_sqrt(x) (sqrt(*(x)))
  180. #define d_tan(x) (tan(*(x)))
  181. #define d_tanh(x) (tanh(*(x)))
  182. #define i_abs(x) abs(*(x))
  183. #define i_dnnt(x) ((integer)u_nint(*(x)))
  184. #define i_len(s, n) (n)
  185. #define i_nint(x) ((integer)u_nint(*(x)))
  186. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  187. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  188. #define pow_si(B,E) spow_ui(*(B),*(E))
  189. #define pow_ri(B,E) spow_ui(*(B),*(E))
  190. #define pow_di(B,E) dpow_ui(*(B),*(E))
  191. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  192. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  193. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  194. #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++ = ' '; }
  195. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  196. #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]; }
  197. #define sig_die(s, kill) { exit(1); }
  198. #define s_stop(s, n) {exit(0);}
  199. #define z_abs(z) (cabs(Cd(z)))
  200. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  201. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  202. #define myexit_() break;
  203. #define mycycle_() continue;
  204. #define myceiling_(w) {ceil(w)}
  205. #define myhuge_(w) {HUGE_VAL}
  206. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  207. #define mymaxloc_(w,s,e,n) dmaxloc_(w,*(s),*(e),n)
  208. /* procedure parameter types for -A and -C++ */
  209. #define F2C_proc_par_types 1
  210. /* Common Block Declarations */
  211. struct {
  212. integer icase, n, incx, incy, mode;
  213. logical pass;
  214. } combla_;
  215. #define combla_1 combla_
  216. /* Table of constant values */
  217. static integer c__1 = 1;
  218. static real c_b34 = (float)1.;
  219. /* Main program */ int main (void)
  220. {
  221. /* Initialized data */
  222. static real sfac = (float)9.765625e-4;
  223. /* Local variables */
  224. extern /* Subroutine */ int check0_(real*), check1_(real*), check2_(real*), check3_(real*);
  225. static integer ic;
  226. extern /* Subroutine */ int header_(void);
  227. /* Test program for the REAL Level 1 CBLAS. */
  228. /* Based upon the original CBLAS test routine together with: */
  229. /* F06EAF Example Program Text */
  230. /* .. Parameters .. */
  231. /* .. Scalars in Common .. */
  232. /* .. Local Scalars .. */
  233. /* .. External Subroutines .. */
  234. /* .. Common blocks .. */
  235. /* .. Data statements .. */
  236. /* .. Executable Statements .. */
  237. printf("Real CBLAS Test Program Results\n");
  238. for (ic = 1; ic <= 11; ++ic) {
  239. combla_1.icase = ic;
  240. header_();
  241. /* .. Initialize PASS, INCX, INCY, and MODE for a new case. .. */
  242. /* .. the value 9999 for INCX, INCY or MODE will appear in the .. */
  243. /* .. detailed output, if any, for cases that do not involve .. */
  244. /* .. these parameters .. */
  245. combla_1.pass = TRUE_;
  246. combla_1.incx = 9999;
  247. combla_1.incy = 9999;
  248. combla_1.mode = 9999;
  249. if (combla_1.icase == 3) {
  250. check0_(&sfac);
  251. } else if (combla_1.icase == 7 || combla_1.icase == 8 ||
  252. combla_1.icase == 9 || combla_1.icase == 10) {
  253. check1_(&sfac);
  254. } else if (combla_1.icase == 1 || combla_1.icase == 2 ||
  255. combla_1.icase == 5 || combla_1.icase == 6) {
  256. check2_(&sfac);
  257. } else if (combla_1.icase == 4 || combla_1.icase == 11) {
  258. check3_(&sfac);
  259. }
  260. /* -- Print */
  261. if (combla_1.pass) {
  262. printf(" ----- PASS -----\n");
  263. }
  264. /* L20: */
  265. }
  266. exit(0);
  267. } /* MAIN__ */
  268. /* Subroutine */ int header_(void)
  269. {
  270. /* Initialized data */
  271. static char l[15][13] = {"CBLAS_SDOT " , "CBLAS_SAXPY " , "CBLAS_SROTG " ,
  272. "CBLAS_SROT " , "CBLAS_SCOPY " , "CBLAS_SSWAP " , "CBLAS_SNRM2 " , "CBLAS_SASUM ",
  273. "CBLAS_SSCAL " , "CBLAS_ISAMAX", "CBLAS_SROTM "};
  274. /* Fortran I/O blocks */
  275. /* .. Parameters .. */
  276. /* .. Scalars in Common .. */
  277. /* .. Local Arrays .. */
  278. /* .. Common blocks .. */
  279. /* .. Data statements .. */
  280. /* .. Executable Statements .. */
  281. printf("\nTest of subprogram number %3d %15s",combla_1.icase,l[combla_1.icase-1]);
  282. return 0;
  283. } /* header_ */
  284. /* Subroutine */ int check0_(real *sfac)
  285. {
  286. /* Initialized data */
  287. static real ds1[8] = { (float).8,(float).6,(float).8,(float)-.6,(float).8,
  288. (float)0.,(float)1.,(float)0. };
  289. static real datrue[8] = { (float).5,(float).5,(float).5,(float)-.5,(float)
  290. -.5,(float)0.,(float)1.,(float)1. };
  291. static real dbtrue[8] = { (float)0.,(float).6,(float)0.,(float)-.6,(float)
  292. 0.,(float)0.,(float)1.,(float)0. };
  293. static real da1[8] = { (float).3,(float).4,(float)-.3,(float)-.4,(float)
  294. -.3,(float)0.,(float)0.,(float)1. };
  295. static real db1[8] = { (float).4,(float).3,(float).4,(float).3,(float)-.4,
  296. (float)0.,(float)1.,(float)0. };
  297. static real dc1[8] = { (float).6,(float).8,(float)-.6,(float).8,(float).6,
  298. (float)1.,(float)0.,(float)1. };
  299. /* Local variables */
  300. static integer k;
  301. extern /* Subroutine */ int srotgtest_(real*,real*,real*,real*), stest1_(real*,real*,real*,real*);
  302. static real sa, sb, sc, ss;
  303. /* .. Parameters .. */
  304. /* .. Scalar Arguments .. */
  305. /* .. Scalars in Common .. */
  306. /* .. Local Scalars .. */
  307. /* .. Local Arrays .. */
  308. /* .. External Subroutines .. */
  309. /* .. Common blocks .. */
  310. /* .. Data statements .. */
  311. /* .. Executable Statements .. */
  312. /* Compute true values which cannot be prestored */
  313. /* in decimal notation */
  314. dbtrue[0] = (float)1.6666666666666667;
  315. dbtrue[2] = (float)-1.6666666666666667;
  316. dbtrue[4] = (float)1.6666666666666667;
  317. for (k = 1; k <= 8; ++k) {
  318. /* .. Set N=K for identification in output if any .. */
  319. combla_1.n = k;
  320. if (combla_1.icase == 3) {
  321. /* .. SROTGTEST .. */
  322. if (k > 8) {
  323. goto L40;
  324. }
  325. sa = da1[k - 1];
  326. sb = db1[k - 1];
  327. srotgtest_(&sa, &sb, &sc, &ss);
  328. stest1_(&sa, &datrue[k - 1], &datrue[k - 1], sfac);
  329. stest1_(&sb, &dbtrue[k - 1], &dbtrue[k - 1], sfac);
  330. stest1_(&sc, &dc1[k - 1], &dc1[k - 1], sfac);
  331. stest1_(&ss, &ds1[k - 1], &ds1[k - 1], sfac);
  332. } else {
  333. fprintf (stderr,"Shouldn't be here in CHECK0\n");
  334. exit(0);
  335. }
  336. /* L20: */
  337. }
  338. L40:
  339. return 0;
  340. } /* check0_ */
  341. /* Subroutine */ int check1_(real* sfac)
  342. {
  343. /* Initialized data */
  344. static real sa[10] = { (float).3,(float)-1.,(float)0.,(float)1.,(float).3,
  345. (float).3,(float).3,(float).3,(float).3,(float).3 };
  346. static real dv[80] /* was [8][5][2] */ = { (float).1,(float)2.,(float)2.,
  347. (float)2.,(float)2.,(float)2.,(float)2.,(float)2.,(float).3,(
  348. float)3.,(float)3.,(float)3.,(float)3.,(float)3.,(float)3.,(float)
  349. 3.,(float).3,(float)-.4,(float)4.,(float)4.,(float)4.,(float)4.,(
  350. float)4.,(float)4.,(float).2,(float)-.6,(float).3,(float)5.,(
  351. float)5.,(float)5.,(float)5.,(float)5.,(float).1,(float)-.3,(
  352. float).5,(float)-.1,(float)6.,(float)6.,(float)6.,(float)6.,(
  353. float).1,(float)8.,(float)8.,(float)8.,(float)8.,(float)8.,(float)
  354. 8.,(float)8.,(float).3,(float)9.,(float)9.,(float)9.,(float)9.,(
  355. float)9.,(float)9.,(float)9.,(float).3,(float)2.,(float)-.4,(
  356. float)2.,(float)2.,(float)2.,(float)2.,(float)2.,(float).2,(float)
  357. 3.,(float)-.6,(float)5.,(float).3,(float)2.,(float)2.,(float)2.,(
  358. float).1,(float)4.,(float)-.3,(float)6.,(float)-.5,(float)7.,(
  359. float)-.1,(float)3. };
  360. static real dtrue1[5] = { (float)0.,(float).3,(float).5,(float).7,(float)
  361. .6 };
  362. static real dtrue3[5] = { (float)0.,(float).3,(float).7,(float)1.1,(float)
  363. 1. };
  364. static real dtrue5[80] /* was [8][5][2] */ = { (float).1,(float)2.,(
  365. float)2.,(float)2.,(float)2.,(float)2.,(float)2.,(float)2.,(float)
  366. -.3,(float)3.,(float)3.,(float)3.,(float)3.,(float)3.,(float)3.,(
  367. float)3.,(float)0.,(float)0.,(float)4.,(float)4.,(float)4.,(float)
  368. 4.,(float)4.,(float)4.,(float).2,(float)-.6,(float).3,(float)5.,(
  369. float)5.,(float)5.,(float)5.,(float)5.,(float).03,(float)-.09,(
  370. float).15,(float)-.03,(float)6.,(float)6.,(float)6.,(float)6.,(
  371. float).1,(float)8.,(float)8.,(float)8.,(float)8.,(float)8.,(float)
  372. 8.,(float)8.,(float).09,(float)9.,(float)9.,(float)9.,(float)9.,(
  373. float)9.,(float)9.,(float)9.,(float).09,(float)2.,(float)-.12,(
  374. float)2.,(float)2.,(float)2.,(float)2.,(float)2.,(float).06,(
  375. float)3.,(float)-.18,(float)5.,(float).09,(float)2.,(float)2.,(
  376. float)2.,(float).03,(float)4.,(float)-.09,(float)6.,(float)-.15,(
  377. float)7.,(float)-.03,(float)3. };
  378. static integer itrue2[5] = { 0,1,2,2,3 };
  379. /* System generated locals */
  380. integer i__1;
  381. real r__1;
  382. /* Local variables */
  383. static integer i__;
  384. extern real snrm2test_(integer*,real*,integer*);
  385. static real stemp[1], strue[8];
  386. extern /* Subroutine */ int stest_(integer*, real*,real*,real*,real*), sscaltest_(integer*,real*,real*,integer*);
  387. extern real sasumtest_(integer*,real*,integer*);
  388. extern /* Subroutine */ int itest1_(integer*,integer*), stest1_(real*,real*,real*,real*);
  389. static real sx[8];
  390. static integer np1;
  391. extern integer isamaxtest_(integer*,real*,integer*);
  392. static integer len;
  393. /* .. Parameters .. */
  394. /* .. Scalar Arguments .. */
  395. /* .. Scalars in Common .. */
  396. /* .. Local Scalars .. */
  397. /* .. Local Arrays .. */
  398. /* .. External Functions .. */
  399. /* .. External Subroutines .. */
  400. /* .. Intrinsic Functions .. */
  401. /* .. Common blocks .. */
  402. /* .. Data statements .. */
  403. /* .. Executable Statements .. */
  404. for (combla_1.incx = 1; combla_1.incx <= 2; ++combla_1.incx) {
  405. for (np1 = 1; np1 <= 5; ++np1) {
  406. combla_1.n = np1 - 1;
  407. len = f2cmax(combla_1.n,1) << 1;
  408. /* .. Set vector arguments .. */
  409. i__1 = len;
  410. for (i__ = 1; i__ <= i__1; ++i__) {
  411. sx[i__ - 1] = dv[i__ + (np1 + combla_1.incx * 5 << 3) - 49];
  412. /* L20: */
  413. }
  414. if (combla_1.icase == 7) {
  415. /* .. SNRM2TEST .. */
  416. stemp[0] = dtrue1[np1 - 1];
  417. r__1 = snrm2test_(&combla_1.n, sx, &combla_1.incx);
  418. stest1_(&r__1, stemp, stemp, sfac);
  419. } else if (combla_1.icase == 8) {
  420. /* .. SASUMTEST .. */
  421. stemp[0] = dtrue3[np1 - 1];
  422. r__1 = sasumtest_(&combla_1.n, sx, &combla_1.incx);
  423. stest1_(&r__1, stemp, stemp, sfac);
  424. } else if (combla_1.icase == 9) {
  425. /* .. SSCALTEST .. */
  426. sscaltest_(&combla_1.n, &sa[(combla_1.incx - 1) * 5 + np1 - 1]
  427. , sx, &combla_1.incx);
  428. i__1 = len;
  429. for (i__ = 1; i__ <= i__1; ++i__) {
  430. strue[i__ - 1] = dtrue5[i__ + (np1 + combla_1.incx * 5 <<
  431. 3) - 49];
  432. /* L40: */
  433. }
  434. stest_(&len, sx, strue, strue, sfac);
  435. } else if (combla_1.icase == 10) {
  436. /* .. ISAMAXTEST .. */
  437. i__1 = isamaxtest_(&combla_1.n, sx, &combla_1.incx);
  438. itest1_(&i__1, &itrue2[np1 - 1]);
  439. } else {
  440. fprintf(stderr, " Shouldn't be here in CHECK1\n");
  441. exit(0);
  442. }
  443. /* L60: */
  444. }
  445. /* L80: */
  446. }
  447. return 0;
  448. } /* check1_ */
  449. /* Subroutine */ int check2_(real* sfac)
  450. {
  451. /* Initialized data */
  452. static real sa = (float).3;
  453. static integer incxs[4] = { 1,2,-2,-1 };
  454. static integer incys[4] = { 1,-2,1,-2 };
  455. static integer lens[8] /* was [4][2] */ = { 1,1,2,4,1,1,3,7 };
  456. static integer ns[4] = { 0,1,2,4 };
  457. static real dx1[7] = { (float).6,(float).1,(float)-.5,(float).8,(float).9,
  458. (float)-.3,(float)-.4 };
  459. static real dy1[7] = { (float).5,(float)-.9,(float).3,(float).7,(float)
  460. -.6,(float).2,(float).8 };
  461. static real dt7[16] /* was [4][4] */ = { (float)0.,(float).3,(float).21,(
  462. float).62,(float)0.,(float).3,(float)-.07,(float).85,(float)0.,(
  463. float).3,(float)-.79,(float)-.74,(float)0.,(float).3,(float).33,(
  464. float)1.27 };
  465. static real dt8[112] /* was [7][4][4] */ = { (float).5,(float)0.,(
  466. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float).68,(
  467. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  468. .68,(float)-.87,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,
  469. (float).68,(float)-.87,(float).15,(float).94,(float)0.,(float)0.,(
  470. float)0.,(float).5,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  471. 0.,(float)0.,(float).68,(float)0.,(float)0.,(float)0.,(float)0.,(
  472. float)0.,(float)0.,(float).35,(float)-.9,(float).48,(float)0.,(
  473. float)0.,(float)0.,(float)0.,(float).38,(float)-.9,(float).57,(
  474. float).7,(float)-.75,(float).2,(float).98,(float).5,(float)0.,(
  475. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float).68,(
  476. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  477. .35,(float)-.72,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,
  478. (float).38,(float)-.63,(float).15,(float).88,(float)0.,(float)0.,(
  479. float)0.,(float).5,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  480. 0.,(float)0.,(float).68,(float)0.,(float)0.,(float)0.,(float)0.,(
  481. float)0.,(float)0.,(float).68,(float)-.9,(float).33,(float)0.,(
  482. float)0.,(float)0.,(float)0.,(float).68,(float)-.9,(float).33,(
  483. float).7,(float)-.75,(float).2,(float)1.04 };
  484. static real dt10x[112] /* was [7][4][4] */ = { (float).6,(float)0.,(
  485. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float).5,(float)
  486. 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float).5,(
  487. float)-.9,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(
  488. float).5,(float)-.9,(float).3,(float).7,(float)0.,(float)0.,(
  489. float)0.,(float).6,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  490. 0.,(float)0.,(float).5,(float)0.,(float)0.,(float)0.,(float)0.,(
  491. float)0.,(float)0.,(float).3,(float).1,(float).5,(float)0.,(float)
  492. 0.,(float)0.,(float)0.,(float).8,(float).1,(float)-.6,(float).8,(
  493. float).3,(float)-.3,(float).5,(float).6,(float)0.,(float)0.,(
  494. float)0.,(float)0.,(float)0.,(float)0.,(float).5,(float)0.,(float)
  495. 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)-.9,(float).1,(
  496. float).5,(float)0.,(float)0.,(float)0.,(float)0.,(float).7,(float)
  497. .1,(float).3,(float).8,(float)-.9,(float)-.3,(float).5,(float).6,(
  498. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  499. .5,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(
  500. float).5,(float).3,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  501. 0.,(float).5,(float).3,(float)-.6,(float).8,(float)0.,(float)0.,(
  502. float)0. };
  503. static real dt10y[112] /* was [7][4][4] */ = { (float).5,(float)0.,(
  504. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float).6,(float)
  505. 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float).6,(
  506. float).1,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  507. .6,(float).1,(float)-.5,(float).8,(float)0.,(float)0.,(float)0.,(
  508. float).5,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  509. 0.,(float).6,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(
  510. float)0.,(float)-.5,(float)-.9,(float).6,(float)0.,(float)0.,(
  511. float)0.,(float)0.,(float)-.4,(float)-.9,(float).9,(float).7,(
  512. float)-.5,(float).2,(float).6,(float).5,(float)0.,(float)0.,(
  513. float)0.,(float)0.,(float)0.,(float)0.,(float).6,(float)0.,(float)
  514. 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)-.5,(float).6,(
  515. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)-.4,(
  516. float).9,(float)-.5,(float).6,(float)0.,(float)0.,(float)0.,(
  517. float).5,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  518. 0.,(float).6,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(
  519. float)0.,(float).6,(float)-.9,(float).1,(float)0.,(float)0.,(
  520. float)0.,(float)0.,(float).6,(float)-.9,(float).1,(float).7,(
  521. float)-.5,(float).2,(float).8 };
  522. static real ssize1[4] = { (float)0.,(float).3,(float)1.6,(float)3.2 };
  523. static real ssize2[28] /* was [14][2] */ = { (float)0.,(float)0.,(
  524. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  525. 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)1.17,(
  526. float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)
  527. 1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(
  528. float)1.17,(float)1.17 };
  529. /* System generated locals */
  530. integer i__1;
  531. real r__1;
  532. /* Local variables */
  533. static integer lenx, leny;
  534. extern real sdottest_(integer*,real*,integer*,real*,integer*);
  535. static integer i__, j, ksize;
  536. extern /* Subroutine */ int stest_(integer*,real*,real*,real*,real*), scopytest_(integer*,real*,integer*,real*,integer*), sswaptest_(integer*,real*,integer*,real*,integer*),
  537. saxpytest_(integer*,real*,real*,integer*,real*,integer*);
  538. static integer ki;
  539. extern /* Subroutine */ int stest1_(real*,real*,real*,real*);
  540. static integer kn, mx, my;
  541. static real sx[7], sy[7], stx[7], sty[7];
  542. /* .. Parameters .. */
  543. /* .. Scalar Arguments .. */
  544. /* .. Scalars in Common .. */
  545. /* .. Local Scalars .. */
  546. /* .. Local Arrays .. */
  547. /* .. External Functions .. */
  548. /* .. External Subroutines .. */
  549. /* .. Intrinsic Functions .. */
  550. /* .. Common blocks .. */
  551. /* .. Data statements .. */
  552. /* .. Executable Statements .. */
  553. for (ki = 1; ki <= 4; ++ki) {
  554. combla_1.incx = incxs[ki - 1];
  555. combla_1.incy = incys[ki - 1];
  556. mx = abs(combla_1.incx);
  557. my = abs(combla_1.incy);
  558. for (kn = 1; kn <= 4; ++kn) {
  559. combla_1.n = ns[kn - 1];
  560. ksize = f2cmin(2,kn);
  561. lenx = lens[kn + (mx << 2) - 5];
  562. leny = lens[kn + (my << 2) - 5];
  563. /* .. Initialize all argument arrays .. */
  564. for (i__ = 1; i__ <= 7; ++i__) {
  565. sx[i__ - 1] = dx1[i__ - 1];
  566. sy[i__ - 1] = dy1[i__ - 1];
  567. /* L20: */
  568. }
  569. if (combla_1.icase == 1) {
  570. /* .. SDOTTEST .. */
  571. r__1 = sdottest_(&combla_1.n, sx, &combla_1.incx, sy, &
  572. combla_1.incy);
  573. stest1_(&r__1, &dt7[kn + (ki << 2) - 5], &ssize1[kn - 1],
  574. sfac);
  575. } else if (combla_1.icase == 2) {
  576. /* .. SAXPYTEST .. */
  577. saxpytest_(&combla_1.n, &sa, sx, &combla_1.incx, sy, &
  578. combla_1.incy);
  579. i__1 = leny;
  580. for (j = 1; j <= i__1; ++j) {
  581. sty[j - 1] = dt8[j + (kn + (ki << 2)) * 7 - 36];
  582. /* L40: */
  583. }
  584. stest_(&leny, sy, sty, &ssize2[ksize * 14 - 14], sfac);
  585. } else if (combla_1.icase == 5) {
  586. /* .. SCOPYTEST .. */
  587. for (i__ = 1; i__ <= 7; ++i__) {
  588. sty[i__ - 1] = dt10y[i__ + (kn + (ki << 2)) * 7 - 36];
  589. /* L60: */
  590. }
  591. scopytest_(&combla_1.n, sx, &combla_1.incx, sy, &
  592. combla_1.incy);
  593. stest_(&leny, sy, sty, ssize2, &c_b34);
  594. } else if (combla_1.icase == 6) {
  595. /* .. SSWAPTEST .. */
  596. sswaptest_(&combla_1.n, sx, &combla_1.incx, sy, &
  597. combla_1.incy);
  598. for (i__ = 1; i__ <= 7; ++i__) {
  599. stx[i__ - 1] = dt10x[i__ + (kn + (ki << 2)) * 7 - 36];
  600. sty[i__ - 1] = dt10y[i__ + (kn + (ki << 2)) * 7 - 36];
  601. /* L80: */
  602. }
  603. stest_(&lenx, sx, stx, ssize2, &c_b34);
  604. stest_(&leny, sy, sty, ssize2, &c_b34);
  605. } else {
  606. fprintf(stderr,"Shouldn't be here in CHECK2\n");
  607. exit(0);
  608. }
  609. /* L100: */
  610. }
  611. /* L120: */
  612. }
  613. return 0;
  614. } /* check2_ */
  615. /* Subroutine */ int check3_(real* sfac)
  616. {
  617. /* Initialized data */
  618. static integer incxs[7] = { 1,1,2,2,-2,-1,-2 };
  619. static integer incys[7] = { 1,2,2,-2,1,-2,-2 };
  620. static integer ns[7] = { 0,1,2,4,5,8,9 };
  621. static real dx[19] = { (float).6,(float).1,(float)-.5,(float).8,(float).9,
  622. (float)-.3,(float)-.4,(float).5,(float)-.9,(float).3,(float).7,(
  623. float)-.6,(float).2,(float).8,(float)-.46,(float).78,(float)-.46,(
  624. float)-.22,(float)1.06 };
  625. static real dy[19] = { (float).5,(float)-.9,(float).3,(float).7,(float)
  626. -.6,(float).2,(float).6,(float).1,(float)-.5,(float).8,(float).9,(
  627. float)-.3,(float).96,(float).1,(float)-.76,(float).8,(float).9,(
  628. float).66,(float).8 };
  629. static real sc = (float).8;
  630. static real ss = (float).6;
  631. static real param[20] /* was [5][4] */ = { (float)-2.,(float)1.,(
  632. float)0.,(float)0.,(float)1.,(float)-1.,(float).2,(float).3,(
  633. float).4,(float).5,(float)0.,(float)1.,(float).3,(float).4,(float)
  634. 1.,(float)1.,(float).2,(float)-1.,(float)1.,(float).5 };
  635. static integer len = 19;
  636. static real ssize2[38] /* was [19][2] */ = { (float)0.,(float)0.,(
  637. float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)
  638. 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(
  639. float)0.,(float)0.,(float)0.,(float)0.,(float)1.17,(float)1.17,(
  640. float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)
  641. 1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(
  642. float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)1.17,(float)
  643. 1.17 };
  644. /* Local variables */
  645. extern /* Subroutine */ void srottest_(integer*,real*,integer*,real*,integer*,real*,real*);
  646. static integer i__, k, ksize;
  647. extern /* Subroutine */ int stest_(integer*,real*,real*,real*,real*), srotmtest_(integer*,real*,integer*,real*,integer*,real*);
  648. static integer ki, kn;
  649. static real sx[19], sy[19], sparam[5], stx[19], sty[19];
  650. /* .. Parameters .. */
  651. /* .. Scalar Arguments .. */
  652. /* .. Scalars in Common .. */
  653. /* .. Local Scalars .. */
  654. /* .. Local Arrays .. */
  655. /* .. External Subroutines .. */
  656. /* .. Intrinsic Functions .. */
  657. /* .. Common blocks .. */
  658. /* .. Data statements .. */
  659. /* .. Executable Statements .. */
  660. for (ki = 1; ki <= 7; ++ki) {
  661. combla_1.incx = incxs[ki - 1];
  662. combla_1.incy = incys[ki - 1];
  663. for (kn = 1; kn <= 7; ++kn) {
  664. combla_1.n = ns[kn - 1];
  665. ksize = f2cmin(2,kn);
  666. if (combla_1.icase == 4) {
  667. /* .. SROTTEST .. */
  668. for (i__ = 1; i__ <= 19; ++i__) {
  669. sx[i__ - 1] = dx[i__ - 1];
  670. sy[i__ - 1] = dy[i__ - 1];
  671. stx[i__ - 1] = dx[i__ - 1];
  672. sty[i__ - 1] = dy[i__ - 1];
  673. /* L20: */
  674. }
  675. srottest_(&combla_1.n, sx, &combla_1.incx, sy, &combla_1.incy,
  676. &sc, &ss);
  677. srot_(&combla_1.n, stx, &combla_1.incx, sty, &combla_1.incy, &
  678. sc, &ss);
  679. stest_(&len, sx, stx, &ssize2[ksize * 19 - 19], sfac);
  680. stest_(&len, sy, sty, &ssize2[ksize * 19 - 19], sfac);
  681. } else if (combla_1.icase == 11) {
  682. /* .. SROTMTEST .. */
  683. for (i__ = 1; i__ <= 19; ++i__) {
  684. sx[i__ - 1] = dx[i__ - 1];
  685. sy[i__ - 1] = dy[i__ - 1];
  686. stx[i__ - 1] = dx[i__ - 1];
  687. sty[i__ - 1] = dy[i__ - 1];
  688. /* L90: */
  689. }
  690. for (i__ = 1; i__ <= 4; ++i__) {
  691. for (k = 1; k <= 5; ++k) {
  692. sparam[k - 1] = param[k + i__ * 5 - 6];
  693. /* L80: */
  694. }
  695. srotmtest_(&combla_1.n, sx, &combla_1.incx, sy, &
  696. combla_1.incy, sparam);
  697. srotm_(&combla_1.n, stx, &combla_1.incx, sty, &
  698. combla_1.incy, sparam);
  699. stest_(&len, sx, stx, &ssize2[ksize * 19 - 19], sfac);
  700. stest_(&len, sy, sty, &ssize2[ksize * 19 - 19], sfac);
  701. /* L70: */
  702. }
  703. } else {
  704. fprintf(stderr,"Shouldn't be here in CHECK3\n");
  705. exit(0);
  706. }
  707. /* L40: */
  708. }
  709. /* L60: */
  710. }
  711. return 0;
  712. } /* check3_ */
  713. /* Subroutine */ int stest_(integer* len, real* scomp, real* strue, real* ssize, real* sfac)
  714. {
  715. integer i__1;
  716. real r__1, r__2, r__3, r__4, r__5;
  717. /* Local variables */
  718. static integer i__;
  719. extern doublereal sdiff_(real*,real*);
  720. static real sd;
  721. /* ********************************* STEST ************************** */
  722. /* THIS SUBR COMPARES ARRAYS SCOMP() AND STRUE() OF LENGTH LEN TO */
  723. /* SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE */
  724. /* NEGLIGIBLE. */
  725. /* C. L. LAWSON, JPL, 1974 DEC 10 */
  726. /* .. Parameters .. */
  727. /* .. Scalar Arguments .. */
  728. /* .. Array Arguments .. */
  729. /* .. Scalars in Common .. */
  730. /* .. Local Scalars .. */
  731. /* .. External Functions .. */
  732. /* .. Intrinsic Functions .. */
  733. /* .. Common blocks .. */
  734. /* .. Executable Statements .. */
  735. /* Parameter adjustments */
  736. --ssize;
  737. --strue;
  738. --scomp;
  739. /* Function Body */
  740. i__1 = *len;
  741. for (i__ = 1; i__ <= i__1; ++i__) {
  742. sd = scomp[i__] - strue[i__];
  743. r__4 = (r__1 = ssize[i__], dabs(r__1)) + (r__2 = *sfac * sd, dabs(
  744. r__2));
  745. r__5 = (r__3 = ssize[i__], dabs(r__3));
  746. if (sdiff_(&r__4, &r__5) == (float)0.) {
  747. goto L40;
  748. }
  749. /* HERE SCOMP(I) IS NOT CLOSE TO STRUE(I). */
  750. if (! combla_1.pass) {
  751. goto L20;
  752. }
  753. /* PRINT FAIL MESSAGE AND HEADER. */
  754. combla_1.pass = FALSE_;
  755. printf(" FAIL\n");
  756. printf("CASE N INCX INCY MODE I COMP(I) TRUE(I) DIFFERENCE SIZE(I)\n");
  757. L20:
  758. printf("%4d %3d %5d %5d %5d %3d %36.8f %36.8f %12.4f %12.4f\n",combla_1.icase, combla_1.n,
  759. combla_1.incx, combla_1.incy, combla_1.mode, i__, scomp[i__], strue[i__], sd, ssize[i__]);
  760. L40:
  761. ;
  762. }
  763. return 0;
  764. } /* stest_ */
  765. /* Subroutine */ int stest1_(real* scomp1, real* strue1, real* ssize, real* sfac)
  766. {
  767. static real scomp[1], strue[1];
  768. extern /* Subroutine */ int stest_(integer*,real*,real*,real*,real*);
  769. /* ************************* STEST1 ***************************** */
  770. /* THIS IS AN INTERFACE SUBROUTINE TO ACCOMMODATE THE FORTRAN */
  771. /* REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE */
  772. /* ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT. */
  773. /* C.L. LAWSON, JPL, 1978 DEC 6 */
  774. /* .. Scalar Arguments .. */
  775. /* .. Array Arguments .. */
  776. /* .. Local Arrays .. */
  777. /* .. External Subroutines .. */
  778. /* .. Executable Statements .. */
  779. /* Parameter adjustments */
  780. --ssize;
  781. /* Function Body */
  782. scomp[0] = *scomp1;
  783. strue[0] = *strue1;
  784. stest_(&c__1, scomp, strue, &ssize[1], sfac);
  785. return 0;
  786. } /* stest1_ */
  787. doublereal sdiff_(real* sa, real* sb)
  788. {
  789. /* System generated locals */
  790. real ret_val;
  791. /* ********************************* SDIFF ************************** */
  792. /* COMPUTES DIFFERENCE OF TWO NUMBERS. C. L. LAWSON, JPL 1974 FEB 15 */
  793. /* .. Scalar Arguments .. */
  794. /* .. Executable Statements .. */
  795. ret_val = *sa - *sb;
  796. return ret_val;
  797. } /* sdiff_ */
  798. /* Subroutine */ int itest1_(integer* icomp, integer* itrue)
  799. {
  800. /* Local variables */
  801. static integer id;
  802. /* ********************************* ITEST1 ************************* */
  803. /* THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR */
  804. /* EQUALITY. */
  805. /* C. L. LAWSON, JPL, 1974 DEC 10 */
  806. /* .. Parameters .. */
  807. /* .. Scalar Arguments .. */
  808. /* .. Scalars in Common .. */
  809. /* .. Local Scalars .. */
  810. /* .. Common blocks .. */
  811. /* .. Executable Statements .. */
  812. if (*icomp == *itrue) {
  813. goto L40;
  814. }
  815. /* HERE ICOMP IS NOT EQUAL TO ITRUE. */
  816. if (! combla_1.pass) {
  817. goto L20;
  818. }
  819. /* PRINT FAIL MESSAGE AND HEADER. */
  820. combla_1.pass = FALSE_;
  821. printf(" FAIL\n");
  822. printf("CASE N INCX INCY MODE COMP TRUE DIFFERENCE\n");
  823. L20:
  824. id = *icomp - *itrue;
  825. printf("%4d %3d %5d %5d %5d %36d %36d %12d\n",
  826. combla_1.icase, combla_1.n, combla_1.incx, combla_1.incy, combla_1.mode, *icomp,*itrue,id);
  827. L40:
  828. return 0;
  829. } /* itest1_ */
  830. #if 0
  831. /* Subroutine */ int srot_(n, sx, incx, sy, incy, c__, s)
  832. integer *n;
  833. real *sx;
  834. integer *incx;
  835. real *sy;
  836. integer *incy;
  837. real *c__, *s;
  838. {
  839. /* System generated locals */
  840. integer i__1;
  841. /* Local variables */
  842. static integer i__;
  843. static real stemp;
  844. static integer ix, iy;
  845. /* --Reference BLAS level1 routine (version 3.8.0) -- */
  846. /* --Reference BLAS is a software package provided by Univ. of Tennessee, -- */
  847. /* --Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  848. /* November 2017 */
  849. /* .. Scalar Arguments .. */
  850. /* .. */
  851. /* .. Array Arguments .. */
  852. /* .. */
  853. /* .. Local Scalars .. */
  854. /* .. */
  855. /* Parameter adjustments */
  856. --sy;
  857. --sx;
  858. /* Function Body */
  859. if (*n <= 0) {
  860. return 0;
  861. }
  862. if (*incx == 1 && *incy == 1) {
  863. i__1 = *n;
  864. for (i__ = 1; i__ <= i__1; ++i__) {
  865. stemp = *c__ * sx[i__] + *s * sy[i__];
  866. sy[i__] = *c__ * sy[i__] - *s * sx[i__];
  867. sx[i__] = stemp;
  868. }
  869. } else {
  870. ix = 1;
  871. iy = 1;
  872. if (*incx < 0) {
  873. ix = (-(*n) + 1) * *incx + 1;
  874. }
  875. if (*incy < 0) {
  876. iy = (-(*n) + 1) * *incy + 1;
  877. }
  878. i__1 = *n;
  879. for (i__ = 1; i__ <= i__1; ++i__) {
  880. stemp = *c__ * sx[ix] + *s * sy[iy];
  881. sy[iy] = *c__ * sy[iy] - *s * sx[ix];
  882. sx[ix] = stemp;
  883. ix += *incx;
  884. iy += *incy;
  885. }
  886. }
  887. return 0;
  888. } /* srot_ */
  889. /* Subroutine */ int srotm_(n, sx, incx, sy, incy, sparam)
  890. integer *n;
  891. real *sx;
  892. integer *incx;
  893. real *sy;
  894. integer *incy;
  895. real *sparam;
  896. {
  897. /* Initialized data */
  898. static real zero = (float)0.;
  899. static real two = (float)2.;
  900. /* System generated locals */
  901. integer i__1, i__2;
  902. /* Local variables */
  903. static integer i__;
  904. static real w, z__, sflag;
  905. static integer kx, ky, nsteps;
  906. static real sh11, sh12, sh21, sh22;
  907. /* --Reference BLAS level1 routine (version 3.8.0) -- */
  908. /* --Reference BLAS is a software package provided by Univ. of Tennessee, -- */
  909. /* --Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  910. /* November 2017 */
  911. /* .. Scalar Arguments .. */
  912. /* .. */
  913. /* .. Array Arguments .. */
  914. /* .. */
  915. /* ==================================================================== */
  916. /* .. Local Scalars .. */
  917. /* .. */
  918. /* .. Data statements .. */
  919. /* Parameter adjustments */
  920. --sparam;
  921. --sy;
  922. --sx;
  923. /* Function Body */
  924. /* .. */
  925. sflag = sparam[1];
  926. if (*n <= 0 || sflag + two == zero) {
  927. return 0;
  928. }
  929. if (*incx == *incy && *incx > 0) {
  930. nsteps = *n * *incx;
  931. if (sflag < zero) {
  932. sh11 = sparam[2];
  933. sh12 = sparam[4];
  934. sh21 = sparam[3];
  935. sh22 = sparam[5];
  936. i__1 = nsteps;
  937. i__2 = *incx;
  938. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  939. w = sx[i__];
  940. z__ = sy[i__];
  941. sx[i__] = w * sh11 + z__ * sh12;
  942. sy[i__] = w * sh21 + z__ * sh22;
  943. }
  944. } else if (sflag == zero) {
  945. sh12 = sparam[4];
  946. sh21 = sparam[3];
  947. i__2 = nsteps;
  948. i__1 = *incx;
  949. for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
  950. w = sx[i__];
  951. z__ = sy[i__];
  952. sx[i__] = w + z__ * sh12;
  953. sy[i__] = w * sh21 + z__;
  954. }
  955. } else {
  956. sh11 = sparam[2];
  957. sh22 = sparam[5];
  958. i__1 = nsteps;
  959. i__2 = *incx;
  960. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  961. w = sx[i__];
  962. z__ = sy[i__];
  963. sx[i__] = w * sh11 + z__;
  964. sy[i__] = -w + sh22 * z__;
  965. }
  966. }
  967. } else {
  968. kx = 1;
  969. ky = 1;
  970. if (*incx < 0) {
  971. kx = (1 - *n) * *incx + 1;
  972. }
  973. if (*incy < 0) {
  974. ky = (1 - *n) * *incy + 1;
  975. }
  976. if (sflag < zero) {
  977. sh11 = sparam[2];
  978. sh12 = sparam[4];
  979. sh21 = sparam[3];
  980. sh22 = sparam[5];
  981. i__2 = *n;
  982. for (i__ = 1; i__ <= i__2; ++i__) {
  983. w = sx[kx];
  984. z__ = sy[ky];
  985. sx[kx] = w * sh11 + z__ * sh12;
  986. sy[ky] = w * sh21 + z__ * sh22;
  987. kx += *incx;
  988. ky += *incy;
  989. }
  990. } else if (sflag == zero) {
  991. sh12 = sparam[4];
  992. sh21 = sparam[3];
  993. i__2 = *n;
  994. for (i__ = 1; i__ <= i__2; ++i__) {
  995. w = sx[kx];
  996. z__ = sy[ky];
  997. sx[kx] = w + z__ * sh12;
  998. sy[ky] = w * sh21 + z__;
  999. kx += *incx;
  1000. ky += *incy;
  1001. }
  1002. } else {
  1003. sh11 = sparam[2];
  1004. sh22 = sparam[5];
  1005. i__2 = *n;
  1006. for (i__ = 1; i__ <= i__2; ++i__) {
  1007. w = sx[kx];
  1008. z__ = sy[ky];
  1009. sx[kx] = w * sh11 + z__;
  1010. sy[ky] = -w + sh22 * z__;
  1011. kx += *incx;
  1012. ky += *incy;
  1013. }
  1014. }
  1015. }
  1016. return 0;
  1017. } /* srotm_ */
  1018. #endif