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