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.

ssyrfsx.c 38 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. /* f2c.h -- Standard Fortran to C header file */
  2. /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
  3. - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
  4. #ifndef F2C_INCLUDE
  5. #define F2C_INCLUDE
  6. #include <math.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <stdio.h>
  10. #include <complex.h>
  11. #ifdef complex
  12. #undef complex
  13. #endif
  14. #ifdef I
  15. #undef I
  16. #endif
  17. #if defined(_WIN64)
  18. typedef long long BLASLONG;
  19. typedef unsigned long long BLASULONG;
  20. #else
  21. typedef long BLASLONG;
  22. typedef unsigned long BLASULONG;
  23. #endif
  24. #ifdef LAPACK_ILP64
  25. typedef BLASLONG blasint;
  26. #if defined(_WIN64)
  27. #define blasabs(x) llabs(x)
  28. #else
  29. #define blasabs(x) labs(x)
  30. #endif
  31. #else
  32. typedef int blasint;
  33. #define blasabs(x) abs(x)
  34. #endif
  35. typedef blasint integer;
  36. typedef unsigned int uinteger;
  37. typedef char *address;
  38. typedef short int shortint;
  39. typedef float real;
  40. typedef double doublereal;
  41. typedef struct { real r, i; } complex;
  42. typedef struct { doublereal r, i; } doublecomplex;
  43. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  44. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  46. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  47. #define pCf(z) (*_pCf(z))
  48. #define pCd(z) (*_pCd(z))
  49. typedef int logical;
  50. typedef short int shortlogical;
  51. typedef char logical1;
  52. typedef char integer1;
  53. #define TRUE_ (1)
  54. #define FALSE_ (0)
  55. /* Extern is for use with -E */
  56. #ifndef Extern
  57. #define Extern extern
  58. #endif
  59. /* I/O stuff */
  60. typedef int flag;
  61. typedef int ftnlen;
  62. typedef int ftnint;
  63. /*external read, write*/
  64. typedef struct
  65. { flag cierr;
  66. ftnint ciunit;
  67. flag ciend;
  68. char *cifmt;
  69. ftnint cirec;
  70. } cilist;
  71. /*internal read, write*/
  72. typedef struct
  73. { flag icierr;
  74. char *iciunit;
  75. flag iciend;
  76. char *icifmt;
  77. ftnint icirlen;
  78. ftnint icirnum;
  79. } icilist;
  80. /*open*/
  81. typedef struct
  82. { flag oerr;
  83. ftnint ounit;
  84. char *ofnm;
  85. ftnlen ofnmlen;
  86. char *osta;
  87. char *oacc;
  88. char *ofm;
  89. ftnint orl;
  90. char *oblnk;
  91. } olist;
  92. /*close*/
  93. typedef struct
  94. { flag cerr;
  95. ftnint cunit;
  96. char *csta;
  97. } cllist;
  98. /*rewind, backspace, endfile*/
  99. typedef struct
  100. { flag aerr;
  101. ftnint aunit;
  102. } alist;
  103. /* inquire */
  104. typedef struct
  105. { flag inerr;
  106. ftnint inunit;
  107. char *infile;
  108. ftnlen infilen;
  109. ftnint *inex; /*parameters in standard's order*/
  110. ftnint *inopen;
  111. ftnint *innum;
  112. ftnint *innamed;
  113. char *inname;
  114. ftnlen innamlen;
  115. char *inacc;
  116. ftnlen inacclen;
  117. char *inseq;
  118. ftnlen inseqlen;
  119. char *indir;
  120. ftnlen indirlen;
  121. char *infmt;
  122. ftnlen infmtlen;
  123. char *inform;
  124. ftnint informlen;
  125. char *inunf;
  126. ftnlen inunflen;
  127. ftnint *inrecl;
  128. ftnint *innrec;
  129. char *inblank;
  130. ftnlen inblanklen;
  131. } inlist;
  132. #define VOID void
  133. union Multitype { /* for multiple entry points */
  134. integer1 g;
  135. shortint h;
  136. integer i;
  137. /* longint j; */
  138. real r;
  139. doublereal d;
  140. complex c;
  141. doublecomplex z;
  142. };
  143. typedef union Multitype Multitype;
  144. struct Vardesc { /* for Namelist */
  145. char *name;
  146. char *addr;
  147. ftnlen *dims;
  148. int type;
  149. };
  150. typedef struct Vardesc Vardesc;
  151. struct Namelist {
  152. char *name;
  153. Vardesc **vars;
  154. int nvars;
  155. };
  156. typedef struct Namelist Namelist;
  157. #define abs(x) ((x) >= 0 ? (x) : -(x))
  158. #define dabs(x) (fabs(x))
  159. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  160. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  161. #define dmin(a,b) (f2cmin(a,b))
  162. #define dmax(a,b) (f2cmax(a,b))
  163. #define bit_test(a,b) ((a) >> (b) & 1)
  164. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  165. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  166. #define abort_() { sig_die("Fortran abort routine called", 1); }
  167. #define c_abs(z) (cabsf(Cf(z)))
  168. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  169. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  170. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  171. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  172. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  173. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  174. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  175. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  176. #define d_abs(x) (fabs(*(x)))
  177. #define d_acos(x) (acos(*(x)))
  178. #define d_asin(x) (asin(*(x)))
  179. #define d_atan(x) (atan(*(x)))
  180. #define d_atn2(x, y) (atan2(*(x),*(y)))
  181. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  182. #define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); }
  183. #define d_cos(x) (cos(*(x)))
  184. #define d_cosh(x) (cosh(*(x)))
  185. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  186. #define d_exp(x) (exp(*(x)))
  187. #define d_imag(z) (cimag(Cd(z)))
  188. #define r_imag(z) (cimag(Cf(z)))
  189. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  190. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  191. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  192. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  193. #define d_log(x) (log(*(x)))
  194. #define d_mod(x, y) (fmod(*(x), *(y)))
  195. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  196. #define d_nint(x) u_nint(*(x))
  197. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  198. #define d_sign(a,b) u_sign(*(a),*(b))
  199. #define r_sign(a,b) u_sign(*(a),*(b))
  200. #define d_sin(x) (sin(*(x)))
  201. #define d_sinh(x) (sinh(*(x)))
  202. #define d_sqrt(x) (sqrt(*(x)))
  203. #define d_tan(x) (tan(*(x)))
  204. #define d_tanh(x) (tanh(*(x)))
  205. #define i_abs(x) abs(*(x))
  206. #define i_dnnt(x) ((integer)u_nint(*(x)))
  207. #define i_len(s, n) (n)
  208. #define i_nint(x) ((integer)u_nint(*(x)))
  209. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  210. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  211. #define pow_si(B,E) spow_ui(*(B),*(E))
  212. #define pow_ri(B,E) spow_ui(*(B),*(E))
  213. #define pow_di(B,E) dpow_ui(*(B),*(E))
  214. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  215. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  216. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  217. #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++ = ' '; }
  218. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  219. #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]; }
  220. #define sig_die(s, kill) { exit(1); }
  221. #define s_stop(s, n) {exit(0);}
  222. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  223. #define z_abs(z) (cabs(Cd(z)))
  224. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  225. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  226. #define myexit_() break;
  227. #define mycycle() continue;
  228. #define myceiling(w) {ceil(w)}
  229. #define myhuge(w) {HUGE_VAL}
  230. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  231. #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  232. /* procedure parameter types for -A and -C++ */
  233. #define F2C_proc_par_types 1
  234. #ifdef __cplusplus
  235. typedef logical (*L_fp)(...);
  236. #else
  237. typedef logical (*L_fp)();
  238. #endif
  239. static float spow_ui(float x, integer n) {
  240. float pow=1.0; unsigned long int u;
  241. if(n != 0) {
  242. if(n < 0) n = -n, x = 1/x;
  243. for(u = n; ; ) {
  244. if(u & 01) pow *= x;
  245. if(u >>= 1) x *= x;
  246. else break;
  247. }
  248. }
  249. return pow;
  250. }
  251. static double dpow_ui(double x, integer n) {
  252. double pow=1.0; unsigned long int u;
  253. if(n != 0) {
  254. if(n < 0) n = -n, x = 1/x;
  255. for(u = n; ; ) {
  256. if(u & 01) pow *= x;
  257. if(u >>= 1) x *= x;
  258. else break;
  259. }
  260. }
  261. return pow;
  262. }
  263. static _Complex float cpow_ui(_Complex float x, integer n) {
  264. _Complex float pow=1.0; unsigned long int u;
  265. if(n != 0) {
  266. if(n < 0) n = -n, x = 1/x;
  267. for(u = n; ; ) {
  268. if(u & 01) pow *= x;
  269. if(u >>= 1) x *= x;
  270. else break;
  271. }
  272. }
  273. return pow;
  274. }
  275. static _Complex double zpow_ui(_Complex double x, integer n) {
  276. _Complex double pow=1.0; unsigned long int u;
  277. if(n != 0) {
  278. if(n < 0) n = -n, x = 1/x;
  279. for(u = n; ; ) {
  280. if(u & 01) pow *= x;
  281. if(u >>= 1) x *= x;
  282. else break;
  283. }
  284. }
  285. return pow;
  286. }
  287. static integer pow_ii(integer x, integer n) {
  288. integer pow; unsigned long int u;
  289. if (n <= 0) {
  290. if (n == 0 || x == 1) pow = 1;
  291. else if (x != -1) pow = x == 0 ? 1/x : 0;
  292. else n = -n;
  293. }
  294. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  295. u = n;
  296. for(pow = 1; ; ) {
  297. if(u & 01) pow *= x;
  298. if(u >>= 1) x *= x;
  299. else break;
  300. }
  301. }
  302. return pow;
  303. }
  304. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  305. {
  306. double m; integer i, mi;
  307. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  308. if (w[i-1]>m) mi=i ,m=w[i-1];
  309. return mi-s+1;
  310. }
  311. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  312. {
  313. float m; integer i, mi;
  314. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  315. if (w[i-1]>m) mi=i ,m=w[i-1];
  316. return mi-s+1;
  317. }
  318. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  319. integer n = *n_, incx = *incx_, incy = *incy_, i;
  320. _Complex float zdotc = 0.0;
  321. if (incx == 1 && incy == 1) {
  322. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  323. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  324. }
  325. } else {
  326. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  327. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  328. }
  329. }
  330. pCf(z) = zdotc;
  331. }
  332. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  333. integer n = *n_, incx = *incx_, incy = *incy_, i;
  334. _Complex double zdotc = 0.0;
  335. if (incx == 1 && incy == 1) {
  336. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  337. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  338. }
  339. } else {
  340. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  341. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  342. }
  343. }
  344. pCd(z) = zdotc;
  345. }
  346. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  347. integer n = *n_, incx = *incx_, incy = *incy_, i;
  348. _Complex float zdotc = 0.0;
  349. if (incx == 1 && incy == 1) {
  350. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  351. zdotc += Cf(&x[i]) * Cf(&y[i]);
  352. }
  353. } else {
  354. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  355. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  356. }
  357. }
  358. pCf(z) = zdotc;
  359. }
  360. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  361. integer n = *n_, incx = *incx_, incy = *incy_, i;
  362. _Complex double zdotc = 0.0;
  363. if (incx == 1 && incy == 1) {
  364. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  365. zdotc += Cd(&x[i]) * Cd(&y[i]);
  366. }
  367. } else {
  368. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  369. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  370. }
  371. }
  372. pCd(z) = zdotc;
  373. }
  374. #endif
  375. /* -- translated by f2c (version 20000121).
  376. You must link the resulting object file with the libraries:
  377. -lf2c -lm (in that order)
  378. */
  379. /* Table of constant values */
  380. static integer c_n1 = -1;
  381. static integer c__0 = 0;
  382. static integer c__1 = 1;
  383. /* > \brief \b SSYRFSX */
  384. /* =========== DOCUMENTATION =========== */
  385. /* Online html documentation available at */
  386. /* http://www.netlib.org/lapack/explore-html/ */
  387. /* > \htmlonly */
  388. /* > Download SSYRFSX + dependencies */
  389. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ssyrfsx
  390. .f"> */
  391. /* > [TGZ]</a> */
  392. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ssyrfsx
  393. .f"> */
  394. /* > [ZIP]</a> */
  395. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ssyrfsx
  396. .f"> */
  397. /* > [TXT]</a> */
  398. /* > \endhtmlonly */
  399. /* Definition: */
  400. /* =========== */
  401. /* SUBROUTINE SSYRFSX( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV, */
  402. /* S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, */
  403. /* ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, */
  404. /* WORK, IWORK, INFO ) */
  405. /* CHARACTER UPLO, EQUED */
  406. /* INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS, */
  407. /* $ N_ERR_BNDS */
  408. /* REAL RCOND */
  409. /* INTEGER IPIV( * ), IWORK( * ) */
  410. /* REAL A( LDA, * ), AF( LDAF, * ), B( LDB, * ), */
  411. /* $ X( LDX, * ), WORK( * ) */
  412. /* REAL S( * ), PARAMS( * ), BERR( * ), */
  413. /* $ ERR_BNDS_NORM( NRHS, * ), */
  414. /* $ ERR_BNDS_COMP( NRHS, * ) */
  415. /* > \par Purpose: */
  416. /* ============= */
  417. /* > */
  418. /* > \verbatim */
  419. /* > */
  420. /* > SSYRFSX improves the computed solution to a system of linear */
  421. /* > equations when the coefficient matrix is symmetric indefinite, and */
  422. /* > provides error bounds and backward error estimates for the */
  423. /* > solution. In addition to normwise error bound, the code provides */
  424. /* > maximum componentwise error bound if possible. See comments for */
  425. /* > ERR_BNDS_NORM and ERR_BNDS_COMP for details of the error bounds. */
  426. /* > */
  427. /* > The original system of linear equations may have been equilibrated */
  428. /* > before calling this routine, as described by arguments EQUED and S */
  429. /* > below. In this case, the solution and error bounds returned are */
  430. /* > for the original unequilibrated system. */
  431. /* > \endverbatim */
  432. /* Arguments: */
  433. /* ========== */
  434. /* > \verbatim */
  435. /* > Some optional parameters are bundled in the PARAMS array. These */
  436. /* > settings determine how refinement is performed, but often the */
  437. /* > defaults are acceptable. If the defaults are acceptable, users */
  438. /* > can pass NPARAMS = 0 which prevents the source code from accessing */
  439. /* > the PARAMS argument. */
  440. /* > \endverbatim */
  441. /* > */
  442. /* > \param[in] UPLO */
  443. /* > \verbatim */
  444. /* > UPLO is CHARACTER*1 */
  445. /* > = 'U': Upper triangle of A is stored; */
  446. /* > = 'L': Lower triangle of A is stored. */
  447. /* > \endverbatim */
  448. /* > */
  449. /* > \param[in] EQUED */
  450. /* > \verbatim */
  451. /* > EQUED is CHARACTER*1 */
  452. /* > Specifies the form of equilibration that was done to A */
  453. /* > before calling this routine. This is needed to compute */
  454. /* > the solution and error bounds correctly. */
  455. /* > = 'N': No equilibration */
  456. /* > = 'Y': Both row and column equilibration, i.e., A has been */
  457. /* > replaced by diag(S) * A * diag(S). */
  458. /* > The right hand side B has been changed accordingly. */
  459. /* > \endverbatim */
  460. /* > */
  461. /* > \param[in] N */
  462. /* > \verbatim */
  463. /* > N is INTEGER */
  464. /* > The order of the matrix A. N >= 0. */
  465. /* > \endverbatim */
  466. /* > */
  467. /* > \param[in] NRHS */
  468. /* > \verbatim */
  469. /* > NRHS is INTEGER */
  470. /* > The number of right hand sides, i.e., the number of columns */
  471. /* > of the matrices B and X. NRHS >= 0. */
  472. /* > \endverbatim */
  473. /* > */
  474. /* > \param[in] A */
  475. /* > \verbatim */
  476. /* > A is REAL array, dimension (LDA,N) */
  477. /* > The symmetric matrix A. If UPLO = 'U', the leading N-by-N */
  478. /* > upper triangular part of A contains the upper triangular */
  479. /* > part of the matrix A, and the strictly lower triangular */
  480. /* > part of A is not referenced. If UPLO = 'L', the leading */
  481. /* > N-by-N lower triangular part of A contains the lower */
  482. /* > triangular part of the matrix A, and the strictly upper */
  483. /* > triangular part of A is not referenced. */
  484. /* > \endverbatim */
  485. /* > */
  486. /* > \param[in] LDA */
  487. /* > \verbatim */
  488. /* > LDA is INTEGER */
  489. /* > The leading dimension of the array A. LDA >= f2cmax(1,N). */
  490. /* > \endverbatim */
  491. /* > */
  492. /* > \param[in] AF */
  493. /* > \verbatim */
  494. /* > AF is REAL array, dimension (LDAF,N) */
  495. /* > The factored form of the matrix A. AF contains the block */
  496. /* > diagonal matrix D and the multipliers used to obtain the */
  497. /* > factor U or L from the factorization A = U*D*U**T or A = */
  498. /* > L*D*L**T as computed by SSYTRF. */
  499. /* > \endverbatim */
  500. /* > */
  501. /* > \param[in] LDAF */
  502. /* > \verbatim */
  503. /* > LDAF is INTEGER */
  504. /* > The leading dimension of the array AF. LDAF >= f2cmax(1,N). */
  505. /* > \endverbatim */
  506. /* > */
  507. /* > \param[in] IPIV */
  508. /* > \verbatim */
  509. /* > IPIV is INTEGER array, dimension (N) */
  510. /* > Details of the interchanges and the block structure of D */
  511. /* > as determined by SSYTRF. */
  512. /* > \endverbatim */
  513. /* > */
  514. /* > \param[in,out] S */
  515. /* > \verbatim */
  516. /* > S is REAL array, dimension (N) */
  517. /* > The scale factors for A. If EQUED = 'Y', A is multiplied on */
  518. /* > the left and right by diag(S). S is an input argument if FACT = */
  519. /* > 'F'; otherwise, S is an output argument. If FACT = 'F' and EQUED */
  520. /* > = 'Y', each element of S must be positive. If S is output, each */
  521. /* > element of S is a power of the radix. If S is input, each element */
  522. /* > of S should be a power of the radix to ensure a reliable solution */
  523. /* > and error estimates. Scaling by powers of the radix does not cause */
  524. /* > rounding errors unless the result underflows or overflows. */
  525. /* > Rounding errors during scaling lead to refining with a matrix that */
  526. /* > is not equivalent to the input matrix, producing error estimates */
  527. /* > that may not be reliable. */
  528. /* > \endverbatim */
  529. /* > */
  530. /* > \param[in] B */
  531. /* > \verbatim */
  532. /* > B is REAL array, dimension (LDB,NRHS) */
  533. /* > The right hand side matrix B. */
  534. /* > \endverbatim */
  535. /* > */
  536. /* > \param[in] LDB */
  537. /* > \verbatim */
  538. /* > LDB is INTEGER */
  539. /* > The leading dimension of the array B. LDB >= f2cmax(1,N). */
  540. /* > \endverbatim */
  541. /* > */
  542. /* > \param[in,out] X */
  543. /* > \verbatim */
  544. /* > X is REAL array, dimension (LDX,NRHS) */
  545. /* > On entry, the solution matrix X, as computed by SGETRS. */
  546. /* > On exit, the improved solution matrix X. */
  547. /* > \endverbatim */
  548. /* > */
  549. /* > \param[in] LDX */
  550. /* > \verbatim */
  551. /* > LDX is INTEGER */
  552. /* > The leading dimension of the array X. LDX >= f2cmax(1,N). */
  553. /* > \endverbatim */
  554. /* > */
  555. /* > \param[out] RCOND */
  556. /* > \verbatim */
  557. /* > RCOND is REAL */
  558. /* > Reciprocal scaled condition number. This is an estimate of the */
  559. /* > reciprocal Skeel condition number of the matrix A after */
  560. /* > equilibration (if done). If this is less than the machine */
  561. /* > precision (in particular, if it is zero), the matrix is singular */
  562. /* > to working precision. Note that the error may still be small even */
  563. /* > if this number is very small and the matrix appears ill- */
  564. /* > conditioned. */
  565. /* > \endverbatim */
  566. /* > */
  567. /* > \param[out] BERR */
  568. /* > \verbatim */
  569. /* > BERR is REAL array, dimension (NRHS) */
  570. /* > Componentwise relative backward error. This is the */
  571. /* > componentwise relative backward error of each solution vector X(j) */
  572. /* > (i.e., the smallest relative change in any element of A or B that */
  573. /* > makes X(j) an exact solution). */
  574. /* > \endverbatim */
  575. /* > */
  576. /* > \param[in] N_ERR_BNDS */
  577. /* > \verbatim */
  578. /* > N_ERR_BNDS is INTEGER */
  579. /* > Number of error bounds to return for each right hand side */
  580. /* > and each type (normwise or componentwise). See ERR_BNDS_NORM and */
  581. /* > ERR_BNDS_COMP below. */
  582. /* > \endverbatim */
  583. /* > */
  584. /* > \param[out] ERR_BNDS_NORM */
  585. /* > \verbatim */
  586. /* > ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS) */
  587. /* > For each right-hand side, this array contains information about */
  588. /* > various error bounds and condition numbers corresponding to the */
  589. /* > normwise relative error, which is defined as follows: */
  590. /* > */
  591. /* > Normwise relative error in the ith solution vector: */
  592. /* > max_j (abs(XTRUE(j,i) - X(j,i))) */
  593. /* > ------------------------------ */
  594. /* > max_j abs(X(j,i)) */
  595. /* > */
  596. /* > The array is indexed by the type of error information as described */
  597. /* > below. There currently are up to three pieces of information */
  598. /* > returned. */
  599. /* > */
  600. /* > The first index in ERR_BNDS_NORM(i,:) corresponds to the ith */
  601. /* > right-hand side. */
  602. /* > */
  603. /* > The second index in ERR_BNDS_NORM(:,err) contains the following */
  604. /* > three fields: */
  605. /* > err = 1 "Trust/don't trust" boolean. Trust the answer if the */
  606. /* > reciprocal condition number is less than the threshold */
  607. /* > sqrt(n) * slamch('Epsilon'). */
  608. /* > */
  609. /* > err = 2 "Guaranteed" error bound: The estimated forward error, */
  610. /* > almost certainly within a factor of 10 of the true error */
  611. /* > so long as the next entry is greater than the threshold */
  612. /* > sqrt(n) * slamch('Epsilon'). This error bound should only */
  613. /* > be trusted if the previous boolean is true. */
  614. /* > */
  615. /* > err = 3 Reciprocal condition number: Estimated normwise */
  616. /* > reciprocal condition number. Compared with the threshold */
  617. /* > sqrt(n) * slamch('Epsilon') to determine if the error */
  618. /* > estimate is "guaranteed". These reciprocal condition */
  619. /* > numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
  620. /* > appropriately scaled matrix Z. */
  621. /* > Let Z = S*A, where S scales each row by a power of the */
  622. /* > radix so all absolute row sums of Z are approximately 1. */
  623. /* > */
  624. /* > See Lapack Working Note 165 for further details and extra */
  625. /* > cautions. */
  626. /* > \endverbatim */
  627. /* > */
  628. /* > \param[out] ERR_BNDS_COMP */
  629. /* > \verbatim */
  630. /* > ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS) */
  631. /* > For each right-hand side, this array contains information about */
  632. /* > various error bounds and condition numbers corresponding to the */
  633. /* > componentwise relative error, which is defined as follows: */
  634. /* > */
  635. /* > Componentwise relative error in the ith solution vector: */
  636. /* > abs(XTRUE(j,i) - X(j,i)) */
  637. /* > max_j ---------------------- */
  638. /* > abs(X(j,i)) */
  639. /* > */
  640. /* > The array is indexed by the right-hand side i (on which the */
  641. /* > componentwise relative error depends), and the type of error */
  642. /* > information as described below. There currently are up to three */
  643. /* > pieces of information returned for each right-hand side. If */
  644. /* > componentwise accuracy is not requested (PARAMS(3) = 0.0), then */
  645. /* > ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most */
  646. /* > the first (:,N_ERR_BNDS) entries are returned. */
  647. /* > */
  648. /* > The first index in ERR_BNDS_COMP(i,:) corresponds to the ith */
  649. /* > right-hand side. */
  650. /* > */
  651. /* > The second index in ERR_BNDS_COMP(:,err) contains the following */
  652. /* > three fields: */
  653. /* > err = 1 "Trust/don't trust" boolean. Trust the answer if the */
  654. /* > reciprocal condition number is less than the threshold */
  655. /* > sqrt(n) * slamch('Epsilon'). */
  656. /* > */
  657. /* > err = 2 "Guaranteed" error bound: The estimated forward error, */
  658. /* > almost certainly within a factor of 10 of the true error */
  659. /* > so long as the next entry is greater than the threshold */
  660. /* > sqrt(n) * slamch('Epsilon'). This error bound should only */
  661. /* > be trusted if the previous boolean is true. */
  662. /* > */
  663. /* > err = 3 Reciprocal condition number: Estimated componentwise */
  664. /* > reciprocal condition number. Compared with the threshold */
  665. /* > sqrt(n) * slamch('Epsilon') to determine if the error */
  666. /* > estimate is "guaranteed". These reciprocal condition */
  667. /* > numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
  668. /* > appropriately scaled matrix Z. */
  669. /* > Let Z = S*(A*diag(x)), where x is the solution for the */
  670. /* > current right-hand side and S scales each row of */
  671. /* > A*diag(x) by a power of the radix so all absolute row */
  672. /* > sums of Z are approximately 1. */
  673. /* > */
  674. /* > See Lapack Working Note 165 for further details and extra */
  675. /* > cautions. */
  676. /* > \endverbatim */
  677. /* > */
  678. /* > \param[in] NPARAMS */
  679. /* > \verbatim */
  680. /* > NPARAMS is INTEGER */
  681. /* > Specifies the number of parameters set in PARAMS. If <= 0, the */
  682. /* > PARAMS array is never referenced and default values are used. */
  683. /* > \endverbatim */
  684. /* > */
  685. /* > \param[in,out] PARAMS */
  686. /* > \verbatim */
  687. /* > PARAMS is REAL array, dimension NPARAMS */
  688. /* > Specifies algorithm parameters. If an entry is < 0.0, then */
  689. /* > that entry will be filled with default value used for that */
  690. /* > parameter. Only positions up to NPARAMS are accessed; defaults */
  691. /* > are used for higher-numbered parameters. */
  692. /* > */
  693. /* > PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative */
  694. /* > refinement or not. */
  695. /* > Default: 1.0 */
  696. /* > = 0.0: No refinement is performed, and no error bounds are */
  697. /* > computed. */
  698. /* > = 1.0: Use the double-precision refinement algorithm, */
  699. /* > possibly with doubled-single computations if the */
  700. /* > compilation environment does not support DOUBLE */
  701. /* > PRECISION. */
  702. /* > (other values are reserved for future use) */
  703. /* > */
  704. /* > PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual */
  705. /* > computations allowed for refinement. */
  706. /* > Default: 10 */
  707. /* > Aggressive: Set to 100 to permit convergence using approximate */
  708. /* > factorizations or factorizations other than LU. If */
  709. /* > the factorization uses a technique other than */
  710. /* > Gaussian elimination, the guarantees in */
  711. /* > err_bnds_norm and err_bnds_comp may no longer be */
  712. /* > trustworthy. */
  713. /* > */
  714. /* > PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code */
  715. /* > will attempt to find a solution with small componentwise */
  716. /* > relative error in the double-precision algorithm. Positive */
  717. /* > is true, 0.0 is false. */
  718. /* > Default: 1.0 (attempt componentwise convergence) */
  719. /* > \endverbatim */
  720. /* > */
  721. /* > \param[out] WORK */
  722. /* > \verbatim */
  723. /* > WORK is REAL array, dimension (4*N) */
  724. /* > \endverbatim */
  725. /* > */
  726. /* > \param[out] IWORK */
  727. /* > \verbatim */
  728. /* > IWORK is INTEGER array, dimension (N) */
  729. /* > \endverbatim */
  730. /* > */
  731. /* > \param[out] INFO */
  732. /* > \verbatim */
  733. /* > INFO is INTEGER */
  734. /* > = 0: Successful exit. The solution to every right-hand side is */
  735. /* > guaranteed. */
  736. /* > < 0: If INFO = -i, the i-th argument had an illegal value */
  737. /* > > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization */
  738. /* > has been completed, but the factor U is exactly singular, so */
  739. /* > the solution and error bounds could not be computed. RCOND = 0 */
  740. /* > is returned. */
  741. /* > = N+J: The solution corresponding to the Jth right-hand side is */
  742. /* > not guaranteed. The solutions corresponding to other right- */
  743. /* > hand sides K with K > J may not be guaranteed as well, but */
  744. /* > only the first such right-hand side is reported. If a small */
  745. /* > componentwise error is not requested (PARAMS(3) = 0.0) then */
  746. /* > the Jth right-hand side is the first with a normwise error */
  747. /* > bound that is not guaranteed (the smallest J such */
  748. /* > that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) */
  749. /* > the Jth right-hand side is the first with either a normwise or */
  750. /* > componentwise error bound that is not guaranteed (the smallest */
  751. /* > J such that either ERR_BNDS_NORM(J,1) = 0.0 or */
  752. /* > ERR_BNDS_COMP(J,1) = 0.0). See the definition of */
  753. /* > ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information */
  754. /* > about all of the right-hand sides check ERR_BNDS_NORM or */
  755. /* > ERR_BNDS_COMP. */
  756. /* > \endverbatim */
  757. /* Authors: */
  758. /* ======== */
  759. /* > \author Univ. of Tennessee */
  760. /* > \author Univ. of California Berkeley */
  761. /* > \author Univ. of Colorado Denver */
  762. /* > \author NAG Ltd. */
  763. /* > \date April 2012 */
  764. /* > \ingroup realSYcomputational */
  765. /* ===================================================================== */
  766. /* Subroutine */ void ssyrfsx_(char *uplo, char *equed, integer *n, integer *
  767. nrhs, real *a, integer *lda, real *af, integer *ldaf, integer *ipiv,
  768. real *s, real *b, integer *ldb, real *x, integer *ldx, real *rcond,
  769. real *berr, integer *n_err_bnds__, real *err_bnds_norm__, real *
  770. err_bnds_comp__, integer *nparams, real *params, real *work, integer *
  771. iwork, integer *info)
  772. {
  773. /* System generated locals */
  774. integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, x_dim1,
  775. x_offset, err_bnds_norm_dim1, err_bnds_norm_offset,
  776. err_bnds_comp_dim1, err_bnds_comp_offset, i__1;
  777. real r__1, r__2;
  778. /* Local variables */
  779. real illrcond_thresh__, unstable_thresh__, err_lbnd__;
  780. extern /* Subroutine */ void sla_syrfsx_extended_(integer *, char *,
  781. integer *, integer *, real *, integer *, real *, integer *,
  782. integer *, logical *, real *, real *, integer *, real *, integer *
  783. , real *, integer *, real *, real *, real *, real *, real *, real
  784. *, real *, integer *, real *, real *, logical *, integer *);
  785. char norm[1];
  786. integer ref_type__;
  787. logical ignore_cwise__;
  788. integer j;
  789. extern logical lsame_(char *, char *);
  790. real anorm;
  791. logical rcequ;
  792. real rcond_tmp__;
  793. integer prec_type__;
  794. extern real slamch_(char *);
  795. extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
  796. extern real slansy_(char *, char *, integer *, real *, integer *, real *);
  797. extern /* Subroutine */ void ssycon_(char *, integer *, real *, integer *,
  798. integer *, real *, real *, real *, integer *, integer *);
  799. extern integer ilaprec_(char *);
  800. integer ithresh, n_norms__;
  801. real rthresh;
  802. extern real sla_syrcond_(char *, integer *, real *, integer *, real *,
  803. integer *, integer *, integer *, real *, integer *, real *,
  804. integer *);
  805. real cwise_wrong__;
  806. /* -- LAPACK computational routine (version 3.7.0) -- */
  807. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  808. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  809. /* April 2012 */
  810. /* ================================================================== */
  811. /* Check the input parameters. */
  812. /* Parameter adjustments */
  813. err_bnds_comp_dim1 = *nrhs;
  814. err_bnds_comp_offset = 1 + err_bnds_comp_dim1 * 1;
  815. err_bnds_comp__ -= err_bnds_comp_offset;
  816. err_bnds_norm_dim1 = *nrhs;
  817. err_bnds_norm_offset = 1 + err_bnds_norm_dim1 * 1;
  818. err_bnds_norm__ -= err_bnds_norm_offset;
  819. a_dim1 = *lda;
  820. a_offset = 1 + a_dim1 * 1;
  821. a -= a_offset;
  822. af_dim1 = *ldaf;
  823. af_offset = 1 + af_dim1 * 1;
  824. af -= af_offset;
  825. --ipiv;
  826. --s;
  827. b_dim1 = *ldb;
  828. b_offset = 1 + b_dim1 * 1;
  829. b -= b_offset;
  830. x_dim1 = *ldx;
  831. x_offset = 1 + x_dim1 * 1;
  832. x -= x_offset;
  833. --berr;
  834. --params;
  835. --work;
  836. --iwork;
  837. /* Function Body */
  838. *info = 0;
  839. ref_type__ = 1;
  840. if (*nparams >= 1) {
  841. if (params[1] < 0.f) {
  842. params[1] = 1.f;
  843. } else {
  844. ref_type__ = params[1];
  845. }
  846. }
  847. /* Set default parameters. */
  848. illrcond_thresh__ = (real) (*n) * slamch_("Epsilon");
  849. ithresh = 10;
  850. rthresh = .5f;
  851. unstable_thresh__ = .25f;
  852. ignore_cwise__ = FALSE_;
  853. if (*nparams >= 2) {
  854. if (params[2] < 0.f) {
  855. params[2] = (real) ithresh;
  856. } else {
  857. ithresh = (integer) params[2];
  858. }
  859. }
  860. if (*nparams >= 3) {
  861. if (params[3] < 0.f) {
  862. if (ignore_cwise__) {
  863. params[3] = 0.f;
  864. } else {
  865. params[3] = 1.f;
  866. }
  867. } else {
  868. ignore_cwise__ = params[3] == 0.f;
  869. }
  870. }
  871. if (ref_type__ == 0 || *n_err_bnds__ == 0) {
  872. n_norms__ = 0;
  873. } else if (ignore_cwise__) {
  874. n_norms__ = 1;
  875. } else {
  876. n_norms__ = 2;
  877. }
  878. rcequ = lsame_(equed, "Y");
  879. /* Test input parameters. */
  880. if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
  881. *info = -1;
  882. } else if (! rcequ && ! lsame_(equed, "N")) {
  883. *info = -2;
  884. } else if (*n < 0) {
  885. *info = -3;
  886. } else if (*nrhs < 0) {
  887. *info = -4;
  888. } else if (*lda < f2cmax(1,*n)) {
  889. *info = -6;
  890. } else if (*ldaf < f2cmax(1,*n)) {
  891. *info = -8;
  892. } else if (*ldb < f2cmax(1,*n)) {
  893. *info = -12;
  894. } else if (*ldx < f2cmax(1,*n)) {
  895. *info = -14;
  896. }
  897. if (*info != 0) {
  898. i__1 = -(*info);
  899. xerbla_("SSYRFSX", &i__1, (ftnlen)7);
  900. return;
  901. }
  902. /* Quick return if possible. */
  903. if (*n == 0 || *nrhs == 0) {
  904. *rcond = 1.f;
  905. i__1 = *nrhs;
  906. for (j = 1; j <= i__1; ++j) {
  907. berr[j] = 0.f;
  908. if (*n_err_bnds__ >= 1) {
  909. err_bnds_norm__[j + err_bnds_norm_dim1] = 1.f;
  910. err_bnds_comp__[j + err_bnds_comp_dim1] = 1.f;
  911. }
  912. if (*n_err_bnds__ >= 2) {
  913. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 0.f;
  914. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 0.f;
  915. }
  916. if (*n_err_bnds__ >= 3) {
  917. err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = 1.f;
  918. err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = 1.f;
  919. }
  920. }
  921. return;
  922. }
  923. /* Default to failure. */
  924. *rcond = 0.f;
  925. i__1 = *nrhs;
  926. for (j = 1; j <= i__1; ++j) {
  927. berr[j] = 1.f;
  928. if (*n_err_bnds__ >= 1) {
  929. err_bnds_norm__[j + err_bnds_norm_dim1] = 1.f;
  930. err_bnds_comp__[j + err_bnds_comp_dim1] = 1.f;
  931. }
  932. if (*n_err_bnds__ >= 2) {
  933. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.f;
  934. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.f;
  935. }
  936. if (*n_err_bnds__ >= 3) {
  937. err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = 0.f;
  938. err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = 0.f;
  939. }
  940. }
  941. /* Compute the norm of A and the reciprocal of the condition */
  942. /* number of A. */
  943. *(unsigned char *)norm = 'I';
  944. anorm = slansy_(norm, uplo, n, &a[a_offset], lda, &work[1]);
  945. ssycon_(uplo, n, &af[af_offset], ldaf, &ipiv[1], &anorm, rcond, &work[1],
  946. &iwork[1], info);
  947. /* Perform refinement on each right-hand side */
  948. if (ref_type__ != 0) {
  949. prec_type__ = ilaprec_("D");
  950. sla_syrfsx_extended_(&prec_type__, uplo, n, nrhs, &a[a_offset], lda,
  951. &af[af_offset], ldaf, &ipiv[1], &rcequ, &s[1], &b[b_offset],
  952. ldb, &x[x_offset], ldx, &berr[1], &n_norms__, &
  953. err_bnds_norm__[err_bnds_norm_offset], &err_bnds_comp__[
  954. err_bnds_comp_offset], &work[*n + 1], &work[1], &work[(*n <<
  955. 1) + 1], &work[1], rcond, &ithresh, &rthresh, &
  956. unstable_thresh__, &ignore_cwise__, info);
  957. }
  958. /* Computing MAX */
  959. r__1 = 10.f, r__2 = sqrt((real) (*n));
  960. err_lbnd__ = f2cmax(r__1,r__2) * slamch_("Epsilon");
  961. if (*n_err_bnds__ >= 1 && n_norms__ >= 1) {
  962. /* Compute scaled normwise condition number cond(A*C). */
  963. if (rcequ) {
  964. rcond_tmp__ = sla_syrcond_(uplo, n, &a[a_offset], lda, &af[
  965. af_offset], ldaf, &ipiv[1], &c_n1, &s[1], info, &work[1],
  966. &iwork[1]);
  967. } else {
  968. rcond_tmp__ = sla_syrcond_(uplo, n, &a[a_offset], lda, &af[
  969. af_offset], ldaf, &ipiv[1], &c__0, &s[1], info, &work[1],
  970. &iwork[1]);
  971. }
  972. i__1 = *nrhs;
  973. for (j = 1; j <= i__1; ++j) {
  974. /* Cap the error at 1.0. */
  975. if (*n_err_bnds__ >= 2 && err_bnds_norm__[j + (err_bnds_norm_dim1
  976. << 1)] > 1.f) {
  977. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.f;
  978. }
  979. /* Threshold the error (see LAWN). */
  980. if (rcond_tmp__ < illrcond_thresh__) {
  981. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.f;
  982. err_bnds_norm__[j + err_bnds_norm_dim1] = 0.f;
  983. if (*info <= *n) {
  984. *info = *n + j;
  985. }
  986. } else if (err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] <
  987. err_lbnd__) {
  988. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = err_lbnd__;
  989. err_bnds_norm__[j + err_bnds_norm_dim1] = 1.f;
  990. }
  991. /* Save the condition number. */
  992. if (*n_err_bnds__ >= 3) {
  993. err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = rcond_tmp__;
  994. }
  995. }
  996. }
  997. if (*n_err_bnds__ >= 1 && n_norms__ >= 2) {
  998. /* Compute componentwise condition number cond(A*diag(Y(:,J))) for */
  999. /* each right-hand side using the current solution as an estimate of */
  1000. /* the true solution. If the componentwise error estimate is too */
  1001. /* large, then the solution is a lousy estimate of truth and the */
  1002. /* estimated RCOND may be too optimistic. To avoid misleading users, */
  1003. /* the inverse condition number is set to 0.0 when the estimated */
  1004. /* cwise error is at least CWISE_WRONG. */
  1005. cwise_wrong__ = sqrt(slamch_("Epsilon"));
  1006. i__1 = *nrhs;
  1007. for (j = 1; j <= i__1; ++j) {
  1008. if (err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] <
  1009. cwise_wrong__) {
  1010. rcond_tmp__ = sla_syrcond_(uplo, n, &a[a_offset], lda, &af[
  1011. af_offset], ldaf, &ipiv[1], &c__1, &x[j * x_dim1 + 1],
  1012. info, &work[1], &iwork[1]);
  1013. } else {
  1014. rcond_tmp__ = 0.f;
  1015. }
  1016. /* Cap the error at 1.0. */
  1017. if (*n_err_bnds__ >= 2 && err_bnds_comp__[j + (err_bnds_comp_dim1
  1018. << 1)] > 1.f) {
  1019. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.f;
  1020. }
  1021. /* Threshold the error (see LAWN). */
  1022. if (rcond_tmp__ < illrcond_thresh__) {
  1023. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.f;
  1024. err_bnds_comp__[j + err_bnds_comp_dim1] = 0.f;
  1025. if (! ignore_cwise__ && *info < *n + j) {
  1026. *info = *n + j;
  1027. }
  1028. } else if (err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] <
  1029. err_lbnd__) {
  1030. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = err_lbnd__;
  1031. err_bnds_comp__[j + err_bnds_comp_dim1] = 1.f;
  1032. }
  1033. /* Save the condition number. */
  1034. if (*n_err_bnds__ >= 3) {
  1035. err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = rcond_tmp__;
  1036. }
  1037. }
  1038. }
  1039. return;
  1040. /* End of SSYRFSX */
  1041. } /* ssyrfsx_ */