dporfsx.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /* dporfsx.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. /* Table of constant values */
  14. static integer c_n1 = -1;
  15. static integer c__0 = 0;
  16. static integer c__1 = 1;
  17. /* Subroutine */ int _starpu_dporfsx_(char *uplo, char *equed, integer *n, integer *
  18. nrhs, doublereal *a, integer *lda, doublereal *af, integer *ldaf,
  19. doublereal *s, doublereal *b, integer *ldb, doublereal *x, integer *
  20. ldx, doublereal *rcond, doublereal *berr, integer *n_err_bnds__,
  21. doublereal *err_bnds_norm__, doublereal *err_bnds_comp__, integer *
  22. nparams, doublereal *params, doublereal *work, integer *iwork,
  23. integer *info)
  24. {
  25. /* System generated locals */
  26. integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, x_dim1,
  27. x_offset, err_bnds_norm_dim1, err_bnds_norm_offset,
  28. err_bnds_comp_dim1, err_bnds_comp_offset, i__1;
  29. doublereal d__1, d__2;
  30. /* Builtin functions */
  31. double sqrt(doublereal);
  32. /* Local variables */
  33. doublereal illrcond_thresh__, unstable_thresh__, err_lbnd__;
  34. integer ref_type__, j;
  35. doublereal rcond_tmp__;
  36. integer prec_type__;
  37. extern doublereal _starpu_dla_porcond__(char *, integer *, doublereal *, integer *
  38. , doublereal *, integer *, integer *, doublereal *, integer *,
  39. doublereal *, integer *, ftnlen);
  40. doublereal cwise_wrong__;
  41. extern /* Subroutine */ int _starpu_dla_porfsx_extended__(integer *, char *,
  42. integer *, integer *, doublereal *, integer *, doublereal *,
  43. integer *, logical *, doublereal *, doublereal *, integer *,
  44. doublereal *, integer *, doublereal *, integer *, doublereal *,
  45. doublereal *, doublereal *, doublereal *, doublereal *,
  46. doublereal *, doublereal *, integer *, doublereal *, doublereal *,
  47. logical *, integer *, ftnlen);
  48. char norm[1];
  49. logical ignore_cwise__;
  50. extern logical _starpu_lsame_(char *, char *);
  51. doublereal anorm;
  52. logical rcequ;
  53. extern doublereal _starpu_dlamch_(char *);
  54. extern /* Subroutine */ int _starpu_xerbla_(char *, integer *), _starpu_dpocon_(
  55. char *, integer *, doublereal *, integer *, doublereal *,
  56. doublereal *, doublereal *, integer *, integer *);
  57. extern doublereal _starpu_dlansy_(char *, char *, integer *, doublereal *,
  58. integer *, doublereal *);
  59. extern integer _starpu_ilaprec_(char *);
  60. integer ithresh, n_norms__;
  61. doublereal rthresh;
  62. /* -- LAPACK routine (version 3.2.1) -- */
  63. /* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */
  64. /* -- Jason Riedy of Univ. of California Berkeley. -- */
  65. /* -- April 2009 -- */
  66. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  67. /* -- Univ. of California Berkeley and NAG Ltd. -- */
  68. /* .. */
  69. /* .. Scalar Arguments .. */
  70. /* .. */
  71. /* .. Array Arguments .. */
  72. /* .. */
  73. /* Purpose */
  74. /* ======= */
  75. /* DPORFSX improves the computed solution to a system of linear */
  76. /* equations when the coefficient matrix is symmetric positive */
  77. /* definite, and provides error bounds and backward error estimates */
  78. /* for the solution. In addition to normwise error bound, the code */
  79. /* provides maximum componentwise error bound if possible. See */
  80. /* comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the */
  81. /* error bounds. */
  82. /* The original system of linear equations may have been equilibrated */
  83. /* before calling this routine, as described by arguments EQUED and S */
  84. /* below. In this case, the solution and error bounds returned are */
  85. /* for the original unequilibrated system. */
  86. /* Arguments */
  87. /* ========= */
  88. /* Some optional parameters are bundled in the PARAMS array. These */
  89. /* settings determine how refinement is performed, but often the */
  90. /* defaults are acceptable. If the defaults are acceptable, users */
  91. /* can pass NPARAMS = 0 which prevents the source code from accessing */
  92. /* the PARAMS argument. */
  93. /* UPLO (input) CHARACTER*1 */
  94. /* = 'U': Upper triangle of A is stored; */
  95. /* = 'L': Lower triangle of A is stored. */
  96. /* EQUED (input) CHARACTER*1 */
  97. /* Specifies the form of equilibration that was done to A */
  98. /* before calling this routine. This is needed to compute */
  99. /* the solution and error bounds correctly. */
  100. /* = 'N': No equilibration */
  101. /* = 'Y': Both row and column equilibration, i.e., A has been */
  102. /* replaced by diag(S) * A * diag(S). */
  103. /* The right hand side B has been changed accordingly. */
  104. /* N (input) INTEGER */
  105. /* The order of the matrix A. N >= 0. */
  106. /* NRHS (input) INTEGER */
  107. /* The number of right hand sides, i.e., the number of columns */
  108. /* of the matrices B and X. NRHS >= 0. */
  109. /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
  110. /* The symmetric matrix A. If UPLO = 'U', the leading N-by-N */
  111. /* upper triangular part of A contains the upper triangular part */
  112. /* of the matrix A, and the strictly lower triangular part of A */
  113. /* is not referenced. If UPLO = 'L', the leading N-by-N lower */
  114. /* triangular part of A contains the lower triangular part of */
  115. /* the matrix A, and the strictly upper triangular part of A is */
  116. /* not referenced. */
  117. /* LDA (input) INTEGER */
  118. /* The leading dimension of the array A. LDA >= max(1,N). */
  119. /* AF (input) DOUBLE PRECISION array, dimension (LDAF,N) */
  120. /* The triangular factor U or L from the Cholesky factorization */
  121. /* A = U**T*U or A = L*L**T, as computed by DPOTRF. */
  122. /* LDAF (input) INTEGER */
  123. /* The leading dimension of the array AF. LDAF >= max(1,N). */
  124. /* S (input or output) DOUBLE PRECISION array, dimension (N) */
  125. /* The row scale factors for A. If EQUED = 'Y', A is multiplied on */
  126. /* the left and right by diag(S). S is an input argument if FACT = */
  127. /* 'F'; otherwise, S is an output argument. If FACT = 'F' and EQUED */
  128. /* = 'Y', each element of S must be positive. If S is output, each */
  129. /* element of S is a power of the radix. If S is input, each element */
  130. /* of S should be a power of the radix to ensure a reliable solution */
  131. /* and error estimates. Scaling by powers of the radix does not cause */
  132. /* rounding errors unless the result underflows or overflows. */
  133. /* Rounding errors during scaling lead to refining with a matrix that */
  134. /* is not equivalent to the input matrix, producing error estimates */
  135. /* that may not be reliable. */
  136. /* B (input) DOUBLE PRECISION array, dimension (LDB,NRHS) */
  137. /* The right hand side matrix B. */
  138. /* LDB (input) INTEGER */
  139. /* The leading dimension of the array B. LDB >= max(1,N). */
  140. /* X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS) */
  141. /* On entry, the solution matrix X, as computed by DGETRS. */
  142. /* On exit, the improved solution matrix X. */
  143. /* LDX (input) INTEGER */
  144. /* The leading dimension of the array X. LDX >= max(1,N). */
  145. /* RCOND (output) DOUBLE PRECISION */
  146. /* Reciprocal scaled condition number. This is an estimate of the */
  147. /* reciprocal Skeel condition number of the matrix A after */
  148. /* equilibration (if done). If this is less than the machine */
  149. /* precision (in particular, if it is zero), the matrix is singular */
  150. /* to working precision. Note that the error may still be small even */
  151. /* if this number is very small and the matrix appears ill- */
  152. /* conditioned. */
  153. /* BERR (output) DOUBLE PRECISION array, dimension (NRHS) */
  154. /* Componentwise relative backward error. This is the */
  155. /* componentwise relative backward error of each solution vector X(j) */
  156. /* (i.e., the smallest relative change in any element of A or B that */
  157. /* makes X(j) an exact solution). */
  158. /* N_ERR_BNDS (input) INTEGER */
  159. /* Number of error bounds to return for each right hand side */
  160. /* and each type (normwise or componentwise). See ERR_BNDS_NORM and */
  161. /* ERR_BNDS_COMP below. */
  162. /* ERR_BNDS_NORM (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) */
  163. /* For each right-hand side, this array contains information about */
  164. /* various error bounds and condition numbers corresponding to the */
  165. /* normwise relative error, which is defined as follows: */
  166. /* Normwise relative error in the ith solution vector: */
  167. /* max_j (abs(XTRUE(j,i) - X(j,i))) */
  168. /* ------------------------------ */
  169. /* max_j abs(X(j,i)) */
  170. /* The array is indexed by the type of error information as described */
  171. /* below. There currently are up to three pieces of information */
  172. /* returned. */
  173. /* The first index in ERR_BNDS_NORM(i,:) corresponds to the ith */
  174. /* right-hand side. */
  175. /* The second index in ERR_BNDS_NORM(:,err) contains the following */
  176. /* three fields: */
  177. /* err = 1 "Trust/don't trust" boolean. Trust the answer if the */
  178. /* reciprocal condition number is less than the threshold */
  179. /* sqrt(n) * dlamch('Epsilon'). */
  180. /* err = 2 "Guaranteed" error bound: The estimated forward error, */
  181. /* almost certainly within a factor of 10 of the true error */
  182. /* so long as the next entry is greater than the threshold */
  183. /* sqrt(n) * dlamch('Epsilon'). This error bound should only */
  184. /* be trusted if the previous boolean is true. */
  185. /* err = 3 Reciprocal condition number: Estimated normwise */
  186. /* reciprocal condition number. Compared with the threshold */
  187. /* sqrt(n) * dlamch('Epsilon') to determine if the error */
  188. /* estimate is "guaranteed". These reciprocal condition */
  189. /* numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
  190. /* appropriately scaled matrix Z. */
  191. /* Let Z = S*A, where S scales each row by a power of the */
  192. /* radix so all absolute row sums of Z are approximately 1. */
  193. /* See Lapack Working Note 165 for further details and extra */
  194. /* cautions. */
  195. /* ERR_BNDS_COMP (output) DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS) */
  196. /* For each right-hand side, this array contains information about */
  197. /* various error bounds and condition numbers corresponding to the */
  198. /* componentwise relative error, which is defined as follows: */
  199. /* Componentwise relative error in the ith solution vector: */
  200. /* abs(XTRUE(j,i) - X(j,i)) */
  201. /* max_j ---------------------- */
  202. /* abs(X(j,i)) */
  203. /* The array is indexed by the right-hand side i (on which the */
  204. /* componentwise relative error depends), and the type of error */
  205. /* information as described below. There currently are up to three */
  206. /* pieces of information returned for each right-hand side. If */
  207. /* componentwise accuracy is not requested (PARAMS(3) = 0.0), then */
  208. /* ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most */
  209. /* the first (:,N_ERR_BNDS) entries are returned. */
  210. /* The first index in ERR_BNDS_COMP(i,:) corresponds to the ith */
  211. /* right-hand side. */
  212. /* The second index in ERR_BNDS_COMP(:,err) contains the following */
  213. /* three fields: */
  214. /* err = 1 "Trust/don't trust" boolean. Trust the answer if the */
  215. /* reciprocal condition number is less than the threshold */
  216. /* sqrt(n) * dlamch('Epsilon'). */
  217. /* err = 2 "Guaranteed" error bound: The estimated forward error, */
  218. /* almost certainly within a factor of 10 of the true error */
  219. /* so long as the next entry is greater than the threshold */
  220. /* sqrt(n) * dlamch('Epsilon'). This error bound should only */
  221. /* be trusted if the previous boolean is true. */
  222. /* err = 3 Reciprocal condition number: Estimated componentwise */
  223. /* reciprocal condition number. Compared with the threshold */
  224. /* sqrt(n) * dlamch('Epsilon') to determine if the error */
  225. /* estimate is "guaranteed". These reciprocal condition */
  226. /* numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some */
  227. /* appropriately scaled matrix Z. */
  228. /* Let Z = S*(A*diag(x)), where x is the solution for the */
  229. /* current right-hand side and S scales each row of */
  230. /* A*diag(x) by a power of the radix so all absolute row */
  231. /* sums of Z are approximately 1. */
  232. /* See Lapack Working Note 165 for further details and extra */
  233. /* cautions. */
  234. /* NPARAMS (input) INTEGER */
  235. /* Specifies the number of parameters set in PARAMS. If .LE. 0, the */
  236. /* PARAMS array is never referenced and default values are used. */
  237. /* PARAMS (input / output) DOUBLE PRECISION array, dimension NPARAMS */
  238. /* Specifies algorithm parameters. If an entry is .LT. 0.0, then */
  239. /* that entry will be filled with default value used for that */
  240. /* parameter. Only positions up to NPARAMS are accessed; defaults */
  241. /* are used for higher-numbered parameters. */
  242. /* PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative */
  243. /* refinement or not. */
  244. /* Default: 1.0D+0 */
  245. /* = 0.0 : No refinement is performed, and no error bounds are */
  246. /* computed. */
  247. /* = 1.0 : Use the double-precision refinement algorithm, */
  248. /* possibly with doubled-single computations if the */
  249. /* compilation environment does not support DOUBLE */
  250. /* PRECISION. */
  251. /* (other values are reserved for future use) */
  252. /* PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual */
  253. /* computations allowed for refinement. */
  254. /* Default: 10 */
  255. /* Aggressive: Set to 100 to permit convergence using approximate */
  256. /* factorizations or factorizations other than LU. If */
  257. /* the factorization uses a technique other than */
  258. /* Gaussian elimination, the guarantees in */
  259. /* err_bnds_norm and err_bnds_comp may no longer be */
  260. /* trustworthy. */
  261. /* PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code */
  262. /* will attempt to find a solution with small componentwise */
  263. /* relative error in the double-precision algorithm. Positive */
  264. /* is true, 0.0 is false. */
  265. /* Default: 1.0 (attempt componentwise convergence) */
  266. /* WORK (workspace) DOUBLE PRECISION array, dimension (4*N) */
  267. /* IWORK (workspace) INTEGER array, dimension (N) */
  268. /* INFO (output) INTEGER */
  269. /* = 0: Successful exit. The solution to every right-hand side is */
  270. /* guaranteed. */
  271. /* < 0: If INFO = -i, the i-th argument had an illegal value */
  272. /* > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization */
  273. /* has been completed, but the factor U is exactly singular, so */
  274. /* the solution and error bounds could not be computed. RCOND = 0 */
  275. /* is returned. */
  276. /* = N+J: The solution corresponding to the Jth right-hand side is */
  277. /* not guaranteed. The solutions corresponding to other right- */
  278. /* hand sides K with K > J may not be guaranteed as well, but */
  279. /* only the first such right-hand side is reported. If a small */
  280. /* componentwise error is not requested (PARAMS(3) = 0.0) then */
  281. /* the Jth right-hand side is the first with a normwise error */
  282. /* bound that is not guaranteed (the smallest J such */
  283. /* that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) */
  284. /* the Jth right-hand side is the first with either a normwise or */
  285. /* componentwise error bound that is not guaranteed (the smallest */
  286. /* J such that either ERR_BNDS_NORM(J,1) = 0.0 or */
  287. /* ERR_BNDS_COMP(J,1) = 0.0). See the definition of */
  288. /* ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information */
  289. /* about all of the right-hand sides check ERR_BNDS_NORM or */
  290. /* ERR_BNDS_COMP. */
  291. /* ================================================================== */
  292. /* .. Parameters .. */
  293. /* .. */
  294. /* .. Local Scalars .. */
  295. /* .. */
  296. /* .. External Subroutines .. */
  297. /* .. */
  298. /* .. Intrinsic Functions .. */
  299. /* .. */
  300. /* .. External Functions .. */
  301. /* .. */
  302. /* .. Executable Statements .. */
  303. /* Check the input parameters. */
  304. /* Parameter adjustments */
  305. err_bnds_comp_dim1 = *nrhs;
  306. err_bnds_comp_offset = 1 + err_bnds_comp_dim1;
  307. err_bnds_comp__ -= err_bnds_comp_offset;
  308. err_bnds_norm_dim1 = *nrhs;
  309. err_bnds_norm_offset = 1 + err_bnds_norm_dim1;
  310. err_bnds_norm__ -= err_bnds_norm_offset;
  311. a_dim1 = *lda;
  312. a_offset = 1 + a_dim1;
  313. a -= a_offset;
  314. af_dim1 = *ldaf;
  315. af_offset = 1 + af_dim1;
  316. af -= af_offset;
  317. --s;
  318. b_dim1 = *ldb;
  319. b_offset = 1 + b_dim1;
  320. b -= b_offset;
  321. x_dim1 = *ldx;
  322. x_offset = 1 + x_dim1;
  323. x -= x_offset;
  324. --berr;
  325. --params;
  326. --work;
  327. --iwork;
  328. /* Function Body */
  329. *info = 0;
  330. ref_type__ = 1;
  331. if (*nparams >= 1) {
  332. if (params[1] < 0.) {
  333. params[1] = 1.;
  334. } else {
  335. ref_type__ = (integer) params[1];
  336. }
  337. }
  338. /* Set default parameters. */
  339. illrcond_thresh__ = (doublereal) (*n) * _starpu_dlamch_("Epsilon");
  340. ithresh = 10;
  341. rthresh = .5;
  342. unstable_thresh__ = .25;
  343. ignore_cwise__ = FALSE_;
  344. if (*nparams >= 2) {
  345. if (params[2] < 0.) {
  346. params[2] = (doublereal) ithresh;
  347. } else {
  348. ithresh = (integer) params[2];
  349. }
  350. }
  351. if (*nparams >= 3) {
  352. if (params[3] < 0.) {
  353. if (ignore_cwise__) {
  354. params[3] = 0.;
  355. } else {
  356. params[3] = 1.;
  357. }
  358. } else {
  359. ignore_cwise__ = params[3] == 0.;
  360. }
  361. }
  362. if (ref_type__ == 0 || *n_err_bnds__ == 0) {
  363. n_norms__ = 0;
  364. } else if (ignore_cwise__) {
  365. n_norms__ = 1;
  366. } else {
  367. n_norms__ = 2;
  368. }
  369. rcequ = _starpu_lsame_(equed, "Y");
  370. /* Test input parameters. */
  371. if (! _starpu_lsame_(uplo, "U") && ! _starpu_lsame_(uplo, "L")) {
  372. *info = -1;
  373. } else if (! rcequ && ! _starpu_lsame_(equed, "N")) {
  374. *info = -2;
  375. } else if (*n < 0) {
  376. *info = -3;
  377. } else if (*nrhs < 0) {
  378. *info = -4;
  379. } else if (*lda < max(1,*n)) {
  380. *info = -6;
  381. } else if (*ldaf < max(1,*n)) {
  382. *info = -8;
  383. } else if (*ldb < max(1,*n)) {
  384. *info = -11;
  385. } else if (*ldx < max(1,*n)) {
  386. *info = -13;
  387. }
  388. if (*info != 0) {
  389. i__1 = -(*info);
  390. _starpu_xerbla_("DPORFSX", &i__1);
  391. return 0;
  392. }
  393. /* Quick return if possible. */
  394. if (*n == 0 || *nrhs == 0) {
  395. *rcond = 1.;
  396. i__1 = *nrhs;
  397. for (j = 1; j <= i__1; ++j) {
  398. berr[j] = 0.;
  399. if (*n_err_bnds__ >= 1) {
  400. err_bnds_norm__[j + err_bnds_norm_dim1] = 1.;
  401. err_bnds_comp__[j + err_bnds_comp_dim1] = 1.;
  402. } else if (*n_err_bnds__ >= 2) {
  403. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 0.;
  404. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 0.;
  405. } else if (*n_err_bnds__ >= 3) {
  406. err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = 1.;
  407. err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = 1.;
  408. }
  409. }
  410. return 0;
  411. }
  412. /* Default to failure. */
  413. *rcond = 0.;
  414. i__1 = *nrhs;
  415. for (j = 1; j <= i__1; ++j) {
  416. berr[j] = 1.;
  417. if (*n_err_bnds__ >= 1) {
  418. err_bnds_norm__[j + err_bnds_norm_dim1] = 1.;
  419. err_bnds_comp__[j + err_bnds_comp_dim1] = 1.;
  420. } else if (*n_err_bnds__ >= 2) {
  421. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.;
  422. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.;
  423. } else if (*n_err_bnds__ >= 3) {
  424. err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = 0.;
  425. err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = 0.;
  426. }
  427. }
  428. /* Compute the norm of A and the reciprocal of the condition */
  429. /* number of A. */
  430. *(unsigned char *)norm = 'I';
  431. anorm = _starpu_dlansy_(norm, uplo, n, &a[a_offset], lda, &work[1]);
  432. _starpu_dpocon_(uplo, n, &af[af_offset], ldaf, &anorm, rcond, &work[1], &iwork[1],
  433. info);
  434. /* Perform refinement on each right-hand side */
  435. if (ref_type__ != 0) {
  436. prec_type__ = _starpu_ilaprec_("E");
  437. _starpu_dla_porfsx_extended__(&prec_type__, uplo, n, nrhs, &a[a_offset], lda,
  438. &af[af_offset], ldaf, &rcequ, &s[1], &b[b_offset], ldb, &x[
  439. x_offset], ldx, &berr[1], &n_norms__, &err_bnds_norm__[
  440. err_bnds_norm_offset], &err_bnds_comp__[err_bnds_comp_offset],
  441. &work[*n + 1], &work[1], &work[(*n << 1) + 1], &work[1],
  442. rcond, &ithresh, &rthresh, &unstable_thresh__, &
  443. ignore_cwise__, info, (ftnlen)1);
  444. }
  445. /* Computing MAX */
  446. d__1 = 10., d__2 = sqrt((doublereal) (*n));
  447. err_lbnd__ = max(d__1,d__2) * _starpu_dlamch_("Epsilon");
  448. if (*n_err_bnds__ >= 1 && n_norms__ >= 1) {
  449. /* Compute scaled normwise condition number cond(A*C). */
  450. if (rcequ) {
  451. rcond_tmp__ = _starpu_dla_porcond__(uplo, n, &a[a_offset], lda, &af[
  452. af_offset], ldaf, &c_n1, &s[1], info, &work[1], &iwork[1],
  453. (ftnlen)1);
  454. } else {
  455. rcond_tmp__ = _starpu_dla_porcond__(uplo, n, &a[a_offset], lda, &af[
  456. af_offset], ldaf, &c__0, &s[1], info, &work[1], &iwork[1],
  457. (ftnlen)1);
  458. }
  459. i__1 = *nrhs;
  460. for (j = 1; j <= i__1; ++j) {
  461. /* Cap the error at 1.0. */
  462. if (*n_err_bnds__ >= 2 && err_bnds_norm__[j + (err_bnds_norm_dim1
  463. << 1)] > 1.) {
  464. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.;
  465. }
  466. /* Threshold the error (see LAWN). */
  467. if (rcond_tmp__ < illrcond_thresh__) {
  468. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = 1.;
  469. err_bnds_norm__[j + err_bnds_norm_dim1] = 0.;
  470. if (*info <= *n) {
  471. *info = *n + j;
  472. }
  473. } else if (err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] <
  474. err_lbnd__) {
  475. err_bnds_norm__[j + (err_bnds_norm_dim1 << 1)] = err_lbnd__;
  476. err_bnds_norm__[j + err_bnds_norm_dim1] = 1.;
  477. }
  478. /* Save the condition number. */
  479. if (*n_err_bnds__ >= 3) {
  480. err_bnds_norm__[j + err_bnds_norm_dim1 * 3] = rcond_tmp__;
  481. }
  482. }
  483. }
  484. if (*n_err_bnds__ >= 1 && n_norms__ >= 2) {
  485. /* Compute componentwise condition number cond(A*diag(Y(:,J))) for */
  486. /* each right-hand side using the current solution as an estimate of */
  487. /* the true solution. If the componentwise error estimate is too */
  488. /* large, then the solution is a lousy estimate of truth and the */
  489. /* estimated RCOND may be too optimistic. To avoid misleading users, */
  490. /* the inverse condition number is set to 0.0 when the estimated */
  491. /* cwise error is at least CWISE_WRONG. */
  492. cwise_wrong__ = sqrt(_starpu_dlamch_("Epsilon"));
  493. i__1 = *nrhs;
  494. for (j = 1; j <= i__1; ++j) {
  495. if (err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] <
  496. cwise_wrong__) {
  497. rcond_tmp__ = _starpu_dla_porcond__(uplo, n, &a[a_offset], lda, &af[
  498. af_offset], ldaf, &c__1, &x[j * x_dim1 + 1], info, &
  499. work[1], &iwork[1], (ftnlen)1);
  500. } else {
  501. rcond_tmp__ = 0.;
  502. }
  503. /* Cap the error at 1.0. */
  504. if (*n_err_bnds__ >= 2 && err_bnds_comp__[j + (err_bnds_comp_dim1
  505. << 1)] > 1.) {
  506. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.;
  507. }
  508. /* Threshold the error (see LAWN). */
  509. if (rcond_tmp__ < illrcond_thresh__) {
  510. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = 1.;
  511. err_bnds_comp__[j + err_bnds_comp_dim1] = 0.;
  512. if (params[3] == 1. && *info < *n + j) {
  513. *info = *n + j;
  514. }
  515. } else if (err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] <
  516. err_lbnd__) {
  517. err_bnds_comp__[j + (err_bnds_comp_dim1 << 1)] = err_lbnd__;
  518. err_bnds_comp__[j + err_bnds_comp_dim1] = 1.;
  519. }
  520. /* Save the condition number. */
  521. if (*n_err_bnds__ >= 3) {
  522. err_bnds_comp__[j + err_bnds_comp_dim1 * 3] = rcond_tmp__;
  523. }
  524. }
  525. }
  526. return 0;
  527. /* End of DPORFSX */
  528. } /* _starpu_dporfsx_ */