dppsv.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* dppsv.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_dppsv_(char *uplo, integer *n, integer *nrhs, doublereal
  14. *ap, doublereal *b, integer *ldb, integer *info)
  15. {
  16. /* System generated locals */
  17. integer b_dim1, b_offset, i__1;
  18. /* Local variables */
  19. extern logical _starpu_lsame_(char *, char *);
  20. extern /* Subroutine */ int _starpu_xerbla_(char *, integer *), _starpu_dpptrf_(
  21. char *, integer *, doublereal *, integer *), _starpu_dpptrs_(char
  22. *, integer *, integer *, doublereal *, doublereal *, integer *,
  23. integer *);
  24. /* -- LAPACK driver 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. /* DPPSV computes the solution to a real system of linear equations */
  34. /* A * X = B, */
  35. /* where A is an N-by-N symmetric positive definite matrix stored in */
  36. /* packed format and X and B are N-by-NRHS matrices. */
  37. /* The Cholesky decomposition is used to factor A as */
  38. /* A = U**T* U, if UPLO = 'U', or */
  39. /* A = L * L**T, if UPLO = 'L', */
  40. /* where U is an upper triangular matrix and L is a lower triangular */
  41. /* matrix. The factored form of A is then used to solve the system of */
  42. /* equations A * X = B. */
  43. /* Arguments */
  44. /* ========= */
  45. /* UPLO (input) CHARACTER*1 */
  46. /* = 'U': Upper triangle of A is stored; */
  47. /* = 'L': Lower triangle of A is stored. */
  48. /* N (input) INTEGER */
  49. /* The number of linear equations, i.e., the order of the */
  50. /* matrix A. N >= 0. */
  51. /* NRHS (input) INTEGER */
  52. /* The number of right hand sides, i.e., the number of columns */
  53. /* of the matrix B. NRHS >= 0. */
  54. /* AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2) */
  55. /* On entry, the upper or lower triangle of the symmetric matrix */
  56. /* A, packed columnwise in a linear array. The j-th column of A */
  57. /* is stored 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. /* See below for further details. */
  61. /* On exit, if INFO = 0, the factor U or L from the Cholesky */
  62. /* factorization A = U**T*U or A = L*L**T, in the same storage */
  63. /* format as A. */
  64. /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
  65. /* On entry, the N-by-NRHS right hand side matrix B. */
  66. /* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
  67. /* LDB (input) INTEGER */
  68. /* The leading dimension of the array B. LDB >= max(1,N). */
  69. /* INFO (output) INTEGER */
  70. /* = 0: successful exit */
  71. /* < 0: if INFO = -i, the i-th argument had an illegal value */
  72. /* > 0: if INFO = i, the leading minor of order i of A is not */
  73. /* positive definite, so the factorization could not be */
  74. /* completed, and the solution has not been computed. */
  75. /* Further Details */
  76. /* =============== */
  77. /* The packed storage scheme is illustrated by the following example */
  78. /* when N = 4, UPLO = 'U': */
  79. /* Two-dimensional storage of the symmetric matrix A: */
  80. /* a11 a12 a13 a14 */
  81. /* a22 a23 a24 */
  82. /* a33 a34 (aij = conjg(aji)) */
  83. /* a44 */
  84. /* Packed storage of the upper triangle of A: */
  85. /* AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ] */
  86. /* ===================================================================== */
  87. /* .. External Functions .. */
  88. /* .. */
  89. /* .. External Subroutines .. */
  90. /* .. */
  91. /* .. Intrinsic Functions .. */
  92. /* .. */
  93. /* .. Executable Statements .. */
  94. /* Test the input parameters. */
  95. /* Parameter adjustments */
  96. --ap;
  97. b_dim1 = *ldb;
  98. b_offset = 1 + b_dim1;
  99. b -= b_offset;
  100. /* Function Body */
  101. *info = 0;
  102. if (! _starpu_lsame_(uplo, "U") && ! _starpu_lsame_(uplo, "L")) {
  103. *info = -1;
  104. } else if (*n < 0) {
  105. *info = -2;
  106. } else if (*nrhs < 0) {
  107. *info = -3;
  108. } else if (*ldb < max(1,*n)) {
  109. *info = -6;
  110. }
  111. if (*info != 0) {
  112. i__1 = -(*info);
  113. _starpu_xerbla_("DPPSV ", &i__1);
  114. return 0;
  115. }
  116. /* Compute the Cholesky factorization A = U'*U or A = L*L'. */
  117. _starpu_dpptrf_(uplo, n, &ap[1], info);
  118. if (*info == 0) {
  119. /* Solve the system A*X = B, overwriting B with X. */
  120. _starpu_dpptrs_(uplo, n, nrhs, &ap[1], &b[b_offset], ldb, info);
  121. }
  122. return 0;
  123. /* End of DPPSV */
  124. } /* _starpu_dppsv_ */