BLAS/SRC/sgemm.f(3)
π BLAS/SRC/sgemm.f(3) β Library Functions Manual β¨
okay bestie, sit down, hydrate, and get ready, because this is the Level 3 BLAS moment of all time. we're in BLAS/SRC/sgemm.f(3) and it's giving main-character linear algebra fr fr π
πΈ NAME πΈ
BLAS/SRC/sgemm.f β no cap, that's the whole name. she's a Fortran file and she knows it π
β¨ SYNOPSIS β¨
π«Ά Functions/Subroutines
subroutine sgemm (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)β literally the function herself. the label under it just saysSGEMM, iconic behaviour honestly.
π Function/Subroutine Documentation π
subroutine sgemm (character transa, character transb, integer m, 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)
SGEMM π¦
π Purpose:
!>
!> SGEMM 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.
!>
so basically: she takes A and B, maybe transposes them (or maybe doesn't, her choice), multiplies them together, scales by alpha, adds beta*C on top, and drops the whole slay result into C. m by k times k by n equals m by n. math ate, no crumbs π
π Parameters π
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.
!>
TRANSA is CHARACTER*1 and she tells us what form of op( A ) we're using π« β 'N' or 'n' means op( A ) = A (no transposing, she's chill), 'T' or 't' means op( A ) = A**T, and 'C' or 'c' also means op( A ) = A**T. yes bestie, 'T' and 'C' do the same thing here β that's not a typo, that's canon π
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.
!>
same energy, but for B π β TRANSB is CHARACTER*1, and it picks the form of op( B ): 'N' or 'n' gives you op( B ) = B, while 'T' or 't' gives op( B ) = B**T, and 'C' or 'c' also gives op( B ) = B**T. twin behaviour, we love consistency π«Ά
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.
!>
M is an INTEGER and it's the row count for both op( A ) and C β and listen β M must be at least zero. negative rows don't exist, we don't do that here π
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.
!>
N is an INTEGER, the column count for op( B ) and for C πΈ and yup, N must be at least zero too. same rule, no exceptions π
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.
!>
K is an INTEGER β the shared dimension, aka the number of columns of op( A ) and the number of rows of op( B ) π₯ and yes, K must be at least zero as well. the trio all agree, we love a united front π§
ALPHA
!> ALPHA is REAL
!> On entry, ALPHA specifies the scalar alpha.
!>
ALPHA is REAL, and on entry she's just... the scalar alpha β¨ no notes, she's perfect.
A
!> A is REAL 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.
!>
A is a REAL array with dimension ( LDA, ka ) β and here's the tea β: ka is k when TRANSA = 'N' or 'n', and it's m otherwise. before entry, if TRANSA = 'N' or 'n', the leading m by k part of A must contain the matrix A; otherwise the leading k by m part of A must contain the matrix A. she adapts, she's flexible, she's that girl π¦
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 ).
!>
LDA is an INTEGER β the first dimension of A as declared in the calling (sub) program π« when TRANSA = 'N' or 'n', LDA must be at least max( 1, m ); otherwise LDA must be at least max( 1, k ). respect the leading dimension or perish, iykyk π
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.
!>
B is a REAL array with dimension ( LDB, kb ), and kb is n when TRANSB = 'N' or 'n', and k otherwise π before entry with TRANSB = 'N' or 'n', the leading k by n part of B must contain the matrix B; otherwise the leading n by k part of B must contain the matrix B. mirror mirror on the wall, she's the counterpart to A and she knows it π
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 ).
!>
LDB is an INTEGER, 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 ). yes the maxes are swapped compared to LDA, don't come for her, that's just how it is π
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.
!>
BETA is REAL and she's the scalar beta π
big glow-up detail: when BETA is supplied as zero, C need not be set on input. so you can roll up with a completely feral uninitialised C and she literally doesn't care. that's the vibe π§
C
!> C is REAL 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 ).
!>
C is a REAL array with dimension ( LDC, N ) π before entry, the leading m by n part of C must contain the matrix C β except when beta is zero, in which case C need not be set on entry (told you, she's forgiving π). on exit, C is overwritten by the m by n matrix ( alpha*op( A )*op( B ) + beta*C ). overwritten bestie!! she does not preserve your old C, she replaces it, that's the whole point π
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 ).
!>
LDC is an INTEGER, the first dimension of C as declared in the calling (sub) program β and LDC must be at least max( 1, m ). final leading-dimension rule of the page, we made it π
π¦ Author π¦
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
look at that group project. four institutions, one subroutine, zero drama (allegedly) π«Ά
π₯ 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.
!>
she's a Level 3 Blas routine π
and the receipts: written on 8-February-1989 by Jack Dongarra (Argonne National Laboratory), Iain Duff (AERE Harwell), Jeremy Du Croz (Numerical Algorithms Group Ltd.), and Sven Hammarling (Numerical Algorithms Group Ltd.). 1989!! she's vintage, she's timeless, she's still out here multiplying matrices. mother behaviour π
Definition at line 186 of file sgemm.f. π
β¨ Author β¨
Generated automatically by Doxygen for LAPACK from the source code. (yes the robots built the docs, we thank them for their service π)
and that's the page bestie π go forth, pass your leading dimensions correctly, and remember: LDA, LDB, LDC are not suggestions, they're a lifestyle π
LAPACK β Version 3.12.0 β BLAS/SRC/sgemm.f(3) β¨ππ¦
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms