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.

zlag2c.f 4.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. *> \brief \b ZLAG2C converts a complex double precision matrix to a complex single precision matrix.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download ZLAG2C + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlag2c.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlag2c.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlag2c.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE ZLAG2C( M, N, A, LDA, SA, LDSA, INFO )
  22. *
  23. * .. Scalar Arguments ..
  24. * INTEGER INFO, LDA, LDSA, M, N
  25. * ..
  26. * .. Array Arguments ..
  27. * COMPLEX SA( LDSA, * )
  28. * COMPLEX*16 A( LDA, * )
  29. * ..
  30. *
  31. *
  32. *> \par Purpose:
  33. * =============
  34. *>
  35. *> \verbatim
  36. *>
  37. *> ZLAG2C converts a COMPLEX*16 matrix, SA, to a COMPLEX matrix, A.
  38. *>
  39. *> RMAX is the overflow for the SINGLE PRECISION arithmetic
  40. *> ZLAG2C checks that all the entries of A are between -RMAX and
  41. *> RMAX. If not the conversion is aborted and a flag is raised.
  42. *>
  43. *> This is an auxiliary routine so there is no argument checking.
  44. *> \endverbatim
  45. *
  46. * Arguments:
  47. * ==========
  48. *
  49. *> \param[in] M
  50. *> \verbatim
  51. *> M is INTEGER
  52. *> The number of lines of the matrix A. M >= 0.
  53. *> \endverbatim
  54. *>
  55. *> \param[in] N
  56. *> \verbatim
  57. *> N is INTEGER
  58. *> The number of columns of the matrix A. N >= 0.
  59. *> \endverbatim
  60. *>
  61. *> \param[in] A
  62. *> \verbatim
  63. *> A is COMPLEX*16 array, dimension (LDA,N)
  64. *> On entry, the M-by-N coefficient matrix A.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] LDA
  68. *> \verbatim
  69. *> LDA is INTEGER
  70. *> The leading dimension of the array A. LDA >= max(1,M).
  71. *> \endverbatim
  72. *>
  73. *> \param[out] SA
  74. *> \verbatim
  75. *> SA is COMPLEX array, dimension (LDSA,N)
  76. *> On exit, if INFO=0, the M-by-N coefficient matrix SA; if
  77. *> INFO>0, the content of SA is unspecified.
  78. *> \endverbatim
  79. *>
  80. *> \param[in] LDSA
  81. *> \verbatim
  82. *> LDSA is INTEGER
  83. *> The leading dimension of the array SA. LDSA >= max(1,M).
  84. *> \endverbatim
  85. *>
  86. *> \param[out] INFO
  87. *> \verbatim
  88. *> INFO is INTEGER
  89. *> = 0: successful exit.
  90. *> = 1: an entry of the matrix A is greater than the SINGLE
  91. *> PRECISION overflow threshold, in this case, the content
  92. *> of SA in exit is unspecified.
  93. *> \endverbatim
  94. *
  95. * Authors:
  96. * ========
  97. *
  98. *> \author Univ. of Tennessee
  99. *> \author Univ. of California Berkeley
  100. *> \author Univ. of Colorado Denver
  101. *> \author NAG Ltd.
  102. *
  103. *> \ingroup complex16OTHERauxiliary
  104. *
  105. * =====================================================================
  106. SUBROUTINE ZLAG2C( M, N, A, LDA, SA, LDSA, INFO )
  107. *
  108. * -- LAPACK auxiliary routine --
  109. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  110. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  111. *
  112. * .. Scalar Arguments ..
  113. INTEGER INFO, LDA, LDSA, M, N
  114. * ..
  115. * .. Array Arguments ..
  116. COMPLEX SA( LDSA, * )
  117. COMPLEX*16 A( LDA, * )
  118. * ..
  119. *
  120. * =====================================================================
  121. *
  122. * .. Local Scalars ..
  123. INTEGER I, J
  124. DOUBLE PRECISION RMAX
  125. * ..
  126. * .. Intrinsic Functions ..
  127. INTRINSIC DBLE, DIMAG, CMPLX
  128. * ..
  129. * .. External Functions ..
  130. REAL SLAMCH
  131. EXTERNAL SLAMCH
  132. * ..
  133. * .. Executable Statements ..
  134. *
  135. RMAX = SLAMCH( 'O' )
  136. DO 20 J = 1, N
  137. DO 10 I = 1, M
  138. IF( ( DBLE( A( I, J ) ).LT.-RMAX ) .OR.
  139. $ ( DBLE( A( I, J ) ).GT.RMAX ) .OR.
  140. $ ( DIMAG( A( I, J ) ).LT.-RMAX ) .OR.
  141. $ ( DIMAG( A( I, J ) ).GT.RMAX ) ) THEN
  142. INFO = 1
  143. GO TO 30
  144. END IF
  145. SA( I, J ) = CMPLX( A( I, J ) )
  146. 10 CONTINUE
  147. 20 CONTINUE
  148. INFO = 0
  149. 30 CONTINUE
  150. RETURN
  151. *
  152. * End of ZLAG2C
  153. *
  154. END