dtrttp.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* dtrttp.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_dtrttp_(char *uplo, integer *n, doublereal *a, integer *
  14. lda, doublereal *ap, integer *info)
  15. {
  16. /* System generated locals */
  17. integer a_dim1, a_offset, i__1, i__2;
  18. /* Local variables */
  19. integer i__, j, k;
  20. extern logical _starpu_lsame_(char *, char *);
  21. logical lower;
  22. extern /* Subroutine */ int _starpu_xerbla_(char *, integer *);
  23. /* -- LAPACK routine (version 3.2) -- */
  24. /* -- Contributed by Fred Gustavson of the IBM Watson Research Center -- */
  25. /* -- and Julien Langou of the Univ. of Colorado Denver -- */
  26. /* -- November 2008 -- */
  27. /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
  28. /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
  29. /* .. Scalar Arguments .. */
  30. /* .. */
  31. /* .. Array Arguments .. */
  32. /* .. */
  33. /* Purpose */
  34. /* ======= */
  35. /* DTRTTP copies a triangular matrix A from full format (TR) to standard */
  36. /* packed format (TP). */
  37. /* Arguments */
  38. /* ========= */
  39. /* UPLO (input) CHARACTER */
  40. /* = 'U': A is upper triangular. */
  41. /* = 'L': A is lower triangular. */
  42. /* N (input) INTEGER */
  43. /* The order of the matrices AP and A. N >= 0. */
  44. /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
  45. /* On exit, the triangular matrix A. If UPLO = 'U', the leading */
  46. /* N-by-N upper triangular part of A contains the upper */
  47. /* triangular part of the matrix A, and the strictly lower */
  48. /* triangular part of A is not referenced. If UPLO = 'L', the */
  49. /* leading N-by-N lower triangular part of A contains the lower */
  50. /* triangular part of the matrix A, and the strictly upper */
  51. /* triangular part of A is not referenced. */
  52. /* LDA (input) INTEGER */
  53. /* The leading dimension of the array A. LDA >= max(1,N). */
  54. /* AP (output) DOUBLE PRECISION array, dimension (N*(N+1)/2 */
  55. /* On exit, the upper or lower triangular matrix A, packed */
  56. /* columnwise in a linear array. The j-th column of A is stored */
  57. /* in the array AP as follows: */
  58. /* if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; */
  59. /* if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. */
  60. /* INFO (output) INTEGER */
  61. /* = 0: successful exit */
  62. /* < 0: if INFO = -i, the i-th argument had an illegal value */
  63. /* ===================================================================== */
  64. /* .. Parameters .. */
  65. /* .. */
  66. /* .. Local Scalars .. */
  67. /* .. */
  68. /* .. External Functions .. */
  69. /* .. */
  70. /* .. External Subroutines .. */
  71. /* .. */
  72. /* .. Executable Statements .. */
  73. /* Test the input parameters. */
  74. /* Parameter adjustments */
  75. a_dim1 = *lda;
  76. a_offset = 1 + a_dim1;
  77. a -= a_offset;
  78. --ap;
  79. /* Function Body */
  80. *info = 0;
  81. lower = _starpu_lsame_(uplo, "L");
  82. if (! lower && ! _starpu_lsame_(uplo, "U")) {
  83. *info = -1;
  84. } else if (*n < 0) {
  85. *info = -2;
  86. } else if (*lda < max(1,*n)) {
  87. *info = -4;
  88. }
  89. if (*info != 0) {
  90. i__1 = -(*info);
  91. _starpu_xerbla_("DTRTTP", &i__1);
  92. return 0;
  93. }
  94. if (lower) {
  95. k = 0;
  96. i__1 = *n;
  97. for (j = 1; j <= i__1; ++j) {
  98. i__2 = *n;
  99. for (i__ = j; i__ <= i__2; ++i__) {
  100. ++k;
  101. ap[k] = a[i__ + j * a_dim1];
  102. }
  103. }
  104. } else {
  105. k = 0;
  106. i__1 = *n;
  107. for (j = 1; j <= i__1; ++j) {
  108. i__2 = j;
  109. for (i__ = 1; i__ <= i__2; ++i__) {
  110. ++k;
  111. ap[k] = a[i__ + j * a_dim1];
  112. }
  113. }
  114. }
  115. return 0;
  116. /* End of DTRTTP */
  117. } /* _starpu_dtrttp_ */