Mitch Richling: Example BLAS/LAPACK Programs
| Author: | Mitch Richling |
| Updated: | 2025-10-06 |
Table of Contents
1. Introduction
You will find several simple examples of programs to get you started with the BLAS and LAPACK APIs commonly used for scientific programming tasks.
Get it all on github: https://github.com/richmit/ex-blas-lapack/
| Library | Arithmetic | C |
C++ |
FORTRAN 77 |
Modern Fortran |
|---|---|---|---|---|---|
BLAS |
Level 1 functions | blas1.c |
- | blas1.f |
blas1.f90 |
BLAS |
Level 2 functions | blas2.c |
- | blas2.f |
blas2.f90 |
CBLAS |
Level 2 functions | blas2b.c |
- | - | - |
BLAS |
Level 3 functions | blas3.c |
- | blas3.f |
blas3.f90 |
| Library | Linear Equations | C |
C++ |
FORTRAN 77 |
Modern Fortran |
LAPACK |
General Real | slvSys.c |
- | slvSys.f |
slvSys.f90 |
LAPACK |
Triangular Real | - | triSlv.f |
triSlv.f90 |
|
| Library | Eigenvalues | C |
C++ |
FORTRAN 77 |
Modern Fortran |
LAPACK |
Symetric Real | - | - | symEig.f |
symEig.f90 |
LAPACK |
General Real | - | - | - | genEig.f90 |
LAPACK |
General Complex | slvPly.c |
slvPly.cpp |
- | - |
2. BLAIO
3. FAQ
3.1. What software do I need?
You will need a compiler for each language you are interested in trying out. The build files are setup for the GNU compiler collection (gcc and gfortran).
You will also need to have the BLAS, CBLAS, LAPACK, & LAPACKE libraries installed. On a Debian based linux distribution you can do that with
something like this:
sudo apt-get install liblapack-dev liblapacke-dev libblas-dev
On Windows under MSYS2 using the mingw64 environment, you can do something similar:
pacman -S mingw-w64-x86_64-lapack mingw-w64-x86_64-openblas
Note there is nothing special about the mingw64 environment in MSYS2 – other environments should work too.
3.2. How do I build the examples?
If you are on a typical linux system, you can probably change into the root directory of the repository and give the following a try:
make all
If that doesn't work, then you probably need to edit the file "make.mk" found in the root of the repository. In particular, set the variables
for your development environment.
If you are just interested in one of the languages, then you can change into the appropriate directory and run make in the same way to build just the examples in that sub-directory.