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.

cgesvx.c 35 kB

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