LAPACK  3.10.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.
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 176 of file ztrmm.f.

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