dpttrs.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* dpttrs.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 integer c_n1 = -1;
  16. /* Subroutine */ int _starpu_dpttrs_(integer *n, integer *nrhs, doublereal *d__,
  17. doublereal *e, doublereal *b, integer *ldb, integer *info)
  18. {
  19. /* System generated locals */
  20. integer b_dim1, b_offset, i__1, i__2, i__3;
  21. /* Local variables */
  22. integer j, jb, nb;
  23. extern /* Subroutine */ int _starpu_dptts2_(integer *, integer *, doublereal *,
  24. doublereal *, doublereal *, integer *), _starpu_xerbla_(char *, integer *);
  25. extern integer _starpu_ilaenv_(integer *, char *, char *, integer *, integer *,
  26. integer *, integer *);
  27. /* -- LAPACK routine (version 3.2) -- */
  28. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  29. /* November 2006 */
  30. /* .. Scalar Arguments .. */
  31. /* .. */
  32. /* .. Array Arguments .. */
  33. /* .. */
  34. /* Purpose */
  35. /* ======= */
  36. /* DPTTRS solves a tridiagonal system of the form */
  37. /* A * X = B */
  38. /* using the L*D*L' factorization of A computed by DPTTRF. D is a */
  39. /* diagonal matrix specified in the vector D, L is a unit bidiagonal */
  40. /* matrix whose subdiagonal is specified in the vector E, and X and B */
  41. /* are N by NRHS matrices. */
  42. /* Arguments */
  43. /* ========= */
  44. /* N (input) INTEGER */
  45. /* The order of the tridiagonal matrix A. N >= 0. */
  46. /* NRHS (input) INTEGER */
  47. /* The number of right hand sides, i.e., the number of columns */
  48. /* of the matrix B. NRHS >= 0. */
  49. /* D (input) DOUBLE PRECISION array, dimension (N) */
  50. /* The n diagonal elements of the diagonal matrix D from the */
  51. /* L*D*L' factorization of A. */
  52. /* E (input) DOUBLE PRECISION array, dimension (N-1) */
  53. /* The (n-1) subdiagonal elements of the unit bidiagonal factor */
  54. /* L from the L*D*L' factorization of A. E can also be regarded */
  55. /* as the superdiagonal of the unit bidiagonal factor U from the */
  56. /* factorization A = U'*D*U. */
  57. /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
  58. /* On entry, the right hand side vectors B for the system of */
  59. /* linear equations. */
  60. /* On exit, the solution vectors, X. */
  61. /* LDB (input) INTEGER */
  62. /* The leading dimension of the array B. LDB >= max(1,N). */
  63. /* INFO (output) INTEGER */
  64. /* = 0: successful exit */
  65. /* < 0: if INFO = -k, the k-th argument had an illegal value */
  66. /* ===================================================================== */
  67. /* .. Local Scalars .. */
  68. /* .. */
  69. /* .. External Functions .. */
  70. /* .. */
  71. /* .. External Subroutines .. */
  72. /* .. */
  73. /* .. Intrinsic Functions .. */
  74. /* .. */
  75. /* .. Executable Statements .. */
  76. /* Test the input arguments. */
  77. /* Parameter adjustments */
  78. --d__;
  79. --e;
  80. b_dim1 = *ldb;
  81. b_offset = 1 + b_dim1;
  82. b -= b_offset;
  83. /* Function Body */
  84. *info = 0;
  85. if (*n < 0) {
  86. *info = -1;
  87. } else if (*nrhs < 0) {
  88. *info = -2;
  89. } else if (*ldb < max(1,*n)) {
  90. *info = -6;
  91. }
  92. if (*info != 0) {
  93. i__1 = -(*info);
  94. _starpu_xerbla_("DPTTRS", &i__1);
  95. return 0;
  96. }
  97. /* Quick return if possible */
  98. if (*n == 0 || *nrhs == 0) {
  99. return 0;
  100. }
  101. /* Determine the number of right-hand sides to solve at a time. */
  102. if (*nrhs == 1) {
  103. nb = 1;
  104. } else {
  105. /* Computing MAX */
  106. i__1 = 1, i__2 = _starpu_ilaenv_(&c__1, "DPTTRS", " ", n, nrhs, &c_n1, &c_n1);
  107. nb = max(i__1,i__2);
  108. }
  109. if (nb >= *nrhs) {
  110. _starpu_dptts2_(n, nrhs, &d__[1], &e[1], &b[b_offset], ldb);
  111. } else {
  112. i__1 = *nrhs;
  113. i__2 = nb;
  114. for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
  115. /* Computing MIN */
  116. i__3 = *nrhs - j + 1;
  117. jb = min(i__3,nb);
  118. _starpu_dptts2_(n, &jb, &d__[1], &e[1], &b[j * b_dim1 + 1], ldb);
  119. /* L10: */
  120. }
  121. }
  122. return 0;
  123. /* End of DPTTRS */
  124. } /* _starpu_dpttrs_ */