OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
pzpotrs.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine pzpotrs (uplo, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)

Function/Subroutine Documentation

◆ pzpotrs()

subroutine pzpotrs ( character uplo,
integer n,
integer nrhs,
complex*16, dimension( * ) a,
integer ia,
integer ja,
integer, dimension( * ) desca,
complex*16, dimension( * ) b,
integer ib,
integer jb,
integer, dimension( * ) descb,
integer info )

Definition at line 1 of file pzpotrs.f.

3*
4* -- ScaLAPACK routine (version 1.7) --
5* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
6* and University of California, Berkeley.
7* May 1, 1997
8*
9* .. Scalar Arguments ..
10 CHARACTER UPLO
11 INTEGER IA, IB, INFO, JA, JB, N, NRHS
12* ..
13* .. Array Arguments ..
14 INTEGER DESCA( * ), DESCB( * )
15 COMPLEX*16 A( * ), B( * )
16* ..
17*
18* Purpose
19* =======
20*
21* PZPOTRS solves a system of linear equations
22*
23* sub( A ) * X = sub( B )
24* A(IA:IA+N-1,JA:JA+N-1)*X = B(IB:IB+N-1,JB:JB+NRHS-1)
25*
26* where sub( A ) denotes A(IA:IA+N-1,JA:JA+N-1) and is a N-by-N
27* hermitian positive definite distributed matrix using the Cholesky
28* factorization sub( A ) = U**H*U or L*L**H computed by PZPOTRF.
29* sub( B ) denotes the distributed matrix B(IB:IB+N-1,JB:JB+NRHS-1).
30*
31* Notes
32* =====
33*
34* Each global data object is described by an associated description
35* vector. This vector stores the information required to establish
36* the mapping between an object element and its corresponding process
37* and memory location.
38*
39* Let A be a generic term for any 2D block cyclicly distributed array.
40* Such a global array has an associated description vector DESCA.
41* In the following comments, the character _ should be read as
42* "of the global array".
43*
44* NOTATION STORED IN EXPLANATION
45* --------------- -------------- --------------------------------------
46* DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case,
47* DTYPE_A = 1.
48* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
49* the BLACS process grid A is distribu-
50* ted over. The context itself is glo-
51* bal, but the handle (the integer
52* value) may vary.
53* M_A (global) DESCA( M_ ) The number of rows in the global
54* array A.
55* N_A (global) DESCA( N_ ) The number of columns in the global
56* array A.
57* MB_A (global) DESCA( MB_ ) The blocking factor used to distribute
58* the rows of the array.
59* NB_A (global) DESCA( NB_ ) The blocking factor used to distribute
60* the columns of the array.
61* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
62* row of the array A is distributed.
63* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
64* first column of the array A is
65* distributed.
66* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
67* array. LLD_A >= MAX(1,LOCr(M_A)).
68*
69* Let K be the number of rows or columns of a distributed matrix,
70* and assume that its process grid has dimension p x q.
71* LOCr( K ) denotes the number of elements of K that a process
72* would receive if K were distributed over the p processes of its
73* process column.
74* Similarly, LOCc( K ) denotes the number of elements of K that a
75* process would receive if K were distributed over the q processes of
76* its process row.
77* The values of LOCr() and LOCc() may be determined via a call to the
78* ScaLAPACK tool function, NUMROC:
79* LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
80* LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
81* An upper bound for these quantities may be computed by:
82* LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
83* LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
84*
85* This routine requires square block decomposition ( MB_A = NB_A ).
86*
87* Arguments
88* =========
89*
90* UPLO (global input) CHARACTER
91* = 'U': Upper triangle of sub( A ) is stored;
92* = 'L': Lower triangle of sub( A ) is stored.
93*
94* N (global input) INTEGER
95* The number of rows and columns to be operated on, i.e. the
96* order of the distributed submatrix sub( A ). N >= 0.
97*
98* NRHS (global input) INTEGER
99* The number of right hand sides, i.e., the number of columns
100* of the distributed submatrix sub( B ). NRHS >= 0.
101*
102* A (local input) COMPLEX*16 pointer into local memory to
103* an array of dimension (LLD_A, LOCc(JA+N-1)). On entry, this
104* array contains the factors L or U from the Cholesky facto-
105* rization sub( A ) = L*L**H or U**H*U, as computed by PZPOTRF.
106*
107* IA (global input) INTEGER
108* The row index in the global array A indicating the first
109* row of sub( A ).
110*
111* JA (global input) INTEGER
112* The column index in the global array A indicating the
113* first column of sub( A ).
114*
115* DESCA (global and local input) INTEGER array of dimension DLEN_.
116* The array descriptor for the distributed matrix A.
117*
118* B (local input/local output) COMPLEX*16 pointer into the
119* local memory to an array of local dimension
120* (LLD_B,LOCc(JB+NRHS-1)). On entry, this array contains the
121* the local pieces of the right hand sides sub( B ).
122* On exit, this array contains the local pieces of the solution
123* distributed matrix X.
124*
125* IB (global input) INTEGER
126* The row index in the global array B indicating the first
127* row of sub( B ).
128*
129* JB (global input) INTEGER
130* The column index in the global array B indicating the
131* first column of sub( B ).
132*
133* DESCB (global and local input) INTEGER array of dimension DLEN_.
134* The array descriptor for the distributed matrix B.
135*
136* INFO (global output) INTEGER
137* = 0: successful exit
138* < 0: If the i-th argument is an array and the j-entry had
139* an illegal value, then INFO = -(i*100+j), if the i-th
140* argument is a scalar and had an illegal value, then
141* INFO = -i.
142*
143* =====================================================================
144*
145* .. Parameters ..
146 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
147 $ LLD_, MB_, M_, NB_, N_, RSRC_
148 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
149 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
150 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
151 COMPLEX*16 ONE
152 parameter( one = 1.0d+0 )
153* ..
154* .. Local Scalars ..
155 LOGICAL UPPER
156 INTEGER IAROW, IBROW, ICTXT, IROFFA, IROFFB, ICOFFA,
157 $ MYCOL, MYROW, NPCOL, NPROW
158* ..
159* .. Local Arrays ..
160 INTEGER IDUM1( 1 ), IDUM2( 1 )
161* ..
162* .. External Subroutines ..
164 $ pztrsm
165* ..
166* .. External Functions ..
167 LOGICAL LSAME
168 INTEGER INDXG2P
169 EXTERNAL indxg2p, lsame
170* ..
171* .. Intrinsic Functions ..
172 INTRINSIC ichar, mod
173* ..
174* .. Executable Statements ..
175*
176* Get grid parameters.
177*
178 ictxt = desca( ctxt_ )
179 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
180*
181* Test the input parameters.
182*
183 info = 0
184 IF( nprow.EQ.-1 ) THEN
185 info = -(700+ctxt_)
186 ELSE
187 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 7, info )
188 CALL chk1mat( n, 2, nrhs, 3, ib, jb, descb, 11, info )
189 upper = lsame( uplo, 'u' )
190.EQ. IF( INFO0 ) THEN
191 IAROW = INDXG2P( IA, DESCA( MB_ ), MYROW, DESCA( RSRC_ ),
192 $ NPROW )
193 IBROW = INDXG2P( IB, DESCB( MB_ ), MYROW, DESCB( RSRC_ ),
194 $ NPROW )
195 IROFFA = MOD( IA-1, DESCA( MB_ ) )
196 IROFFB = MOD( IB-1, DESCB( MB_ ) )
197 ICOFFA = MOD( JA-1, DESCA( NB_ ) )
198.NOT..AND..NOT. IF ( UPPER LSAME( UPLO, 'l' ) ) THEN
199 INFO = -1
200.NE. ELSE IF( IROFFA0 ) THEN
201 INFO = -5
202.NE. ELSE IF( ICOFFA0 ) THEN
203 INFO = -6
204.NE. ELSE IF( DESCA( MB_ )DESCA( NB_ ) ) THEN
205 INFO = -(700+NB_)
206.NE..OR..NE. ELSE IF( IROFFB0 IBROWIAROW ) THEN
207 INFO = -9
208.NE. ELSE IF( DESCB( MB_ )DESCA( NB_ ) ) THEN
209 INFO = -(1100+NB_)
210 END IF
211 END IF
212 IF( UPPER ) THEN
213 IDUM1( 1 ) = ICHAR( 'u' )
214 ELSE
215 IDUM1( 1 ) = ICHAR( 'l' )
216 END IF
217 IDUM2( 1 ) = 1
218 CALL PCHK2MAT( N, 2, N, 2, IA, JA, DESCA, 7, N, 2, NRHS,
219 $ 3, IB, JB, DESCB, 11, 1, IDUM1, IDUM2, INFO )
220 END IF
221*
222.NE. IF( INFO0 ) THEN
223 CALL PXERBLA( ICTXT, 'pzpotrs', -INFO )
224 RETURN
225 END IF
226*
227* Quick return if possible
228*
229.EQ..OR..EQ. IF( N0 NRHS0 )
230 $ RETURN
231*
232 IF( UPPER ) THEN
233*
234* Solve sub( A ) * X = sub( B ) where sub( A ) = U'*U.
235*
236* Solve U'*X = sub( B ), overwriting sub( B ) with X.
237*
238 CALL PZTRSM( 'left', 'upper', 'conjugate transpose',
239 $ 'non-unit', N, NRHS, ONE, A, IA, JA, DESCA, B, IB,
240 $ JB, DESCB )
241*
242* Solve U*X = sub( B ), overwriting sub( B ) with X.
243*
244 CALL PZTRSM( 'left', 'upper', 'no transpose', 'non-unit', N,
245 $ NRHS, ONE, A, IA, JA, DESCA, B, IB, JB, DESCB )
246 ELSE
247*
248* Solve sub( A ) *X = sub( B ) where sub( A ) = L*L'.
249*
250* Solve L*X = sub( B ), overwriting sub( B ) with X.
251*
252 CALL PZTRSM( 'left', 'lower', 'no transpose', 'non-unit', N,
253 $ NRHS, ONE, A, IA, JA, DESCA, B, IB, JB, DESCB )
254*
255* Solve L'*X = sub( B ), overwriting sub( B ) with X.
256*
257 CALL PZTRSM( 'left', 'lower', 'conjugate transpose',
258 $ 'non-unit', N, NRHS, ONE, A, IA, JA, DESCA, B, IB,
259 $ JB, DESCB )
260 END IF
261*
262 RETURN
263*
264* End of PZPOTRS
265*
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
integer function indxg2p(indxglob, nb, iproc, isrcproc, nprocs)
Definition mpi.f:947
subroutine chk1mat(ma, mapos0, na, napos0, ia, ja, desca, descapos0, info)
Definition mpi.f:1577
subroutine pxerbla(contxt, srname, info)
Definition mpi.f:1600
subroutine pztrsm(side, uplo, transa, diag, m, n, alpha, a, ia, ja, desca, b, ib, jb, descb)
Definition mpi.f:1483
subroutine pchk2mat(ma, mapos0, na, napos0, ia, ja, desca, descapos0, mb, mbpos0, nb, nbpos0, ib, jb, descb, descbpos0, nextra, ex, expos, info)
Definition mpi.f:1588
subroutine blacs_gridinfo(cntxt, nprow, npcol, myrow, mycol)
Definition mpi.f:754
subroutine pzpotrs(uplo, n, nrhs, a, ia, ja, desca, b, ib, jb, descb, info)
Definition pzpotrs.f:3