dla_rpvgrw.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* _starpu_dla_rpvgrw.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. doublereal _starpu_dla_rpvgrw__(integer *n, integer *ncols, doublereal *a, integer *
  14. lda, doublereal *af, integer *ldaf)
  15. {
  16. /* System generated locals */
  17. integer a_dim1, a_offset, af_dim1, af_offset, i__1, i__2;
  18. doublereal ret_val, d__1, d__2;
  19. /* Local variables */
  20. integer i__, j;
  21. doublereal amax, umax, rpvgrw;
  22. /* -- LAPACK routine (version 3.2.1) -- */
  23. /* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */
  24. /* -- Jason Riedy of Univ. of California Berkeley. -- */
  25. /* -- April 2009 -- */
  26. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  27. /* -- Univ. of California Berkeley and NAG Ltd. -- */
  28. /* .. */
  29. /* .. Scalar Arguments .. */
  30. /* .. */
  31. /* .. Array Arguments .. */
  32. /* .. */
  33. /* Purpose */
  34. /* ======= */
  35. /* DLA_RPVGRW computes the reciprocal pivot growth factor */
  36. /* norm(A)/norm(U). The "max absolute element" norm is used. If this is */
  37. /* much less than 1, the stability of the LU factorization of the */
  38. /* (equilibrated) matrix A could be poor. This also means that the */
  39. /* solution X, estimated condition numbers, and error bounds could be */
  40. /* unreliable. */
  41. /* Arguments */
  42. /* ========= */
  43. /* N (input) INTEGER */
  44. /* The number of linear equations, i.e., the order of the */
  45. /* matrix A. N >= 0. */
  46. /* NCOLS (input) INTEGER */
  47. /* The number of columns of the matrix A. NCOLS >= 0. */
  48. /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
  49. /* On entry, the N-by-N matrix A. */
  50. /* LDA (input) INTEGER */
  51. /* The leading dimension of the array A. LDA >= max(1,N). */
  52. /* AF (input) DOUBLE PRECISION array, dimension (LDAF,N) */
  53. /* The factors L and U from the factorization */
  54. /* A = P*L*U as computed by DGETRF. */
  55. /* LDAF (input) INTEGER */
  56. /* The leading dimension of the array AF. LDAF >= max(1,N). */
  57. /* ===================================================================== */
  58. /* .. Local Scalars .. */
  59. /* .. */
  60. /* .. Intrinsic Functions .. */
  61. /* .. */
  62. /* .. Executable Statements .. */
  63. /* Parameter adjustments */
  64. a_dim1 = *lda;
  65. a_offset = 1 + a_dim1;
  66. a -= a_offset;
  67. af_dim1 = *ldaf;
  68. af_offset = 1 + af_dim1;
  69. af -= af_offset;
  70. /* Function Body */
  71. rpvgrw = 1.;
  72. i__1 = *ncols;
  73. for (j = 1; j <= i__1; ++j) {
  74. amax = 0.;
  75. umax = 0.;
  76. i__2 = *n;
  77. for (i__ = 1; i__ <= i__2; ++i__) {
  78. /* Computing MAX */
  79. d__2 = (d__1 = a[i__ + j * a_dim1], abs(d__1));
  80. amax = max(d__2,amax);
  81. }
  82. i__2 = j;
  83. for (i__ = 1; i__ <= i__2; ++i__) {
  84. /* Computing MAX */
  85. d__2 = (d__1 = af[i__ + j * af_dim1], abs(d__1));
  86. umax = max(d__2,umax);
  87. }
  88. if (umax != 0.) {
  89. /* Computing MIN */
  90. d__1 = amax / umax;
  91. rpvgrw = min(d__1,rpvgrw);
  92. }
  93. }
  94. ret_val = rpvgrw;
  95. return ret_val;
  96. } /* _starpu_dla_rpvgrw__ */