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.

clakf2.f 4.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. *> \brief \b CLAKF2
  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 CLAKF2( M, N, A, LDA, B, D, E, Z, LDZ )
  12. *
  13. * .. Scalar Arguments ..
  14. * INTEGER LDA, LDZ, M, N
  15. * ..
  16. * .. Array Arguments ..
  17. * COMPLEX A( LDA, * ), B( LDA, * ), D( LDA, * ),
  18. * $ E( LDA, * ), Z( LDZ, * )
  19. * ..
  20. *
  21. *
  22. *> \par Purpose:
  23. * =============
  24. *>
  25. *> \verbatim
  26. *>
  27. *> Form the 2*M*N by 2*M*N matrix
  28. *>
  29. *> Z = [ kron(In, A) -kron(B', Im) ]
  30. *> [ kron(In, D) -kron(E', Im) ],
  31. *>
  32. *> where In is the identity matrix of size n and X' is the transpose
  33. *> of X. kron(X, Y) is the Kronecker product between the matrices X
  34. *> and Y.
  35. *> \endverbatim
  36. *
  37. * Arguments:
  38. * ==========
  39. *
  40. *> \param[in] M
  41. *> \verbatim
  42. *> M is INTEGER
  43. *> Size of matrix, must be >= 1.
  44. *> \endverbatim
  45. *>
  46. *> \param[in] N
  47. *> \verbatim
  48. *> N is INTEGER
  49. *> Size of matrix, must be >= 1.
  50. *> \endverbatim
  51. *>
  52. *> \param[in] A
  53. *> \verbatim
  54. *> A is COMPLEX, dimension ( LDA, M )
  55. *> The matrix A in the output matrix Z.
  56. *> \endverbatim
  57. *>
  58. *> \param[in] LDA
  59. *> \verbatim
  60. *> LDA is INTEGER
  61. *> The leading dimension of A, B, D, and E. ( LDA >= M+N )
  62. *> \endverbatim
  63. *>
  64. *> \param[in] B
  65. *> \verbatim
  66. *> B is COMPLEX, dimension ( LDA, N )
  67. *> \endverbatim
  68. *>
  69. *> \param[in] D
  70. *> \verbatim
  71. *> D is COMPLEX, dimension ( LDA, M )
  72. *> \endverbatim
  73. *>
  74. *> \param[in] E
  75. *> \verbatim
  76. *> E is COMPLEX, dimension ( LDA, N )
  77. *>
  78. *> The matrices used in forming the output matrix Z.
  79. *> \endverbatim
  80. *>
  81. *> \param[out] Z
  82. *> \verbatim
  83. *> Z is COMPLEX, dimension ( LDZ, 2*M*N )
  84. *> The resultant Kronecker M*N*2 by M*N*2 matrix (see above.)
  85. *> \endverbatim
  86. *>
  87. *> \param[in] LDZ
  88. *> \verbatim
  89. *> LDZ is INTEGER
  90. *> The leading dimension of Z. ( LDZ >= 2*M*N )
  91. *> \endverbatim
  92. *
  93. * Authors:
  94. * ========
  95. *
  96. *> \author Univ. of Tennessee
  97. *> \author Univ. of California Berkeley
  98. *> \author Univ. of Colorado Denver
  99. *> \author NAG Ltd.
  100. *
  101. *> \date December 2016
  102. *
  103. *> \ingroup complex_matgen
  104. *
  105. * =====================================================================
  106. SUBROUTINE CLAKF2( M, N, A, LDA, B, D, E, Z, LDZ )
  107. *
  108. * -- LAPACK computational routine (version 3.7.0) --
  109. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  110. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  111. * December 2016
  112. *
  113. * .. Scalar Arguments ..
  114. INTEGER LDA, LDZ, M, N
  115. * ..
  116. * .. Array Arguments ..
  117. COMPLEX A( LDA, * ), B( LDA, * ), D( LDA, * ),
  118. $ E( LDA, * ), Z( LDZ, * )
  119. * ..
  120. *
  121. * ====================================================================
  122. *
  123. * .. Parameters ..
  124. COMPLEX ZERO
  125. PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ) )
  126. * ..
  127. * .. Local Scalars ..
  128. INTEGER I, IK, J, JK, L, MN, MN2
  129. * ..
  130. * .. External Subroutines ..
  131. EXTERNAL CLASET
  132. * ..
  133. * .. Executable Statements ..
  134. *
  135. * Initialize Z
  136. *
  137. MN = M*N
  138. MN2 = 2*MN
  139. CALL CLASET( 'Full', MN2, MN2, ZERO, ZERO, Z, LDZ )
  140. *
  141. IK = 1
  142. DO 50 L = 1, N
  143. *
  144. * form kron(In, A)
  145. *
  146. DO 20 I = 1, M
  147. DO 10 J = 1, M
  148. Z( IK+I-1, IK+J-1 ) = A( I, J )
  149. 10 CONTINUE
  150. 20 CONTINUE
  151. *
  152. * form kron(In, D)
  153. *
  154. DO 40 I = 1, M
  155. DO 30 J = 1, M
  156. Z( IK+MN+I-1, IK+J-1 ) = D( I, J )
  157. 30 CONTINUE
  158. 40 CONTINUE
  159. *
  160. IK = IK + M
  161. 50 CONTINUE
  162. *
  163. IK = 1
  164. DO 90 L = 1, N
  165. JK = MN + 1
  166. *
  167. DO 80 J = 1, N
  168. *
  169. * form -kron(B', Im)
  170. *
  171. DO 60 I = 1, M
  172. Z( IK+I-1, JK+I-1 ) = -B( J, L )
  173. 60 CONTINUE
  174. *
  175. * form -kron(E', Im)
  176. *
  177. DO 70 I = 1, M
  178. Z( IK+MN+I-1, JK+I-1 ) = -E( J, L )
  179. 70 CONTINUE
  180. *
  181. JK = JK + M
  182. 80 CONTINUE
  183. *
  184. IK = IK + M
  185. 90 CONTINUE
  186. *
  187. RETURN
  188. *
  189. * End of CLAKF2
  190. *
  191. END