dlaqr1.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* dlaqr1.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_dlaqr1_(integer *n, doublereal *h__, integer *ldh,
  14. doublereal *sr1, doublereal *si1, doublereal *sr2, doublereal *si2,
  15. doublereal *v)
  16. {
  17. /* System generated locals */
  18. integer h_dim1, h_offset;
  19. doublereal d__1, d__2, d__3;
  20. /* Local variables */
  21. doublereal s, h21s, h31s;
  22. /* -- LAPACK auxiliary routine (version 3.2) -- */
  23. /* Univ. of Tennessee, Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd.. */
  24. /* November 2006 */
  25. /* .. Scalar Arguments .. */
  26. /* .. */
  27. /* .. Array Arguments .. */
  28. /* .. */
  29. /* Given a 2-by-2 or 3-by-3 matrix H, DLAQR1 sets v to a */
  30. /* scalar multiple of the first column of the product */
  31. /* (*) K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I) */
  32. /* scaling to avoid overflows and most underflows. It */
  33. /* is assumed that either */
  34. /* 1) sr1 = sr2 and si1 = -si2 */
  35. /* or */
  36. /* 2) si1 = si2 = 0. */
  37. /* This is useful for starting double implicit shift bulges */
  38. /* in the QR algorithm. */
  39. /* N (input) integer */
  40. /* Order of the matrix H. N must be either 2 or 3. */
  41. /* H (input) DOUBLE PRECISION array of dimension (LDH,N) */
  42. /* The 2-by-2 or 3-by-3 matrix H in (*). */
  43. /* LDH (input) integer */
  44. /* The leading dimension of H as declared in */
  45. /* the calling procedure. LDH.GE.N */
  46. /* SR1 (input) DOUBLE PRECISION */
  47. /* SI1 The shifts in (*). */
  48. /* SR2 */
  49. /* SI2 */
  50. /* V (output) DOUBLE PRECISION array of dimension N */
  51. /* A scalar multiple of the first column of the */
  52. /* matrix K in (*). */
  53. /* ================================================================ */
  54. /* Based on contributions by */
  55. /* Karen Braman and Ralph Byers, Department of Mathematics, */
  56. /* University of Kansas, USA */
  57. /* ================================================================ */
  58. /* .. Parameters .. */
  59. /* .. */
  60. /* .. Local Scalars .. */
  61. /* .. */
  62. /* .. Intrinsic Functions .. */
  63. /* .. */
  64. /* .. Executable Statements .. */
  65. /* Parameter adjustments */
  66. h_dim1 = *ldh;
  67. h_offset = 1 + h_dim1;
  68. h__ -= h_offset;
  69. --v;
  70. /* Function Body */
  71. if (*n == 2) {
  72. s = (d__1 = h__[h_dim1 + 1] - *sr2, abs(d__1)) + abs(*si2) + (d__2 =
  73. h__[h_dim1 + 2], abs(d__2));
  74. if (s == 0.) {
  75. v[1] = 0.;
  76. v[2] = 0.;
  77. } else {
  78. h21s = h__[h_dim1 + 2] / s;
  79. v[1] = h21s * h__[(h_dim1 << 1) + 1] + (h__[h_dim1 + 1] - *sr1) *
  80. ((h__[h_dim1 + 1] - *sr2) / s) - *si1 * (*si2 / s);
  81. v[2] = h21s * (h__[h_dim1 + 1] + h__[(h_dim1 << 1) + 2] - *sr1 - *
  82. sr2);
  83. }
  84. } else {
  85. s = (d__1 = h__[h_dim1 + 1] - *sr2, abs(d__1)) + abs(*si2) + (d__2 =
  86. h__[h_dim1 + 2], abs(d__2)) + (d__3 = h__[h_dim1 + 3], abs(
  87. d__3));
  88. if (s == 0.) {
  89. v[1] = 0.;
  90. v[2] = 0.;
  91. v[3] = 0.;
  92. } else {
  93. h21s = h__[h_dim1 + 2] / s;
  94. h31s = h__[h_dim1 + 3] / s;
  95. v[1] = (h__[h_dim1 + 1] - *sr1) * ((h__[h_dim1 + 1] - *sr2) / s)
  96. - *si1 * (*si2 / s) + h__[(h_dim1 << 1) + 1] * h21s + h__[
  97. h_dim1 * 3 + 1] * h31s;
  98. v[2] = h21s * (h__[h_dim1 + 1] + h__[(h_dim1 << 1) + 2] - *sr1 - *
  99. sr2) + h__[h_dim1 * 3 + 2] * h31s;
  100. v[3] = h31s * (h__[h_dim1 + 1] + h__[h_dim1 * 3 + 3] - *sr1 - *
  101. sr2) + h21s * h__[(h_dim1 << 1) + 3];
  102. }
  103. }
  104. return 0;
  105. } /* _starpu_dlaqr1_ */