OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches

Functions

subroutine dgemm (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
 DGEMM
subroutine dsymm (side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc)
 DSYMM
subroutine dsyr2k (uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
 DSYR2K
subroutine dsyrk (uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
 DSYRK
subroutine dtrmm (side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
 DTRMM
subroutine dtrsm (side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
 DTRSM

Detailed Description

This is the group of double LEVEL 3 BLAS routines.

Function Documentation

◆ dgemm()

subroutine dgemm ( character transa,
character transb,
integer m,
integer n,
integer k,
double precision alpha,
double precision, dimension(lda,*) a,
integer lda,
double precision, dimension(ldb,*) b,
integer ldb,
double precision beta,
double precision, dimension(ldc,*) c,
integer ldc )

DGEMM

Purpose:
!>
!> DGEMM  performs one of the matrix-matrix operations
!>
!>    C := alpha*op( A )*op( B ) + beta*C,
!>
!> where  op( X ) is one of
!>
!>    op( X ) = X   or   op( X ) = X**T,
!>
!> alpha and beta are scalars, and A, B and C are matrices, with op( A )
!> an m by k matrix,  op( B )  a  k by n matrix and  C an m by n matrix.
!> 
Parameters
[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]TRANSB
!>          TRANSB is CHARACTER*1
!>           On entry, TRANSB specifies the form of op( B ) to be used in
!>           the matrix multiplication as follows:
!>
!>              TRANSB = 'N' or 'n',  op( B ) = B.
!>
!>              TRANSB = 'T' or 't',  op( B ) = B**T.
!>
!>              TRANSB = 'C' or 'c',  op( B ) = B**T.
!> 
[in]M
!>          M is INTEGER
!>           On entry,  M  specifies  the number  of rows  of the  matrix
!>           op( A )  and of the  matrix  C.  M  must  be at least  zero.
!> 
[in]N
!>          N is INTEGER
!>           On entry,  N  specifies the number  of columns of the matrix
!>           op( B ) and the number of columns of the matrix C. N must be
!>           at least zero.
!> 
[in]K
!>          K is INTEGER
!>           On entry,  K  specifies  the number of columns of the matrix
!>           op( A ) and the number of rows of the matrix op( B ). K must
!>           be at least  zero.
!> 
[in]ALPHA
!>          ALPHA is DOUBLE PRECISION.
!>           On entry, ALPHA specifies the scalar alpha.
!> 
[in]A
!>          A is DOUBLE PRECISION array, dimension ( LDA, ka ), where ka is
!>           k  when  TRANSA = 'N' or 'n',  and is  m  otherwise.
!>           Before entry with  TRANSA = 'N' or 'n',  the leading  m by k
!>           part of the array  A  must contain the matrix  A,  otherwise
!>           the leading  k by m  part of the array  A  must contain  the
!>           matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>           On entry, LDA specifies the first dimension of A as declared
!>           in the calling (sub) program. When  TRANSA = 'N' or 'n' then
!>           LDA must be at least  max( 1, m ), otherwise  LDA must be at
!>           least  max( 1, k ).
!> 
[in]B
!>          B is DOUBLE PRECISION array, dimension ( LDB, kb ), where kb is
!>           n  when  TRANSB = 'N' or 'n',  and is  k  otherwise.
!>           Before entry with  TRANSB = 'N' or 'n',  the leading  k by n
!>           part of the array  B  must contain the matrix  B,  otherwise
!>           the leading  n by k  part of the array  B  must contain  the
!>           matrix B.
!> 
[in]LDB
!>          LDB is INTEGER
!>           On entry, LDB specifies the first dimension of B as declared
!>           in the calling (sub) program. When  TRANSB = 'N' or 'n' then
!>           LDB must be at least  max( 1, k ), otherwise  LDB must be at
!>           least  max( 1, n ).
!> 
[in]BETA
!>          BETA is DOUBLE PRECISION.
!>           On entry,  BETA  specifies the scalar  beta.  When  BETA  is
!>           supplied as zero then C need not be set on input.
!> 
[in,out]C
!>          C is DOUBLE PRECISION array, dimension ( LDC, N )
!>           Before entry, the leading  m by n  part of the array  C must
!>           contain the matrix  C,  except when  beta  is zero, in which
!>           case C need not be set on entry.
!>           On exit, the array  C  is overwritten by the  m by n  matrix
!>           ( alpha*op( A )*op( B ) + beta*C ).
!> 
[in]LDC
!>          LDC is INTEGER
!>           On entry, LDC specifies the first dimension of C as declared
!>           in  the  calling  (sub)  program.   LDC  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 186 of file dgemm.f.

187*
188* -- Reference BLAS level3 routine --
189* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
190* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
191*
192* .. Scalar Arguments ..
193 DOUBLE PRECISION ALPHA,BETA
194 INTEGER K,LDA,LDB,LDC,M,N
195 CHARACTER TRANSA,TRANSB
196* ..
197* .. Array Arguments ..
198 DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*)
199* ..
200*
201* =====================================================================
202*
203* .. External Functions ..
204 LOGICAL LSAME
205 EXTERNAL lsame
206* ..
207* .. External Subroutines ..
208 EXTERNAL xerbla
209* ..
210* .. Intrinsic Functions ..
211 INTRINSIC max
212* ..
213* .. Local Scalars ..
214 DOUBLE PRECISION TEMP
215 INTEGER I,INFO,J,L,NROWA,NROWB
216 LOGICAL NOTA,NOTB
217* ..
218* .. Parameters ..
219 DOUBLE PRECISION ONE,ZERO
220 parameter(one=1.0d+0,zero=0.0d+0)
221* ..
222*
223* Set NOTA and NOTB as true if A and B respectively are not
224* transposed and set NROWA and NROWB as the number of rows of A
225* and B respectively.
226*
227 nota = lsame(transa,'N')
228 notb = lsame(transb,'N')
229 IF (nota) THEN
230 nrowa = m
231 ELSE
232 nrowa = k
233 END IF
234 IF (notb) THEN
235 nrowb = k
236 ELSE
237 nrowb = n
238 END IF
239*
240* Test the input parameters.
241*
242 info = 0
243 IF ((.NOT.nota) .AND. (.NOT.lsame(transa,'C')) .AND.
244 + (.NOT.lsame(transa,'T'))) THEN
245 info = 1
246 ELSE IF ((.NOT.notb) .AND. (.NOT.lsame(transb,'C')) .AND.
247 + (.NOT.lsame(transb,'T'))) THEN
248 info = 2
249 ELSE IF (m.LT.0) THEN
250 info = 3
251 ELSE IF (n.LT.0) THEN
252 info = 4
253 ELSE IF (k.LT.0) THEN
254 info = 5
255 ELSE IF (lda.LT.max(1,nrowa)) THEN
256 info = 8
257 ELSE IF (ldb.LT.max(1,nrowb)) THEN
258 info = 10
259 ELSE IF (ldc.LT.max(1,m)) THEN
260 info = 13
261 END IF
262 IF (info.NE.0) THEN
263 CALL xerbla('DGEMM ',info)
264 RETURN
265 END IF
266*
267* Quick return if possible.
268*
269 IF ((m.EQ.0) .OR. (n.EQ.0) .OR.
270 + (((alpha.EQ.zero).OR. (k.EQ.0)).AND. (beta.EQ.one))) RETURN
271*
272* And if alpha.eq.zero.
273*
274 IF (alpha.EQ.zero) THEN
275 IF (beta.EQ.zero) THEN
276 DO 20 j = 1,n
277 DO 10 i = 1,m
278 c(i,j) = zero
279 10 CONTINUE
280 20 CONTINUE
281 ELSE
282 DO 40 j = 1,n
283 DO 30 i = 1,m
284 c(i,j) = beta*c(i,j)
285 30 CONTINUE
286 40 CONTINUE
287 END IF
288 RETURN
289 END IF
290*
291* Start the operations.
292*
293 IF (notb) THEN
294 IF (nota) THEN
295*
296* Form C := alpha*A*B + beta*C.
297*
298 DO 90 j = 1,n
299 IF (beta.EQ.zero) THEN
300 DO 50 i = 1,m
301 c(i,j) = zero
302 50 CONTINUE
303 ELSE IF (beta.NE.one) THEN
304 DO 60 i = 1,m
305 c(i,j) = beta*c(i,j)
306 60 CONTINUE
307 END IF
308 DO 80 l = 1,k
309 temp = alpha*b(l,j)
310 DO 70 i = 1,m
311 c(i,j) = c(i,j) + temp*a(i,l)
312 70 CONTINUE
313 80 CONTINUE
314 90 CONTINUE
315 ELSE
316*
317* Form C := alpha*A**T*B + beta*C
318*
319 DO 120 j = 1,n
320 DO 110 i = 1,m
321 temp = zero
322 DO 100 l = 1,k
323 temp = temp + a(l,i)*b(l,j)
324 100 CONTINUE
325 IF (beta.EQ.zero) THEN
326 c(i,j) = alpha*temp
327 ELSE
328 c(i,j) = alpha*temp + beta*c(i,j)
329 END IF
330 110 CONTINUE
331 120 CONTINUE
332 END IF
333 ELSE
334 IF (nota) THEN
335*
336* Form C := alpha*A*B**T + beta*C
337*
338 DO 170 j = 1,n
339 IF (beta.EQ.zero) THEN
340 DO 130 i = 1,m
341 c(i,j) = zero
342 130 CONTINUE
343 ELSE IF (beta.NE.one) THEN
344 DO 140 i = 1,m
345 c(i,j) = beta*c(i,j)
346 140 CONTINUE
347 END IF
348 DO 160 l = 1,k
349 temp = alpha*b(j,l)
350 DO 150 i = 1,m
351 c(i,j) = c(i,j) + temp*a(i,l)
352 150 CONTINUE
353 160 CONTINUE
354 170 CONTINUE
355 ELSE
356*
357* Form C := alpha*A**T*B**T + beta*C
358*
359 DO 200 j = 1,n
360 DO 190 i = 1,m
361 temp = zero
362 DO 180 l = 1,k
363 temp = temp + a(l,i)*b(j,l)
364 180 CONTINUE
365 IF (beta.EQ.zero) THEN
366 c(i,j) = alpha*temp
367 ELSE
368 c(i,j) = alpha*temp + beta*c(i,j)
369 END IF
370 190 CONTINUE
371 200 CONTINUE
372 END IF
373 END IF
374*
375 RETURN
376*
377* End of DGEMM
378*
#define alpha
Definition eval.h:35
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
#define max(a, b)
Definition macros.h:21

◆ dsymm()

subroutine dsymm ( character side,
character uplo,
integer m,
integer n,
double precision alpha,
double precision, dimension(lda,*) a,
integer lda,
double precision, dimension(ldb,*) b,
integer ldb,
double precision beta,
double precision, dimension(ldc,*) c,
integer ldc )

DSYMM

Purpose:
!>
!> DSYMM  performs one of the matrix-matrix operations
!>
!>    C := alpha*A*B + beta*C,
!>
!> or
!>
!>    C := alpha*B*A + beta*C,
!>
!> where alpha and beta are scalars,  A is a symmetric matrix and  B and
!> C are  m by n matrices.
!> 
Parameters
[in]SIDE
!>          SIDE is CHARACTER*1
!>           On entry,  SIDE  specifies whether  the  symmetric matrix  A
!>           appears on the  left or right  in the  operation as follows:
!>
!>              SIDE = 'L' or 'l'   C := alpha*A*B + beta*C,
!>
!>              SIDE = 'R' or 'r'   C := alpha*B*A + beta*C,
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>           On  entry,   UPLO  specifies  whether  the  upper  or  lower
!>           triangular  part  of  the  symmetric  matrix   A  is  to  be
!>           referenced as follows:
!>
!>              UPLO = 'U' or 'u'   Only the upper triangular part of the
!>                                  symmetric matrix is to be referenced.
!>
!>              UPLO = 'L' or 'l'   Only the lower triangular part of the
!>                                  symmetric matrix is to be referenced.
!> 
[in]M
!>          M is INTEGER
!>           On entry,  M  specifies the number of rows of the matrix  C.
!>           M  must be at least zero.
!> 
[in]N
!>          N is INTEGER
!>           On entry, N specifies the number of columns of the matrix C.
!>           N  must be at least zero.
!> 
[in]ALPHA
!>          ALPHA is DOUBLE PRECISION.
!>           On entry, ALPHA specifies the scalar alpha.
!> 
[in]A
!>          A is DOUBLE PRECISION array, dimension ( LDA, ka ), where ka is
!>           m  when  SIDE = 'L' or 'l'  and is  n otherwise.
!>           Before entry  with  SIDE = 'L' or 'l',  the  m by m  part of
!>           the array  A  must contain the  symmetric matrix,  such that
!>           when  UPLO = 'U' or 'u', the leading m by m upper triangular
!>           part of the array  A  must contain the upper triangular part
!>           of the  symmetric matrix and the  strictly  lower triangular
!>           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
!>           the leading  m by m  lower triangular part  of the  array  A
!>           must  contain  the  lower triangular part  of the  symmetric
!>           matrix and the  strictly upper triangular part of  A  is not
!>           referenced.
!>           Before entry  with  SIDE = 'R' or 'r',  the  n by n  part of
!>           the array  A  must contain the  symmetric matrix,  such that
!>           when  UPLO = 'U' or 'u', the leading n by n upper triangular
!>           part of the array  A  must contain the upper triangular part
!>           of the  symmetric matrix and the  strictly  lower triangular
!>           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
!>           the leading  n by n  lower triangular part  of the  array  A
!>           must  contain  the  lower triangular part  of the  symmetric
!>           matrix and the  strictly upper triangular part of  A  is not
!>           referenced.
!> 
[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 ), otherwise  LDA must be at
!>           least  max( 1, n ).
!> 
[in]B
!>          B is DOUBLE PRECISION array, dimension ( LDB, N )
!>           Before entry, the leading  m by n part of the array  B  must
!>           contain the matrix B.
!> 
[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 ).
!> 
[in]BETA
!>          BETA is DOUBLE PRECISION.
!>           On entry,  BETA  specifies the scalar  beta.  When  BETA  is
!>           supplied as zero then C need not be set on input.
!> 
[in,out]C
!>          C is DOUBLE PRECISION array, dimension ( LDC, N )
!>           Before entry, the leading  m by n  part of the array  C must
!>           contain the matrix  C,  except when  beta  is zero, in which
!>           case C need not be set on entry.
!>           On exit, the array  C  is overwritten by the  m by n updated
!>           matrix.
!> 
[in]LDC
!>          LDC is INTEGER
!>           On entry, LDC specifies the first dimension of C as declared
!>           in  the  calling  (sub)  program.   LDC  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 188 of file dsymm.f.

189*
190* -- Reference BLAS level3 routine --
191* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
192* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
193*
194* .. Scalar Arguments ..
195 DOUBLE PRECISION ALPHA,BETA
196 INTEGER LDA,LDB,LDC,M,N
197 CHARACTER SIDE,UPLO
198* ..
199* .. Array Arguments ..
200 DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*)
201* ..
202*
203* =====================================================================
204*
205* .. External Functions ..
206 LOGICAL LSAME
207 EXTERNAL lsame
208* ..
209* .. External Subroutines ..
210 EXTERNAL xerbla
211* ..
212* .. Intrinsic Functions ..
213 INTRINSIC max
214* ..
215* .. Local Scalars ..
216 DOUBLE PRECISION TEMP1,TEMP2
217 INTEGER I,INFO,J,K,NROWA
218 LOGICAL UPPER
219* ..
220* .. Parameters ..
221 DOUBLE PRECISION ONE,ZERO
222 parameter(one=1.0d+0,zero=0.0d+0)
223* ..
224*
225* Set NROWA as the number of rows of A.
226*
227 IF (lsame(side,'L')) THEN
228 nrowa = m
229 ELSE
230 nrowa = n
231 END IF
232 upper = lsame(uplo,'U')
233*
234* Test the input parameters.
235*
236 info = 0
237 IF ((.NOT.lsame(side,'L')) .AND. (.NOT.lsame(side,'R'))) THEN
238 info = 1
239 ELSE IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
240 info = 2
241 ELSE IF (m.LT.0) THEN
242 info = 3
243 ELSE IF (n.LT.0) THEN
244 info = 4
245 ELSE IF (lda.LT.max(1,nrowa)) THEN
246 info = 7
247 ELSE IF (ldb.LT.max(1,m)) THEN
248 info = 9
249 ELSE IF (ldc.LT.max(1,m)) THEN
250 info = 12
251 END IF
252 IF (info.NE.0) THEN
253 CALL xerbla('DSYMM ',info)
254 RETURN
255 END IF
256*
257* Quick return if possible.
258*
259 IF ((m.EQ.0) .OR. (n.EQ.0) .OR.
260 + ((alpha.EQ.zero).AND. (beta.EQ.one))) RETURN
261*
262* And when alpha.eq.zero.
263*
264 IF (alpha.EQ.zero) THEN
265 IF (beta.EQ.zero) THEN
266 DO 20 j = 1,n
267 DO 10 i = 1,m
268 c(i,j) = zero
269 10 CONTINUE
270 20 CONTINUE
271 ELSE
272 DO 40 j = 1,n
273 DO 30 i = 1,m
274 c(i,j) = beta*c(i,j)
275 30 CONTINUE
276 40 CONTINUE
277 END IF
278 RETURN
279 END IF
280*
281* Start the operations.
282*
283 IF (lsame(side,'L')) THEN
284*
285* Form C := alpha*A*B + beta*C.
286*
287 IF (upper) THEN
288 DO 70 j = 1,n
289 DO 60 i = 1,m
290 temp1 = alpha*b(i,j)
291 temp2 = zero
292 DO 50 k = 1,i - 1
293 c(k,j) = c(k,j) + temp1*a(k,i)
294 temp2 = temp2 + b(k,j)*a(k,i)
295 50 CONTINUE
296 IF (beta.EQ.zero) THEN
297 c(i,j) = temp1*a(i,i) + alpha*temp2
298 ELSE
299 c(i,j) = beta*c(i,j) + temp1*a(i,i) +
300 + alpha*temp2
301 END IF
302 60 CONTINUE
303 70 CONTINUE
304 ELSE
305 DO 100 j = 1,n
306 DO 90 i = m,1,-1
307 temp1 = alpha*b(i,j)
308 temp2 = zero
309 DO 80 k = i + 1,m
310 c(k,j) = c(k,j) + temp1*a(k,i)
311 temp2 = temp2 + b(k,j)*a(k,i)
312 80 CONTINUE
313 IF (beta.EQ.zero) THEN
314 c(i,j) = temp1*a(i,i) + alpha*temp2
315 ELSE
316 c(i,j) = beta*c(i,j) + temp1*a(i,i) +
317 + alpha*temp2
318 END IF
319 90 CONTINUE
320 100 CONTINUE
321 END IF
322 ELSE
323*
324* Form C := alpha*B*A + beta*C.
325*
326 DO 170 j = 1,n
327 temp1 = alpha*a(j,j)
328 IF (beta.EQ.zero) THEN
329 DO 110 i = 1,m
330 c(i,j) = temp1*b(i,j)
331 110 CONTINUE
332 ELSE
333 DO 120 i = 1,m
334 c(i,j) = beta*c(i,j) + temp1*b(i,j)
335 120 CONTINUE
336 END IF
337 DO 140 k = 1,j - 1
338 IF (upper) THEN
339 temp1 = alpha*a(k,j)
340 ELSE
341 temp1 = alpha*a(j,k)
342 END IF
343 DO 130 i = 1,m
344 c(i,j) = c(i,j) + temp1*b(i,k)
345 130 CONTINUE
346 140 CONTINUE
347 DO 160 k = j + 1,n
348 IF (upper) THEN
349 temp1 = alpha*a(j,k)
350 ELSE
351 temp1 = alpha*a(k,j)
352 END IF
353 DO 150 i = 1,m
354 c(i,j) = c(i,j) + temp1*b(i,k)
355 150 CONTINUE
356 160 CONTINUE
357 170 CONTINUE
358 END IF
359*
360 RETURN
361*
362* End of DSYMM
363*

◆ dsyr2k()

subroutine dsyr2k ( character uplo,
character trans,
integer n,
integer k,
double precision alpha,
double precision, dimension(lda,*) a,
integer lda,
double precision, dimension(ldb,*) b,
integer ldb,
double precision beta,
double precision, dimension(ldc,*) c,
integer ldc )

DSYR2K

Purpose:
!>
!> DSYR2K  performs one of the symmetric rank 2k operations
!>
!>    C := alpha*A*B**T + alpha*B*A**T + beta*C,
!>
!> or
!>
!>    C := alpha*A**T*B + alpha*B**T*A + beta*C,
!>
!> where  alpha and beta  are scalars, C is an  n by n  symmetric matrix
!> and  A and B  are  n by k  matrices  in the  first  case  and  k by n
!> matrices in the second case.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>           On  entry,   UPLO  specifies  whether  the  upper  or  lower
!>           triangular  part  of the  array  C  is to be  referenced  as
!>           follows:
!>
!>              UPLO = 'U' or 'u'   Only the  upper triangular part of  C
!>                                  is to be referenced.
!>
!>              UPLO = 'L' or 'l'   Only the  lower triangular part of  C
!>                                  is to be referenced.
!> 
[in]TRANS
!>          TRANS is CHARACTER*1
!>           On entry,  TRANS  specifies the operation to be performed as
!>           follows:
!>
!>              TRANS = 'N' or 'n'   C := alpha*A*B**T + alpha*B*A**T +
!>                                        beta*C.
!>
!>              TRANS = 'T' or 't'   C := alpha*A**T*B + alpha*B**T*A +
!>                                        beta*C.
!>
!>              TRANS = 'C' or 'c'   C := alpha*A**T*B + alpha*B**T*A +
!>                                        beta*C.
!> 
[in]N
!>          N is INTEGER
!>           On entry,  N specifies the order of the matrix C.  N must be
!>           at least zero.
!> 
[in]K
!>          K is INTEGER
!>           On entry with  TRANS = 'N' or 'n',  K  specifies  the number
!>           of  columns  of the  matrices  A and B,  and on  entry  with
!>           TRANS = 'T' or 't' or 'C' or 'c',  K  specifies  the  number
!>           of rows of the matrices  A and B.  K must be at least  zero.
!> 
[in]ALPHA
!>          ALPHA is DOUBLE PRECISION.
!>           On entry, ALPHA specifies the scalar alpha.
!> 
[in]A
!>          A is DOUBLE PRECISION array, dimension ( LDA, ka ), where ka is
!>           k  when  TRANS = 'N' or 'n',  and is  n  otherwise.
!>           Before entry with  TRANS = 'N' or 'n',  the  leading  n by k
!>           part of the array  A  must contain the matrix  A,  otherwise
!>           the leading  k by n  part of the array  A  must contain  the
!>           matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>           On entry, LDA specifies the first dimension of A as declared
!>           in  the  calling  (sub)  program.   When  TRANS = 'N' or 'n'
!>           then  LDA must be at least  max( 1, n ), otherwise  LDA must
!>           be at least  max( 1, k ).
!> 
[in]B
!>          B is DOUBLE PRECISION array, dimension ( LDB, kb ), where kb is
!>           k  when  TRANS = 'N' or 'n',  and is  n  otherwise.
!>           Before entry with  TRANS = 'N' or 'n',  the  leading  n by k
!>           part of the array  B  must contain the matrix  B,  otherwise
!>           the leading  k by n  part of the array  B  must contain  the
!>           matrix B.
!> 
[in]LDB
!>          LDB is INTEGER
!>           On entry, LDB specifies the first dimension of B as declared
!>           in  the  calling  (sub)  program.   When  TRANS = 'N' or 'n'
!>           then  LDB must be at least  max( 1, n ), otherwise  LDB must
!>           be at least  max( 1, k ).
!> 
[in]BETA
!>          BETA is DOUBLE PRECISION.
!>           On entry, BETA specifies the scalar beta.
!> 
[in,out]C
!>          C is DOUBLE PRECISION array, dimension ( LDC, N )
!>           Before entry  with  UPLO = 'U' or 'u',  the leading  n by n
!>           upper triangular part of the array C must contain the upper
!>           triangular part  of the  symmetric matrix  and the strictly
!>           lower triangular part of C is not referenced.  On exit, the
!>           upper triangular part of the array  C is overwritten by the
!>           upper triangular part of the updated matrix.
!>           Before entry  with  UPLO = 'L' or 'l',  the leading  n by n
!>           lower triangular part of the array C must contain the lower
!>           triangular part  of the  symmetric matrix  and the strictly
!>           upper triangular part of C is not referenced.  On exit, the
!>           lower triangular part of the array  C is overwritten by the
!>           lower triangular part of the updated matrix.
!> 
[in]LDC
!>          LDC is INTEGER
!>           On entry, LDC specifies the first dimension of C as declared
!>           in  the  calling  (sub)  program.   LDC  must  be  at  least
!>           max( 1, n ).
!> 
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 191 of file dsyr2k.f.

192*
193* -- Reference BLAS level3 routine --
194* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
195* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
196*
197* .. Scalar Arguments ..
198 DOUBLE PRECISION ALPHA,BETA
199 INTEGER K,LDA,LDB,LDC,N
200 CHARACTER TRANS,UPLO
201* ..
202* .. Array Arguments ..
203 DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*)
204* ..
205*
206* =====================================================================
207*
208* .. External Functions ..
209 LOGICAL LSAME
210 EXTERNAL lsame
211* ..
212* .. External Subroutines ..
213 EXTERNAL xerbla
214* ..
215* .. Intrinsic Functions ..
216 INTRINSIC max
217* ..
218* .. Local Scalars ..
219 DOUBLE PRECISION TEMP1,TEMP2
220 INTEGER I,INFO,J,L,NROWA
221 LOGICAL UPPER
222* ..
223* .. Parameters ..
224 DOUBLE PRECISION ONE,ZERO
225 parameter(one=1.0d+0,zero=0.0d+0)
226* ..
227*
228* Test the input parameters.
229*
230 IF (lsame(trans,'N')) THEN
231 nrowa = n
232 ELSE
233 nrowa = k
234 END IF
235 upper = lsame(uplo,'U')
236*
237 info = 0
238 IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
239 info = 1
240 ELSE IF ((.NOT.lsame(trans,'N')) .AND.
241 + (.NOT.lsame(trans,'T')) .AND.
242 + (.NOT.lsame(trans,'C'))) THEN
243 info = 2
244 ELSE IF (n.LT.0) THEN
245 info = 3
246 ELSE IF (k.LT.0) THEN
247 info = 4
248 ELSE IF (lda.LT.max(1,nrowa)) THEN
249 info = 7
250 ELSE IF (ldb.LT.max(1,nrowa)) THEN
251 info = 9
252 ELSE IF (ldc.LT.max(1,n)) THEN
253 info = 12
254 END IF
255 IF (info.NE.0) THEN
256 CALL xerbla('DSYR2K',info)
257 RETURN
258 END IF
259*
260* Quick return if possible.
261*
262 IF ((n.EQ.0) .OR. (((alpha.EQ.zero).OR.
263 + (k.EQ.0)).AND. (beta.EQ.one))) RETURN
264*
265* And when alpha.eq.zero.
266*
267 IF (alpha.EQ.zero) THEN
268 IF (upper) THEN
269 IF (beta.EQ.zero) THEN
270 DO 20 j = 1,n
271 DO 10 i = 1,j
272 c(i,j) = zero
273 10 CONTINUE
274 20 CONTINUE
275 ELSE
276 DO 40 j = 1,n
277 DO 30 i = 1,j
278 c(i,j) = beta*c(i,j)
279 30 CONTINUE
280 40 CONTINUE
281 END IF
282 ELSE
283 IF (beta.EQ.zero) THEN
284 DO 60 j = 1,n
285 DO 50 i = j,n
286 c(i,j) = zero
287 50 CONTINUE
288 60 CONTINUE
289 ELSE
290 DO 80 j = 1,n
291 DO 70 i = j,n
292 c(i,j) = beta*c(i,j)
293 70 CONTINUE
294 80 CONTINUE
295 END IF
296 END IF
297 RETURN
298 END IF
299*
300* Start the operations.
301*
302 IF (lsame(trans,'N')) THEN
303*
304* Form C := alpha*A*B**T + alpha*B*A**T + C.
305*
306 IF (upper) THEN
307 DO 130 j = 1,n
308 IF (beta.EQ.zero) THEN
309 DO 90 i = 1,j
310 c(i,j) = zero
311 90 CONTINUE
312 ELSE IF (beta.NE.one) THEN
313 DO 100 i = 1,j
314 c(i,j) = beta*c(i,j)
315 100 CONTINUE
316 END IF
317 DO 120 l = 1,k
318 IF ((a(j,l).NE.zero) .OR. (b(j,l).NE.zero)) THEN
319 temp1 = alpha*b(j,l)
320 temp2 = alpha*a(j,l)
321 DO 110 i = 1,j
322 c(i,j) = c(i,j) + a(i,l)*temp1 +
323 + b(i,l)*temp2
324 110 CONTINUE
325 END IF
326 120 CONTINUE
327 130 CONTINUE
328 ELSE
329 DO 180 j = 1,n
330 IF (beta.EQ.zero) THEN
331 DO 140 i = j,n
332 c(i,j) = zero
333 140 CONTINUE
334 ELSE IF (beta.NE.one) THEN
335 DO 150 i = j,n
336 c(i,j) = beta*c(i,j)
337 150 CONTINUE
338 END IF
339 DO 170 l = 1,k
340 IF ((a(j,l).NE.zero) .OR. (b(j,l).NE.zero)) THEN
341 temp1 = alpha*b(j,l)
342 temp2 = alpha*a(j,l)
343 DO 160 i = j,n
344 c(i,j) = c(i,j) + a(i,l)*temp1 +
345 + b(i,l)*temp2
346 160 CONTINUE
347 END IF
348 170 CONTINUE
349 180 CONTINUE
350 END IF
351 ELSE
352*
353* Form C := alpha*A**T*B + alpha*B**T*A + C.
354*
355 IF (upper) THEN
356 DO 210 j = 1,n
357 DO 200 i = 1,j
358 temp1 = zero
359 temp2 = zero
360 DO 190 l = 1,k
361 temp1 = temp1 + a(l,i)*b(l,j)
362 temp2 = temp2 + b(l,i)*a(l,j)
363 190 CONTINUE
364 IF (beta.EQ.zero) THEN
365 c(i,j) = alpha*temp1 + alpha*temp2
366 ELSE
367 c(i,j) = beta*c(i,j) + alpha*temp1 +
368 + alpha*temp2
369 END IF
370 200 CONTINUE
371 210 CONTINUE
372 ELSE
373 DO 240 j = 1,n
374 DO 230 i = j,n
375 temp1 = zero
376 temp2 = zero
377 DO 220 l = 1,k
378 temp1 = temp1 + a(l,i)*b(l,j)
379 temp2 = temp2 + b(l,i)*a(l,j)
380 220 CONTINUE
381 IF (beta.EQ.zero) THEN
382 c(i,j) = alpha*temp1 + alpha*temp2
383 ELSE
384 c(i,j) = beta*c(i,j) + alpha*temp1 +
385 + alpha*temp2
386 END IF
387 230 CONTINUE
388 240 CONTINUE
389 END IF
390 END IF
391*
392 RETURN
393*
394* End of DSYR2K
395*

◆ dsyrk()

subroutine dsyrk ( character uplo,
character trans,
integer n,
integer k,
double precision alpha,
double precision, dimension(lda,*) a,
integer lda,
double precision beta,
double precision, dimension(ldc,*) c,
integer ldc )

DSYRK

Purpose:
!>
!> DSYRK  performs one of the symmetric rank k operations
!>
!>    C := alpha*A*A**T + beta*C,
!>
!> or
!>
!>    C := alpha*A**T*A + beta*C,
!>
!> where  alpha and beta  are scalars, C is an  n by n  symmetric matrix
!> and  A  is an  n by k  matrix in the first case and a  k by n  matrix
!> in the second case.
!> 
Parameters
[in]UPLO
!>          UPLO is CHARACTER*1
!>           On  entry,   UPLO  specifies  whether  the  upper  or  lower
!>           triangular  part  of the  array  C  is to be  referenced  as
!>           follows:
!>
!>              UPLO = 'U' or 'u'   Only the  upper triangular part of  C
!>                                  is to be referenced.
!>
!>              UPLO = 'L' or 'l'   Only the  lower triangular part of  C
!>                                  is to be referenced.
!> 
[in]TRANS
!>          TRANS is CHARACTER*1
!>           On entry,  TRANS  specifies the operation to be performed as
!>           follows:
!>
!>              TRANS = 'N' or 'n'   C := alpha*A*A**T + beta*C.
!>
!>              TRANS = 'T' or 't'   C := alpha*A**T*A + beta*C.
!>
!>              TRANS = 'C' or 'c'   C := alpha*A**T*A + beta*C.
!> 
[in]N
!>          N is INTEGER
!>           On entry,  N specifies the order of the matrix C.  N must be
!>           at least zero.
!> 
[in]K
!>          K is INTEGER
!>           On entry with  TRANS = 'N' or 'n',  K  specifies  the number
!>           of  columns   of  the   matrix   A,   and  on   entry   with
!>           TRANS = 'T' or 't' or 'C' or 'c',  K  specifies  the  number
!>           of rows of the matrix  A.  K must be at least zero.
!> 
[in]ALPHA
!>          ALPHA is DOUBLE PRECISION.
!>           On entry, ALPHA specifies the scalar alpha.
!> 
[in]A
!>          A is DOUBLE PRECISION array, dimension ( LDA, ka ), where ka is
!>           k  when  TRANS = 'N' or 'n',  and is  n  otherwise.
!>           Before entry with  TRANS = 'N' or 'n',  the  leading  n by k
!>           part of the array  A  must contain the matrix  A,  otherwise
!>           the leading  k by n  part of the array  A  must contain  the
!>           matrix A.
!> 
[in]LDA
!>          LDA is INTEGER
!>           On entry, LDA specifies the first dimension of A as declared
!>           in  the  calling  (sub)  program.   When  TRANS = 'N' or 'n'
!>           then  LDA must be at least  max( 1, n ), otherwise  LDA must
!>           be at least  max( 1, k ).
!> 
[in]BETA
!>          BETA is DOUBLE PRECISION.
!>           On entry, BETA specifies the scalar beta.
!> 
[in,out]C
!>          C is DOUBLE PRECISION array, dimension ( LDC, N )
!>           Before entry  with  UPLO = 'U' or 'u',  the leading  n by n
!>           upper triangular part of the array C must contain the upper
!>           triangular part  of the  symmetric matrix  and the strictly
!>           lower triangular part of C is not referenced.  On exit, the
!>           upper triangular part of the array  C is overwritten by the
!>           upper triangular part of the updated matrix.
!>           Before entry  with  UPLO = 'L' or 'l',  the leading  n by n
!>           lower triangular part of the array C must contain the lower
!>           triangular part  of the  symmetric matrix  and the strictly
!>           upper triangular part of C is not referenced.  On exit, the
!>           lower triangular part of the array  C is overwritten by the
!>           lower triangular part of the updated matrix.
!> 
[in]LDC
!>          LDC is INTEGER
!>           On entry, LDC specifies the first dimension of C as declared
!>           in  the  calling  (sub)  program.   LDC  must  be  at  least
!>           max( 1, n ).
!> 
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 168 of file dsyrk.f.

169*
170* -- Reference BLAS level3 routine --
171* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
172* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
173*
174* .. Scalar Arguments ..
175 DOUBLE PRECISION ALPHA,BETA
176 INTEGER K,LDA,LDC,N
177 CHARACTER TRANS,UPLO
178* ..
179* .. Array Arguments ..
180 DOUBLE PRECISION A(LDA,*),C(LDC,*)
181* ..
182*
183* =====================================================================
184*
185* .. External Functions ..
186 LOGICAL LSAME
187 EXTERNAL lsame
188* ..
189* .. External Subroutines ..
190 EXTERNAL xerbla
191* ..
192* .. Intrinsic Functions ..
193 INTRINSIC max
194* ..
195* .. Local Scalars ..
196 DOUBLE PRECISION TEMP
197 INTEGER I,INFO,J,L,NROWA
198 LOGICAL UPPER
199* ..
200* .. Parameters ..
201 DOUBLE PRECISION ONE,ZERO
202 parameter(one=1.0d+0,zero=0.0d+0)
203* ..
204*
205* Test the input parameters.
206*
207 IF (lsame(trans,'N')) THEN
208 nrowa = n
209 ELSE
210 nrowa = k
211 END IF
212 upper = lsame(uplo,'U')
213*
214 info = 0
215 IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
216 info = 1
217 ELSE IF ((.NOT.lsame(trans,'N')) .AND.
218 + (.NOT.lsame(trans,'T')) .AND.
219 + (.NOT.lsame(trans,'C'))) THEN
220 info = 2
221 ELSE IF (n.LT.0) THEN
222 info = 3
223 ELSE IF (k.LT.0) THEN
224 info = 4
225 ELSE IF (lda.LT.max(1,nrowa)) THEN
226 info = 7
227 ELSE IF (ldc.LT.max(1,n)) THEN
228 info = 10
229 END IF
230 IF (info.NE.0) THEN
231 CALL xerbla('DSYRK ',info)
232 RETURN
233 END IF
234*
235* Quick return if possible.
236*
237 IF ((n.EQ.0) .OR. (((alpha.EQ.zero).OR.
238 + (k.EQ.0)).AND. (beta.EQ.one))) RETURN
239*
240* And when alpha.eq.zero.
241*
242 IF (alpha.EQ.zero) THEN
243 IF (upper) THEN
244 IF (beta.EQ.zero) THEN
245 DO 20 j = 1,n
246 DO 10 i = 1,j
247 c(i,j) = zero
248 10 CONTINUE
249 20 CONTINUE
250 ELSE
251 DO 40 j = 1,n
252 DO 30 i = 1,j
253 c(i,j) = beta*c(i,j)
254 30 CONTINUE
255 40 CONTINUE
256 END IF
257 ELSE
258 IF (beta.EQ.zero) THEN
259 DO 60 j = 1,n
260 DO 50 i = j,n
261 c(i,j) = zero
262 50 CONTINUE
263 60 CONTINUE
264 ELSE
265 DO 80 j = 1,n
266 DO 70 i = j,n
267 c(i,j) = beta*c(i,j)
268 70 CONTINUE
269 80 CONTINUE
270 END IF
271 END IF
272 RETURN
273 END IF
274*
275* Start the operations.
276*
277 IF (lsame(trans,'N')) THEN
278*
279* Form C := alpha*A*A**T + beta*C.
280*
281 IF (upper) THEN
282 DO 130 j = 1,n
283 IF (beta.EQ.zero) THEN
284 DO 90 i = 1,j
285 c(i,j) = zero
286 90 CONTINUE
287 ELSE IF (beta.NE.one) THEN
288 DO 100 i = 1,j
289 c(i,j) = beta*c(i,j)
290 100 CONTINUE
291 END IF
292 DO 120 l = 1,k
293 IF (a(j,l).NE.zero) THEN
294 temp = alpha*a(j,l)
295 DO 110 i = 1,j
296 c(i,j) = c(i,j) + temp*a(i,l)
297 110 CONTINUE
298 END IF
299 120 CONTINUE
300 130 CONTINUE
301 ELSE
302 DO 180 j = 1,n
303 IF (beta.EQ.zero) THEN
304 DO 140 i = j,n
305 c(i,j) = zero
306 140 CONTINUE
307 ELSE IF (beta.NE.one) THEN
308 DO 150 i = j,n
309 c(i,j) = beta*c(i,j)
310 150 CONTINUE
311 END IF
312 DO 170 l = 1,k
313 IF (a(j,l).NE.zero) THEN
314 temp = alpha*a(j,l)
315 DO 160 i = j,n
316 c(i,j) = c(i,j) + temp*a(i,l)
317 160 CONTINUE
318 END IF
319 170 CONTINUE
320 180 CONTINUE
321 END IF
322 ELSE
323*
324* Form C := alpha*A**T*A + beta*C.
325*
326 IF (upper) THEN
327 DO 210 j = 1,n
328 DO 200 i = 1,j
329 temp = zero
330 DO 190 l = 1,k
331 temp = temp + a(l,i)*a(l,j)
332 190 CONTINUE
333 IF (beta.EQ.zero) THEN
334 c(i,j) = alpha*temp
335 ELSE
336 c(i,j) = alpha*temp + beta*c(i,j)
337 END IF
338 200 CONTINUE
339 210 CONTINUE
340 ELSE
341 DO 240 j = 1,n
342 DO 230 i = j,n
343 temp = zero
344 DO 220 l = 1,k
345 temp = temp + a(l,i)*a(l,j)
346 220 CONTINUE
347 IF (beta.EQ.zero) THEN
348 c(i,j) = alpha*temp
349 ELSE
350 c(i,j) = alpha*temp + beta*c(i,j)
351 END IF
352 230 CONTINUE
353 240 CONTINUE
354 END IF
355 END IF
356*
357 RETURN
358*
359* End of DSYRK
360*

◆ dtrmm()

subroutine dtrmm ( character side,
character uplo,
character transa,
character diag,
integer m,
integer n,
double precision alpha,
double precision, dimension(lda,*) a,
integer lda,
double precision, dimension(ldb,*) b,
integer ldb )

DTRMM

Purpose:
!>
!> DTRMM  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 DOUBLE PRECISION.
!>           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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 dtrmm.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 DOUBLE PRECISION ALPHA
184 INTEGER LDA,LDB,M,N
185 CHARACTER DIAG,SIDE,TRANSA,UPLO
186* ..
187* .. Array Arguments ..
188 DOUBLE PRECISION 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 DOUBLE PRECISION TEMP
205 INTEGER I,INFO,J,K,NROWA
206 LOGICAL LSIDE,NOUNIT,UPPER
207* ..
208* .. Parameters ..
209 DOUBLE PRECISION ONE,ZERO
210 parameter(one=1.0d+0,zero=0.0d+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('DTRMM ',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 DTRMM
411*

◆ dtrsm()

subroutine dtrsm ( character side,
character uplo,
character transa,
character diag,
integer m,
integer n,
double precision alpha,
double precision, dimension(lda,*) a,
integer lda,
double precision, dimension(ldb,*) b,
integer ldb )

DTRSM

Purpose:
!>
!> DTRSM  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.
!>
!> 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**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 DOUBLE PRECISION.
!>           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 DOUBLE PRECISION array, 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 DOUBLE PRECISION array, 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.
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 180 of file dtrsm.f.

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