LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ strmm()

subroutine strmm ( character  SIDE,
character  UPLO,
character  TRANSA,
character  DIAG,
integer  M,
integer  N,
real  ALPHA,
real, dimension(lda,*)  A,
integer  LDA,
real, dimension(ldb,*)  B,
integer  LDB 
)

STRMM

Purpose:
 STRMM  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.
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**T.
[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 REAL
           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 REAL 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 REAL 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 strmm.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  REAL ALPHA
184  INTEGER LDA,LDB,M,N
185  CHARACTER DIAG,SIDE,TRANSA,UPLO
186 * ..
187 * .. Array Arguments ..
188  REAL 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 max
202 * ..
203 * .. Local Scalars ..
204  REAL TEMP
205  INTEGER I,INFO,J,K,NROWA
206  LOGICAL LSIDE,NOUNIT,UPPER
207 * ..
208 * .. Parameters ..
209  REAL ONE,ZERO
210  parameter(one=1.0e+0,zero=0.0e+0)
211 * ..
212 *
213 * Test the input parameters.
214 *
215  lside = lsame(side,'L')
216  IF (lside) THEN
217  nrowa = m
218  ELSE
219  nrowa = n
220  END IF
221  nounit = lsame(diag,'N')
222  upper = lsame(uplo,'U')
223 *
224  info = 0
225  IF ((.NOT.lside) .AND. (.NOT.lsame(side,'R'))) THEN
226  info = 1
227  ELSE IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
228  info = 2
229  ELSE IF ((.NOT.lsame(transa,'N')) .AND.
230  + (.NOT.lsame(transa,'T')) .AND.
231  + (.NOT.lsame(transa,'C'))) THEN
232  info = 3
233  ELSE IF ((.NOT.lsame(diag,'U')) .AND. (.NOT.lsame(diag,'N'))) THEN
234  info = 4
235  ELSE IF (m.LT.0) THEN
236  info = 5
237  ELSE IF (n.LT.0) THEN
238  info = 6
239  ELSE IF (lda.LT.max(1,nrowa)) THEN
240  info = 9
241  ELSE IF (ldb.LT.max(1,m)) THEN
242  info = 11
243  END IF
244  IF (info.NE.0) THEN
245  CALL xerbla('STRMM ',info)
246  RETURN
247  END IF
248 *
249 * Quick return if possible.
250 *
251  IF (m.EQ.0 .OR. n.EQ.0) RETURN
252 *
253 * And when alpha.eq.zero.
254 *
255  IF (alpha.EQ.zero) THEN
256  DO 20 j = 1,n
257  DO 10 i = 1,m
258  b(i,j) = zero
259  10 CONTINUE
260  20 CONTINUE
261  RETURN
262  END IF
263 *
264 * Start the operations.
265 *
266  IF (lside) THEN
267  IF (lsame(transa,'N')) THEN
268 *
269 * Form B := alpha*A*B.
270 *
271  IF (upper) THEN
272  DO 50 j = 1,n
273  DO 40 k = 1,m
274  IF (b(k,j).NE.zero) THEN
275  temp = alpha*b(k,j)
276  DO 30 i = 1,k - 1
277  b(i,j) = b(i,j) + temp*a(i,k)
278  30 CONTINUE
279  IF (nounit) temp = temp*a(k,k)
280  b(k,j) = temp
281  END IF
282  40 CONTINUE
283  50 CONTINUE
284  ELSE
285  DO 80 j = 1,n
286  DO 70 k = m,1,-1
287  IF (b(k,j).NE.zero) THEN
288  temp = alpha*b(k,j)
289  b(k,j) = temp
290  IF (nounit) b(k,j) = b(k,j)*a(k,k)
291  DO 60 i = k + 1,m
292  b(i,j) = b(i,j) + temp*a(i,k)
293  60 CONTINUE
294  END IF
295  70 CONTINUE
296  80 CONTINUE
297  END IF
298  ELSE
299 *
300 * Form B := alpha*A**T*B.
301 *
302  IF (upper) THEN
303  DO 110 j = 1,n
304  DO 100 i = m,1,-1
305  temp = b(i,j)
306  IF (nounit) temp = temp*a(i,i)
307  DO 90 k = 1,i - 1
308  temp = temp + a(k,i)*b(k,j)
309  90 CONTINUE
310  b(i,j) = alpha*temp
311  100 CONTINUE
312  110 CONTINUE
313  ELSE
314  DO 140 j = 1,n
315  DO 130 i = 1,m
316  temp = b(i,j)
317  IF (nounit) temp = temp*a(i,i)
318  DO 120 k = i + 1,m
319  temp = temp + a(k,i)*b(k,j)
320  120 CONTINUE
321  b(i,j) = alpha*temp
322  130 CONTINUE
323  140 CONTINUE
324  END IF
325  END IF
326  ELSE
327  IF (lsame(transa,'N')) THEN
328 *
329 * Form B := alpha*B*A.
330 *
331  IF (upper) THEN
332  DO 180 j = n,1,-1
333  temp = alpha
334  IF (nounit) temp = temp*a(j,j)
335  DO 150 i = 1,m
336  b(i,j) = temp*b(i,j)
337  150 CONTINUE
338  DO 170 k = 1,j - 1
339  IF (a(k,j).NE.zero) THEN
340  temp = alpha*a(k,j)
341  DO 160 i = 1,m
342  b(i,j) = b(i,j) + temp*b(i,k)
343  160 CONTINUE
344  END IF
345  170 CONTINUE
346  180 CONTINUE
347  ELSE
348  DO 220 j = 1,n
349  temp = alpha
350  IF (nounit) temp = temp*a(j,j)
351  DO 190 i = 1,m
352  b(i,j) = temp*b(i,j)
353  190 CONTINUE
354  DO 210 k = j + 1,n
355  IF (a(k,j).NE.zero) THEN
356  temp = alpha*a(k,j)
357  DO 200 i = 1,m
358  b(i,j) = b(i,j) + temp*b(i,k)
359  200 CONTINUE
360  END IF
361  210 CONTINUE
362  220 CONTINUE
363  END IF
364  ELSE
365 *
366 * Form B := alpha*B*A**T.
367 *
368  IF (upper) THEN
369  DO 260 k = 1,n
370  DO 240 j = 1,k - 1
371  IF (a(j,k).NE.zero) THEN
372  temp = alpha*a(j,k)
373  DO 230 i = 1,m
374  b(i,j) = b(i,j) + temp*b(i,k)
375  230 CONTINUE
376  END IF
377  240 CONTINUE
378  temp = alpha
379  IF (nounit) temp = temp*a(k,k)
380  IF (temp.NE.one) THEN
381  DO 250 i = 1,m
382  b(i,k) = temp*b(i,k)
383  250 CONTINUE
384  END IF
385  260 CONTINUE
386  ELSE
387  DO 300 k = n,1,-1
388  DO 280 j = k + 1,n
389  IF (a(j,k).NE.zero) THEN
390  temp = alpha*a(j,k)
391  DO 270 i = 1,m
392  b(i,j) = b(i,j) + temp*b(i,k)
393  270 CONTINUE
394  END IF
395  280 CONTINUE
396  temp = alpha
397  IF (nounit) temp = temp*a(k,k)
398  IF (temp.NE.one) THEN
399  DO 290 i = 1,m
400  b(i,k) = temp*b(i,k)
401  290 CONTINUE
402  END IF
403  300 CONTINUE
404  END IF
405  END IF
406  END IF
407 *
408  RETURN
409 *
410 * End of STRMM
411 *
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: