You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

zgesvf.f 3.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. SUBROUTINE ZGESVF( N, NRHS, A, LDA, IPIV, B, LDB, INFO )
  2. *
  3. * -- LAPACK driver routine (version 3.1) --
  4. * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
  5. * November 2006
  6. *
  7. * .. Scalar Arguments ..
  8. INTEGER INFO, LDA, LDB, N, NRHS
  9. * ..
  10. * .. Array Arguments ..
  11. INTEGER IPIV( * )
  12. COMPLEX*16 A( LDA, * ), B( LDB, * )
  13. * ..
  14. *
  15. * Purpose
  16. * =======
  17. *
  18. * ZGESV computes the solution to a complex system of linear equations
  19. * A * X = B,
  20. * where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
  21. *
  22. * The LU decomposition with partial pivoting and row interchanges is
  23. * used to factor A as
  24. * A = P * L * U,
  25. * where P is a permutation matrix, L is unit lower triangular, and U is
  26. * upper triangular. The factored form of A is then used to solve the
  27. * system of equations A * X = B.
  28. *
  29. * Arguments
  30. * =========
  31. *
  32. * N (input) INTEGER
  33. * The number of linear equations, i.e., the order of the
  34. * matrix A. N >= 0.
  35. *
  36. * NRHS (input) INTEGER
  37. * The number of right hand sides, i.e., the number of columns
  38. * of the matrix B. NRHS >= 0.
  39. *
  40. * A (input/output) COMPLEX*16 array, dimension (LDA,N)
  41. * On entry, the N-by-N coefficient matrix A.
  42. * On exit, the factors L and U from the factorization
  43. * A = P*L*U; the unit diagonal elements of L are not stored.
  44. *
  45. * LDA (input) INTEGER
  46. * The leading dimension of the array A. LDA >= max(1,N).
  47. *
  48. * IPIV (output) INTEGER array, dimension (N)
  49. * The pivot indices that define the permutation matrix P;
  50. * row i of the matrix was interchanged with row IPIV(i).
  51. *
  52. * B (input/output) COMPLEX*16 array, dimension (LDB,NRHS)
  53. * On entry, the N-by-NRHS matrix of right hand side matrix B.
  54. * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
  55. *
  56. * LDB (input) INTEGER
  57. * The leading dimension of the array B. LDB >= max(1,N).
  58. *
  59. * INFO (output) INTEGER
  60. * = 0: successful exit
  61. * < 0: if INFO = -i, the i-th argument had an illegal value
  62. * > 0: if INFO = i, U(i,i) is exactly zero. The factorization
  63. * has been completed, but the factor U is exactly
  64. * singular, so the solution could not be computed.
  65. *
  66. * =====================================================================
  67. *
  68. * .. External Subroutines ..
  69. EXTERNAL XERBLA, ZGETRF, ZGETRS
  70. * ..
  71. * .. Intrinsic Functions ..
  72. INTRINSIC MAX
  73. * ..
  74. * .. Executable Statements ..
  75. *
  76. * Test the input parameters.
  77. *
  78. INFO = 0
  79. IF( N.LT.0 ) THEN
  80. INFO = -1
  81. ELSE IF( NRHS.LT.0 ) THEN
  82. INFO = -2
  83. ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
  84. INFO = -4
  85. ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
  86. INFO = -7
  87. END IF
  88. IF( INFO.NE.0 ) THEN
  89. CALL XERBLA( 'ZGESV ', -INFO )
  90. RETURN
  91. END IF
  92. *
  93. * Compute the LU factorization of A.
  94. *
  95. CALL ZGETRF( N, N, A, LDA, IPIV, INFO )
  96. IF( INFO.EQ.0 ) THEN
  97. *
  98. * Solve the system A*X = B, overwriting B with X.
  99. *
  100. CALL ZGETRS( 'No transpose', N, NRHS, A, LDA, IPIV, B, LDB,
  101. $ INFO )
  102. END IF
  103. RETURN
  104. *
  105. * End of ZGESV
  106. *
  107. END