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.

zlsets.f 5.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. *> \brief \b ZLSETS
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * SUBROUTINE ZLSETS( M, P, N, A, AF, LDA, B, BF, LDB, C, CF, D, DF,
  12. * X, WORK, LWORK, RWORK, RESULT )
  13. *
  14. * .. Scalar Arguments ..
  15. * INTEGER LDA, LDB, LWORK, M, N, P
  16. * ..
  17. * .. Array Arguments ..
  18. *
  19. *
  20. *> \par Purpose:
  21. * =============
  22. *>
  23. *> \verbatim
  24. *>
  25. *> ZLSETS tests ZGGLSE - a subroutine for solving linear equality
  26. *> constrained least square problem (LSE).
  27. *> \endverbatim
  28. *
  29. * Arguments:
  30. * ==========
  31. *
  32. *> \param[in] M
  33. *> \verbatim
  34. *> M is INTEGER
  35. *> The number of rows of the matrix A. M >= 0.
  36. *> \endverbatim
  37. *>
  38. *> \param[in] P
  39. *> \verbatim
  40. *> P is INTEGER
  41. *> The number of rows of the matrix B. P >= 0.
  42. *> \endverbatim
  43. *>
  44. *> \param[in] N
  45. *> \verbatim
  46. *> N is INTEGER
  47. *> The number of columns of the matrices A and B. N >= 0.
  48. *> \endverbatim
  49. *>
  50. *> \param[in] A
  51. *> \verbatim
  52. *> A is COMPLEX*16 array, dimension (LDA,N)
  53. *> The M-by-N matrix A.
  54. *> \endverbatim
  55. *>
  56. *> \param[out] AF
  57. *> \verbatim
  58. *> AF is COMPLEX*16 array, dimension (LDA,N)
  59. *> \endverbatim
  60. *>
  61. *> \param[in] LDA
  62. *> \verbatim
  63. *> LDA is INTEGER
  64. *> The leading dimension of the arrays A, AF, Q and R.
  65. *> LDA >= max(M,N).
  66. *> \endverbatim
  67. *>
  68. *> \param[in] B
  69. *> \verbatim
  70. *> B is COMPLEX*16 array, dimension (LDB,N)
  71. *> The P-by-N matrix A.
  72. *> \endverbatim
  73. *>
  74. *> \param[out] BF
  75. *> \verbatim
  76. *> BF is COMPLEX*16 array, dimension (LDB,N)
  77. *> \endverbatim
  78. *>
  79. *> \param[in] LDB
  80. *> \verbatim
  81. *> LDB is INTEGER
  82. *> The leading dimension of the arrays B, BF, V and S.
  83. *> LDB >= max(P,N).
  84. *> \endverbatim
  85. *>
  86. *> \param[in] C
  87. *> \verbatim
  88. *> C is COMPLEX*16 array, dimension( M )
  89. *> the vector C in the LSE problem.
  90. *> \endverbatim
  91. *>
  92. *> \param[out] CF
  93. *> \verbatim
  94. *> CF is COMPLEX*16 array, dimension( M )
  95. *> \endverbatim
  96. *>
  97. *> \param[in] D
  98. *> \verbatim
  99. *> D is COMPLEX*16 array, dimension( P )
  100. *> the vector D in the LSE problem.
  101. *> \endverbatim
  102. *>
  103. *> \param[out] DF
  104. *> \verbatim
  105. *> DF is COMPLEX*16 array, dimension( P )
  106. *> \endverbatim
  107. *>
  108. *> \param[out] X
  109. *> \verbatim
  110. *> X is COMPLEX*16 array, dimension( N )
  111. *> solution vector X in the LSE problem.
  112. *> \endverbatim
  113. *>
  114. *> \param[out] WORK
  115. *> \verbatim
  116. *> WORK is COMPLEX*16 array, dimension (LWORK)
  117. *> \endverbatim
  118. *>
  119. *> \param[in] LWORK
  120. *> \verbatim
  121. *> LWORK is INTEGER
  122. *> The dimension of the array WORK.
  123. *> \endverbatim
  124. *>
  125. *> \param[out] RWORK
  126. *> \verbatim
  127. *> RWORK is DOUBLE PRECISION array, dimension (M)
  128. *> \endverbatim
  129. *>
  130. *> \param[out] RESULT
  131. *> \verbatim
  132. *> RESULT is DOUBLE PRECISION array, dimension (2)
  133. *> The test ratios:
  134. *> RESULT(1) = norm( A*x - c )/ norm(A)*norm(X)*EPS
  135. *> RESULT(2) = norm( B*x - d )/ norm(B)*norm(X)*EPS
  136. *> \endverbatim
  137. *
  138. * Authors:
  139. * ========
  140. *
  141. *> \author Univ. of Tennessee
  142. *> \author Univ. of California Berkeley
  143. *> \author Univ. of Colorado Denver
  144. *> \author NAG Ltd.
  145. *
  146. *> \ingroup complex16_eig
  147. *
  148. * =====================================================================
  149. SUBROUTINE ZLSETS( M, P, N, A, AF, LDA, B, BF, LDB, C, CF, D, DF,
  150. $ X, WORK, LWORK, RWORK, RESULT )
  151. *
  152. * -- LAPACK test routine --
  153. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  154. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  155. *
  156. * .. Scalar Arguments ..
  157. INTEGER LDA, LDB, LWORK, M, N, P
  158. * ..
  159. * .. Array Arguments ..
  160. *
  161. * ====================================================================
  162. *
  163. DOUBLE PRECISION RESULT( 2 ), RWORK( * )
  164. COMPLEX*16 A( LDA, * ), AF( LDA, * ), B( LDB, * ),
  165. $ BF( LDB, * ), C( * ), CF( * ), D( * ), DF( * ),
  166. $ WORK( LWORK ), X( * )
  167. * ..
  168. * .. Local Scalars ..
  169. INTEGER INFO
  170. * ..
  171. * .. External Subroutines ..
  172. EXTERNAL ZCOPY, ZGET02, ZGGLSE, ZLACPY
  173. * ..
  174. * .. Executable Statements ..
  175. *
  176. * Copy the matrices A and B to the arrays AF and BF,
  177. * and the vectors C and D to the arrays CF and DF,
  178. *
  179. CALL ZLACPY( 'Full', M, N, A, LDA, AF, LDA )
  180. CALL ZLACPY( 'Full', P, N, B, LDB, BF, LDB )
  181. CALL ZCOPY( M, C, 1, CF, 1 )
  182. CALL ZCOPY( P, D, 1, DF, 1 )
  183. *
  184. * Solve LSE problem
  185. *
  186. CALL ZGGLSE( M, N, P, AF, LDA, BF, LDB, CF, DF, X, WORK, LWORK,
  187. $ INFO )
  188. *
  189. * Test the residual for the solution of LSE
  190. *
  191. * Compute RESULT(1) = norm( A*x - c ) / norm(A)*norm(X)*EPS
  192. *
  193. CALL ZCOPY( M, C, 1, CF, 1 )
  194. CALL ZCOPY( P, D, 1, DF, 1 )
  195. CALL ZGET02( 'No transpose', M, N, 1, A, LDA, X, N, CF, M, RWORK,
  196. $ RESULT( 1 ) )
  197. *
  198. * Compute result(2) = norm( B*x - d ) / norm(B)*norm(X)*EPS
  199. *
  200. CALL ZGET02( 'No transpose', P, N, 1, B, LDB, X, N, DF, P, RWORK,
  201. $ RESULT( 2 ) )
  202. *
  203. RETURN
  204. *
  205. * End of ZLSETS
  206. *
  207. END