blas
An interface to level 1, 2 and 3 BLAS linear algebra routines.
Documentation
Naming conventions for routines
Every routine in the BLAS library comes in four flavors, each prefixed by the letters S, D, C, and Z, respectively. Each letter indicates the format of input data:
- S stands for single-precision (32-bit IEEE floating point numbers),
- D stands for double-precision (64-bit IEEE floating point numbers),
- C stands for complex numbers (represented by pairs of 32-bit IEEE floating point numbers),
- Z stands for double complex numbers (represented by pairs of 64-bit IEEE floating point numbers)
In addition, each BLAS routine in this egg comes in three flavors:
- Safe, pure
Safe routines check the sizes of their input arguments. For example, if a routine is supplied arguments that indicate that an input matrix is of dimensions M-by-N, then the argument corresponding to that matrix is checked that it is of size M * N.
Pure routines do not alter their arguments in any way. A new matrix or vector is allocated for the return value of the routine.
- Safe, destructive (suffix: !)
Safe routines check the sizes of their input arguments. For example, if a routine is supplied arguments that indicate that an input matrix is of dimensions M-by-N, then the argument corresponding to that matrix is checked that it is of size M * N.
Destructive routines can modify some or all of their arguments. They are given names ending in exclamation mark. Please consult the BLAS documentation to determine which functions modify their input arguments.
- Unsafe, destructive (prefix: unsafe-, suffix: !)
Unsafe routines do not check the sizes of their input arguments. They invoke the corresponding BLAS routines directly. Unsafe routines do not have pure variants.
For example, function xGEMM (matrix-matrix multiplication) comes in the following variants:
| BLAS name | Safe, pure | Safe, destructive | Unsafe, destructive |
|---|---|---|---|
| SGEMM | sgemm | sgemm! | unsafe-sgemm! |
| DGEMM | dgemm | dgemm! | unsafe-dgemm! |
| CGEMM | cgemm | cgemm! | unsafe-cgemm! |
| ZGEMM | zgemm | zgemm! | unsafe-zgemm! |
Keyword Arguments
All optional arguments in BLAS procedures are specified using keyword arguments. This includes parameters such as vector increments (incx, incy), matrix leading dimensions (lda, ldb, ldc), and vector offsets (offx, offy).
Keyword arguments are specified using the #:keyword value syntax. For example:
;; Using keyword arguments (saxpy 5 2.0 x y #:incx 2 #:incy 1 #:offx 0 #:offy 3) ;; With defaults (equivalent to above) (saxpy 5 2.0 x y #:offy 3) ; incx=1, incy=1, offx=0 by default
Vector copy routines
scopy:: F32VECTOR -> F32VECTOR dcopy:: F64VECTOR -> F64VECTOR ccopy:: F32VECTOR -> F32VECTOR zcopy:: F64VECTOR -> F64VECTOR These procedures return a copy of given input SRFI-4 vector. The returned vector is allocated with the corresponding SRFI-4 constructor, and the input vector is copied to it by the corresponding BLAS copy procedure.
Vector copy routines with offset support
These procedures copy N elements from vector X to vector Y with support for offsets and increments. X is the source SRFI-4 vector. Y is the optional destination vector; if not provided, a new vector is allocated. OFFSETX and OFFSETY specify the starting positions in the source and destination vectors, respectively (default 0). INCX and INCY specify the increment between elements in the source and destination vectors, respectively (default 1).
The copy operation accesses elements at positions OFFSETX, OFFSETX + INCX, OFFSETX + 2*INCX, ..., OFFSETX + (N-1)INCX in the source vector, and stores them at positions OFFSETY, OFFSETY + INCY, OFFSETY + 2INCY, ..., OFFSETY + (N-1)*INCY in the destination vector.
For complex vectors (cicopy and zicopy), the offset values refer to complex element positions, not individual float positions.
Examples:
;; Copy 3 elements from x starting at position 1 to a new vector (sicopy 3 x #:offsetx 1) ;; Copy with different increments and offsets (dicopy 5 x y #:offsetx 2 #:offsety 1 #:incx 2 #:incy 1)
BLAS level 1 routines
Conventions
The BLAS level 1 procedures in this egg use keyword arguments for optional parameters such as vector increments (incx and incy) and offsets (offx and offy). The default value of incx and incy is 1, and the default value of offx and offy is 0.
In the procedure signatures below, these optional arguments are indicated by [ and ] (square brackets).
Apply plane rotation
srot:: N * X * Y * C * S #:key [INCX 1] [INCY 1] -> F32VECTOR * F32VECTOR drot:: N * X * Y * C * S #:key [INCX 1] [INCY 1] -> F64VECTOR * F64VECTOR xROT applies a plane rotation matrix to a sequence of ordered pairs: (x_i , y_i), for i = 1, 2, ..., n.
X and Y are vector of dimensions (N-1) * abs(incx) + 1 and (N-1) * abs(incy) + 1, respectively.
C and S are respectively the cosine and sine of the plane of rotation.
Scale vector
sscal:: N * ALPHA * X #:key [INCX 1] -> F32VECTOR dscal:: N * ALPHA * X #:key [INCX 1] -> F64VECTOR cscal:: N * ALPHA * X #:key [INCX 1] -> F32VECTOR zscal:: N * ALPHA * X #:key [INCX 1] -> F64VECTOR xSCAL scales a vector with a scalar: x := alpha * x.
Swap the elements of two vectors
sswap:: N * X * Y #:key [INCX 1] [INCY 1] -> F32VECTOR dswap:: N * X * Y #:key [INCX 1] [INCY 1] -> F64VECTOR cswap:: N * X * Y #:key [INCX 1] [INCY 1] -> F32VECTOR zswap:: N * X * Y #:key [INCX 1] [INCY 1] -> F64VECTOR xSWAP interchanges the elements of two vectors: x <-> y.
Real vector dot product
sdot:: N * X * Y #:key [INCX 1] [INCY 1] -> NUMBER ddot:: N * X * Y #:key [INCX 1] [INCY 1] -> NUMBER xDOT computes the dot product of two vectors of real values: dot := x'*y = \Sum_{i=1}^{n} (x_i * y_i).
Complex vector dot product
cdotu:: N * X * Y #:key [INCX 1] [INCY 1] -> NUMBER zdotu:: N * X * Y #:key [INCX 1] [INCY 1] -> NUMBER xDOTU computes the dot product of two vectors of complex values: dotu := x'*y = \Sum_{i=1}^{n} (x_i * y_i).
Hermitian vector dot product
cdotc:: N * X * Y #:key [INCX 1] [INCY 1] -> NUMBER zdotc:: N * X * Y #:key [INCX 1] [INCY 1] -> NUMBER xDOTC computes the dot product of the conjugates of two complex vectors: dotu := conjg(x')*y = \Sum_{i=1}^{n} (conjg(x_i) * y_i), for i = 1, 2, ..., n.
Vector multiply-add
saxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] -> F32VECTOR daxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] -> F64VECTOR caxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] -> F32VECTOR zaxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] -> F64VECTOR xAXPY adds a scalar multiple of a vector to another vector: y := alpha * x + y.
Vector multiply-add with optional offset
siaxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] [OFFX 0] [OFFY 0] -> F32VECTOR diaxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] [OFFX 0] [OFFY 0] -> F64VECTOR ciaxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] [OFFX 0] [OFFY 0] -> F32VECTOR ziaxpy:: N * ALPHA * X * Y #:key [INCX 1] [INCY 1] [OFFX 0] [OFFY 0] -> F64VECTOR xIAXPY adds a scalar multiple of a vector to another vector, where the beginning of each vector argument can be offset: y[yofs:n] := alpha * x[xofs:n] + y[yofs:n].
Euclidean norm of a vector
snrm2:: N * X #:key [INCX 1] -> NUMBER dnrm2:: N * X #:key [INCX 1] -> NUMBER cnrm2:: N * X #:key [INCX 1] -> NUMBER znrm2:: N * X #:key [INCX 1] -> NUMBER xNRM2 computes the Euclidean (L2) norm of a vector.
Sum of absolute values of the elements in a vector
sasum:: N * X #:key [INCX 1] -> NUMBER dasum:: N * X #:key [INCX 1] -> NUMBER casum:: N * X #:key [INCX 1] -> NUMBER zasum:: N * X #:key [INCX 1] -> NUMBER xASUM sums the absolute values of the elements in a vector.
Sum of absolute values of the elements in a vector
samax:: N * X #:key [INCX 1] -> INDEX damax:: N * X #:key [INCX 1] -> INDEX camax:: N * X #:key [INCX 1] -> INDEX zamax:: N * X #:key [INCX 1] -> INDEX xAMAX searches a vector for the first occurrence of its maximum absolute value, and returns the index of that element.
BLAS level 2 routines
Conventions
The BLAS level 2 procedures in this egg use keyword arguments for optional parameters such as the leading dimension argument (lda) and the vector increment arguments (incx and incy), as well as offset arguments (offx and offy). The default value of lda is the largest matrix dimension, depending on the semantics of the respective operation, and the default value of incx and incy is 1, while offx and offy default to 0.
In the procedure signatures below, these optional arguments are indicated by [ and ] (square brackets).
Argument ORDER is one of RowMajor or ColMajor to indicate that the input and output matrices are in row-major or column-major form, respectively.
Where present, argument TRANS can be one of NoTrans or Trans to indicate whether the input matrix is to be transposed or not.
Where present, argument UPLO can be one of Upper or Lower to indicate whether the upper or lower triangular part of an input symmetric matrix is to referenced,or to specify the type of an input triangular matrix.
Where present, argument DIAG can be one of NonUnit or Unit to indicate whether an input triangular matrix is unit triangular or not.
General matrix-vector multiply-add
sgemv:: ORDER * TRANS * M * N * ALPHA * A * X * BETA * Y #:key [LDA (if (= TRANS NoTrans) M N)] [INCX 1] [INCY 1] -> F32VECTOR dgemv:: ORDER * TRANS * M * N * ALPHA * A * X * BETA * Y #:key [LDA (if (= TRANS NoTrans) M N)] [INCX 1] [INCY 1] -> F64VECTOR cgemv:: ORDER * TRANS * M * N * ALPHA * A * X * BETA * Y #:key [LDA (if (= TRANS NoTrans) M N)] [INCX 1] [INCY 1] -> F32VECTOR zgemv:: ORDER * TRANS * M * N * ALPHA * A * X * BETA * Y #:key [LDA (if (= TRANS NoTrans) M N)] [INCX 1] [INCY 1] -> F64VECTOR xGEMV performs the matrix-vector multiply-add operation of the form y := alpha*op( A )*x + beta*y, where op( X ) is one of op( A ) = A or op( A ) = A'.
ALPHA and BETA are scalars, and A is an M x N matrix.
X is a vector of size (1 + ( N - 1 ) * abs(INCX)) when argument TRANS is NoTrans, and (1 + ( M - 1 ) * abs(INCX)) otherwise. Y is a vector of size (1 + ( M - 1 ) * abs(INCY)) when argument TRANS is NoTrans, and (1 + ( N - 1 ) * abs(INCY)) otherwise.
Banded matrix-vector multiply-add
xGBMV performs the matrix-vector multiply-add operation of the form y := alpha*op( A )*x + beta*y, where op( X ) is one of op( A ) = A or op( A ) = A'.
ALPHA and BETA are scalars, and A is an M x N banded matrix, with KL sub-diagonals and KU super-diagonals.
X is a vector of size (1 + ( N - 1 ) * abs(INCX)) when argument TRANS is NoTrans, and (1 + ( M - 1 ) * abs(INCX)) otherwise. Y is a vector of size (1 + ( M - 1 ) * abs(INCY)) when argument TRANS is NoTrans, and (1 + ( N - 1 ) * abs(INCY)) otherwise.
Hermitian matrix-vector multiply-add
chemv:: ORDER * UPLO * N * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F32VECTOR zhemv:: ORDER * UPLO * N * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F64VECTOR xHEMV performs the matrix-vector multiply-add operation of the form y := alpha*op( A )*x + beta*y, where op( X ) is one of op( A ) = A or op( A ) = A'.
ALPHA and BETA are scalars, and A is an N x N Hermitian matrix.
X and Y are N element vectors.
Hermitian banded matrix-vector multiply-add
chbmv:: ORDER * UPLO * N * K * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F32VECTOR zhbmv:: ORDER * UPLO * N * K * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F64VECTOR xHBMV performs the matrix-vector multiply-add operation of the form y := alpha*op( A )*x + beta*y, where op( X ) is one of op( A ) = A or op( A ) = A'.
ALPHA and BETA are scalars, and A is an N x N Hermitian banded matrix, with K super-diagonals.
X and Y are N element vectors.
Symmetric matrix-vector multiply-add
ssymv:: ORDER * UPLO * N * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F32VECTOR dsymv:: ORDER * UPLO * N * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F64VECTOR xSYMV performs matrix-vector multiply-add operation of the form y := alpha*A*x + beta*y.
ALPHA and BETA are scalars, and A is an N x N symmetric matrix.
X and Y are N element vectors.
Banded symmetric matrix-vector multiply-add
ssbmv:: ORDER * UPLO * N * K * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F32VECTOR dsbmv:: ORDER * UPLO * N * K * ALPHA * A * X * BETA * Y [LDA * INCX * INCY] -> F64VECTOR xSBMV performs matrix-vector multiply-add operation of the form y := alpha*A*B + beta*y.
ALPHA and BETA are scalars, and A is an N x N symmetric banded matrix, with K super-diagonals.
X and Y are N element vectors.
Triangular matrix-vector multiply-add
strmv:: ORDER * UPLO * TRANS * DIAG * N * A * X [LDA * INCX] -> F32VECTOR dtrmv:: ORDER * UPLO * TRANS * DIAG * N * A * X [LDA * INCX] -> F64VECTOR ctrmv:: ORDER * UPLO * TRANS * DIAG * N * A * X [LDA * INCX] -> F32VECTOR ztrmv:: ORDER * UPLO * TRANS * DIAG * N * A * X [LDA * INCX] -> F64VECTOR xTRMV performs matrix-vector multiply-add operation of the form y := alpha*op( A )*x, where op ( A ) = A or op ( A ) = A'
ALPHA and BETA are scalars, and A is an N x N upper or lower triangular matrix.
X is a vector of length (1 + (n - 1) * abs(INCX)).
Banded triangular matrix-vector multiply-add
stbmv:: ORDER * UPLO * TRANS * DIAG * N * K * A * X [LDA * INCX] -> F32VECTOR dtbmv:: ORDER * UPLO * TRANS * DIAG * N * K * A * X [LDA * INCX] -> F64VECTOR ctbmv:: ORDER * UPLO * TRANS * DIAG * N * K * A * X [LDA * INCX] -> F32VECTOR ztbmv:: ORDER * UPLO * TRANS * DIAG * N * K * A * X [LDA * INCX] -> F64VECTOR xTBMV performs matrix-vector multiply-add operation of the form y := alpha*A*B + beta*y, where op ( A ) = A or op ( A ) = A'
ALPHA and BETA are scalars, and A is an N x N upper or lower triangular banded matrix, with K+1 diagonals.
X is a vector of length (1 + (n - 1) * abs(INCX)).
Triangular matrix equation solve
strsv:: ORDER * UPLO * TRANS * DIAG * N * ALPHA * A * B * [LDA * INCB] -> F32VECTOR dtrsv:: ORDER * UPLO * TRANS * DIAG * N * A * B * [LDA * INCB] -> F64VECTOR ctrsv:: ORDER * UPLO * TRANS * DIAG * N * A * B * [LDA * INCB] -> F32VECTOR ztrsv:: ORDER * UPLO * TRANS * DIAG * N * A * B * [LDA * INCB] -> F64VECTOR xTRSV solves one of the systems of equations A*x = b or A'*x = b.
ALPHA and BETA are scalars, A is a upper or lower triangular matrix, and B is a N element vector.
Banded triangular matrix equation solve
stbsv:: ORDER * UPLO * TRANS * DIAG * N * K * A * B * [LDA * INCB] -> F32VECTOR dtbsv:: ORDER * UPLO * TRANS * DIAG * N * K * A * B * [LDA * INCB] -> F64VECTOR ctbsv:: ORDER * UPLO * TRANS * DIAG * N * K * A * B * [LDA * INCB] -> F32VECTOR ztbsv:: ORDER * UPLO * TRANS * DIAG * N * K * A * B * [LDA * INCB] -> F64VECTOR xTBSV solves one of the systems of equations A*x = b or A'*x = b.
ALPHA and BETA are scalars, A is a upper or lower banded triangular matrix with K+1 diagonals, and B is a N element vector.
Rank 1 operation
sger:: ORDER * M * N * ALPHA * X * Y * A #:key [LDA M] [INCX 1] [INCY 1] -> F32VECTOR dger:: ORDER * M * N * ALPHA * X * Y * A #:key [LDA M] [INCX 1] [INCY 1] -> F64VECTOR xGER performs the rank 1 operation A := alpha*x*y' + A.
ALPHA is a scalar, X is an M element vector, Y is an N element vector, and A is an M x N matrix.
Rank 1 operation with optional offset
siger:: ORDER * M * N * ALPHA * X * Y * A #:key [LDA M] [INCX 1] [INCY 1] [OFFX 0] [OFFY 0] -> F32VECTOR diger:: ORDER * M * N * ALPHA * X * Y * A #:key [LDA M] [INCX 1] [INCY 1] [OFFX 0] [OFFY 0] -> F64VECTOR xIGER performs the rank 1 operation A := alpha*x[xofs:M]*y'[yofs:N] + A.
ALPHA is a scalar, X is an M element vector, Y is an N element vector, and A is an M x N matrix.
Rank 1 operation on complex matrices and vectors
cgeru:: ORDER * M * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F32VECTOR zgeru:: ORDER * M * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F64VECTOR xGERU performs the rank 1 operation A := alpha*x*y' + A.
ALPHA is a scalar, X is an M element vector, Y is an N element vector, and A is an M x N matrix.
Rank 1 operation on complex matrices and vectors
cgerc:: ORDER * M * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F32VECTOR zgerc:: ORDER * M * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F64VECTOR xGERC performs the rank 1 operation A := alpha*x*conjg(y') + A.
ALPHA is a scalar, X is an M element vector, Y is an N element vector, and A is an M x N matrix.
Hermitian rank 1 operation
cher:: ORDER * UPLO * N * ALPHA * X * A [LDA * INCX] -> F32VECTOR zher:: ORDER * UPLO * N * ALPHA * X * A [LDA * INCX] -> F64VECTOR xHER performs the Hermitian rank 1 operation A := alpha*x*conjg(x') + A.
ALPHA is a scalar, X is an N element vector, and A is an N x N Hermitian matrix.
Hermitian rank 2 operation
cher2:: ORDER * UPLO * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F32VECTOR zher2:: ORDER * UPLO * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F64VECTOR xHER2 performs the Hermitian rank 2 operation A := alpha*x*conjg(y') + conjg(alpha)*y*conjg(x') + A.
ALPHA is a scalar, X and Y are N element vectors, and A is an N x N Hermitian matrix.
Symmetric rank 1 operation
ssyr:: ORDER * UPLO * N * ALPHA * X * A [LDA * INCX] -> F32VECTOR dsyr:: ORDER * UPLO * N * ALPHA * X * A [LDA * INCX] -> F64VECTOR xSYR performs the symmetric rank 1 operation A := alpha*x*x' + A.
ALPHA is a scalar, X is an N element vector, and A is an N x N symmetric matrix.
Symmetric rank 2 operation
ssyr2:: ORDER * UPLO * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F32VECTOR dsyr2:: ORDER * UPLO * N * ALPHA * X * Y * A [LDA * INCX * INCY] -> F64VECTOR xSYR2 performs the symmetric rank 2 operation A := alpha*x*y' + alpha*y*x' + A.
ALPHA is a scalar, X and Y are N element vectors, and A is an N x N symmetric matrix.
BLAS level 3 routines
Conventions
The BLAS level 3 procedures in this egg use keyword arguments for optional parameters such as the leading dimension arguments (lda, ldb, and ldc). The default values are set to the largest matrix dimension, depending on the semantics of the respective operation.
Argument ORDER is one of RowMajor or ColMajor to indicate that the input and output matrices are in row-major or column-major form, respectively.
Where present, arguments TRANS, TRANSA, TRANSB can be one of NoTrans or Trans to indicate whether the respective input matrices are to be transposed or not.
Where present, argument SIDE can be one of Left or Right to indicate whether an input symmetric matrix appears on the left or right in the respective operation.
Where present, argument UPLO can be one of Upper or Lower to indicate whether the upper or lower triangular part of an input symmetric matrix is to referenced,or to specify the type of an input triangular matrix.
Where present, argument DIAG can be one of NonUnit or Unit to indicate whether an input triangular matrix is unit triangular or not.
General matrix multiply-add
sgemm:: ORDER * TRANSA * TRANSB * M * N * K * ALPHA * A * B * BETA * C #:key [LDA (if (= TRANSA NoTrans) M K)] [LDB (if (= TRANSB NoTrans) K N)] [LDC N] -> F32VECTOR dgemm:: ORDER * TRANSA * TRANSB * M * N * K * ALPHA * A * B * BETA * C #:key [LDA (if (= TRANSA NoTrans) M K)] [LDB (if (= TRANSB NoTrans) K N)] [LDC N] -> F64VECTOR cgemm:: ORDER * TRANSA * TRANSB * M * N * K * ALPHA * A * B * BETA * C #:key [LDA (if (= TRANSA NoTrans) M K)] [LDB (if (= TRANSB NoTrans) K N)] [LDC N] -> F32VECTOR zgemm:: ORDER * TRANSA * TRANSB * M * N * K * ALPHA * A * B * BETA * C #:key [LDA (if (= TRANSA NoTrans) M K)] [LDB (if (= TRANSB NoTrans) K N)] [LDC N] -> F64VECTOR xGEMM performs matrix-matrix multiply-add operation of the form C := alpha*op( A )*op( B ) + beta*C, where op( X ) is one of op( X ) = X or op( X ) = X'.
ALPHA and BETA are scalars, and A, B and C are matrices, with op( A ) an M x K matrix, op( B ) a K x N matrix and C an M x N matrix.
Symmetric matrix multiply-add
ssymm:: ORDER * SIDE * UPLO * M * N * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F32VECTOR dsymm:: ORDER * SIDE * UPLO * M * N * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F64VECTOR csymm:: ORDER * SIDE * UPLO * M * N * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F32VECTOR zsymm:: ORDER * SIDE * UPLO * M * N * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F64VECTOR xSYMM performs matrix-matrix multiply-add operation of the form C := alpha*A*B + beta*C or C := alpha*B*A + beta*C.
ALPHA and BETA are scalars, A is a symmetric matrix, and B and C are M x N matrices.
Symmetric rank k operation
ssyrk:: ORDER * UPLO * TRANS * N * K * ALPHA * A * BETA * C [LDA * LDB * LDC] -> F32VECTOR dsyrk:: ORDER * UPLO * TRANS * N * K * ALPHA * A * BETA * C [LDA * LDB * LDC] -> F64VECTOR csyrk:: ORDER * UPLO * TRANS * N * K * ALPHA * A * BETA * C [LDA * LDB * LDC] -> F64VECTOR zsyrk:: ORDER * UPLO * TRANS * N * K * ALPHA * A * BETA * C [LDA * LDB * LDC] -> F64VECTOR xSYRK performs one of the symmetric rank k operations
{{C := alpha*A*A' + beta*C}} or {{C := alpha*A'*A + beta*C}}. ALPHA and BETA are scalars, A is an N x K or K x N matrix, and C is an N x N symmetric matrix.
Hermitian rank k operation
cherk:: ORDER * UPLO * TRANS * N * K * ALPHA * A * BETA * C [LDA * LDB * LDC] -> F32VECTOR zherk:: ORDER * UPLO * TRANS * N * K * ALPHA * A * BETA * C [LDA * LDB * LDC] -> F64VECTOR xHERK performs one of the hermitian rank k operations C := alpha*A*conjg(A') + beta*C or C := alpha*conjg(A')*A + beta*C.
ALPHA and BETA are scalars, A is an N x K or K x N matrix, and C is an N x N hermitian matrix.
Symmetric rank 2k operation
ssyr2k:: ORDER * UPLO * TRANS * N * K * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F32VECTOR dsyr2k:: ORDER * UPLO * TRANS * N * K * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F64VECTOR csyr2k:: ORDER * UPLO * TRANS * N * K * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F64VECTOR zsyr2k:: ORDER * UPLO * TRANS * N * K * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F64VECTOR xSYR2K performs one of the symmetric rank 2k operations C := alpha*A*B' + beta*C or C := alpha*B'*A + beta*C.
ALPHA and BETA are scalars, A and B are N x K or K x N matrices, and C is an N x N symmetric matrix.
Hermitian rank 2k operation
cher2k:: ORDER * UPLO * TRANS * N * K * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F32VECTOR zher2k:: ORDER * UPLO * TRANS * N * K * ALPHA * A * B * BETA * C [LDA * LDB * LDC] -> F64VECTOR xHER2K performs one of the hermitian rank 2k operations C := alpha*A*conjg(B') + beta*C or C := alpha*conjg(B')*A + beta*C.
ALPHA and BETA are scalars, A and B are N x K or K x N matrices, and C is an N x N hermitian matrix.
Triangular matrix multiply
strmm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B [LDA * LDB] -> F32VECTOR dtrmm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B [LDA * LDB] -> F64VECTOR ctrmm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B [LDA * LDB] -> F32VECTOR ztrmm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B [LDA * LDB] -> F64VECTOR xTRMM performs matrix-matrix multiply operation of the form B := alpha*op( A )*B or B := alpha*B*op( A ).
ALPHA is a scalar, A is an upper or lower triangular matrix, and B is an M x N matrix.
Triangular matrix equation solve
strsm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B * [LDA * LDB * LDC] -> F32VECTOR dtrsm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B * [LDA * LDB * LDC] -> F64VECTOR ctrsm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B * [LDA * LDB * LDC] -> F32VECTOR ztrsm:: ORDER * SIDE * UPLO * TRANSA * DIAG * M * N * ALPHA * A * B * [LDA * LDB * LDC] -> F64VECTOR xTRSM solves one of the matrix equations
{{op( A )*X = alpha*B}} or {{X*op( A ) = alpha*B}}. op( A ) is one of op( A ) = A or op( A ) = A'.
ALPHA and BETA are scalars, A is a upper or lower triangular matrix, and B is a M x N matrix.
Examples
(import srfi-4 blas) (define order ColMajor) (define transa NoTrans) (define m 4) (define n 4) (define alpha 1) (define beta 0) (define a ; column-major order! (f64vector 1 2 3 4 1 1 1 1 3 4 5 6 5 6 7 8) ) (define x (f64vector 1 2 1 1)) (define y (f64vector 0 0 0 0)) (dgemv! order transa m n alpha a x beta y #:lda 4 #:incx 1 #:incy 1) (print y) (define x2 (f64vector 0 1 2 1 1 0)) (define y2 (f64vector 0 0 0 0 0 0)) ;; Perform operation on subset of vectors (siaxpy 3 2.0 x2 y2 #:offx 1 #:offy 2 #:incx 1 #:incy 1) (print y2) ; -> #f64(0.0 0.0 2.0 4.0 2.0 0.0)
About this egg
Author
Felix Winkelmann and Ivan Raikov
Repository
This egg is hosted on the CHICKEN Subversion repository:
https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/blas
If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.
Version history
- 5.2
- Ported to CHICKEN 6
- 5.0
- Updated to use keyword arguments for optional parameters; added offset support for level 1 routines
- 4.1
- Fixed use of memq [thanks to Moritz Heidkamp]
- 4.0
- Using bind instead of easyffi
- 3.1
- Updated test script to return proper exit code
- 3.0
- Eliminated reduntant blas: prefix from names of exported symbols
- 2.8
- Eliminated use of noop
- 2.7
- Switched to wiki documentation
- 2.6
- Ported to Chicken 4
- 2.5
- Build script updated for better cross-platform compatibility
- 2.4
- Added iger procedures; fixed a bug in the default arguments of level 2 routines
- 2.3
- Added iaxpy procedures; fixed a bug in the default arguments of level 1 routines
- 2.2
- Fixed a bug in the renaming of C routines
- 2.1
- Added eggdoc property to meta file
- 2.0
- An overhaul of the library to introduce safe, unsafe, and pure variants of each routine
- 1.8
- Added icopy procedures [by Ivan Raikov]
- 1.7
- Support for Mac OS X added [by Will Farr]
- 1.6
- Fixed bug in blas library test code
- 1.5
- Added support for CLAPACK [by Ivan Raikov]
- 1.4
- Added support for atlas CBLAS library [by Stu Glaser]
- 1.3
- Tries to find a proper CBLAS library (currently only GSL)
- 1.2
- Adapted to new FFI macro-names
- 1.1
- Adapted to new setup scheme
License
Copyright (c) 2003-2006, Felix L. Winkelmann Copyright (c) 2007-2025 Ivan Raikov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.