LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine ztrsm ( character  SIDE,
character  UPLO,
character  TRANSA,
character  DIAG,
integer  M,
integer  N,
complex*16  ALPHA,
complex*16, dimension(lda,*)  A,
integer  LDA,
complex*16, dimension(ldb,*)  B,
integer  LDB 
)

ZTRSM

Purpose:
 ZTRSM  solves one of the matrix equations

    op( A )*X = alpha*B,   or   X*op( A ) = alpha*B,

 where alpha is a scalar, X and B are m by n matrices, A is a unit, or
 non-unit,  upper or lower triangular matrix  and  op( A )  is one  of

    op( A ) = A   or   op( A ) = A**T   or   op( A ) = A**H.

 The matrix X is overwritten on B.
Parameters
[in]SIDE
          SIDE is CHARACTER*1
           On entry, SIDE specifies whether op( A ) appears on the left
           or right of X as follows:

              SIDE = 'L' or 'l'   op( A )*X = alpha*B.

              SIDE = 'R' or 'r'   X*op( A ) = alpha*B.
[in]UPLO
          UPLO is CHARACTER*1
           On entry, UPLO specifies whether the matrix A is an upper or
           lower triangular matrix as follows:

              UPLO = 'U' or 'u'   A is an upper triangular matrix.

              UPLO = 'L' or 'l'   A is a lower triangular matrix.
[in]TRANSA
          TRANSA is CHARACTER*1
           On entry, TRANSA specifies the form of op( A ) to be used in
           the matrix multiplication as follows:

              TRANSA = 'N' or 'n'   op( A ) = A.

              TRANSA = 'T' or 't'   op( A ) = A**T.

              TRANSA = 'C' or 'c'   op( A ) = A**H.
[in]DIAG
          DIAG is CHARACTER*1
           On entry, DIAG specifies whether or not A is unit triangular
           as follows:

              DIAG = 'U' or 'u'   A is assumed to be unit triangular.

              DIAG = 'N' or 'n'   A is not assumed to be unit
                                  triangular.
[in]M
          M is INTEGER
           On entry, M specifies the number of rows of B. M must be at
           least zero.
[in]N
          N is INTEGER
           On entry, N specifies the number of columns of B.  N must be
           at least zero.
[in]ALPHA
          ALPHA is COMPLEX*16
           On entry,  ALPHA specifies the scalar  alpha. When  alpha is
           zero then  A is not referenced and  B need not be set before
           entry.
[in]A
          A is COMPLEX*16 array of DIMENSION ( LDA, k ),
           where k is m when SIDE = 'L' or 'l'  
             and k is n when SIDE = 'R' or 'r'.
           Before entry  with  UPLO = 'U' or 'u',  the  leading  k by k
           upper triangular part of the array  A must contain the upper
           triangular matrix  and the strictly lower triangular part of
           A is not referenced.
           Before entry  with  UPLO = 'L' or 'l',  the  leading  k by k
           lower triangular part of the array  A must contain the lower
           triangular matrix  and the strictly upper triangular part of
           A is not referenced.
           Note that when  DIAG = 'U' or 'u',  the diagonal elements of
           A  are not referenced either,  but are assumed to be  unity.
[in]LDA
          LDA is INTEGER
           On entry, LDA specifies the first dimension of A as declared
           in the calling (sub) program.  When  SIDE = 'L' or 'l'  then
           LDA  must be at least  max( 1, m ),  when  SIDE = 'R' or 'r'
           then LDA must be at least max( 1, n ).
[in,out]B
          B is COMPLEX*16 array of DIMENSION ( LDB, n ).
           Before entry,  the leading  m by n part of the array  B must
           contain  the  right-hand  side  matrix  B,  and  on exit  is
           overwritten by the solution matrix  X.
[in]LDB
          LDB is INTEGER
           On entry, LDB specifies the first dimension of B as declared
           in  the  calling  (sub)  program.   LDB  must  be  at  least
           max( 1, m ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  Level 3 Blas routine.

  -- Written on 8-February-1989.
     Jack Dongarra, Argonne National Laboratory.
     Iain Duff, AERE Harwell.
     Jeremy Du Croz, Numerical Algorithms Group Ltd.
     Sven Hammarling, Numerical Algorithms Group Ltd.

Definition at line 182 of file ztrsm.f.

182 *
183 * -- Reference BLAS level3 routine (version 3.4.0) --
184 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
185 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
186 * November 2011
187 *
188 * .. Scalar Arguments ..
189  COMPLEX*16 alpha
190  INTEGER lda,ldb,m,n
191  CHARACTER diag,side,transa,uplo
192 * ..
193 * .. Array Arguments ..
194  COMPLEX*16 a(lda,*),b(ldb,*)
195 * ..
196 *
197 * =====================================================================
198 *
199 * .. External Functions ..
200  LOGICAL lsame
201  EXTERNAL lsame
202 * ..
203 * .. External Subroutines ..
204  EXTERNAL xerbla
205 * ..
206 * .. Intrinsic Functions ..
207  INTRINSIC dconjg,max
208 * ..
209 * .. Local Scalars ..
210  COMPLEX*16 temp
211  INTEGER i,info,j,k,nrowa
212  LOGICAL lside,noconj,nounit,upper
213 * ..
214 * .. Parameters ..
215  COMPLEX*16 one
216  parameter(one= (1.0d+0,0.0d+0))
217  COMPLEX*16 zero
218  parameter(zero= (0.0d+0,0.0d+0))
219 * ..
220 *
221 * Test the input parameters.
222 *
223  lside = lsame(side,'L')
224  IF (lside) THEN
225  nrowa = m
226  ELSE
227  nrowa = n
228  END IF
229  noconj = lsame(transa,'T')
230  nounit = lsame(diag,'N')
231  upper = lsame(uplo,'U')
232 *
233  info = 0
234  IF ((.NOT.lside) .AND. (.NOT.lsame(side,'R'))) THEN
235  info = 1
236  ELSE IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
237  info = 2
238  ELSE IF ((.NOT.lsame(transa,'N')) .AND.
239  + (.NOT.lsame(transa,'T')) .AND.
240  + (.NOT.lsame(transa,'C'))) THEN
241  info = 3
242  ELSE IF ((.NOT.lsame(diag,'U')) .AND. (.NOT.lsame(diag,'N'))) THEN
243  info = 4
244  ELSE IF (m.LT.0) THEN
245  info = 5
246  ELSE IF (n.LT.0) THEN
247  info = 6
248  ELSE IF (lda.LT.max(1,nrowa)) THEN
249  info = 9
250  ELSE IF (ldb.LT.max(1,m)) THEN
251  info = 11
252  END IF
253  IF (info.NE.0) THEN
254  CALL xerbla('ZTRSM ',info)
255  RETURN
256  END IF
257 *
258 * Quick return if possible.
259 *
260  IF (m.EQ.0 .OR. n.EQ.0) RETURN
261 *
262 * And when alpha.eq.zero.
263 *
264  IF (alpha.EQ.zero) THEN
265  DO 20 j = 1,n
266  DO 10 i = 1,m
267  b(i,j) = zero
268  10 CONTINUE
269  20 CONTINUE
270  RETURN
271  END IF
272 *
273 * Start the operations.
274 *
275  IF (lside) THEN
276  IF (lsame(transa,'N')) THEN
277 *
278 * Form B := alpha*inv( A )*B.
279 *
280  IF (upper) THEN
281  DO 60 j = 1,n
282  IF (alpha.NE.one) THEN
283  DO 30 i = 1,m
284  b(i,j) = alpha*b(i,j)
285  30 CONTINUE
286  END IF
287  DO 50 k = m,1,-1
288  IF (b(k,j).NE.zero) THEN
289  IF (nounit) b(k,j) = b(k,j)/a(k,k)
290  DO 40 i = 1,k - 1
291  b(i,j) = b(i,j) - b(k,j)*a(i,k)
292  40 CONTINUE
293  END IF
294  50 CONTINUE
295  60 CONTINUE
296  ELSE
297  DO 100 j = 1,n
298  IF (alpha.NE.one) THEN
299  DO 70 i = 1,m
300  b(i,j) = alpha*b(i,j)
301  70 CONTINUE
302  END IF
303  DO 90 k = 1,m
304  IF (b(k,j).NE.zero) THEN
305  IF (nounit) b(k,j) = b(k,j)/a(k,k)
306  DO 80 i = k + 1,m
307  b(i,j) = b(i,j) - b(k,j)*a(i,k)
308  80 CONTINUE
309  END IF
310  90 CONTINUE
311  100 CONTINUE
312  END IF
313  ELSE
314 *
315 * Form B := alpha*inv( A**T )*B
316 * or B := alpha*inv( A**H )*B.
317 *
318  IF (upper) THEN
319  DO 140 j = 1,n
320  DO 130 i = 1,m
321  temp = alpha*b(i,j)
322  IF (noconj) THEN
323  DO 110 k = 1,i - 1
324  temp = temp - a(k,i)*b(k,j)
325  110 CONTINUE
326  IF (nounit) temp = temp/a(i,i)
327  ELSE
328  DO 120 k = 1,i - 1
329  temp = temp - dconjg(a(k,i))*b(k,j)
330  120 CONTINUE
331  IF (nounit) temp = temp/dconjg(a(i,i))
332  END IF
333  b(i,j) = temp
334  130 CONTINUE
335  140 CONTINUE
336  ELSE
337  DO 180 j = 1,n
338  DO 170 i = m,1,-1
339  temp = alpha*b(i,j)
340  IF (noconj) THEN
341  DO 150 k = i + 1,m
342  temp = temp - a(k,i)*b(k,j)
343  150 CONTINUE
344  IF (nounit) temp = temp/a(i,i)
345  ELSE
346  DO 160 k = i + 1,m
347  temp = temp - dconjg(a(k,i))*b(k,j)
348  160 CONTINUE
349  IF (nounit) temp = temp/dconjg(a(i,i))
350  END IF
351  b(i,j) = temp
352  170 CONTINUE
353  180 CONTINUE
354  END IF
355  END IF
356  ELSE
357  IF (lsame(transa,'N')) THEN
358 *
359 * Form B := alpha*B*inv( A ).
360 *
361  IF (upper) THEN
362  DO 230 j = 1,n
363  IF (alpha.NE.one) THEN
364  DO 190 i = 1,m
365  b(i,j) = alpha*b(i,j)
366  190 CONTINUE
367  END IF
368  DO 210 k = 1,j - 1
369  IF (a(k,j).NE.zero) THEN
370  DO 200 i = 1,m
371  b(i,j) = b(i,j) - a(k,j)*b(i,k)
372  200 CONTINUE
373  END IF
374  210 CONTINUE
375  IF (nounit) THEN
376  temp = one/a(j,j)
377  DO 220 i = 1,m
378  b(i,j) = temp*b(i,j)
379  220 CONTINUE
380  END IF
381  230 CONTINUE
382  ELSE
383  DO 280 j = n,1,-1
384  IF (alpha.NE.one) THEN
385  DO 240 i = 1,m
386  b(i,j) = alpha*b(i,j)
387  240 CONTINUE
388  END IF
389  DO 260 k = j + 1,n
390  IF (a(k,j).NE.zero) THEN
391  DO 250 i = 1,m
392  b(i,j) = b(i,j) - a(k,j)*b(i,k)
393  250 CONTINUE
394  END IF
395  260 CONTINUE
396  IF (nounit) THEN
397  temp = one/a(j,j)
398  DO 270 i = 1,m
399  b(i,j) = temp*b(i,j)
400  270 CONTINUE
401  END IF
402  280 CONTINUE
403  END IF
404  ELSE
405 *
406 * Form B := alpha*B*inv( A**T )
407 * or B := alpha*B*inv( A**H ).
408 *
409  IF (upper) THEN
410  DO 330 k = n,1,-1
411  IF (nounit) THEN
412  IF (noconj) THEN
413  temp = one/a(k,k)
414  ELSE
415  temp = one/dconjg(a(k,k))
416  END IF
417  DO 290 i = 1,m
418  b(i,k) = temp*b(i,k)
419  290 CONTINUE
420  END IF
421  DO 310 j = 1,k - 1
422  IF (a(j,k).NE.zero) THEN
423  IF (noconj) THEN
424  temp = a(j,k)
425  ELSE
426  temp = dconjg(a(j,k))
427  END IF
428  DO 300 i = 1,m
429  b(i,j) = b(i,j) - temp*b(i,k)
430  300 CONTINUE
431  END IF
432  310 CONTINUE
433  IF (alpha.NE.one) THEN
434  DO 320 i = 1,m
435  b(i,k) = alpha*b(i,k)
436  320 CONTINUE
437  END IF
438  330 CONTINUE
439  ELSE
440  DO 380 k = 1,n
441  IF (nounit) THEN
442  IF (noconj) THEN
443  temp = one/a(k,k)
444  ELSE
445  temp = one/dconjg(a(k,k))
446  END IF
447  DO 340 i = 1,m
448  b(i,k) = temp*b(i,k)
449  340 CONTINUE
450  END IF
451  DO 360 j = k + 1,n
452  IF (a(j,k).NE.zero) THEN
453  IF (noconj) THEN
454  temp = a(j,k)
455  ELSE
456  temp = dconjg(a(j,k))
457  END IF
458  DO 350 i = 1,m
459  b(i,j) = b(i,j) - temp*b(i,k)
460  350 CONTINUE
461  END IF
462  360 CONTINUE
463  IF (alpha.NE.one) THEN
464  DO 370 i = 1,m
465  b(i,k) = alpha*b(i,k)
466  370 CONTINUE
467  END IF
468  380 CONTINUE
469  END IF
470  END IF
471  END IF
472 *
473  RETURN
474 *
475 * End of ZTRSM .
476 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: