Skip to content

matrix

High-performance dense linear-algebra kernels in C, built the "FLAME / GotoBLAS way".

This project is a hands-on, fully documented study of how a naive triple-loop matrix multiply or matrix–vector multiply is progressively turned into a cache-aware, vectorized micro-kernel. It contains a complete, runnable optimization ladder for both operations, plus the full mathematics behind every step.

Two kernel families

Kernel Operation Signature
matmul (matrix × matrix) C = A·B + C matmul(m, n, k, a, lda, b, ldb, c, ldc)
matvec (matrix × vector) y = A·x + y matvec(m, k, a, lda, x, y)

Both use column-major storage (Fortran / BLAS convention):

A(i, j) = a[j*lda + i]

What you can do here

  • Run all 30 optimization levels and watch the GFLOPS climb.
  • Read the mathematics behind every level in the research notes.
  • Follow the tutorials to build up the kernels yourself.
  • Contribute a new level, packing routine, example, or tutorial.

Jump straight in

The Quickstart gets you building and running in one minute. The Tutorials walk you through the ladder step by step.

Getting started in one command

make && make test

Then explore individual levels:

./build/matvec5     # matrix-vector, level 5
./build/matmat8     # matrix-matrix, level 8