LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cheswapr()

subroutine cheswapr ( character uplo,
integer n,
complex, dimension( lda, n ) a,
integer lda,
integer i1,
integer i2 )

CHESWAPR applies an elementary permutation on the rows and columns of a Hermitian matrix.

Download CHESWAPR + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> CHESWAPR applies an elementary permutation on the rows and the columns of
!> a hermitian matrix.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>          Specifies whether the details of the factorization are stored
!>          as an upper or lower triangular matrix.
!>          = 'U':  Upper triangular, form is A = U*D*U**T;
!>          = 'L':  Lower triangular, form is A = L*D*L**T.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is COMPLEX array, dimension (LDA,N)
!>          On entry, the NB diagonal matrix D and the multipliers
!>          used to obtain the factor U or L as computed by CSYTRF.
!>
!>          On exit, if INFO = 0, the (symmetric) inverse of the original
!>          matrix.  If UPLO = 'U', the upper triangular part of the
!>          inverse is formed and the part of A below the diagonal is not
!>          referenced; if UPLO = 'L' the lower triangular part of the
!>          inverse is formed and the part of A above the diagonal is
!>          not referenced.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N).
!> 
[in]I1
!>          I1 is INTEGER
!>          Index of the first row to swap
!> 
[in]I2
!>          I2 is INTEGER
!>          Index of the second row to swap
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 99 of file cheswapr.f.

100*
101* -- LAPACK auxiliary routine --
102* -- LAPACK is a software package provided by Univ. of Tennessee, --
103* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
104*
105* .. Scalar Arguments ..
106 CHARACTER UPLO
107 INTEGER I1, I2, LDA, N
108* ..
109* .. Array Arguments ..
110 COMPLEX A( LDA, N )
111*
112* =====================================================================
113*
114* ..
115* .. Local Scalars ..
116 LOGICAL UPPER
117 INTEGER I
118 COMPLEX TMP
119*
120* .. External Functions ..
121 LOGICAL LSAME
122 EXTERNAL lsame
123* ..
124* .. External Subroutines ..
125 EXTERNAL cswap
126* ..
127* .. Executable Statements ..
128*
129 upper = lsame( uplo, 'U' )
130 IF (upper) THEN
131*
132* UPPER
133* first swap
134* - swap column I1 and I2 from I1 to I1-1
135 CALL cswap( i1-1, a(1,i1), 1, a(1,i2), 1 )
136*
137* second swap :
138* - swap A(I1,I1) and A(I2,I2)
139* - swap row I1 from I1+1 to I2-1 with col I2 from I1+1 to I2-1
140* - swap A(I2,I1) and A(I1,I2)
141
142 tmp=a(i1,i1)
143 a(i1,i1)=a(i2,i2)
144 a(i2,i2)=tmp
145*
146 DO i=1,i2-i1-1
147 tmp=a(i1,i1+i)
148 a(i1,i1+i)=conjg(a(i1+i,i2))
149 a(i1+i,i2)=conjg(tmp)
150 END DO
151*
152 a(i1,i2)=conjg(a(i1,i2))
153
154*
155* third swap
156* - swap row I1 and I2 from I2+1 to N
157 DO i=i2+1,n
158 tmp=a(i1,i)
159 a(i1,i)=a(i2,i)
160 a(i2,i)=tmp
161 END DO
162*
163 ELSE
164*
165* LOWER
166* first swap
167* - swap row I1 and I2 from 1 to I1-1
168 CALL cswap ( i1-1, a(i1,1), lda, a(i2,1), lda )
169*
170* second swap :
171* - swap A(I1,I1) and A(I2,I2)
172* - swap col I1 from I1+1 to I2-1 with row I2 from I1+1 to I2-1
173* - swap A(I2,I1) and A(I1,I2)
174
175 tmp=a(i1,i1)
176 a(i1,i1)=a(i2,i2)
177 a(i2,i2)=tmp
178*
179 DO i=1,i2-i1-1
180 tmp=a(i1+i,i1)
181 a(i1+i,i1)=conjg(a(i2,i1+i))
182 a(i2,i1+i)=conjg(tmp)
183 END DO
184*
185 a(i2,i1)=conjg(a(i2,i1))
186*
187* third swap
188* - swap col I1 and I2 from I2+1 to N
189 DO i=i2+1,n
190 tmp=a(i,i1)
191 a(i,i1)=a(i,i2)
192 a(i,i2)=tmp
193 END DO
194*
195 ENDIF
196
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
Definition cswap.f:81
Here is the call graph for this function:
Here is the caller graph for this function: