dlauu2.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /* dlauu2.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 doublereal c_b7 = 1.;
  15. static integer c__1 = 1;
  16. /* Subroutine */ int _starpu_dlauu2_(char *uplo, integer *n, doublereal *a, integer *
  17. lda, integer *info)
  18. {
  19. /* System generated locals */
  20. integer a_dim1, a_offset, i__1, i__2, i__3;
  21. /* Local variables */
  22. integer i__;
  23. doublereal aii;
  24. extern doublereal _starpu_ddot_(integer *, doublereal *, integer *, doublereal *,
  25. integer *);
  26. extern /* Subroutine */ int _starpu_dscal_(integer *, doublereal *, doublereal *,
  27. integer *);
  28. extern logical _starpu_lsame_(char *, char *);
  29. extern /* Subroutine */ int _starpu_dgemv_(char *, integer *, integer *,
  30. doublereal *, doublereal *, integer *, doublereal *, integer *,
  31. doublereal *, doublereal *, integer *);
  32. logical upper;
  33. extern /* Subroutine */ int _starpu_xerbla_(char *, integer *);
  34. /* -- LAPACK auxiliary 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. /* DLAUU2 computes the product U * U' or L' * L, where the triangular */
  44. /* factor U or L is stored in the upper or lower triangular part of */
  45. /* the array A. */
  46. /* If UPLO = 'U' or 'u' then the upper triangle of the result is stored, */
  47. /* overwriting the factor U in A. */
  48. /* If UPLO = 'L' or 'l' then the lower triangle of the result is stored, */
  49. /* overwriting the factor L in A. */
  50. /* This is the unblocked form of the algorithm, calling Level 2 BLAS. */
  51. /* Arguments */
  52. /* ========= */
  53. /* UPLO (input) CHARACTER*1 */
  54. /* Specifies whether the triangular factor stored in the array A */
  55. /* is upper or lower triangular: */
  56. /* = 'U': Upper triangular */
  57. /* = 'L': Lower triangular */
  58. /* N (input) INTEGER */
  59. /* The order of the triangular factor U or L. N >= 0. */
  60. /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
  61. /* On entry, the triangular factor U or L. */
  62. /* On exit, if UPLO = 'U', the upper triangle of A is */
  63. /* overwritten with the upper triangle of the product U * U'; */
  64. /* if UPLO = 'L', the lower triangle of A is overwritten with */
  65. /* the lower triangle of the product L' * L. */
  66. /* LDA (input) INTEGER */
  67. /* The leading dimension of the array A. LDA >= max(1,N). */
  68. /* INFO (output) INTEGER */
  69. /* = 0: successful exit */
  70. /* < 0: if INFO = -k, the k-th argument had an illegal value */
  71. /* ===================================================================== */
  72. /* .. Parameters .. */
  73. /* .. */
  74. /* .. Local Scalars .. */
  75. /* .. */
  76. /* .. External Functions .. */
  77. /* .. */
  78. /* .. External Subroutines .. */
  79. /* .. */
  80. /* .. Intrinsic Functions .. */
  81. /* .. */
  82. /* .. Executable Statements .. */
  83. /* Test the input parameters. */
  84. /* Parameter adjustments */
  85. a_dim1 = *lda;
  86. a_offset = 1 + a_dim1;
  87. a -= a_offset;
  88. /* Function Body */
  89. *info = 0;
  90. upper = _starpu_lsame_(uplo, "U");
  91. if (! upper && ! _starpu_lsame_(uplo, "L")) {
  92. *info = -1;
  93. } else if (*n < 0) {
  94. *info = -2;
  95. } else if (*lda < max(1,*n)) {
  96. *info = -4;
  97. }
  98. if (*info != 0) {
  99. i__1 = -(*info);
  100. _starpu_xerbla_("DLAUU2", &i__1);
  101. return 0;
  102. }
  103. /* Quick return if possible */
  104. if (*n == 0) {
  105. return 0;
  106. }
  107. if (upper) {
  108. /* Compute the product U * U'. */
  109. i__1 = *n;
  110. for (i__ = 1; i__ <= i__1; ++i__) {
  111. aii = a[i__ + i__ * a_dim1];
  112. if (i__ < *n) {
  113. i__2 = *n - i__ + 1;
  114. a[i__ + i__ * a_dim1] = _starpu_ddot_(&i__2, &a[i__ + i__ * a_dim1],
  115. lda, &a[i__ + i__ * a_dim1], lda);
  116. i__2 = i__ - 1;
  117. i__3 = *n - i__;
  118. _starpu_dgemv_("No transpose", &i__2, &i__3, &c_b7, &a[(i__ + 1) *
  119. a_dim1 + 1], lda, &a[i__ + (i__ + 1) * a_dim1], lda, &
  120. aii, &a[i__ * a_dim1 + 1], &c__1);
  121. } else {
  122. _starpu_dscal_(&i__, &aii, &a[i__ * a_dim1 + 1], &c__1);
  123. }
  124. /* L10: */
  125. }
  126. } else {
  127. /* Compute the product L' * L. */
  128. i__1 = *n;
  129. for (i__ = 1; i__ <= i__1; ++i__) {
  130. aii = a[i__ + i__ * a_dim1];
  131. if (i__ < *n) {
  132. i__2 = *n - i__ + 1;
  133. a[i__ + i__ * a_dim1] = _starpu_ddot_(&i__2, &a[i__ + i__ * a_dim1], &
  134. c__1, &a[i__ + i__ * a_dim1], &c__1);
  135. i__2 = *n - i__;
  136. i__3 = i__ - 1;
  137. _starpu_dgemv_("Transpose", &i__2, &i__3, &c_b7, &a[i__ + 1 + a_dim1],
  138. lda, &a[i__ + 1 + i__ * a_dim1], &c__1, &aii, &a[i__
  139. + a_dim1], lda);
  140. } else {
  141. _starpu_dscal_(&i__, &aii, &a[i__ + a_dim1], lda);
  142. }
  143. /* L20: */
  144. }
  145. }
  146. return 0;
  147. /* End of DLAUU2 */
  148. } /* _starpu_dlauu2_ */