1 SUBROUTINE pcget22( TRANSA, TRANSE, TRANSW, N, A, DESCA, E, DESCE,
2 $ W, WORK, DESCW, RWORK, RESULT )
10 CHARACTER TRANSA, TRANSE, TRANSW
14 INTEGER DESCA( * ), DESCE( * ), DESCW( * )
15 REAL RESULT( 2 ), RWORK( * )
16 COMPLEX A( * ), E( * ), W( * ), WORK( * )
93 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
94 $ mb_, nb_, rsrc_, csrc_, lld_
95 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
96 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
97 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
99 parameter( zero = 0.0e+0, one = 1.0e+0 )
101 parameter( czero = ( 0.0e+0, 0.0e+0 ),
102 $ cone = ( 1.0e+0, 0.0e+0 ) )
105 CHARACTER NORMA, NORME
106 INTEGER ICOL, II, IROW, ITRNSE, ITRNSW, J, JCOL, JJ,
107 $ jrow, jvec, lda, lde, ldw, mb, mycol, myrow,
108 $ nb, npcol, nprow, contxt, ra, ca, rsrc, csrc
109 REAL ANORM, ENORM, ENRMAX, ENRMIN, ERRNRM, TEMP1,
115 REAL PSLAMCH, PCLANGE
116 EXTERNAL lsame, pslamch, pclange
119 EXTERNAL blacs_gridinfo, sgamn2d, sgamx2d,
infog2l,
123 INTRINSIC abs, real, conjg, aimag,
max,
min
129 cabs1( cdum ) = abs( real( cdum ) ) + abs( aimag( cdum ) )
140 contxt = desca( ctxt_ )
141 rsrc = desca( rsrc_ )
142 csrc = desca( csrc_ )
148 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
150 unfl = pslamch( contxt,
'Safe minimum' )
151 ulp = pslamch( contxt,
'Precision' )
158 IF( lsame( transa,
'T' ) .OR. lsame( transa,
'C' ) )
THEN
162 IF( lsame( transe,
'T' ) )
THEN
165 ELSE IF( lsame( transe,
'C' ) )
THEN
170 IF( lsame( transw,
'C' ) )
THEN
178 IF( itrnse.EQ.0 )
THEN
182 CALL infog2l( j, jvec, desce, nprow, npcol, myrow, mycol,
183 $ irow, icol, ii, jj )
184 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
185 temp1 =
max( temp1, cabs1( e( ( icol-1 )*lde+
189 IF( mycol.EQ.jj )
THEN
190 CALL sgamx2d( contxt,
'Col',
' ', 1, 1, temp1, 1, ra, ca,
192 enrmin =
min( enrmin, temp1 )
193 enrmax =
max( enrmax, temp1 )
196 CALL sgamx2d( contxt,
'Row',
' ', 1, 1, enrmax, 1, ra, ca, -1,
198 CALL sgamn2d( contxt,
'Row',
' ', 1, 1, enrmin, 1, ra, ca, -1,
204 CALL infog2l( j, jvec, desce, nprow, npcol, myrow, mycol,
205 $ irow, icol, ii, jj )
206 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
207 temp1 =
max( temp1, cabs1( e( ( icol-1 )*lde+
211 IF( myrow.EQ.ii )
THEN
212 CALL sgamx2d( contxt,
'Row',
' ', 1, 1, temp1, 1, ra, ca,
214 enrmin =
min( enrmin, temp1 )
215 enrmax =
max( enrmax, temp1 )
218 CALL sgamx2d( contxt,
'Row',
' ', 1, 1, enrmax, 1, ra, ca, -1,
220 CALL sgamn2d( contxt,
'Row',
' ', 1, 1, enrmin, 1, ra, ca, -1,
226 anorm =
max( pclange( norma, n, n, a, 1, 1, desca, rwork ), unfl )
230 enorm =
max( pclange( norme, n, n, e, 1, 1, desce, rwork ), ulp )
236 CALL pclaset(
'Full', n, n, czero, czero, work, 1, 1, descw )
239 IF( itrnsw.EQ.0 )
THEN
242 wtemp = conjg( w( jcol ) )
245 IF( itrnse.EQ.0 )
THEN
246 CALL pcaxpy( n, wtemp, e, 1, jcol, desce, 1, work, 1, jcol,
248 ELSE IF( itrnse.EQ.1 )
THEN
249 CALL pcaxpy( n, wtemp, e, jcol, 1, desce, n, work, 1, jcol,
252 CALL pcaxpy( n, conjg( wtemp ), e, jcol, 1, desce, n, work,
253 $ 1, jcol, descw, 1 )
255 CALL infog2l( jrow, jcol, descw, nprow, npcol, myrow,
256 $ mycol, irow, icol, ii, jj )
257 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
258 work( ( jcol-1 )*ldw+jrow )
259 $ = conjg( work( ( jcol-1 )*ldw+jrow ) )
265 CALL pcgemm( transa, transe, n, n, n, cone, a, 1, 1, desca, e, 1,
266 $ 1, desce, -cone, work, 1, 1, descw )
268 errnrm = pclange(
'One', n, n, work, 1, 1, descw, rwork ) / enorm
272 IF( anorm.GT.errnrm )
THEN
273 result( 1 ) = ( errnrm / anorm ) / ulp
275 IF( anorm.LT.one )
THEN
276 result( 1 ) = (
min( errnrm, anorm ) / anorm ) / ulp
278 result( 1 ) =
min( errnrm / anorm, one ) / ulp
284 result( 2 ) =
max( abs( enrmax-one ), abs( enrmin-one ) ) /