dlatrz.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* dlatrz.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_dlatrz_(integer *m, integer *n, integer *l, doublereal *
  14. a, integer *lda, doublereal *tau, doublereal *work)
  15. {
  16. /* System generated locals */
  17. integer a_dim1, a_offset, i__1, i__2;
  18. /* Local variables */
  19. integer i__;
  20. extern /* Subroutine */ int _starpu_dlarz_(char *, integer *, integer *, integer *
  21. , doublereal *, integer *, doublereal *, doublereal *, integer *,
  22. doublereal *), _starpu_dlarfp_(integer *, doublereal *,
  23. doublereal *, integer *, doublereal *);
  24. /* -- LAPACK routine (version 3.2) -- */
  25. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  26. /* November 2006 */
  27. /* .. Scalar Arguments .. */
  28. /* .. */
  29. /* .. Array Arguments .. */
  30. /* .. */
  31. /* Purpose */
  32. /* ======= */
  33. /* DLATRZ factors the M-by-(M+L) real upper trapezoidal matrix */
  34. /* [ A1 A2 ] = [ A(1:M,1:M) A(1:M,N-L+1:N) ] as ( R 0 ) * Z, by means */
  35. /* of orthogonal transformations. Z is an (M+L)-by-(M+L) orthogonal */
  36. /* matrix and, R and A1 are M-by-M upper triangular matrices. */
  37. /* Arguments */
  38. /* ========= */
  39. /* M (input) INTEGER */
  40. /* The number of rows of the matrix A. M >= 0. */
  41. /* N (input) INTEGER */
  42. /* The number of columns of the matrix A. N >= 0. */
  43. /* L (input) INTEGER */
  44. /* The number of columns of the matrix A containing the */
  45. /* meaningful part of the Householder vectors. N-M >= L >= 0. */
  46. /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
  47. /* On entry, the leading M-by-N upper trapezoidal part of the */
  48. /* array A must contain the matrix to be factorized. */
  49. /* On exit, the leading M-by-M upper triangular part of A */
  50. /* contains the upper triangular matrix R, and elements N-L+1 to */
  51. /* N of the first M rows of A, with the array TAU, represent the */
  52. /* orthogonal matrix Z as a product of M elementary reflectors. */
  53. /* LDA (input) INTEGER */
  54. /* The leading dimension of the array A. LDA >= max(1,M). */
  55. /* TAU (output) DOUBLE PRECISION array, dimension (M) */
  56. /* The scalar factors of the elementary reflectors. */
  57. /* WORK (workspace) DOUBLE PRECISION array, dimension (M) */
  58. /* Further Details */
  59. /* =============== */
  60. /* Based on contributions by */
  61. /* A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */
  62. /* The factorization is obtained by Householder's method. The kth */
  63. /* transformation matrix, Z( k ), which is used to introduce zeros into */
  64. /* the ( m - k + 1 )th row of A, is given in the form */
  65. /* Z( k ) = ( I 0 ), */
  66. /* ( 0 T( k ) ) */
  67. /* where */
  68. /* T( k ) = I - tau*u( k )*u( k )', u( k ) = ( 1 ), */
  69. /* ( 0 ) */
  70. /* ( z( k ) ) */
  71. /* tau is a scalar and z( k ) is an l element vector. tau and z( k ) */
  72. /* are chosen to annihilate the elements of the kth row of A2. */
  73. /* The scalar tau is returned in the kth element of TAU and the vector */
  74. /* u( k ) in the kth row of A2, such that the elements of z( k ) are */
  75. /* in a( k, l + 1 ), ..., a( k, n ). The elements of R are returned in */
  76. /* the upper triangular part of A1. */
  77. /* Z is given by */
  78. /* Z = Z( 1 ) * Z( 2 ) * ... * Z( m ). */
  79. /* ===================================================================== */
  80. /* .. Parameters .. */
  81. /* .. */
  82. /* .. Local Scalars .. */
  83. /* .. */
  84. /* .. External Subroutines .. */
  85. /* .. */
  86. /* .. Executable Statements .. */
  87. /* Test the input arguments */
  88. /* Quick return if possible */
  89. /* Parameter adjustments */
  90. a_dim1 = *lda;
  91. a_offset = 1 + a_dim1;
  92. a -= a_offset;
  93. --tau;
  94. --work;
  95. /* Function Body */
  96. if (*m == 0) {
  97. return 0;
  98. } else if (*m == *n) {
  99. i__1 = *n;
  100. for (i__ = 1; i__ <= i__1; ++i__) {
  101. tau[i__] = 0.;
  102. /* L10: */
  103. }
  104. return 0;
  105. }
  106. for (i__ = *m; i__ >= 1; --i__) {
  107. /* Generate elementary reflector H(i) to annihilate */
  108. /* [ A(i,i) A(i,n-l+1:n) ] */
  109. i__1 = *l + 1;
  110. _starpu_dlarfp_(&i__1, &a[i__ + i__ * a_dim1], &a[i__ + (*n - *l + 1) *
  111. a_dim1], lda, &tau[i__]);
  112. /* Apply H(i) to A(1:i-1,i:n) from the right */
  113. i__1 = i__ - 1;
  114. i__2 = *n - i__ + 1;
  115. _starpu_dlarz_("Right", &i__1, &i__2, l, &a[i__ + (*n - *l + 1) * a_dim1],
  116. lda, &tau[i__], &a[i__ * a_dim1 + 1], lda, &work[1]);
  117. /* L20: */
  118. }
  119. return 0;
  120. /* End of DLATRZ */
  121. } /* _starpu_dlatrz_ */