gemmtr(3)
π gemmtr(3) π
gemmtr β straight out of the LAPACK manual, and bestie, you're gonna eat this up β¨
π NAME
gemmtr - gemmtr: general matrix-matrix multiply with triangular output π
β¨ SYNOPSIS
π¦ Functions
Four routines, one for each flavour of yours truly β same job, different number type. Match the letter to your data and slay:
CGEMMTRβsubroutine cgemmtr (uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)DGEMMTRβsubroutine dgemmtr (uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)SGEMMTRβsubroutine sgemmtr (uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)ZGEMMTRβsubroutine zgemmtr (uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
πΈ Detailed Description
Ok so this whole page lives under a bunch of doxygen groups, and the family tree looks like this, verbatim, no notes:
@defgroup hemm {he,sy}mm: Hermitian/symmetric matrix-matrix multiply
@defgroup herk {he,sy}rk: Hermitian/symmetric rank-k update
@defgroup her2k {he,sy}r2k: Hermitian/symmetric rank-2k update
@defgroup trmm trmm: triangular matrix-matrix multiply
@defgroup trsm trsm: triangular matrix-matrix solve
@}
π₯ Function Documentation
π subroutine cgemmtr
Here's the exact signature, wrapped exactly like the real thing, don't come for me:
subroutine cgemmtr (character uplo, character transa, character transb,
integer n, integer k, complex alpha, complex, dimension(lda,*) a,
integer lda, complex, dimension(ldb,*) b, integer ldb, complex beta,
complex, dimension(ldc,*) c, integer ldc)
CGEMMTR π
π«Ά Purpose
CGEMMTR does one of the matrix-matrix operations, literally:
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 n by k matrix, op( B ) a k by n matrix and C an n by n matrix. And here's the main character twist: the routine only accesses and updates the upper or lower triangular part of the result matrix C. That's the whole vibe check β you use this when you already know the resulting C is Hermitian or symmetric, so why waste the other half, right? π
π Parameters
UPLOβCHARACTER*1. On entry,UPLOsays which triangle of C is being accessed and updated.UPLO = 'L'or'l'β the lower triangular part of C is the one that's used.UPLO = 'U'or'u'β the upper triangular part of C is the one that's used.
TRANSAβCHARACTER*1. On entry,TRANSAsays what form ofop( A )we're using in the multiplication:TRANSA = 'N'or'n'βop( A ) = A.TRANSA = 'T'or't'βop( A ) = A**T.TRANSA = 'C'or'c'βop( A ) = A**H.
TRANSBβCHARACTER*1. On entry,TRANSBsays what form ofop( B )we're using in the multiplication:TRANSB = 'N'or'n'βop( B ) = B.TRANSB = 'T'or't'βop( B ) = B**T.TRANSB = 'C'or'c'βop( B ) = B**H.
NβINTEGER. On entry,Nspecifies the number of rows and columns of the matrix C, the number of columns ofop(B)and the number of rows ofop(A).Nmust be at least zero.KβINTEGER. On entry,Kspecifies the number of columns of the matrixop( A )and the number of rows of the matrixop( B ).Kmust be at least zero.ALPHAβCOMPLEX. On entry,ALPHAspecifies the scalar alpha.AβCOMPLEXarray, dimension( LDA, ka ), wherekaiskwhenTRANSA = 'N'or'n', and isnotherwise. Before entry withTRANSA = 'N'or'n', the leadingnbykpart of the array A must contain the matrix A, otherwise the leadingkbympart of the array A must contain the matrix A.LDAβINTEGER. On entry,LDAspecifies the first dimension of A as declared in the calling (sub) program. WhenTRANSA = 'N'or'n'thenLDAmust be at leastmax( 1, n ), otherwiseLDAmust be at leastmax( 1, k ).BβCOMPLEXarray, dimension( LDB, kb ), wherekbisnwhenTRANSB = 'N'or'n', and iskotherwise. Before entry withTRANSB = 'N'or'n', the leadingkbynpart of the array B must contain the matrix B, otherwise the leadingnbykpart of the array B must contain the matrix B.LDBβINTEGER. On entry,LDBspecifies the first dimension of B as declared in the calling (sub) program. WhenTRANSB = 'N'or'n'thenLDBmust be at leastmax( 1, k ), otherwiseLDBmust be at leastmax( 1, n ).BETAβCOMPLEX. On entry,BETAspecifies the scalar beta. WhenBETAis supplied as zero then C need not be set on input.
Not me pointing out the free lunch: BETA zero means you don't gotta set C beforehand. Iconic behaviour honestly π
CβCOMPLEXarray, dimension( LDC, N ). Before entry, the leadingnbynpart of the array C must contain the matrix C, except whenbetais zero, in which case C need not be set on entry. On exit, the upper or lower triangular part of the matrix C is overwritten by thenbynmatrix
( alpha*op( A )*op( B ) + beta*C ).
LDCβINTEGER. On entry,LDCspecifies the first dimension of C as declared in the calling (sub) program.LDCmust be at leastmax( 1, n ).
β¨ Author
Martin Koehler
π§ Further Details
Level 3 Blas routine.
-- Written on 19-July-2023.
Martin Koehler, MPI Magdeburg
π subroutine dgemmtr
The double precision one, aka the everyday baddie:
subroutine dgemmtr (character uplo, character transa, character transb,
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)
DGEMMTR π
π«Ά Purpose
DGEMMTR does 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 n by k matrix, op( B ) a k by n matrix and C an n by n matrix. Same deal as before: only the upper or lower triangular part of the result matrix C gets accessed and updated. You reach for this when the resulting C is known to be symmetric. No cap π«Ά
π Parameters
UPLOβCHARACTER*1. On entry,UPLOsays whether the lower or the upper triangular part of C is being accessed and updated.UPLO = 'L'or'l'β the lower triangular part of C is used.UPLO = 'U'or'u'β the upper triangular part of C is used.
TRANSAβCHARACTER*1. On entry,TRANSAspecifies the form ofop( A )used in the matrix multiplication:TRANSA = 'N'or'n'βop( A ) = A.TRANSA = 'T'or't'βop( A ) = A**T.TRANSA = 'C'or'c'βop( A ) = A**T.
TRANSBβCHARACTER*1. On entry,TRANSBspecifies the form ofop( B )used in the matrix multiplication:TRANSB = 'N'or'n'βop( B ) = B.TRANSB = 'T'or't'βop( B ) = B**T.TRANSB = 'C'or'c'βop( B ) = B**T.
NβINTEGER. On entry,Nspecifies the number of rows and columns of the matrix C, the number of columns ofop(B)and the number of rows ofop(A).Nmust be at least zero.KβINTEGER. On entry,Kspecifies the number of columns of the matrixop( A )and the number of rows of the matrixop( B ).Kmust be at least zero.ALPHAβDOUBLE PRECISION. On entry,ALPHAspecifies the scalar alpha.AβDOUBLE PRECISIONarray, dimension( LDA, ka ), wherekaiskwhenTRANSA = 'N'or'n', and isnotherwise. Before entry withTRANSA = 'N'or'n', the leadingnbykpart of the array A must contain the matrix A, otherwise the leadingkbympart of the array A must contain the matrix A.LDAβINTEGER. On entry,LDAspecifies the first dimension of A as declared in the calling (sub) program. WhenTRANSA = 'N'or'n'thenLDAmust be at leastmax( 1, n ), otherwiseLDAmust be at leastmax( 1, k ).BβDOUBLE PRECISIONarray, dimension( LDB, kb ), wherekbisnwhenTRANSB = 'N'or'n', and iskotherwise. Before entry withTRANSB = 'N'or'n', the leadingkbynpart of the array B must contain the matrix B, otherwise the leadingnbykpart of the array B must contain the matrix B.LDBβINTEGER. On entry,LDBspecifies the first dimension of B as declared in the calling (sub) program. WhenTRANSB = 'N'or'n'then...
LDB
LDB is INTEGER π
On entry, LDB is the first dimension of B, exactly as you declared it 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 ). check it, bestie, she does not play. π
BETA
BETA is DOUBLE PRECISION β¨
On entry, BETA is the scalar beta. And the lil glow-up moment: when BETA is supplied as zero then C need not be set on input. free pass, no cap. π
C
C is DOUBLE PRECISION array, dimension ( LDC, N ) π
Before entry, the leading n 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 upper or lower triangular part of the matrix C is overwritten by the n by n matrix
( alpha*op( A )*op( B ) + beta*C ).
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 ). that's the vibe check and you WILL pass it. β¨
Author
Martin Koehler
Further Details:
!>
!> Level 3 Blas routine.
!>
!> -- Written on 19-July-2023.
!> Martin Koehler, MPI Magdeburg
!>
okay now we get to the other family members and honestly they're giving twins energy, it's serving matching outfits π β same job, different scalar types. let's go.
subroutine sgemmtr (character uplo, character transa, character transb,
integer n, integer k, real alpha, real, dimension(lda,*) a, integer lda,
real, dimension(ldb,*) b, integer ldb, real beta, real, dimension(ldc,*)
c, integer ldc)
SGEMMTR
Purpose:
!>
!> SGEMMTR 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 n by k matrix, op( B ) a k by n matrix and C an n by n matrix.
!> Thereby, the routine only accesses and updates the upper or lower
!> triangular part of the result matrix C. This behaviour can be used if
!> the resulting matrix C is known to be symmetric.
!>
Parameters
UPLO
UPLO is CHARACTER*1 π¦
On entry, UPLO says whether it's the lower or the upper triangular part of C that gets accessed and updated. pick a lane:
UPLO = 'L'or'l'β the lower triangular part ofCis used. πUPLO = 'U'or'u'β the upper triangular part ofCis used. πΈ
TRANSA
TRANSA is CHARACTER*1 β¨
On entry, TRANSA picks the form of op( A ) for the multiply, like so:
TRANSA = 'N'or'n',op( A ) = A. πTRANSA = 'T'or't',op( A ) = A**T. π₯TRANSA = 'C'or'c',op( A ) = A**T. π«Ά
TRANSB
TRANSB is CHARACTER*1 β¨
On entry, TRANSB picks the form of op( B ) for the multiply, 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. π«Ά
N
N is INTEGER π
On entry, N specifies the number of rows and columns of the matrix C, the number of columns of op(B) and the number of rows of op(A). N must be at least zero. zero is allowed, negative is not, periodt. π
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. same rules, bestie. π
ALPHA
ALPHA is REAL. β
On entry, ALPHA is the scalar alpha. that's it, that's the whole thing. π
A
A is REAL array, dimension ( LDA, ka ), where ka is k when TRANSA = 'N' or 'n', and is n otherwise. π Before entry with TRANSA = 'N' or 'n', the leading n 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. (yes, m, bestie, that's literally what it says, we do not editorialise. π)
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, n ) β otherwise LDA must be at least max( 1, k ). π₯
B
B is REAL 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. π
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 ). β¨
BETA
BETA is REAL. β
On entry, BETA specifies the scalar beta. When BETA is supplied as zero then C need not be set on input. iconic shortcut, take it. π
C
C is REAL array, dimension ( LDC, N ) π
Before entry, the leading n 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 upper or lower triangular part of the matrix C is overwritten by the n by n matrix
( alpha*op( A )*op( B ) + beta*C ).
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 ). no notes. π
Author
Martin Koehler
Further Details:
!>
!> Level 3 Blas routine.
!>
!> -- Written on 19-July-2023.
!> Martin Koehler, MPI Magdeburg
!>
and now for the β¨deluxeβ¨ edition, the complex one, she's fancy and she knows it ππ
subroutine zgemmtr (character uplo, character transa, character transb,
integer n, integer k, complex*16 alpha, complex*16, dimension(lda,*) a,
integer lda, complex*16, dimension(ldb,*) b, integer ldb, complex*16
beta, complex*16, dimension(ldc,*) c, integer ldc)
ZGEMMTR
Purpose:
!>
!> ZGEMMTR 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 n by k matrix, op( B ) a k by n matrix and C an n by n matrix.
!> Thereby, the routine only accesses and updates the upper or lower
!> triangular part of the result matrix C. This behaviour can be used if
!> the resulting matrix C is known to be Hermitian or symmetric.
!>
Parameters
UPLO
UPLO is CHARACTER*1 π¦
On entry, UPLO specifies whether the lower or the upper triangular part of C is access and updated. pick your side, babes:
UPLO = 'L'or'l', the lower triangular part ofCis used. πUPLO = 'U'or'u', the upper triangular part ofCis used. πΈ
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. π (conjugate transpose, she's fancy like that)
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**H. π
N
N is INTEGER π
On entry, N specifies the number of rows and columns of the matrix C, the number of columns of op(B) and the number of rows of op(A). N must be at least zero. π
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. π
ALPHA
ALPHA is COMPLEX*16. β
On entry, ALPHA specifies the scalar alpha. π
A
A is COMPLEX*16 array, dimension ( LDA, ka ), where ka is k when TRANSA = 'N' or 'n', and is n otherwise. π Before entry with TRANSA = 'N' or 'n', the leading n 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. (yep, m again, we stay faithful bestie. π)
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, n ) β otherwise LDA must be at least max( 1, k ). π₯
B
- B is a
COMPLEX*16array, dimension( LDB, kb ), wherekbisnwhenTRANSB = 'N'or'n', and iskotherwise. π¦ Before entry withTRANSB = 'N'or'n', the leadingkbynpart of the arrayBmust contain the matrixB, otherwise the leadingnbykpart of the arrayBmust contain the matrixB. No cap, that's the whole vibe. LDBβLDBisINTEGER. On entry,LDBspecifies the first dimension ofBas declared in the calling (sub) program. WhenTRANSB = 'N'or'n'thenLDBmust be at leastmax( 1, k ), otherwiseLDBmust be at leastmax( 1, n ). Bestie, lowkey if you get this wrong the whole thing is giving chaos πBETAβBETAisCOMPLEX*16. On entry,BETAspecifies the scalarbeta. WhenBETAis supplied as zero thenCneed not be set on input. β¨ (yes, you read that right β free pass onC, we love a shortcut)CβCisCOMPLEX*16array, dimension( LDC, N ). Before entry, the leadingnbynpart of the arrayCmust contain the matrixC, except whenbetais zero, in which caseCneed not be set on entry. On exit, the upper or lower triangular part of the matrixCis overwritten by thenbynmatrix( alpha*op( A )*op( B ) + beta*C ). π₯ she ate and left no crumbs, honestly.LDCβLDCisINTEGER. On entry,LDCspecifies the first dimension ofCas declared in the calling (sub) program.LDCmust be at leastmax( 1, n ). π
π Author π
Martin Koehler π
πΈ Further Details πΈ
The page itself is very demure, very mindful about it:
Level 3 Blas routine.-- Written on 19-July-2023.Martin Koehler, MPI Magdeburg
The way it just drops the whole origin story at the end like an after-credits scene π
β¨ Author β¨
Yeah so this whole thing? Generated automatically by Doxygen for LAPACK from the source code. π€ Not a human typing out 400 lines at 2am β it's giving robot main character energy π
π And that's the entire page, bestie. This is gemmtr(3), LAPACK's finest, Version 3.12.0, stamped Mon Jul 6 2026 17:38:28. Go forth and multiply (matrices). Periodt. π
ππ«Ά
π¦ where this page comes from
- ubuntu stonking: liblapack-doc 3.12.1-8ubuntu1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms