Skip to content

Reading BLAS names

BLAS (Basic Linear Algebra Subprograms) routine names look cryptic — gemv, ger, syr2, gemm — but they are systematic: each name is a compressed description of what the routine does. Once you can read the pieces, the names are self-documenting and easy to remember. This page is the key.

BLAS is organized into levels by how much arithmetic a routine does relative to the data it touches — which is exactly what decides whether it is memory-bound or compute-bound, and how it tiles:

levelshapework / dataexamples
Level 1vector–vectorO(n)O(n) / O(n)O(n)axpy, dot, nrm2, scal
Level 2matrix–vectorO(n2)O(n^2) / O(n2)O(n^2)gemv, ger, symv, syr
Level 3matrix–matrixO(n3)O(n^3) / O(n2)O(n^2)gemm

Level 3 is the prize: O(n3)O(n^3) work on only O(n2)O(n^2) data means each element is reused O(n)O(n) times, so it tiles with high arithmetic intensity — the reason gemm dominates DL compute.

A Level-2/3 name is three fields glued together: [type][structure][operation].

Field 1 — data type (dropped throughout this catalog, where everything is real):

sdcz
singledoublecomplexdouble complex

Field 2 — matrix structure — which part of the matrix actually carries data:

gesyhetrgb / sb / tb
generalsymmetricHermitiantriangularbanded

Field 3 — operation:

mvmmrr2sv
matrix–vector productmatrix–matrix productrank-1 updaterank-2 updatetriangular solve

Read left to right and the name expands itself:

  • gemv = ge + mv = GEneral Matrix–Vector product
  • ger = ge + r = GEneral Rank-1 update
  • syr2 = sy + r2 = SYmmetric Rank-2 update
  • gemm = ge + mm = GEneral Matrix–Matrix product

Level 1 — the names predate the field scheme, so they are mnemonics rather than [type][structure][op]:

namereads asoperation
axpya·x plus yy:=αx+yy := \alpha x + y
dotdot products:=xTys := x^{\mathsf T} y
nrm2norm, 2-norms:=x2s := \lVert x\rVert_2
asumabsolute sums:=ixis := \sum_i \lvert x_i\rvert
scalscalex:=αxx := \alpha x
swapswapxyx \leftrightarrow y
copycopyy:=xy := x
rot(Givens) rotationapply a plane rotation to (x,y)(x,y)
iamaxindex of abs maxargmaxixi\arg\max_i \lvert x_i\rvert

Level 2[structure][operation]:

nameexpands tooperation
gemvgeneral matrix–vectory:=αAx+βyy := \alpha A x + \beta y
gergeneral rank-1A:=A+αxyTA := A + \alpha x y^{\mathsf T}
trmvtriangular matrix–vectorx:=Txx := T x
symvsymmetric matrix–vectory:=αAx+βyy := \alpha A x + \beta y, A=ATA = A^{\mathsf T}
syrsymmetric rank-1A:=A+αxxTA := A + \alpha x x^{\mathsf T}
syr2symmetric rank-2A:=A+α(xyT+yxT)A := A + \alpha(x y^{\mathsf T} + y x^{\mathsf T})

Level 3:

nameexpands tooperation
gemmgeneral matrix–matrixC:=αAB+βCC := \alpha A B + \beta C

In the domain-flow view the name’s fields often predict the recurrence shape:

  • the operation field tells you the index-space geometry — mv is a reduction (a matvec contracts an axis), r/r2 are fully-parallel outer products (a rank update has no reduction), and mm is the full 3-D reduction cube;
  • the structure field tells you the matrix is referenced only in a triangular half — sy/he exploit symmetry to read half the elements, tr is triangular. For the rank updates syr/syr2 this restricts the writes too, so their domain of computation is a triangular prism rather than a box; the matrix–vector cases symv/trmv still produce a full vector, they just read half the matrix.

So gemv and ger being adjacent in the catalog is not a coincidence: they are the inner-product and outer-product halves of the same matrix–vector interaction, and their SUREs are almost mirror images (a reduction vs. a broadcast-only map).