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.

dgesvx.c 35 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  1. /* f2c.h -- Standard Fortran to C header file */
  2. /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
  3. - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
  4. #ifndef F2C_INCLUDE
  5. #define F2C_INCLUDE
  6. #include <math.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <stdio.h>
  10. #include <complex.h>
  11. #ifdef complex
  12. #undef complex
  13. #endif
  14. #ifdef I
  15. #undef I
  16. #endif
  17. #if defined(_WIN64)
  18. typedef long long BLASLONG;
  19. typedef unsigned long long BLASULONG;
  20. #else
  21. typedef long BLASLONG;
  22. typedef unsigned long BLASULONG;
  23. #endif
  24. #ifdef LAPACK_ILP64
  25. typedef BLASLONG blasint;
  26. #if defined(_WIN64)
  27. #define blasabs(x) llabs(x)
  28. #else
  29. #define blasabs(x) labs(x)
  30. #endif
  31. #else
  32. typedef int blasint;
  33. #define blasabs(x) abs(x)
  34. #endif
  35. typedef blasint integer;
  36. typedef unsigned int uinteger;
  37. typedef char *address;
  38. typedef short int shortint;
  39. typedef float real;
  40. typedef double doublereal;
  41. typedef struct { real r, i; } complex;
  42. typedef struct { doublereal r, i; } doublecomplex;
  43. static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
  44. static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
  45. static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
  46. static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
  47. #define pCf(z) (*_pCf(z))
  48. #define pCd(z) (*_pCd(z))
  49. typedef int logical;
  50. typedef short int shortlogical;
  51. typedef char logical1;
  52. typedef char integer1;
  53. #define TRUE_ (1)
  54. #define FALSE_ (0)
  55. /* Extern is for use with -E */
  56. #ifndef Extern
  57. #define Extern extern
  58. #endif
  59. /* I/O stuff */
  60. typedef int flag;
  61. typedef int ftnlen;
  62. typedef int ftnint;
  63. /*external read, write*/
  64. typedef struct
  65. { flag cierr;
  66. ftnint ciunit;
  67. flag ciend;
  68. char *cifmt;
  69. ftnint cirec;
  70. } cilist;
  71. /*internal read, write*/
  72. typedef struct
  73. { flag icierr;
  74. char *iciunit;
  75. flag iciend;
  76. char *icifmt;
  77. ftnint icirlen;
  78. ftnint icirnum;
  79. } icilist;
  80. /*open*/
  81. typedef struct
  82. { flag oerr;
  83. ftnint ounit;
  84. char *ofnm;
  85. ftnlen ofnmlen;
  86. char *osta;
  87. char *oacc;
  88. char *ofm;
  89. ftnint orl;
  90. char *oblnk;
  91. } olist;
  92. /*close*/
  93. typedef struct
  94. { flag cerr;
  95. ftnint cunit;
  96. char *csta;
  97. } cllist;
  98. /*rewind, backspace, endfile*/
  99. typedef struct
  100. { flag aerr;
  101. ftnint aunit;
  102. } alist;
  103. /* inquire */
  104. typedef struct
  105. { flag inerr;
  106. ftnint inunit;
  107. char *infile;
  108. ftnlen infilen;
  109. ftnint *inex; /*parameters in standard's order*/
  110. ftnint *inopen;
  111. ftnint *innum;
  112. ftnint *innamed;
  113. char *inname;
  114. ftnlen innamlen;
  115. char *inacc;
  116. ftnlen inacclen;
  117. char *inseq;
  118. ftnlen inseqlen;
  119. char *indir;
  120. ftnlen indirlen;
  121. char *infmt;
  122. ftnlen infmtlen;
  123. char *inform;
  124. ftnint informlen;
  125. char *inunf;
  126. ftnlen inunflen;
  127. ftnint *inrecl;
  128. ftnint *innrec;
  129. char *inblank;
  130. ftnlen inblanklen;
  131. } inlist;
  132. #define VOID void
  133. union Multitype { /* for multiple entry points */
  134. integer1 g;
  135. shortint h;
  136. integer i;
  137. /* longint j; */
  138. real r;
  139. doublereal d;
  140. complex c;
  141. doublecomplex z;
  142. };
  143. typedef union Multitype Multitype;
  144. struct Vardesc { /* for Namelist */
  145. char *name;
  146. char *addr;
  147. ftnlen *dims;
  148. int type;
  149. };
  150. typedef struct Vardesc Vardesc;
  151. struct Namelist {
  152. char *name;
  153. Vardesc **vars;
  154. int nvars;
  155. };
  156. typedef struct Namelist Namelist;
  157. #define abs(x) ((x) >= 0 ? (x) : -(x))
  158. #define dabs(x) (fabs(x))
  159. #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
  160. #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
  161. #define dmin(a,b) (f2cmin(a,b))
  162. #define dmax(a,b) (f2cmax(a,b))
  163. #define bit_test(a,b) ((a) >> (b) & 1)
  164. #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
  165. #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
  166. #define abort_() { sig_die("Fortran abort routine called", 1); }
  167. #define c_abs(z) (cabsf(Cf(z)))
  168. #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
  169. #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
  170. #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
  171. #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
  172. #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
  173. #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
  174. //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
  175. #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
  176. #define d_abs(x) (fabs(*(x)))
  177. #define d_acos(x) (acos(*(x)))
  178. #define d_asin(x) (asin(*(x)))
  179. #define d_atan(x) (atan(*(x)))
  180. #define d_atn2(x, y) (atan2(*(x),*(y)))
  181. #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
  182. #define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); }
  183. #define d_cos(x) (cos(*(x)))
  184. #define d_cosh(x) (cosh(*(x)))
  185. #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
  186. #define d_exp(x) (exp(*(x)))
  187. #define d_imag(z) (cimag(Cd(z)))
  188. #define r_imag(z) (cimag(Cf(z)))
  189. #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  190. #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
  191. #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  192. #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
  193. #define d_log(x) (log(*(x)))
  194. #define d_mod(x, y) (fmod(*(x), *(y)))
  195. #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
  196. #define d_nint(x) u_nint(*(x))
  197. #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
  198. #define d_sign(a,b) u_sign(*(a),*(b))
  199. #define r_sign(a,b) u_sign(*(a),*(b))
  200. #define d_sin(x) (sin(*(x)))
  201. #define d_sinh(x) (sinh(*(x)))
  202. #define d_sqrt(x) (sqrt(*(x)))
  203. #define d_tan(x) (tan(*(x)))
  204. #define d_tanh(x) (tanh(*(x)))
  205. #define i_abs(x) abs(*(x))
  206. #define i_dnnt(x) ((integer)u_nint(*(x)))
  207. #define i_len(s, n) (n)
  208. #define i_nint(x) ((integer)u_nint(*(x)))
  209. #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
  210. #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
  211. #define pow_si(B,E) spow_ui(*(B),*(E))
  212. #define pow_ri(B,E) spow_ui(*(B),*(E))
  213. #define pow_di(B,E) dpow_ui(*(B),*(E))
  214. #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
  215. #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
  216. #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
  217. #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
  218. #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
  219. #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
  220. #define sig_die(s, kill) { exit(1); }
  221. #define s_stop(s, n) {exit(0);}
  222. static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
  223. #define z_abs(z) (cabs(Cd(z)))
  224. #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
  225. #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
  226. #define myexit_() break;
  227. #define mycycle() continue;
  228. #define myceiling(w) {ceil(w)}
  229. #define myhuge(w) {HUGE_VAL}
  230. //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
  231. #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
  232. /* procedure parameter types for -A and -C++ */
  233. #define F2C_proc_par_types 1
  234. #ifdef __cplusplus
  235. typedef logical (*L_fp)(...);
  236. #else
  237. typedef logical (*L_fp)();
  238. #endif
  239. static float spow_ui(float x, integer n) {
  240. float pow=1.0; unsigned long int u;
  241. if(n != 0) {
  242. if(n < 0) n = -n, x = 1/x;
  243. for(u = n; ; ) {
  244. if(u & 01) pow *= x;
  245. if(u >>= 1) x *= x;
  246. else break;
  247. }
  248. }
  249. return pow;
  250. }
  251. static double dpow_ui(double x, integer n) {
  252. double pow=1.0; unsigned long int u;
  253. if(n != 0) {
  254. if(n < 0) n = -n, x = 1/x;
  255. for(u = n; ; ) {
  256. if(u & 01) pow *= x;
  257. if(u >>= 1) x *= x;
  258. else break;
  259. }
  260. }
  261. return pow;
  262. }
  263. static _Complex float cpow_ui(_Complex float x, integer n) {
  264. _Complex float pow=1.0; unsigned long int u;
  265. if(n != 0) {
  266. if(n < 0) n = -n, x = 1/x;
  267. for(u = n; ; ) {
  268. if(u & 01) pow *= x;
  269. if(u >>= 1) x *= x;
  270. else break;
  271. }
  272. }
  273. return pow;
  274. }
  275. static _Complex double zpow_ui(_Complex double x, integer n) {
  276. _Complex double pow=1.0; unsigned long int u;
  277. if(n != 0) {
  278. if(n < 0) n = -n, x = 1/x;
  279. for(u = n; ; ) {
  280. if(u & 01) pow *= x;
  281. if(u >>= 1) x *= x;
  282. else break;
  283. }
  284. }
  285. return pow;
  286. }
  287. static integer pow_ii(integer x, integer n) {
  288. integer pow; unsigned long int u;
  289. if (n <= 0) {
  290. if (n == 0 || x == 1) pow = 1;
  291. else if (x != -1) pow = x == 0 ? 1/x : 0;
  292. else n = -n;
  293. }
  294. if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
  295. u = n;
  296. for(pow = 1; ; ) {
  297. if(u & 01) pow *= x;
  298. if(u >>= 1) x *= x;
  299. else break;
  300. }
  301. }
  302. return pow;
  303. }
  304. static integer dmaxloc_(double *w, integer s, integer e, integer *n)
  305. {
  306. double m; integer i, mi;
  307. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  308. if (w[i-1]>m) mi=i ,m=w[i-1];
  309. return mi-s+1;
  310. }
  311. static integer smaxloc_(float *w, integer s, integer e, integer *n)
  312. {
  313. float m; integer i, mi;
  314. for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
  315. if (w[i-1]>m) mi=i ,m=w[i-1];
  316. return mi-s+1;
  317. }
  318. static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  319. integer n = *n_, incx = *incx_, incy = *incy_, i;
  320. _Complex float zdotc = 0.0;
  321. if (incx == 1 && incy == 1) {
  322. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  323. zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
  324. }
  325. } else {
  326. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  327. zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
  328. }
  329. }
  330. pCf(z) = zdotc;
  331. }
  332. static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  333. integer n = *n_, incx = *incx_, incy = *incy_, i;
  334. _Complex double zdotc = 0.0;
  335. if (incx == 1 && incy == 1) {
  336. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  337. zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
  338. }
  339. } else {
  340. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  341. zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
  342. }
  343. }
  344. pCd(z) = zdotc;
  345. }
  346. static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
  347. integer n = *n_, incx = *incx_, incy = *incy_, i;
  348. _Complex float zdotc = 0.0;
  349. if (incx == 1 && incy == 1) {
  350. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  351. zdotc += Cf(&x[i]) * Cf(&y[i]);
  352. }
  353. } else {
  354. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  355. zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
  356. }
  357. }
  358. pCf(z) = zdotc;
  359. }
  360. static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
  361. integer n = *n_, incx = *incx_, incy = *incy_, i;
  362. _Complex double zdotc = 0.0;
  363. if (incx == 1 && incy == 1) {
  364. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  365. zdotc += Cd(&x[i]) * Cd(&y[i]);
  366. }
  367. } else {
  368. for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
  369. zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
  370. }
  371. }
  372. pCd(z) = zdotc;
  373. }
  374. #endif
  375. /* -- translated by f2c (version 20000121).
  376. You must link the resulting object file with the libraries:
  377. -lf2c -lm (in that order)
  378. */
  379. /* > \brief <b> DGESVX computes the solution to system of linear equations A * X = B for GE matrices</b> */
  380. /* =========== DOCUMENTATION =========== */
  381. /* Online html documentation available at */
  382. /* http://www.netlib.org/lapack/explore-html/ */
  383. /* > \htmlonly */
  384. /* > Download DGESVX + dependencies */
  385. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgesvx.
  386. f"> */
  387. /* > [TGZ]</a> */
  388. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgesvx.
  389. f"> */
  390. /* > [ZIP]</a> */
  391. /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgesvx.
  392. f"> */
  393. /* > [TXT]</a> */
  394. /* > \endhtmlonly */
  395. /* Definition: */
  396. /* =========== */
  397. /* SUBROUTINE DGESVX( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, */
  398. /* EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR, */
  399. /* WORK, IWORK, INFO ) */
  400. /* CHARACTER EQUED, FACT, TRANS */
  401. /* INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS */
  402. /* DOUBLE PRECISION RCOND */
  403. /* INTEGER IPIV( * ), IWORK( * ) */
  404. /* DOUBLE PRECISION A( LDA, * ), AF( LDAF, * ), B( LDB, * ), */
  405. /* $ BERR( * ), C( * ), FERR( * ), R( * ), */
  406. /* $ WORK( * ), X( LDX, * ) */
  407. /* > \par Purpose: */
  408. /* ============= */
  409. /* > */
  410. /* > \verbatim */
  411. /* > */
  412. /* > DGESVX uses the LU factorization to compute the solution to a real */
  413. /* > system of linear equations */
  414. /* > A * X = B, */
  415. /* > where A is an N-by-N matrix and X and B are N-by-NRHS matrices. */
  416. /* > */
  417. /* > Error bounds on the solution and a condition estimate are also */
  418. /* > provided. */
  419. /* > \endverbatim */
  420. /* > \par Description: */
  421. /* ================= */
  422. /* > */
  423. /* > \verbatim */
  424. /* > */
  425. /* > The following steps are performed: */
  426. /* > */
  427. /* > 1. If FACT = 'E', real scaling factors are computed to equilibrate */
  428. /* > the system: */
  429. /* > TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B */
  430. /* > TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B */
  431. /* > TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B */
  432. /* > Whether or not the system will be equilibrated depends on the */
  433. /* > scaling of the matrix A, but if equilibration is used, A is */
  434. /* > overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N') */
  435. /* > or diag(C)*B (if TRANS = 'T' or 'C'). */
  436. /* > */
  437. /* > 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the */
  438. /* > matrix A (after equilibration if FACT = 'E') as */
  439. /* > A = P * L * U, */
  440. /* > where P is a permutation matrix, L is a unit lower triangular */
  441. /* > matrix, and U is upper triangular. */
  442. /* > */
  443. /* > 3. If some U(i,i)=0, so that U is exactly singular, then the routine */
  444. /* > returns with INFO = i. Otherwise, the factored form of A is used */
  445. /* > to estimate the condition number of the matrix A. If the */
  446. /* > reciprocal of the condition number is less than machine precision, */
  447. /* > INFO = N+1 is returned as a warning, but the routine still goes on */
  448. /* > to solve for X and compute error bounds as described below. */
  449. /* > */
  450. /* > 4. The system of equations is solved for X using the factored form */
  451. /* > of A. */
  452. /* > */
  453. /* > 5. Iterative refinement is applied to improve the computed solution */
  454. /* > matrix and calculate error bounds and backward error estimates */
  455. /* > for it. */
  456. /* > */
  457. /* > 6. If equilibration was used, the matrix X is premultiplied by */
  458. /* > diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so */
  459. /* > that it solves the original system before equilibration. */
  460. /* > \endverbatim */
  461. /* Arguments: */
  462. /* ========== */
  463. /* > \param[in] FACT */
  464. /* > \verbatim */
  465. /* > FACT is CHARACTER*1 */
  466. /* > Specifies whether or not the factored form of the matrix A is */
  467. /* > supplied on entry, and if not, whether the matrix A should be */
  468. /* > equilibrated before it is factored. */
  469. /* > = 'F': On entry, AF and IPIV contain the factored form of A. */
  470. /* > If EQUED is not 'N', the matrix A has been */
  471. /* > equilibrated with scaling factors given by R and C. */
  472. /* > A, AF, and IPIV are not modified. */
  473. /* > = 'N': The matrix A will be copied to AF and factored. */
  474. /* > = 'E': The matrix A will be equilibrated if necessary, then */
  475. /* > copied to AF and factored. */
  476. /* > \endverbatim */
  477. /* > */
  478. /* > \param[in] TRANS */
  479. /* > \verbatim */
  480. /* > TRANS is CHARACTER*1 */
  481. /* > Specifies the form of the system of equations: */
  482. /* > = 'N': A * X = B (No transpose) */
  483. /* > = 'T': A**T * X = B (Transpose) */
  484. /* > = 'C': A**H * X = B (Transpose) */
  485. /* > \endverbatim */
  486. /* > */
  487. /* > \param[in] N */
  488. /* > \verbatim */
  489. /* > N is INTEGER */
  490. /* > The number of linear equations, i.e., the order of the */
  491. /* > matrix A. N >= 0. */
  492. /* > \endverbatim */
  493. /* > */
  494. /* > \param[in] NRHS */
  495. /* > \verbatim */
  496. /* > NRHS is INTEGER */
  497. /* > The number of right hand sides, i.e., the number of columns */
  498. /* > of the matrices B and X. NRHS >= 0. */
  499. /* > \endverbatim */
  500. /* > */
  501. /* > \param[in,out] A */
  502. /* > \verbatim */
  503. /* > A is DOUBLE PRECISION array, dimension (LDA,N) */
  504. /* > On entry, the N-by-N matrix A. If FACT = 'F' and EQUED is */
  505. /* > not 'N', then A must have been equilibrated by the scaling */
  506. /* > factors in R and/or C. A is not modified if FACT = 'F' or */
  507. /* > 'N', or if FACT = 'E' and EQUED = 'N' on exit. */
  508. /* > */
  509. /* > On exit, if EQUED .ne. 'N', A is scaled as follows: */
  510. /* > EQUED = 'R': A := diag(R) * A */
  511. /* > EQUED = 'C': A := A * diag(C) */
  512. /* > EQUED = 'B': A := diag(R) * A * diag(C). */
  513. /* > \endverbatim */
  514. /* > */
  515. /* > \param[in] LDA */
  516. /* > \verbatim */
  517. /* > LDA is INTEGER */
  518. /* > The leading dimension of the array A. LDA >= f2cmax(1,N). */
  519. /* > \endverbatim */
  520. /* > */
  521. /* > \param[in,out] AF */
  522. /* > \verbatim */
  523. /* > AF is DOUBLE PRECISION array, dimension (LDAF,N) */
  524. /* > If FACT = 'F', then AF is an input argument and on entry */
  525. /* > contains the factors L and U from the factorization */
  526. /* > A = P*L*U as computed by DGETRF. If EQUED .ne. 'N', then */
  527. /* > AF is the factored form of the equilibrated matrix A. */
  528. /* > */
  529. /* > If FACT = 'N', then AF is an output argument and on exit */
  530. /* > returns the factors L and U from the factorization A = P*L*U */
  531. /* > of the original matrix A. */
  532. /* > */
  533. /* > If FACT = 'E', then AF is an output argument and on exit */
  534. /* > returns the factors L and U from the factorization A = P*L*U */
  535. /* > of the equilibrated matrix A (see the description of A for */
  536. /* > the form of the equilibrated matrix). */
  537. /* > \endverbatim */
  538. /* > */
  539. /* > \param[in] LDAF */
  540. /* > \verbatim */
  541. /* > LDAF is INTEGER */
  542. /* > The leading dimension of the array AF. LDAF >= f2cmax(1,N). */
  543. /* > \endverbatim */
  544. /* > */
  545. /* > \param[in,out] IPIV */
  546. /* > \verbatim */
  547. /* > IPIV is INTEGER array, dimension (N) */
  548. /* > If FACT = 'F', then IPIV is an input argument and on entry */
  549. /* > contains the pivot indices from the factorization A = P*L*U */
  550. /* > as computed by DGETRF; row i of the matrix was interchanged */
  551. /* > with row IPIV(i). */
  552. /* > */
  553. /* > If FACT = 'N', then IPIV is an output argument and on exit */
  554. /* > contains the pivot indices from the factorization A = P*L*U */
  555. /* > of the original matrix A. */
  556. /* > */
  557. /* > If FACT = 'E', then IPIV is an output argument and on exit */
  558. /* > contains the pivot indices from the factorization A = P*L*U */
  559. /* > of the equilibrated matrix A. */
  560. /* > \endverbatim */
  561. /* > */
  562. /* > \param[in,out] EQUED */
  563. /* > \verbatim */
  564. /* > EQUED is CHARACTER*1 */
  565. /* > Specifies the form of equilibration that was done. */
  566. /* > = 'N': No equilibration (always true if FACT = 'N'). */
  567. /* > = 'R': Row equilibration, i.e., A has been premultiplied by */
  568. /* > diag(R). */
  569. /* > = 'C': Column equilibration, i.e., A has been postmultiplied */
  570. /* > by diag(C). */
  571. /* > = 'B': Both row and column equilibration, i.e., A has been */
  572. /* > replaced by diag(R) * A * diag(C). */
  573. /* > EQUED is an input argument if FACT = 'F'; otherwise, it is an */
  574. /* > output argument. */
  575. /* > \endverbatim */
  576. /* > */
  577. /* > \param[in,out] R */
  578. /* > \verbatim */
  579. /* > R is DOUBLE PRECISION array, dimension (N) */
  580. /* > The row scale factors for A. If EQUED = 'R' or 'B', A is */
  581. /* > multiplied on the left by diag(R); if EQUED = 'N' or 'C', R */
  582. /* > is not accessed. R is an input argument if FACT = 'F'; */
  583. /* > otherwise, R is an output argument. If FACT = 'F' and */
  584. /* > EQUED = 'R' or 'B', each element of R must be positive. */
  585. /* > \endverbatim */
  586. /* > */
  587. /* > \param[in,out] C */
  588. /* > \verbatim */
  589. /* > C is DOUBLE PRECISION array, dimension (N) */
  590. /* > The column scale factors for A. If EQUED = 'C' or 'B', A is */
  591. /* > multiplied on the right by diag(C); if EQUED = 'N' or 'R', C */
  592. /* > is not accessed. C is an input argument if FACT = 'F'; */
  593. /* > otherwise, C is an output argument. If FACT = 'F' and */
  594. /* > EQUED = 'C' or 'B', each element of C must be positive. */
  595. /* > \endverbatim */
  596. /* > */
  597. /* > \param[in,out] B */
  598. /* > \verbatim */
  599. /* > B is DOUBLE PRECISION array, dimension (LDB,NRHS) */
  600. /* > On entry, the N-by-NRHS right hand side matrix B. */
  601. /* > On exit, */
  602. /* > if EQUED = 'N', B is not modified; */
  603. /* > if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by */
  604. /* > diag(R)*B; */
  605. /* > if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is */
  606. /* > overwritten by diag(C)*B. */
  607. /* > \endverbatim */
  608. /* > */
  609. /* > \param[in] LDB */
  610. /* > \verbatim */
  611. /* > LDB is INTEGER */
  612. /* > The leading dimension of the array B. LDB >= f2cmax(1,N). */
  613. /* > \endverbatim */
  614. /* > */
  615. /* > \param[out] X */
  616. /* > \verbatim */
  617. /* > X is DOUBLE PRECISION array, dimension (LDX,NRHS) */
  618. /* > If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X */
  619. /* > to the original system of equations. Note that A and B are */
  620. /* > modified on exit if EQUED .ne. 'N', and the solution to the */
  621. /* > equilibrated system is inv(diag(C))*X if TRANS = 'N' and */
  622. /* > EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C' */
  623. /* > and EQUED = 'R' or 'B'. */
  624. /* > \endverbatim */
  625. /* > */
  626. /* > \param[in] LDX */
  627. /* > \verbatim */
  628. /* > LDX is INTEGER */
  629. /* > The leading dimension of the array X. LDX >= f2cmax(1,N). */
  630. /* > \endverbatim */
  631. /* > */
  632. /* > \param[out] RCOND */
  633. /* > \verbatim */
  634. /* > RCOND is DOUBLE PRECISION */
  635. /* > The estimate of the reciprocal condition number of the matrix */
  636. /* > A after equilibration (if done). If RCOND is less than the */
  637. /* > machine precision (in particular, if RCOND = 0), the matrix */
  638. /* > is singular to working precision. This condition is */
  639. /* > indicated by a return code of INFO > 0. */
  640. /* > \endverbatim */
  641. /* > */
  642. /* > \param[out] FERR */
  643. /* > \verbatim */
  644. /* > FERR is DOUBLE PRECISION array, dimension (NRHS) */
  645. /* > The estimated forward error bound for each solution vector */
  646. /* > X(j) (the j-th column of the solution matrix X). */
  647. /* > If XTRUE is the true solution corresponding to X(j), FERR(j) */
  648. /* > is an estimated upper bound for the magnitude of the largest */
  649. /* > element in (X(j) - XTRUE) divided by the magnitude of the */
  650. /* > largest element in X(j). The estimate is as reliable as */
  651. /* > the estimate for RCOND, and is almost always a slight */
  652. /* > overestimate of the true error. */
  653. /* > \endverbatim */
  654. /* > */
  655. /* > \param[out] BERR */
  656. /* > \verbatim */
  657. /* > BERR is DOUBLE PRECISION array, dimension (NRHS) */
  658. /* > The componentwise relative backward error of each solution */
  659. /* > vector X(j) (i.e., the smallest relative change in */
  660. /* > any element of A or B that makes X(j) an exact solution). */
  661. /* > \endverbatim */
  662. /* > */
  663. /* > \param[out] WORK */
  664. /* > \verbatim */
  665. /* > WORK is DOUBLE PRECISION array, dimension (4*N) */
  666. /* > On exit, WORK(1) contains the reciprocal pivot growth */
  667. /* > factor norm(A)/norm(U). The "f2cmax absolute element" norm is */
  668. /* > used. If WORK(1) is much less than 1, then the stability */
  669. /* > of the LU factorization of the (equilibrated) matrix A */
  670. /* > could be poor. This also means that the solution X, condition */
  671. /* > estimator RCOND, and forward error bound FERR could be */
  672. /* > unreliable. If factorization fails with 0<INFO<=N, then */
  673. /* > WORK(1) contains the reciprocal pivot growth factor for the */
  674. /* > leading INFO columns of A. */
  675. /* > \endverbatim */
  676. /* > */
  677. /* > \param[out] IWORK */
  678. /* > \verbatim */
  679. /* > IWORK is INTEGER array, dimension (N) */
  680. /* > \endverbatim */
  681. /* > */
  682. /* > \param[out] INFO */
  683. /* > \verbatim */
  684. /* > INFO is INTEGER */
  685. /* > = 0: successful exit */
  686. /* > < 0: if INFO = -i, the i-th argument had an illegal value */
  687. /* > > 0: if INFO = i, and i is */
  688. /* > <= N: U(i,i) is exactly zero. The factorization has */
  689. /* > been completed, but the factor U is exactly */
  690. /* > singular, so the solution and error bounds */
  691. /* > could not be computed. RCOND = 0 is returned. */
  692. /* > = N+1: U is nonsingular, but RCOND is less than machine */
  693. /* > precision, meaning that the matrix is singular */
  694. /* > to working precision. Nevertheless, the */
  695. /* > solution and error bounds are computed because */
  696. /* > there are a number of situations where the */
  697. /* > computed solution can be more accurate than the */
  698. /* > value of RCOND would suggest. */
  699. /* > \endverbatim */
  700. /* Authors: */
  701. /* ======== */
  702. /* > \author Univ. of Tennessee */
  703. /* > \author Univ. of California Berkeley */
  704. /* > \author Univ. of Colorado Denver */
  705. /* > \author NAG Ltd. */
  706. /* > \date April 2012 */
  707. /* > \ingroup doubleGEsolve */
  708. /* ===================================================================== */
  709. /* Subroutine */ int dgesvx_(char *fact, char *trans, integer *n, integer *
  710. nrhs, doublereal *a, integer *lda, doublereal *af, integer *ldaf,
  711. integer *ipiv, char *equed, doublereal *r__, doublereal *c__,
  712. doublereal *b, integer *ldb, doublereal *x, integer *ldx, doublereal *
  713. rcond, doublereal *ferr, doublereal *berr, doublereal *work, integer *
  714. iwork, integer *info)
  715. {
  716. /* System generated locals */
  717. integer a_dim1, a_offset, af_dim1, af_offset, b_dim1, b_offset, x_dim1,
  718. x_offset, i__1, i__2;
  719. doublereal d__1, d__2;
  720. /* Local variables */
  721. doublereal amax;
  722. char norm[1];
  723. integer i__, j;
  724. extern logical lsame_(char *, char *);
  725. doublereal rcmin, rcmax, anorm;
  726. logical equil;
  727. extern doublereal dlamch_(char *), dlange_(char *, integer *,
  728. integer *, doublereal *, integer *, doublereal *);
  729. extern /* Subroutine */ int dlaqge_(integer *, integer *, doublereal *,
  730. integer *, doublereal *, doublereal *, doublereal *, doublereal *,
  731. doublereal *, char *), dgecon_(char *, integer *,
  732. doublereal *, integer *, doublereal *, doublereal *, doublereal *,
  733. integer *, integer *);
  734. doublereal colcnd;
  735. logical nofact;
  736. extern /* Subroutine */ int dgeequ_(integer *, integer *, doublereal *,
  737. integer *, doublereal *, doublereal *, doublereal *, doublereal *,
  738. doublereal *, integer *), dgerfs_(char *, integer *, integer *,
  739. doublereal *, integer *, doublereal *, integer *, integer *,
  740. doublereal *, integer *, doublereal *, integer *, doublereal *,
  741. doublereal *, doublereal *, integer *, integer *),
  742. dgetrf_(integer *, integer *, doublereal *, integer *, integer *,
  743. integer *), dlacpy_(char *, integer *, integer *, doublereal *,
  744. integer *, doublereal *, integer *), xerbla_(char *,
  745. integer *, ftnlen);
  746. doublereal bignum;
  747. extern doublereal dlantr_(char *, char *, char *, integer *, integer *,
  748. doublereal *, integer *, doublereal *);
  749. integer infequ;
  750. logical colequ;
  751. extern /* Subroutine */ int dgetrs_(char *, integer *, integer *,
  752. doublereal *, integer *, integer *, doublereal *, integer *,
  753. integer *);
  754. doublereal rowcnd;
  755. logical notran;
  756. doublereal smlnum;
  757. logical rowequ;
  758. doublereal rpvgrw;
  759. /* -- LAPACK driver routine (version 3.7.0) -- */
  760. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  761. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  762. /* April 2012 */
  763. /* ===================================================================== */
  764. /* Parameter adjustments */
  765. a_dim1 = *lda;
  766. a_offset = 1 + a_dim1 * 1;
  767. a -= a_offset;
  768. af_dim1 = *ldaf;
  769. af_offset = 1 + af_dim1 * 1;
  770. af -= af_offset;
  771. --ipiv;
  772. --r__;
  773. --c__;
  774. b_dim1 = *ldb;
  775. b_offset = 1 + b_dim1 * 1;
  776. b -= b_offset;
  777. x_dim1 = *ldx;
  778. x_offset = 1 + x_dim1 * 1;
  779. x -= x_offset;
  780. --ferr;
  781. --berr;
  782. --work;
  783. --iwork;
  784. /* Function Body */
  785. *info = 0;
  786. nofact = lsame_(fact, "N");
  787. equil = lsame_(fact, "E");
  788. notran = lsame_(trans, "N");
  789. if (nofact || equil) {
  790. *(unsigned char *)equed = 'N';
  791. rowequ = FALSE_;
  792. colequ = FALSE_;
  793. } else {
  794. rowequ = lsame_(equed, "R") || lsame_(equed,
  795. "B");
  796. colequ = lsame_(equed, "C") || lsame_(equed,
  797. "B");
  798. smlnum = dlamch_("Safe minimum");
  799. bignum = 1. / smlnum;
  800. }
  801. /* Test the input parameters. */
  802. if (! nofact && ! equil && ! lsame_(fact, "F")) {
  803. *info = -1;
  804. } else if (! notran && ! lsame_(trans, "T") && !
  805. lsame_(trans, "C")) {
  806. *info = -2;
  807. } else if (*n < 0) {
  808. *info = -3;
  809. } else if (*nrhs < 0) {
  810. *info = -4;
  811. } else if (*lda < f2cmax(1,*n)) {
  812. *info = -6;
  813. } else if (*ldaf < f2cmax(1,*n)) {
  814. *info = -8;
  815. } else if (lsame_(fact, "F") && ! (rowequ || colequ
  816. || lsame_(equed, "N"))) {
  817. *info = -10;
  818. } else {
  819. if (rowequ) {
  820. rcmin = bignum;
  821. rcmax = 0.;
  822. i__1 = *n;
  823. for (j = 1; j <= i__1; ++j) {
  824. /* Computing MIN */
  825. d__1 = rcmin, d__2 = r__[j];
  826. rcmin = f2cmin(d__1,d__2);
  827. /* Computing MAX */
  828. d__1 = rcmax, d__2 = r__[j];
  829. rcmax = f2cmax(d__1,d__2);
  830. /* L10: */
  831. }
  832. if (rcmin <= 0.) {
  833. *info = -11;
  834. } else if (*n > 0) {
  835. rowcnd = f2cmax(rcmin,smlnum) / f2cmin(rcmax,bignum);
  836. } else {
  837. rowcnd = 1.;
  838. }
  839. }
  840. if (colequ && *info == 0) {
  841. rcmin = bignum;
  842. rcmax = 0.;
  843. i__1 = *n;
  844. for (j = 1; j <= i__1; ++j) {
  845. /* Computing MIN */
  846. d__1 = rcmin, d__2 = c__[j];
  847. rcmin = f2cmin(d__1,d__2);
  848. /* Computing MAX */
  849. d__1 = rcmax, d__2 = c__[j];
  850. rcmax = f2cmax(d__1,d__2);
  851. /* L20: */
  852. }
  853. if (rcmin <= 0.) {
  854. *info = -12;
  855. } else if (*n > 0) {
  856. colcnd = f2cmax(rcmin,smlnum) / f2cmin(rcmax,bignum);
  857. } else {
  858. colcnd = 1.;
  859. }
  860. }
  861. if (*info == 0) {
  862. if (*ldb < f2cmax(1,*n)) {
  863. *info = -14;
  864. } else if (*ldx < f2cmax(1,*n)) {
  865. *info = -16;
  866. }
  867. }
  868. }
  869. if (*info != 0) {
  870. i__1 = -(*info);
  871. xerbla_("DGESVX", &i__1, (ftnlen)6);
  872. return 0;
  873. }
  874. if (equil) {
  875. /* Compute row and column scalings to equilibrate the matrix A. */
  876. dgeequ_(n, n, &a[a_offset], lda, &r__[1], &c__[1], &rowcnd, &colcnd, &
  877. amax, &infequ);
  878. if (infequ == 0) {
  879. /* Equilibrate the matrix. */
  880. dlaqge_(n, n, &a[a_offset], lda, &r__[1], &c__[1], &rowcnd, &
  881. colcnd, &amax, equed);
  882. rowequ = lsame_(equed, "R") || lsame_(equed,
  883. "B");
  884. colequ = lsame_(equed, "C") || lsame_(equed,
  885. "B");
  886. }
  887. }
  888. /* Scale the right hand side. */
  889. if (notran) {
  890. if (rowequ) {
  891. i__1 = *nrhs;
  892. for (j = 1; j <= i__1; ++j) {
  893. i__2 = *n;
  894. for (i__ = 1; i__ <= i__2; ++i__) {
  895. b[i__ + j * b_dim1] = r__[i__] * b[i__ + j * b_dim1];
  896. /* L30: */
  897. }
  898. /* L40: */
  899. }
  900. }
  901. } else if (colequ) {
  902. i__1 = *nrhs;
  903. for (j = 1; j <= i__1; ++j) {
  904. i__2 = *n;
  905. for (i__ = 1; i__ <= i__2; ++i__) {
  906. b[i__ + j * b_dim1] = c__[i__] * b[i__ + j * b_dim1];
  907. /* L50: */
  908. }
  909. /* L60: */
  910. }
  911. }
  912. if (nofact || equil) {
  913. /* Compute the LU factorization of A. */
  914. dlacpy_("Full", n, n, &a[a_offset], lda, &af[af_offset], ldaf);
  915. dgetrf_(n, n, &af[af_offset], ldaf, &ipiv[1], info);
  916. /* Return if INFO is non-zero. */
  917. if (*info > 0) {
  918. /* Compute the reciprocal pivot growth factor of the */
  919. /* leading rank-deficient INFO columns of A. */
  920. rpvgrw = dlantr_("M", "U", "N", info, info, &af[af_offset], ldaf,
  921. &work[1]);
  922. if (rpvgrw == 0.) {
  923. rpvgrw = 1.;
  924. } else {
  925. rpvgrw = dlange_("M", n, info, &a[a_offset], lda, &work[1]) / rpvgrw;
  926. }
  927. work[1] = rpvgrw;
  928. *rcond = 0.;
  929. return 0;
  930. }
  931. }
  932. /* Compute the norm of the matrix A and the */
  933. /* reciprocal pivot growth factor RPVGRW. */
  934. if (notran) {
  935. *(unsigned char *)norm = '1';
  936. } else {
  937. *(unsigned char *)norm = 'I';
  938. }
  939. anorm = dlange_(norm, n, n, &a[a_offset], lda, &work[1]);
  940. rpvgrw = dlantr_("M", "U", "N", n, n, &af[af_offset], ldaf, &work[1]);
  941. if (rpvgrw == 0.) {
  942. rpvgrw = 1.;
  943. } else {
  944. rpvgrw = dlange_("M", n, n, &a[a_offset], lda, &work[1]) /
  945. rpvgrw;
  946. }
  947. /* Compute the reciprocal of the condition number of A. */
  948. dgecon_(norm, n, &af[af_offset], ldaf, &anorm, rcond, &work[1], &iwork[1],
  949. info);
  950. /* Compute the solution matrix X. */
  951. dlacpy_("Full", n, nrhs, &b[b_offset], ldb, &x[x_offset], ldx);
  952. dgetrs_(trans, n, nrhs, &af[af_offset], ldaf, &ipiv[1], &x[x_offset], ldx,
  953. info);
  954. /* Use iterative refinement to improve the computed solution and */
  955. /* compute error bounds and backward error estimates for it. */
  956. dgerfs_(trans, n, nrhs, &a[a_offset], lda, &af[af_offset], ldaf, &ipiv[1],
  957. &b[b_offset], ldb, &x[x_offset], ldx, &ferr[1], &berr[1], &work[
  958. 1], &iwork[1], info);
  959. /* Transform the solution matrix X to a solution of the original */
  960. /* system. */
  961. if (notran) {
  962. if (colequ) {
  963. i__1 = *nrhs;
  964. for (j = 1; j <= i__1; ++j) {
  965. i__2 = *n;
  966. for (i__ = 1; i__ <= i__2; ++i__) {
  967. x[i__ + j * x_dim1] = c__[i__] * x[i__ + j * x_dim1];
  968. /* L70: */
  969. }
  970. /* L80: */
  971. }
  972. i__1 = *nrhs;
  973. for (j = 1; j <= i__1; ++j) {
  974. ferr[j] /= colcnd;
  975. /* L90: */
  976. }
  977. }
  978. } else if (rowequ) {
  979. i__1 = *nrhs;
  980. for (j = 1; j <= i__1; ++j) {
  981. i__2 = *n;
  982. for (i__ = 1; i__ <= i__2; ++i__) {
  983. x[i__ + j * x_dim1] = r__[i__] * x[i__ + j * x_dim1];
  984. /* L100: */
  985. }
  986. /* L110: */
  987. }
  988. i__1 = *nrhs;
  989. for (j = 1; j <= i__1; ++j) {
  990. ferr[j] /= rowcnd;
  991. /* L120: */
  992. }
  993. }
  994. work[1] = rpvgrw;
  995. /* Set INFO = N+1 if the matrix is singular to working precision. */
  996. if (*rcond < dlamch_("Epsilon")) {
  997. *info = *n + 1;
  998. }
  999. return 0;
  1000. /* End of DGESVX */
  1001. } /* dgesvx_ */