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.

csgt01.f 6.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. *> \brief \b CSGT01
  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 CSGT01( ITYPE, UPLO, N, M, A, LDA, B, LDB, Z, LDZ, D,
  12. * WORK, RWORK, RESULT )
  13. *
  14. * .. Scalar Arguments ..
  15. * CHARACTER UPLO
  16. * INTEGER ITYPE, LDA, LDB, LDZ, M, N
  17. * ..
  18. * .. Array Arguments ..
  19. * REAL D( * ), RESULT( * ), RWORK( * )
  20. * COMPLEX A( LDA, * ), B( LDB, * ), WORK( * ),
  21. * $ Z( LDZ, * )
  22. * ..
  23. *
  24. *
  25. *> \par Purpose:
  26. * =============
  27. *>
  28. *> \verbatim
  29. *>
  30. *> CSGT01 checks a decomposition of the form
  31. *>
  32. *> A Z = B Z D or
  33. *> A B Z = Z D or
  34. *> B A Z = Z D
  35. *>
  36. *> where A is a Hermitian matrix, B is Hermitian positive definite,
  37. *> Z is unitary, and D is diagonal.
  38. *>
  39. *> One of the following test ratios is computed:
  40. *>
  41. *> ITYPE = 1: RESULT(1) = | A Z - B Z D | / ( |A| |Z| n ulp )
  42. *>
  43. *> ITYPE = 2: RESULT(1) = | A B Z - Z D | / ( |A| |Z| n ulp )
  44. *>
  45. *> ITYPE = 3: RESULT(1) = | B A Z - Z D | / ( |A| |Z| n ulp )
  46. *> \endverbatim
  47. *
  48. * Arguments:
  49. * ==========
  50. *
  51. *> \param[in] ITYPE
  52. *> \verbatim
  53. *> ITYPE is INTEGER
  54. *> The form of the Hermitian generalized eigenproblem.
  55. *> = 1: A*z = (lambda)*B*z
  56. *> = 2: A*B*z = (lambda)*z
  57. *> = 3: B*A*z = (lambda)*z
  58. *> \endverbatim
  59. *>
  60. *> \param[in] UPLO
  61. *> \verbatim
  62. *> UPLO is CHARACTER*1
  63. *> Specifies whether the upper or lower triangular part of the
  64. *> Hermitian matrices A and B is stored.
  65. *> = 'U': Upper triangular
  66. *> = 'L': Lower triangular
  67. *> \endverbatim
  68. *>
  69. *> \param[in] N
  70. *> \verbatim
  71. *> N is INTEGER
  72. *> The order of the matrix A. N >= 0.
  73. *> \endverbatim
  74. *>
  75. *> \param[in] M
  76. *> \verbatim
  77. *> M is INTEGER
  78. *> The number of eigenvalues found. M >= 0.
  79. *> \endverbatim
  80. *>
  81. *> \param[in] A
  82. *> \verbatim
  83. *> A is COMPLEX array, dimension (LDA, N)
  84. *> The original Hermitian matrix A.
  85. *> \endverbatim
  86. *>
  87. *> \param[in] LDA
  88. *> \verbatim
  89. *> LDA is INTEGER
  90. *> The leading dimension of the array A. LDA >= max(1,N).
  91. *> \endverbatim
  92. *>
  93. *> \param[in] B
  94. *> \verbatim
  95. *> B is COMPLEX array, dimension (LDB, N)
  96. *> The original Hermitian positive definite matrix B.
  97. *> \endverbatim
  98. *>
  99. *> \param[in] LDB
  100. *> \verbatim
  101. *> LDB is INTEGER
  102. *> The leading dimension of the array B. LDB >= max(1,N).
  103. *> \endverbatim
  104. *>
  105. *> \param[in] Z
  106. *> \verbatim
  107. *> Z is COMPLEX array, dimension (LDZ, M)
  108. *> The computed eigenvectors of the generalized eigenproblem.
  109. *> \endverbatim
  110. *>
  111. *> \param[in] LDZ
  112. *> \verbatim
  113. *> LDZ is INTEGER
  114. *> The leading dimension of the array Z. LDZ >= max(1,N).
  115. *> \endverbatim
  116. *>
  117. *> \param[in] D
  118. *> \verbatim
  119. *> D is REAL array, dimension (M)
  120. *> The computed eigenvalues of the generalized eigenproblem.
  121. *> \endverbatim
  122. *>
  123. *> \param[out] WORK
  124. *> \verbatim
  125. *> WORK is COMPLEX array, dimension (N*N)
  126. *> \endverbatim
  127. *>
  128. *> \param[out] RWORK
  129. *> \verbatim
  130. *> RWORK is REAL array, dimension (N)
  131. *> \endverbatim
  132. *>
  133. *> \param[out] RESULT
  134. *> \verbatim
  135. *> RESULT is REAL array, dimension (1)
  136. *> The test ratio as described above.
  137. *> \endverbatim
  138. *
  139. * Authors:
  140. * ========
  141. *
  142. *> \author Univ. of Tennessee
  143. *> \author Univ. of California Berkeley
  144. *> \author Univ. of Colorado Denver
  145. *> \author NAG Ltd.
  146. *
  147. *> \date December 2016
  148. *
  149. *> \ingroup complex_eig
  150. *
  151. * =====================================================================
  152. SUBROUTINE CSGT01( ITYPE, UPLO, N, M, A, LDA, B, LDB, Z, LDZ, D,
  153. $ WORK, RWORK, RESULT )
  154. *
  155. * -- LAPACK test routine (version 3.7.0) --
  156. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  157. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  158. * December 2016
  159. *
  160. * .. Scalar Arguments ..
  161. CHARACTER UPLO
  162. INTEGER ITYPE, LDA, LDB, LDZ, M, N
  163. * ..
  164. * .. Array Arguments ..
  165. REAL D( * ), RESULT( * ), RWORK( * )
  166. COMPLEX A( LDA, * ), B( LDB, * ), WORK( * ),
  167. $ Z( LDZ, * )
  168. * ..
  169. *
  170. * =====================================================================
  171. *
  172. * .. Parameters ..
  173. REAL ZERO, ONE
  174. PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
  175. COMPLEX CZERO, CONE
  176. PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ),
  177. $ CONE = ( 1.0E+0, 0.0E+0 ) )
  178. * ..
  179. * .. Local Scalars ..
  180. INTEGER I
  181. REAL ANORM, ULP
  182. * ..
  183. * .. External Functions ..
  184. REAL CLANGE, CLANHE, SLAMCH
  185. EXTERNAL CLANGE, CLANHE, SLAMCH
  186. * ..
  187. * .. External Subroutines ..
  188. EXTERNAL CHEMM, CSSCAL
  189. * ..
  190. * .. Executable Statements ..
  191. *
  192. RESULT( 1 ) = ZERO
  193. IF( N.LE.0 )
  194. $ RETURN
  195. *
  196. ULP = SLAMCH( 'Epsilon' )
  197. *
  198. * Compute product of 1-norms of A and Z.
  199. *
  200. ANORM = CLANHE( '1', UPLO, N, A, LDA, RWORK )*
  201. $ CLANGE( '1', N, M, Z, LDZ, RWORK )
  202. IF( ANORM.EQ.ZERO )
  203. $ ANORM = ONE
  204. *
  205. IF( ITYPE.EQ.1 ) THEN
  206. *
  207. * Norm of AZ - BZD
  208. *
  209. CALL CHEMM( 'Left', UPLO, N, M, CONE, A, LDA, Z, LDZ, CZERO,
  210. $ WORK, N )
  211. DO 10 I = 1, M
  212. CALL CSSCAL( N, D( I ), Z( 1, I ), 1 )
  213. 10 CONTINUE
  214. CALL CHEMM( 'Left', UPLO, N, M, CONE, B, LDB, Z, LDZ, -CONE,
  215. $ WORK, N )
  216. *
  217. RESULT( 1 ) = ( CLANGE( '1', N, M, WORK, N, RWORK ) / ANORM ) /
  218. $ ( N*ULP )
  219. *
  220. ELSE IF( ITYPE.EQ.2 ) THEN
  221. *
  222. * Norm of ABZ - ZD
  223. *
  224. CALL CHEMM( 'Left', UPLO, N, M, CONE, B, LDB, Z, LDZ, CZERO,
  225. $ WORK, N )
  226. DO 20 I = 1, M
  227. CALL CSSCAL( N, D( I ), Z( 1, I ), 1 )
  228. 20 CONTINUE
  229. CALL CHEMM( 'Left', UPLO, N, M, CONE, A, LDA, WORK, N, -CONE,
  230. $ Z, LDZ )
  231. *
  232. RESULT( 1 ) = ( CLANGE( '1', N, M, Z, LDZ, RWORK ) / ANORM ) /
  233. $ ( N*ULP )
  234. *
  235. ELSE IF( ITYPE.EQ.3 ) THEN
  236. *
  237. * Norm of BAZ - ZD
  238. *
  239. CALL CHEMM( 'Left', UPLO, N, M, CONE, A, LDA, Z, LDZ, CZERO,
  240. $ WORK, N )
  241. DO 30 I = 1, M
  242. CALL CSSCAL( N, D( I ), Z( 1, I ), 1 )
  243. 30 CONTINUE
  244. CALL CHEMM( 'Left', UPLO, N, M, CONE, B, LDB, WORK, N, -CONE,
  245. $ Z, LDZ )
  246. *
  247. RESULT( 1 ) = ( CLANGE( '1', N, M, Z, LDZ, RWORK ) / ANORM ) /
  248. $ ( N*ULP )
  249. END IF
  250. *
  251. RETURN
  252. *
  253. * End of CSGT01
  254. *
  255. END