LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ ztrmm()

subroutine ztrmm ( 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 
)

ZTRMM

Purpose:
 ZTRMM  performs one of the matrix-matrix operations

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

 where  alpha  is a scalar,  B  is an m by n matrix,  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.
Parameters
[in]SIDE
          SIDE is CHARACTER*1
           On entry,  SIDE specifies whether  op( A ) multiplies B from
           the left or right as follows:

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

              SIDE = 'R' or 'r'   B := alpha*B*op( A ).
[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, dimension ( LDA, k ), where k is m
           when  SIDE = 'L' or 'l'  and 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, dimension ( LDB, N ).
           Before entry,  the leading  m by n part of the array  B must
           contain the matrix  B,  and  on exit  is overwritten  by the
           transformed matrix.
[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
December 2016
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 179 of file ztrmm.f.

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