dlatzm.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* dlatzm.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. /* Table of constant values */
  14. static integer c__1 = 1;
  15. static doublereal c_b5 = 1.;
  16. /* Subroutine */ int _starpu_dlatzm_(char *side, integer *m, integer *n, doublereal *
  17. v, integer *incv, doublereal *tau, doublereal *c1, doublereal *c2,
  18. integer *ldc, doublereal *work)
  19. {
  20. /* System generated locals */
  21. integer c1_dim1, c1_offset, c2_dim1, c2_offset, i__1;
  22. doublereal d__1;
  23. /* Local variables */
  24. extern /* Subroutine */ int _starpu_dger_(integer *, integer *, doublereal *,
  25. doublereal *, integer *, doublereal *, integer *, doublereal *,
  26. integer *);
  27. extern logical _starpu_lsame_(char *, char *);
  28. extern /* Subroutine */ int _starpu_dgemv_(char *, integer *, integer *,
  29. doublereal *, doublereal *, integer *, doublereal *, integer *,
  30. doublereal *, doublereal *, integer *), _starpu_dcopy_(integer *,
  31. doublereal *, integer *, doublereal *, integer *), _starpu_daxpy_(integer
  32. *, doublereal *, doublereal *, integer *, doublereal *, integer *)
  33. ;
  34. /* -- LAPACK routine (version 3.2) -- */
  35. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  36. /* November 2006 */
  37. /* .. Scalar Arguments .. */
  38. /* .. */
  39. /* .. Array Arguments .. */
  40. /* .. */
  41. /* Purpose */
  42. /* ======= */
  43. /* This routine is deprecated and has been replaced by routine DORMRZ. */
  44. /* DLATZM applies a Householder matrix generated by DTZRQF to a matrix. */
  45. /* Let P = I - tau*u*u', u = ( 1 ), */
  46. /* ( v ) */
  47. /* where v is an (m-1) vector if SIDE = 'L', or a (n-1) vector if */
  48. /* SIDE = 'R'. */
  49. /* If SIDE equals 'L', let */
  50. /* C = [ C1 ] 1 */
  51. /* [ C2 ] m-1 */
  52. /* n */
  53. /* Then C is overwritten by P*C. */
  54. /* If SIDE equals 'R', let */
  55. /* C = [ C1, C2 ] m */
  56. /* 1 n-1 */
  57. /* Then C is overwritten by C*P. */
  58. /* Arguments */
  59. /* ========= */
  60. /* SIDE (input) CHARACTER*1 */
  61. /* = 'L': form P * C */
  62. /* = 'R': form C * P */
  63. /* M (input) INTEGER */
  64. /* The number of rows of the matrix C. */
  65. /* N (input) INTEGER */
  66. /* The number of columns of the matrix C. */
  67. /* V (input) DOUBLE PRECISION array, dimension */
  68. /* (1 + (M-1)*abs(INCV)) if SIDE = 'L' */
  69. /* (1 + (N-1)*abs(INCV)) if SIDE = 'R' */
  70. /* The vector v in the representation of P. V is not used */
  71. /* if TAU = 0. */
  72. /* INCV (input) INTEGER */
  73. /* The increment between elements of v. INCV <> 0 */
  74. /* TAU (input) DOUBLE PRECISION */
  75. /* The value tau in the representation of P. */
  76. /* C1 (input/output) DOUBLE PRECISION array, dimension */
  77. /* (LDC,N) if SIDE = 'L' */
  78. /* (M,1) if SIDE = 'R' */
  79. /* On entry, the n-vector C1 if SIDE = 'L', or the m-vector C1 */
  80. /* if SIDE = 'R'. */
  81. /* On exit, the first row of P*C if SIDE = 'L', or the first */
  82. /* column of C*P if SIDE = 'R'. */
  83. /* C2 (input/output) DOUBLE PRECISION array, dimension */
  84. /* (LDC, N) if SIDE = 'L' */
  85. /* (LDC, N-1) if SIDE = 'R' */
  86. /* On entry, the (m - 1) x n matrix C2 if SIDE = 'L', or the */
  87. /* m x (n - 1) matrix C2 if SIDE = 'R'. */
  88. /* On exit, rows 2:m of P*C if SIDE = 'L', or columns 2:m of C*P */
  89. /* if SIDE = 'R'. */
  90. /* LDC (input) INTEGER */
  91. /* The leading dimension of the arrays C1 and C2. LDC >= (1,M). */
  92. /* WORK (workspace) DOUBLE PRECISION array, dimension */
  93. /* (N) if SIDE = 'L' */
  94. /* (M) if SIDE = 'R' */
  95. /* ===================================================================== */
  96. /* .. Parameters .. */
  97. /* .. */
  98. /* .. External Subroutines .. */
  99. /* .. */
  100. /* .. External Functions .. */
  101. /* .. */
  102. /* .. Intrinsic Functions .. */
  103. /* .. */
  104. /* .. Executable Statements .. */
  105. /* Parameter adjustments */
  106. --v;
  107. c2_dim1 = *ldc;
  108. c2_offset = 1 + c2_dim1;
  109. c2 -= c2_offset;
  110. c1_dim1 = *ldc;
  111. c1_offset = 1 + c1_dim1;
  112. c1 -= c1_offset;
  113. --work;
  114. /* Function Body */
  115. if (min(*m,*n) == 0 || *tau == 0.) {
  116. return 0;
  117. }
  118. if (_starpu_lsame_(side, "L")) {
  119. /* w := C1 + v' * C2 */
  120. _starpu_dcopy_(n, &c1[c1_offset], ldc, &work[1], &c__1);
  121. i__1 = *m - 1;
  122. _starpu_dgemv_("Transpose", &i__1, n, &c_b5, &c2[c2_offset], ldc, &v[1], incv,
  123. &c_b5, &work[1], &c__1);
  124. /* [ C1 ] := [ C1 ] - tau* [ 1 ] * w' */
  125. /* [ C2 ] [ C2 ] [ v ] */
  126. d__1 = -(*tau);
  127. _starpu_daxpy_(n, &d__1, &work[1], &c__1, &c1[c1_offset], ldc);
  128. i__1 = *m - 1;
  129. d__1 = -(*tau);
  130. _starpu_dger_(&i__1, n, &d__1, &v[1], incv, &work[1], &c__1, &c2[c2_offset],
  131. ldc);
  132. } else if (_starpu_lsame_(side, "R")) {
  133. /* w := C1 + C2 * v */
  134. _starpu_dcopy_(m, &c1[c1_offset], &c__1, &work[1], &c__1);
  135. i__1 = *n - 1;
  136. _starpu_dgemv_("No transpose", m, &i__1, &c_b5, &c2[c2_offset], ldc, &v[1],
  137. incv, &c_b5, &work[1], &c__1);
  138. /* [ C1, C2 ] := [ C1, C2 ] - tau* w * [ 1 , v'] */
  139. d__1 = -(*tau);
  140. _starpu_daxpy_(m, &d__1, &work[1], &c__1, &c1[c1_offset], &c__1);
  141. i__1 = *n - 1;
  142. d__1 = -(*tau);
  143. _starpu_dger_(m, &i__1, &d__1, &work[1], &c__1, &v[1], incv, &c2[c2_offset],
  144. ldc);
  145. }
  146. return 0;
  147. /* End of DLATZM */
  148. } /* _starpu_dlatzm_ */