dgesvx.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. /* dgesvx.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. /* Subroutine */ int _starpu_dgesvx_(char *fact, char *trans, integer *n, integer *
  14. nrhs, doublereal *a, integer *lda, doublereal *af, integer *ldaf,
  15. integer *ipiv, char *equed, doublereal *r__, doublereal *c__,
  16. doublereal *b, integer *ldb, doublereal *x, integer *ldx, doublereal *
  17. rcond, doublereal *ferr, doublereal *berr, doublereal *work, integer *
  18. iwork, integer *info)
  19. {
  20. /* System generated locals */
  21. integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, x_dim1,
  22. x_offset, i__1, i__2;
  23. doublereal d__1, d__2;
  24. /* Local variables */
  25. integer i__, j;
  26. doublereal amax;
  27. char norm[1];
  28. extern logical _starpu_lsame_(char *, char *);
  29. doublereal rcmin, rcmax, anorm;
  30. logical equil;
  31. extern doublereal _starpu_dlamch_(char *), _starpu_dlange_(char *, integer *,
  32. integer *, doublereal *, integer *, doublereal *);
  33. extern /* Subroutine */ int _starpu_dlaqge_(integer *, integer *, doublereal *,
  34. integer *, doublereal *, doublereal *, doublereal *, doublereal *,
  35. doublereal *, char *), _starpu_dgecon_(char *, integer *,
  36. doublereal *, integer *, doublereal *, doublereal *, doublereal *,
  37. integer *, integer *);
  38. doublereal colcnd;
  39. logical nofact;
  40. extern /* Subroutine */ int _starpu_dgeequ_(integer *, integer *, doublereal *,
  41. integer *, doublereal *, doublereal *, doublereal *, doublereal *,
  42. doublereal *, integer *), _starpu_dgerfs_(char *, integer *, integer *,
  43. doublereal *, integer *, doublereal *, integer *, integer *,
  44. doublereal *, integer *, doublereal *, integer *, doublereal *,
  45. doublereal *, doublereal *, integer *, integer *),
  46. _starpu_dgetrf_(integer *, integer *, doublereal *, integer *, integer *,
  47. integer *), _starpu_dlacpy_(char *, integer *, integer *, doublereal *,
  48. integer *, doublereal *, integer *), _starpu_xerbla_(char *,
  49. integer *);
  50. doublereal bignum;
  51. extern doublereal _starpu_dlantr_(char *, char *, char *, integer *, integer *,
  52. doublereal *, integer *, doublereal *);
  53. integer infequ;
  54. logical colequ;
  55. extern /* Subroutine */ int _starpu_dgetrs_(char *, integer *, integer *,
  56. doublereal *, integer *, integer *, doublereal *, integer *,
  57. integer *);
  58. doublereal rowcnd;
  59. logical notran;
  60. doublereal smlnum;
  61. logical rowequ;
  62. doublereal rpvgrw;
  63. /* -- LAPACK driver routine (version 3.2) -- */
  64. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  65. /* November 2006 */
  66. /* .. Scalar Arguments .. */
  67. /* .. */
  68. /* .. Array Arguments .. */
  69. /* .. */
  70. /* Purpose */
  71. /* ======= */
  72. /* DGESVX uses the LU factorization to compute the solution to a real */
  73. /* system of linear equations */
  74. /* A * X = B, */
  75. /* where A is an N-by-N matrix and X and B are N-by-NRHS matrices. */
  76. /* Error bounds on the solution and a condition estimate are also */
  77. /* provided. */
  78. /* Description */
  79. /* =========== */
  80. /* The following steps are performed: */
  81. /* 1. If FACT = 'E', real scaling factors are computed to equilibrate */
  82. /* the system: */
  83. /* TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B */
  84. /* TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B */
  85. /* TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B */
  86. /* Whether or not the system will be equilibrated depends on the */
  87. /* scaling of the matrix A, but if equilibration is used, A is */
  88. /* overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') */
  89. /* or diag(C)*B (if TRANS = 'T' or 'C'). */
  90. /* 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the */
  91. /* matrix A (after equilibration if FACT = 'E') as */
  92. /* A = P * L * U, */
  93. /* where P is a permutation matrix, L is a unit lower triangular */
  94. /* matrix, and U is upper triangular. */
  95. /* 3. If some U(i,i)=0, so that U is exactly singular, then the routine */
  96. /* returns with INFO = i. Otherwise, the factored form of A is used */
  97. /* to estimate the condition number of the matrix A. If the */
  98. /* reciprocal of the condition number is less than machine precision, */
  99. /* INFO = N+1 is returned as a warning, but the routine still goes on */
  100. /* to solve for X and compute error bounds as described below. */
  101. /* 4. The system of equations is solved for X using the factored form */
  102. /* of A. */
  103. /* 5. Iterative refinement is applied to improve the computed solution */
  104. /* matrix and calculate error bounds and backward error estimates */
  105. /* for it. */
  106. /* 6. If equilibration was used, the matrix X is premultiplied by */
  107. /* diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so */
  108. /* that it solves the original system before equilibration. */
  109. /* Arguments */
  110. /* ========= */
  111. /* FACT (input) CHARACTER*1 */
  112. /* Specifies whether or not the factored form of the matrix A is */
  113. /* supplied on entry, and if not, whether the matrix A should be */
  114. /* equilibrated before it is factored. */
  115. /* = 'F': On entry, AF and IPIV contain the factored form of A. */
  116. /* If EQUED is not 'N', the matrix A has been */
  117. /* equilibrated with scaling factors given by R and C. */
  118. /* A, AF, and IPIV are not modified. */
  119. /* = 'N': The matrix A will be copied to AF and factored. */
  120. /* = 'E': The matrix A will be equilibrated if necessary, then */
  121. /* copied to AF and factored. */
  122. /* TRANS (input) CHARACTER*1 */
  123. /* Specifies the form of the system of equations: */
  124. /* = 'N': A * X = B (No transpose) */
  125. /* = 'T': A**T * X = B (Transpose) */
  126. /* = 'C': A**H * X = B (Transpose) */
  127. /* N (input) INTEGER */
  128. /* The number of linear equations, i.e., the order of the */
  129. /* matrix A. N >= 0. */
  130. /* NRHS (input) INTEGER */
  131. /* The number of right hand sides, i.e., the number of columns */
  132. /* of the matrices B and X. NRHS >= 0. */
  133. /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
  134. /* On entry, the N-by-N matrix A. If FACT = 'F' and EQUED is */
  135. /* not 'N', then A must have been equilibrated by the scaling */
  136. /* factors in R and/or C. A is not modified if FACT = 'F' or */
  137. /* 'N', or if FACT = 'E' and EQUED = 'N' on exit. */
  138. /* On exit, if EQUED .ne. 'N', A is scaled as follows: */
  139. /* EQUED = 'R': A := diag(R) * A */
  140. /* EQUED = 'C': A := A * diag(C) */
  141. /* EQUED = 'B': A := diag(R) * A * diag(C). */
  142. /* LDA (input) INTEGER */
  143. /* The leading dimension of the array A. LDA >= max(1,N). */
  144. /* AF (input or output) DOUBLE PRECISION array, dimension (LDAF,N) */
  145. /* If FACT = 'F', then AF is an input argument and on entry */
  146. /* contains the factors L and U from the factorization */
  147. /* A = P*L*U as computed by DGETRF. If EQUED .ne. 'N', then */
  148. /* AF is the factored form of the equilibrated matrix A. */
  149. /* If FACT = 'N', then AF is an output argument and on exit */
  150. /* returns the factors L and U from the factorization A = P*L*U */
  151. /* of the original matrix A. */
  152. /* If FACT = 'E', then AF is an output argument and on exit */
  153. /* returns the factors L and U from the factorization A = P*L*U */
  154. /* of the equilibrated matrix A (see the description of A for */
  155. /* the form of the equilibrated matrix). */
  156. /* LDAF (input) INTEGER */
  157. /* The leading dimension of the array AF. LDAF >= max(1,N). */
  158. /* IPIV (input or output) INTEGER array, dimension (N) */
  159. /* If FACT = 'F', then IPIV is an input argument and on entry */
  160. /* contains the pivot indices from the factorization A = P*L*U */
  161. /* as computed by DGETRF; row i of the matrix was interchanged */
  162. /* with row IPIV(i). */
  163. /* If FACT = 'N', then IPIV is an output argument and on exit */
  164. /* contains the pivot indices from the factorization A = P*L*U */
  165. /* of the original matrix A. */
  166. /* If FACT = 'E', then IPIV is an output argument and on exit */
  167. /* contains the pivot indices from the factorization A = P*L*U */
  168. /* of the equilibrated matrix A. */
  169. /* EQUED (input or output) CHARACTER*1 */
  170. /* Specifies the form of equilibration that was done. */
  171. /* = 'N': No equilibration (always true if FACT = 'N'). */
  172. /* = 'R': Row equilibration, i.e., A has been premultiplied by */
  173. /* diag(R). */
  174. /* = 'C': Column equilibration, i.e., A has been postmultiplied */
  175. /* by diag(C). */
  176. /* = 'B': Both row and column equilibration, i.e., A has been */
  177. /* replaced by diag(R) * A * diag(C). */
  178. /* EQUED is an input argument if FACT = 'F'; otherwise, it is an */
  179. /* output argument. */
  180. /* R (input or output) DOUBLE PRECISION array, dimension (N) */
  181. /* The row scale factors for A. If EQUED = 'R' or 'B', A is */
  182. /* multiplied on the left by diag(R); if EQUED = 'N' or 'C', R */
  183. /* is not accessed. R is an input argument if FACT = 'F'; */
  184. /* otherwise, R is an output argument. If FACT = 'F' and */
  185. /* EQUED = 'R' or 'B', each element of R must be positive. */
  186. /* C (input or output) DOUBLE PRECISION array, dimension (N) */
  187. /* The column scale factors for A. If EQUED = 'C' or 'B', A is */
  188. /* multiplied on the right by diag(C); if EQUED = 'N' or 'R', C */
  189. /* is not accessed. C is an input argument if FACT = 'F'; */
  190. /* otherwise, C is an output argument. If FACT = 'F' and */
  191. /* EQUED = 'C' or 'B', each element of C must be positive. */
  192. /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
  193. /* On entry, the N-by-NRHS right hand side matrix B. */
  194. /* On exit, */
  195. /* if EQUED = 'N', B is not modified; */
  196. /* if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by */
  197. /* diag(R)*B; */
  198. /* if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is */
  199. /* overwritten by diag(C)*B. */
  200. /* LDB (input) INTEGER */
  201. /* The leading dimension of the array B. LDB >= max(1,N). */
  202. /* X (output) DOUBLE PRECISION array, dimension (LDX,NRHS) */
  203. /* If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X */
  204. /* to the original system of equations. Note that A and B are */
  205. /* modified on exit if EQUED .ne. 'N', and the solution to the */
  206. /* equilibrated system is inv(diag(C))*X if TRANS = 'N' and */
  207. /* EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C' */
  208. /* and EQUED = 'R' or 'B'. */
  209. /* LDX (input) INTEGER */
  210. /* The leading dimension of the array X. LDX >= max(1,N). */
  211. /* RCOND (output) DOUBLE PRECISION */
  212. /* The estimate of the reciprocal condition number of the matrix */
  213. /* A after equilibration (if done). If RCOND is less than the */
  214. /* machine precision (in particular, if RCOND = 0), the matrix */
  215. /* is singular to working precision. This condition is */
  216. /* indicated by a return code of INFO > 0. */
  217. /* FERR (output) DOUBLE PRECISION array, dimension (NRHS) */
  218. /* The estimated forward error bound for each solution vector */
  219. /* X(j) (the j-th column of the solution matrix X). */
  220. /* If XTRUE is the true solution corresponding to X(j), FERR(j) */
  221. /* is an estimated upper bound for the magnitude of the largest */
  222. /* element in (X(j) - XTRUE) divided by the magnitude of the */
  223. /* largest element in X(j). The estimate is as reliable as */
  224. /* the estimate for RCOND, and is almost always a slight */
  225. /* overestimate of the true error. */
  226. /* BERR (output) DOUBLE PRECISION array, dimension (NRHS) */
  227. /* The componentwise relative backward error of each solution */
  228. /* vector X(j) (i.e., the smallest relative change in */
  229. /* any element of A or B that makes X(j) an exact solution). */
  230. /* WORK (workspace/output) DOUBLE PRECISION array, dimension (4*N) */
  231. /* On exit, WORK(1) contains the reciprocal pivot growth */
  232. /* factor norm(A)/norm(U). The "max absolute element" norm is */
  233. /* used. If WORK(1) is much less than 1, then the stability */
  234. /* of the LU factorization of the (equilibrated) matrix A */
  235. /* could be poor. This also means that the solution X, condition */
  236. /* estimator RCOND, and forward error bound FERR could be */
  237. /* unreliable. If factorization fails with 0<INFO<=N, then */
  238. /* WORK(1) contains the reciprocal pivot growth factor for the */
  239. /* leading INFO columns of A. */
  240. /* IWORK (workspace) INTEGER array, dimension (N) */
  241. /* INFO (output) INTEGER */
  242. /* = 0: successful exit */
  243. /* < 0: if INFO = -i, the i-th argument had an illegal value */
  244. /* > 0: if INFO = i, and i is */
  245. /* <= N: U(i,i) is exactly zero. The factorization has */
  246. /* been completed, but the factor U is exactly */
  247. /* singular, so the solution and error bounds */
  248. /* could not be computed. RCOND = 0 is returned. */
  249. /* = N+1: U is nonsingular, but RCOND is less than machine */
  250. /* precision, meaning that the matrix is singular */
  251. /* to working precision. Nevertheless, the */
  252. /* solution and error bounds are computed because */
  253. /* there are a number of situations where the */
  254. /* computed solution can be more accurate than the */
  255. /* value of RCOND would suggest. */
  256. /* ===================================================================== */
  257. /* .. Parameters .. */
  258. /* .. */
  259. /* .. Local Scalars .. */
  260. /* .. */
  261. /* .. External Functions .. */
  262. /* .. */
  263. /* .. External Subroutines .. */
  264. /* .. */
  265. /* .. Intrinsic Functions .. */
  266. /* .. */
  267. /* .. Executable Statements .. */
  268. /* Parameter adjustments */
  269. a_dim1 = *lda;
  270. a_offset = 1 + a_dim1;
  271. a -= a_offset;
  272. af_dim1 = *ldaf;
  273. af_offset = 1 + af_dim1;
  274. af -= af_offset;
  275. --ipiv;
  276. --r__;
  277. --c__;
  278. b_dim1 = *ldb;
  279. b_offset = 1 + b_dim1;
  280. b -= b_offset;
  281. x_dim1 = *ldx;
  282. x_offset = 1 + x_dim1;
  283. x -= x_offset;
  284. --ferr;
  285. --berr;
  286. --work;
  287. --iwork;
  288. /* Function Body */
  289. *info = 0;
  290. nofact = _starpu_lsame_(fact, "N");
  291. equil = _starpu_lsame_(fact, "E");
  292. notran = _starpu_lsame_(trans, "N");
  293. if (nofact || equil) {
  294. *(unsigned char *)equed = 'N';
  295. rowequ = FALSE_;
  296. colequ = FALSE_;
  297. } else {
  298. rowequ = _starpu_lsame_(equed, "R") || _starpu_lsame_(equed,
  299. "B");
  300. colequ = _starpu_lsame_(equed, "C") || _starpu_lsame_(equed,
  301. "B");
  302. smlnum = _starpu_dlamch_("Safe minimum");
  303. bignum = 1. / smlnum;
  304. }
  305. /* Test the input parameters. */
  306. if (! nofact && ! equil && ! _starpu_lsame_(fact, "F")) {
  307. *info = -1;
  308. } else if (! notran && ! _starpu_lsame_(trans, "T") && !
  309. _starpu_lsame_(trans, "C")) {
  310. *info = -2;
  311. } else if (*n < 0) {
  312. *info = -3;
  313. } else if (*nrhs < 0) {
  314. *info = -4;
  315. } else if (*lda < max(1,*n)) {
  316. *info = -6;
  317. } else if (*ldaf < max(1,*n)) {
  318. *info = -8;
  319. } else if (_starpu_lsame_(fact, "F") && ! (rowequ || colequ
  320. || _starpu_lsame_(equed, "N"))) {
  321. *info = -10;
  322. } else {
  323. if (rowequ) {
  324. rcmin = bignum;
  325. rcmax = 0.;
  326. i__1 = *n;
  327. for (j = 1; j <= i__1; ++j) {
  328. /* Computing MIN */
  329. d__1 = rcmin, d__2 = r__[j];
  330. rcmin = min(d__1,d__2);
  331. /* Computing MAX */
  332. d__1 = rcmax, d__2 = r__[j];
  333. rcmax = max(d__1,d__2);
  334. /* L10: */
  335. }
  336. if (rcmin <= 0.) {
  337. *info = -11;
  338. } else if (*n > 0) {
  339. rowcnd = max(rcmin,smlnum) / min(rcmax,bignum);
  340. } else {
  341. rowcnd = 1.;
  342. }
  343. }
  344. if (colequ && *info == 0) {
  345. rcmin = bignum;
  346. rcmax = 0.;
  347. i__1 = *n;
  348. for (j = 1; j <= i__1; ++j) {
  349. /* Computing MIN */
  350. d__1 = rcmin, d__2 = c__[j];
  351. rcmin = min(d__1,d__2);
  352. /* Computing MAX */
  353. d__1 = rcmax, d__2 = c__[j];
  354. rcmax = max(d__1,d__2);
  355. /* L20: */
  356. }
  357. if (rcmin <= 0.) {
  358. *info = -12;
  359. } else if (*n > 0) {
  360. colcnd = max(rcmin,smlnum) / min(rcmax,bignum);
  361. } else {
  362. colcnd = 1.;
  363. }
  364. }
  365. if (*info == 0) {
  366. if (*ldb < max(1,*n)) {
  367. *info = -14;
  368. } else if (*ldx < max(1,*n)) {
  369. *info = -16;
  370. }
  371. }
  372. }
  373. if (*info != 0) {
  374. i__1 = -(*info);
  375. _starpu_xerbla_("DGESVX", &i__1);
  376. return 0;
  377. }
  378. if (equil) {
  379. /* Compute row and column scalings to equilibrate the matrix A. */
  380. _starpu_dgeequ_(n, n, &a[a_offset], lda, &r__[1], &c__[1], &rowcnd, &colcnd, &
  381. amax, &infequ);
  382. if (infequ == 0) {
  383. /* Equilibrate the matrix. */
  384. _starpu_dlaqge_(n, n, &a[a_offset], lda, &r__[1], &c__[1], &rowcnd, &
  385. colcnd, &amax, equed);
  386. rowequ = _starpu_lsame_(equed, "R") || _starpu_lsame_(equed,
  387. "B");
  388. colequ = _starpu_lsame_(equed, "C") || _starpu_lsame_(equed,
  389. "B");
  390. }
  391. }
  392. /* Scale the right hand side. */
  393. if (notran) {
  394. if (rowequ) {
  395. i__1 = *nrhs;
  396. for (j = 1; j <= i__1; ++j) {
  397. i__2 = *n;
  398. for (i__ = 1; i__ <= i__2; ++i__) {
  399. b[i__ + j * b_dim1] = r__[i__] * b[i__ + j * b_dim1];
  400. /* L30: */
  401. }
  402. /* L40: */
  403. }
  404. }
  405. } else if (colequ) {
  406. i__1 = *nrhs;
  407. for (j = 1; j <= i__1; ++j) {
  408. i__2 = *n;
  409. for (i__ = 1; i__ <= i__2; ++i__) {
  410. b[i__ + j * b_dim1] = c__[i__] * b[i__ + j * b_dim1];
  411. /* L50: */
  412. }
  413. /* L60: */
  414. }
  415. }
  416. if (nofact || equil) {
  417. /* Compute the LU factorization of A. */
  418. _starpu_dlacpy_("Full", n, n, &a[a_offset], lda, &af[af_offset], ldaf);
  419. _starpu_dgetrf_(n, n, &af[af_offset], ldaf, &ipiv[1], info);
  420. /* Return if INFO is non-zero. */
  421. if (*info > 0) {
  422. /* Compute the reciprocal pivot growth factor of the */
  423. /* leading rank-deficient INFO columns of A. */
  424. rpvgrw = _starpu_dlantr_("M", "U", "N", info, info, &af[af_offset], ldaf,
  425. &work[1]);
  426. if (rpvgrw == 0.) {
  427. rpvgrw = 1.;
  428. } else {
  429. rpvgrw = _starpu_dlange_("M", n, info, &a[a_offset], lda, &work[1]) / rpvgrw;
  430. }
  431. work[1] = rpvgrw;
  432. *rcond = 0.;
  433. return 0;
  434. }
  435. }
  436. /* Compute the norm of the matrix A and the */
  437. /* reciprocal pivot growth factor RPVGRW. */
  438. if (notran) {
  439. *(unsigned char *)norm = '1';
  440. } else {
  441. *(unsigned char *)norm = 'I';
  442. }
  443. anorm = _starpu_dlange_(norm, n, n, &a[a_offset], lda, &work[1]);
  444. rpvgrw = _starpu_dlantr_("M", "U", "N", n, n, &af[af_offset], ldaf, &work[1]);
  445. if (rpvgrw == 0.) {
  446. rpvgrw = 1.;
  447. } else {
  448. rpvgrw = _starpu_dlange_("M", n, n, &a[a_offset], lda, &work[1]) /
  449. rpvgrw;
  450. }
  451. /* Compute the reciprocal of the condition number of A. */
  452. _starpu_dgecon_(norm, n, &af[af_offset], ldaf, &anorm, rcond, &work[1], &iwork[1],
  453. info);
  454. /* Compute the solution matrix X. */
  455. _starpu_dlacpy_("Full", n, nrhs, &b[b_offset], ldb, &x[x_offset], ldx);
  456. _starpu_dgetrs_(trans, n, nrhs, &af[af_offset], ldaf, &ipiv[1], &x[x_offset], ldx,
  457. info);
  458. /* Use iterative refinement to improve the computed solution and */
  459. /* compute error bounds and backward error estimates for it. */
  460. _starpu_dgerfs_(trans, n, nrhs, &a[a_offset], lda, &af[af_offset], ldaf, &ipiv[1],
  461. &b[b_offset], ldb, &x[x_offset], ldx, &ferr[1], &berr[1], &work[
  462. 1], &iwork[1], info);
  463. /* Transform the solution matrix X to a solution of the original */
  464. /* system. */
  465. if (notran) {
  466. if (colequ) {
  467. i__1 = *nrhs;
  468. for (j = 1; j <= i__1; ++j) {
  469. i__2 = *n;
  470. for (i__ = 1; i__ <= i__2; ++i__) {
  471. x[i__ + j * x_dim1] = c__[i__] * x[i__ + j * x_dim1];
  472. /* L70: */
  473. }
  474. /* L80: */
  475. }
  476. i__1 = *nrhs;
  477. for (j = 1; j <= i__1; ++j) {
  478. ferr[j] /= colcnd;
  479. /* L90: */
  480. }
  481. }
  482. } else if (rowequ) {
  483. i__1 = *nrhs;
  484. for (j = 1; j <= i__1; ++j) {
  485. i__2 = *n;
  486. for (i__ = 1; i__ <= i__2; ++i__) {
  487. x[i__ + j * x_dim1] = r__[i__] * x[i__ + j * x_dim1];
  488. /* L100: */
  489. }
  490. /* L110: */
  491. }
  492. i__1 = *nrhs;
  493. for (j = 1; j <= i__1; ++j) {
  494. ferr[j] /= rowcnd;
  495. /* L120: */
  496. }
  497. }
  498. work[1] = rpvgrw;
  499. /* Set INFO = N+1 if the matrix is singular to working precision. */
  500. if (*rcond < _starpu_dlamch_("Epsilon")) {
  501. *info = *n + 1;
  502. }
  503. return 0;
  504. /* End of DGESVX */
  505. } /* _starpu_dgesvx_ */