Next: Linear Algebra, Previous: Sorting, Up: Top
The Basic Linear Algebra Subprograms (blas) define a set of fundamental operations on vectors and matrices which can be used to create optimized higher-level linear algebra functionality.
The library provides a low-level layer which corresponds directly to the
C-language blas standard, referred to here as “cblas”, and a
higher-level interface for operations on GSL vectors and matrices.
Users who are interested in simple operations on GSL vector and matrix
objects should use the high-level layer, which is declared in the file
gsl_blas.h
. This should satisfy the needs of most users. Note
that GSL matrices are implemented using dense-storage so the interface
only includes the corresponding dense-storage blas functions. The full
blas functionality for band-format and packed-format matrices is
available through the low-level cblas interface.
The interface for the gsl_cblas
layer is specified in the file
gsl_cblas.h
. This interface corresponds to the blas Technical
Forum's draft standard for the C interface to legacy blas
implementations. Users who have access to other conforming cblas
implementations can use these in place of the version provided by the
library. Note that users who have only a Fortran blas library can
use a cblas conformant wrapper to convert it into a cblas
library. A reference cblas wrapper for legacy Fortran
implementations exists as part of the draft cblas standard and can
be obtained from Netlib. The complete set of cblas functions is
listed in an appendix (see GSL CBLAS Library).
There are three levels of blas operations,
Each routine has a name which specifies the operation, the type of matrices involved and their precisions. Some of the most common operations and their names are given below,
The types of matrices are,
Each operation is defined for four precisions,
Thus, for example, the name sgemm stands for “single-precision general matrix-matrix multiply” and zgemm stands for “double-precision complex matrix-matrix multiply”.