dlapll.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* dlapll.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_dlapll_(integer *n, doublereal *x, integer *incx,
  14. doublereal *y, integer *incy, doublereal *ssmin)
  15. {
  16. /* System generated locals */
  17. integer i__1;
  18. /* Local variables */
  19. doublereal c__, a11, a12, a22, tau;
  20. extern doublereal _starpu_ddot_(integer *, doublereal *, integer *, doublereal *,
  21. integer *);
  22. extern /* Subroutine */ int _starpu_dlas2_(doublereal *, doublereal *, doublereal
  23. *, doublereal *, doublereal *), _starpu_daxpy_(integer *, doublereal *,
  24. doublereal *, integer *, doublereal *, integer *);
  25. doublereal ssmax;
  26. extern /* Subroutine */ int _starpu_dlarfg_(integer *, doublereal *, doublereal *,
  27. integer *, doublereal *);
  28. /* -- LAPACK auxiliary routine (version 3.2) -- */
  29. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  30. /* November 2006 */
  31. /* .. Scalar Arguments .. */
  32. /* .. */
  33. /* .. Array Arguments .. */
  34. /* .. */
  35. /* Purpose */
  36. /* ======= */
  37. /* Given two column vectors X and Y, let */
  38. /* A = ( X Y ). */
  39. /* The subroutine first computes the QR factorization of A = Q*R, */
  40. /* and then computes the SVD of the 2-by-2 upper triangular matrix R. */
  41. /* The smaller singular value of R is returned in SSMIN, which is used */
  42. /* as the measurement of the linear dependency of the vectors X and Y. */
  43. /* Arguments */
  44. /* ========= */
  45. /* N (input) INTEGER */
  46. /* The length of the vectors X and Y. */
  47. /* X (input/output) DOUBLE PRECISION array, */
  48. /* dimension (1+(N-1)*INCX) */
  49. /* On entry, X contains the N-vector X. */
  50. /* On exit, X is overwritten. */
  51. /* INCX (input) INTEGER */
  52. /* The increment between successive elements of X. INCX > 0. */
  53. /* Y (input/output) DOUBLE PRECISION array, */
  54. /* dimension (1+(N-1)*INCY) */
  55. /* On entry, Y contains the N-vector Y. */
  56. /* On exit, Y is overwritten. */
  57. /* INCY (input) INTEGER */
  58. /* The increment between successive elements of Y. INCY > 0. */
  59. /* SSMIN (output) DOUBLE PRECISION */
  60. /* The smallest singular value of the N-by-2 matrix A = ( X Y ). */
  61. /* ===================================================================== */
  62. /* .. Parameters .. */
  63. /* .. */
  64. /* .. Local Scalars .. */
  65. /* .. */
  66. /* .. External Functions .. */
  67. /* .. */
  68. /* .. External Subroutines .. */
  69. /* .. */
  70. /* .. Executable Statements .. */
  71. /* Quick return if possible */
  72. /* Parameter adjustments */
  73. --y;
  74. --x;
  75. /* Function Body */
  76. if (*n <= 1) {
  77. *ssmin = 0.;
  78. return 0;
  79. }
  80. /* Compute the QR factorization of the N-by-2 matrix ( X Y ) */
  81. _starpu_dlarfg_(n, &x[1], &x[*incx + 1], incx, &tau);
  82. a11 = x[1];
  83. x[1] = 1.;
  84. c__ = -tau * _starpu_ddot_(n, &x[1], incx, &y[1], incy);
  85. _starpu_daxpy_(n, &c__, &x[1], incx, &y[1], incy);
  86. i__1 = *n - 1;
  87. _starpu_dlarfg_(&i__1, &y[*incy + 1], &y[(*incy << 1) + 1], incy, &tau);
  88. a12 = y[1];
  89. a22 = y[*incy + 1];
  90. /* Compute the SVD of 2-by-2 Upper triangular matrix. */
  91. _starpu_dlas2_(&a11, &a12, &a22, ssmin, &ssmax);
  92. return 0;
  93. /* End of DLAPLL */
  94. } /* _starpu_dlapll_ */