BLAS

Apple’s implementation of the Basic Linear Algebra Subprograms (BLAS).

Overview

The vecLib framework contains nine C header files (not counting `vecLib.h` which merely includes the others).

This document describes the functions declared in the header files `cblas.h` and `vblas.h`, which contain the interfaces for Apple’s implementation of the Basic Linear Algebra Subprograms (BLAS) API.

Topics

General Functions

`SetBLASParamErrorProc`

Sets an error handler function.

`cblas_errprn`

Prints an error message.

`cblas_xerbla`

The default error handler for BLAS routines.

`cblas_icamax`

Returns the index of the element with the largest absolute value in a vector (single-precision complex).

`cblas_idamax`

Returns the index of the element with the largest absolute value in a vector (double-precision).

`cblas_isamax`

Returns the index of the element with the largest absolute value in a vector (single-precision).

`cblas_izamax`

Returns the index of the element with the largest absolute value in a vector (double-precision complex).

`vS256Divide`

Signed 256-bit division.

`vU512Divide`

Unsigned 512-bit division.

CATLAS and CBLAS Vector Functions

`catlas_caxpby`

Computes the product of two vectors, scaling each one separately (single-precision complex).

`catlas_cset`

Modifies a vector (single-precision complex) in place, setting each element to a given value.

`catlas_daxpby`

Computes the sum of two vectors, scaling each one separately (double-precision).

`catlas_dset`

Modifies a vector (double-precision) in place, setting each element to a given value.

`catlas_saxpby`

Computes the sum of two vectors, scaling each one separately (single-precision).

`catlas_sset`

Modifies a vector (single-precision) in place, setting each element to a given value.

`catlas_zaxpby`

Computes the sum of two vectors, scaling each one separately (double-precision complex).

`catlas_zset`

Modifies a vector (double-precision complex) in place, setting each element to a given value.

`cblas_sdot`

Computes the dot product of two vectors (single-precision).

`cblas_sdsdot`

Computes the dot product of two single-precision vectors plus an initial single-precision value.

`cblas_cdotc_sub`

Calculates the dot product of the complex conjugate of a single-precision complex vector with a second single-precision complex vector.

`cblas_cdotu_sub`

Computes the dot product of two single-precision complex vectors.

`cblas_ddot`

Computes the dot product of two vectors (double-precision).

`cblas_dsdot`

Computes the double-precision dot product of a pair of single-precision vectors.

`cblas_zdotc_sub`

Calculates the dot product of the complex conjugate of a double-precision complex vector with a second double-precision complex vector.

`cblas_zdotu_sub`

Computes the dot product of two double-precision complex vectors.

Sparse Computation

Matrix and Vector Operations

Perform computations with matrices and vectors.

Pointwise Matrix Operations

Create, insert values into, and extract values from a pointwise sparse matrix.

Blockwise Matrix Operations

Create, insert values into, and extract values from a blockwise sparse matrix.

General Sparse Matrix Management Operations

Operations to manage and work with sparse matrix properties.

Sparse Utility Operations

Various utility operations for creating and working with sparse structures.

Single-Precision Float Matrix Functions

`cblas_sasum`

Computes the sum of the absolute values of elements in a vector (single-precision).

`cblas_saxpy`

Computes a constant times a vector plus a vector (single-precision).

`cblas_scopy`

Copies a vector to another vector (single-precision).

`cblas_sgbmv`

Scales a general band matrix, then multiplies by a vector, then adds a vector (single precision).

`cblas_sgemm`

Multiplies two matrices (single-precision).

`cblas_sgemv`

Multiplies a matrix by a vector (single precision).

`cblas_sger`

Multiplies vector X by the transpose of vector Y, then adds matrix A (single precison).

`cblas_snrm2`

Computes the L2 norm (Euclidian length) of a vector (single precision).

`cblas_srot`

Applies a Givens rotation matrix to a pair of vectors.

`cblas_srotg`

Constructs a Givens rotation matrix.

`cblas_srotm`

Applies a modified Givens transformation (single precision).

`cblas_srotmg`

Generates a modified Givens rotation matrix.

`cblas_ssbmv`

Scales a symmetric band matrix, then multiplies by a vector, then adds a vector (single-precision).

`cblas_sscal`

Multiplies each element of a vector by a constant (single-precision).

`cblas_sspmv`

Scales a packed symmetric matrix, then multiplies by a vector, then scales and adds another vector (single precision).

`cblas_sspr`

Rank one update: adds a packed symmetric matrix to the product of a scaling factor, a vector, and its transpose (single precision).

`cblas_sspr2`

Rank two update of a packed symmetric matrix using two vectors (single precision).

`cblas_sswap`

Exchanges the elements of two vectors (single precision).

`cblas_ssymm`

Multiplies a matrix by a symmetric matrix (single-precision).

`cblas_ssymv`

Scales a symmetric matrix, multiplies by a vector, then scales and adds another vector (single precision).

`cblas_ssyr`

Rank one update: adds a symmetric matrix to the product of a scaling factor, a vector, and its transpose (single precision).

`cblas_ssyr2`

Rank two update of a symmetric matrix using two vectors (single precision).

`cblas_ssyr2k`

Performs a rank-2k update of a symmetric matrix (single precision).

`cblas_ssyrk`

Rank-k update—multiplies a symmetric matrix by its transpose and adds a second matrix (single precision).

`cblas_stbmv`

Scales a triangular band matrix, then multiplies by a vector (single precision).

`cblas_stbsv`

Solves a triangular banded system of equations.

`cblas_stpmv`

Multiplies a triangular matrix by a vector, then adds a vector (single precision).

`cblas_stpsv`

Solves a packed triangular system of equations.

`cblas_strmm`

Scales a triangular matrix and multiplies it by a matrix.

`cblas_strmv`

Multiplies a triangular matrix by a vector.

`cblas_strsm`

Solves a triangular system of equations with multiple values for the right side.

`cblas_strsv`

Solves a triangular system of equations with a single value for the right side.

Single-Precision Complex Matrix Functions

`cblas_caxpy`

Computes a constant times a vector plus a vector (single-precision complex).

`cblas_ccopy`

Copies a vector to another vector (single-precision complex).

`cblas_cgbmv`

Scales a general band matrix, then multiplies by a vector, then adds a vector (single-precision complex).

`cblas_cgemm`

Multiplies two matrices (single-precision complex).

`cblas_cgemv`

Multiplies a matrix by a vector (single-precision complex).

`cblas_cgerc`

Multiplies vector X by the conjugate transpose of vector Y, then adds matrix A (single-precision complex).

`cblas_cgeru`

Multiplies vector X by the transpose of vector Y, then adds matrix A (single-precision complex).

`cblas_chbmv`

Scales a Hermitian band matrix, then multiplies by a vector, then adds a vector (single-precision complex).

`cblas_chemm`

Multiplies two Hermitian matrices (single-precision complex), then adds a third (with scaling).

`cblas_chemv`

Scales and multiplies a Hermitian matrix by a vector, then adds a second (scaled) vector.

`cblas_cher`

Hermitian rank 1 update: adds the product of a scaling factor, vector `X`, and the conjugate transpose of `X` to matrix `A`.

`cblas_cher2`

Hermitian rank 2 update: adds the product of a scaling factor, vector `X`, and the conjugate transpose of vector `Y` to the product of the conjugate of the scaling factor, vector `Y`, and the conjugate transpose of vector `X`, and adds the result to matrix `A`.

`cblas_cher2k`

Performs a rank-2k update of a complex Hermitian matrix (single-precision complex).

`cblas_cherk`

Rank-k update—multiplies a Hermitian matrix by its transpose and adds a second matrix (single precision).

`cblas_chpmv`

Scales a packed hermitian matrix, multiplies it by a vector, and adds a scaled vector.

`cblas_chpr`

Scales and multiplies a vector times its conjugate transpose, then adds a matrix.

`cblas_chpr2`

Multiplies a vector times the conjugate transpose of a second vector and vice-versa, sums the results, and adds a matrix.

`cblas_crotg`

Constructs a complex Givens rotation.

`cblas_cscal`

Multiplies each element of a vector by a constant (single-precision complex).

`cblas_csrot`

Applies a Givens rotation matrix to a pair of complex vectors.

`cblas_csscal`

Multiplies each element of a vector by a constant (single-precision complex).

`cblas_cswap`

Exchanges the elements of two vectors (single-precision complex).

`cblas_csymm`

Multiplies a matrix by a symmetric matrix (single-precision complex).

`cblas_csyr2k`

Performs a rank-2k update of a symmetric matrix (single-precision complex).

`cblas_csyrk`

Rank-k update—multiplies a symmetric matrix by its transpose and adds a second matrix (single-precision complex).

`cblas_ctbmv`

Scales a triangular band matrix, then multiplies by a vector (single-precision compex).

`cblas_ctbsv`

Solves a triangular banded system of equations.

`cblas_ctpmv`

Multiplies a triangular matrix by a vector, then adds a vector (single-precision complex).

`cblas_ctpsv`

Solves a packed triangular system of equations.

`cblas_ctrmm`

Scales a triangular matrix and multiplies it by a matrix.

`cblas_ctrmv`

Multiplies a triangular matrix by a vector.

`cblas_ctrsm`

Solves a triangular system of equations with multiple values for the right side.

`cblas_ctrsv`

Solves a triangular system of equations with a single value for the right side.

`cblas_scasum`

Computes the sum of the absolute values of real and imaginary parts of elements in a vector (single-precision complex).

`cblas_scnrm2`

Computes the unitary norm of a vector (single-precision complex).

Double-Precision Float Matrix Functions

`cblas_dasum`

Computes the sum of the absolute values of elements in a vector (double-precision).

`cblas_daxpy`

Computes a constant times a vector plus a vector (double-precision).

`cblas_dcopy`

Copies a vector to another vector (double-precision).

`cblas_dgbmv`

Scales a general band matrix, then multiplies by a vector, then adds a vector (double precision).

`cblas_dgemm`

Multiplies two matrices (double-precision).

`cblas_dgemv`

Multiplies a matrix by a vector (double precision).

`cblas_dger`

Multiplies vector X by the transpose of vector Y, then adds matrix A (double precison).

`cblas_dnrm2`

Computes the L2 norm (Euclidian length) of a vector (double precision).

`cblas_drot`

Applies a Givens rotation matrix to a pair of vectors.

`cblas_drotg`

Constructs a Givens rotation matrix.

`cblas_drotm`

Applies a modified Givens transformation (single precision).

`cblas_drotmg`

Generates a modified Givens rotation matrix.

`cblas_dsbmv`

Scales a symmetric band matrix, then multiplies by a vector, then adds a vector (double precision).

`cblas_dscal`

Multiplies each element of a vector by a constant (double-precision).

`cblas_dspmv`

Scales a packed symmetric matrix, then multiplies by a vector, then scales and adds another vector (double precision).

`cblas_dspr`

Rank one update: adds a packed symmetric matrix to the product of a scaling factor, a vector, and its transpose (double precision).

`cblas_dspr2`

Rank two update of a packed symmetric matrix using two vectors (single precision).

`cblas_dswap`

Exchanges the elements of two vectors (double precision).

`cblas_dsymm`

Multiplies a matrix by a symmetric matrix (double-precision).

`cblas_dsymv`

Scales a symmetric matrix, multiplies by a vector, then scales and adds another vector (single precision).

`cblas_dsyr`

Rank one update: adds a symmetric matrix to the product of a scaling factor, a vector, and its transpose (double precision).

`cblas_dsyr2`

Rank two update of a symmetric matrix using two vectors (single precision).

`cblas_dsyr2k`

Performs a rank-2k update of a symmetric matrix (double precision).

`cblas_dsyrk`

Rank-k update—multiplies a symmetric matrix by its transpose and adds a second matrix (double precision).

`cblas_dtbmv`

Scales a triangular band matrix, then multiplies by a vector (double precision).

`cblas_dtbsv`

Solves a triangular banded system of equations.

`cblas_dtpmv`

Multiplies a triangular matrix by a vector, then adds a vector (double precision).

`cblas_dtpsv`

Solves a packed triangular system of equations.

`cblas_dtrmm`

Scales a triangular matrix and multiplies it by a matrix.

`cblas_dtrmv`

Multiplies a triangular matrix by a vector.

`cblas_dtrsm`

Solves a triangular system of equations with multiple values for the right side.

`cblas_dtrsv`

Solves a triangular system of equations with a single value for the right side.

Double-Precision Complex Matrix Functions

`cblas_dzasum`

Computes the sum of the absolute values of real and imaginary parts of elements in a vector (single-precision complex).

`cblas_dznrm2`

Computes the unitary norm of a vector (double-precision complex).

`cblas_zaxpy`

Computes a constant times a vector plus a vector (double-precision complex).

`cblas_zcopy`

Copies a vector to another vector (double-precision complex).

`cblas_zdrot`

Applies a Givens rotation matrix to a pair of complex vectors.

`cblas_zdscal`

Multiplies each element of a vector by a constant (double-precision complex).

`cblas_zgbmv`

Scales a general band matrix, then multiplies by a vector, then adds a vector (double-precision complex).

`cblas_zgemm`

Multiplies two matrices (double-precision complex).

`cblas_zgemv`

Multiplies a matrix by a vector (double-precision complex).

`cblas_zgerc`

Multiplies vector X by the conjugate transpose of vector Y, then adds matrix A (double-precision complex).

`cblas_zgeru`

Multiplies vector X by the transpose of vector Y, then adds matrix A (double-precision complex).

`cblas_zhbmv`

Scales a Hermitian band matrix, then multiplies by a vector, then adds a vector (double-precision complex).

`cblas_zhemm`

Multiplies two Hermitian matrices (double-precision complex).

`cblas_zhemv`

Scales and multiplies a Hermitian matrix by a vector, then adds a second (scaled) vector.

`cblas_zher`

Adds the product of a scaling factor, vector `X`, and the conjugate transpose of `X` to matrix `A`.

`cblas_zher2`

Hermitian rank 2 update: adds the product of a scaling factor, vector `X`, and the conjugate transpose of vector `Y` to the product of the conjugate of the scaling factor, vector `Y`, and the conjugate transpose of vector `X`, and adds the result to matrix `A`.

`cblas_zher2k`

Performs a rank-2k update of a complex Hermitian matrix (double-precision complex).

`cblas_zherk`

Rank-k update—multiplies a Hermitian matrix by its transpose and adds a second matrix (single precision).

`cblas_zhpmv`

Scales a packed hermitian matrix, multiplies it by a vector, and adds a scaled vector.

`cblas_zhpr`

Scales and multiplies a vector times its conjugate transpose, then adds a matrix.

`cblas_zhpr2`

Multiplies a vector times the conjugate transpose of a second vector and vice-versa, sums the results, and adds a matrix.

`cblas_zrotg`

Constructs a complex Givens rotation.

`cblas_zscal`

Multiplies each element of a vector by a constant (double-precision complex).

`cblas_zswap`

Exchanges the elements of two vectors (double-precision complex).

`cblas_zsymm`

Multiplies a matrix by a symmetric matrix (double-precision complex).

`cblas_zsyr2k`

Performs a rank-2k update of a symmetric matrix (double-precision complex).

`cblas_zsyrk`

Rank-k update—multiplies a symmetric matrix by its transpose and adds a second matrix (double-precision complex).

`cblas_ztbmv`

Scales a triangular band matrix, then multiplies by a vector (double-precision complex).

`cblas_ztbsv`

Solves a triangular banded system of equations.

`cblas_ztpmv`

Multiplies a triangular matrix by a vector, then adds a vector (double-precision compex).

`cblas_ztpsv`

Solves a packed triangular system of equations.

`cblas_ztrmm`

Scales a triangular matrix and multiplies it by a matrix.

`cblas_ztrmv`

Multiplies a triangular matrix by a vector.

`cblas_ztrsm`

Solves a triangular system of equations with multiple values for the right side.

`cblas_ztrsv`

Solves a triangular system of equations with a single value for the right side.

Size-Optimized Operations

These matrix operations are specifically tuned for a particular size of matrices.

`vS512Add`

`vS512AddS`

Signed 512-bit addition with saturation (clipping).

`vU512Add`

`vU512AddS`

Unsigned 512-bit addition with saturation (clipping).

`vS1024Add`

`vS1024AddS`

Signed 1024-bit addition with saturation (clipping).

`vU1024Add`

`vU1024AddS`

Unsigned 1024-bit addition with saturation (clipping).

`vS256Sub`

Signed 256-bit subtraction (modular arithmetic).

`vS256SubS`

Signed 256-bit subtraction with saturation (clipping).

`vU256Sub`

Unsigned 256-bit subtraction (modular arithmetic).

`vU256SubS`

Unsigned 256-bit subtraction with saturation (clipping).

`vS512Sub`

Signed 512-bit subtraction (modular arithmetic).

`vS512SubS`

Signed 512-bit subtraction with saturation (clipping).

`vU512Sub`

Unsigned 512-bit subtraction (modular arithmetic).

`vU512SubS`

Unsigned 512-bit subtraction with saturation (clipping).

`vS1024Sub`

Signed 1024-bit subtraction (modular arithmetic).

`vS1024SubS`

Signed 1024-bit subtraction with saturation (clipping).

`vU1024Sub`

Unsigned 1024-bit subtraction (modular arithmetic).

`vU1024SubS`

Unsigned 1024-bit subtraction with saturation (clipping).

`vU256Neg`

Unsigned 256-bit negation.

`vS64Neg`

Signed 64-bit negation.

`vU64Neg`

Unsigned 64-bit negation.

`vU128Neg`

Unsigned 128-bit negation.

`vU512Neg`

Unsigned 512-bit negation.

`vS512Neg`

Signed 512-bit negation.

`vS128Neg`

Signed 128-bit negation.

`vS256Neg`

Signed 256-bit negation.

`vU256Mod`

Unsigned 256-bit mod.

`vS256Mod`

Signed 256-bit mod.

`vU1024Neg`

Unsigned 1024-bit negation.

`vS1024Neg`

Signed 1024-bit negation.

`vU1024Mod`

Unsigned 1024-bit mod.

`vS1024Mod`

Signed 256-bit Mod.

`vU512Mod`

Unsigned 512-bit mod.

`vS512Mod`

Signed 512-bit mod.

Fortran Prototypes

Entry points that can be called from Fortran programs. You should generally not call these from software written in C.

`vS256HalfMultiply`

Signed 256-bit multiplication; result is the same width as multiplicands.

`vU512HalfMultiply`

Unsigned 512-bit multiplication; result is the same width as multiplicands.

`vS512HalfMultiply`

Signed 512-bit multiplication; result is the same width as multiplicands.

`vU1024HalfMultiply`

Unsigned 1024-bit multiplication; result is the same width as multiplicands.

`vS1024HalfMultiply`

Signed 1024-bit multiplication; result is the same width as multiplicands.

`vU128FullMultiply`

Unsigned 128-bit multiplication; result is twice as wide as multiplicands.

`vS128FullMultiply`

Signed 128-bit multiplication; result is twice as wide as multiplicands.

`vU256FullMultiply`

Unsigned 256-bit multiplication; result is twice as wide as multiplicands.

`vS256FullMultiply`

Signed 256-bit multiplication; result is twice as wide as multiplicands.

`vU512FullMultiply`

Unsigned 512-bit multiplication; result is twice as wide as multiplicands.

`vS512FullMultiply`

Signed 512-bit multiplication; result is twice as wide as multiplicands.

Data Types

`BLASParamErrorProc`

BLAS error handler callback type.

`VectorFloat`

A vector of floating-point numbers.

`ConstVectorFloat`

A constant vector of floating-point numbers.

Constants

`CBLAS_ORDER`

Indicates whether a matrix is in row-major or column-major order.

`CBLAS_TRANSPOSE`

Indicates transpose operation to perform on a matrix.

`CBLAS_UPLO`

Indicates which part of a symmetric matrix to use.

`CBLAS_DIAG`

Indicates whether a triangular matrix is unit-diagonal (diagonal elements are all equal to 1).

`CBLAS_SIDE`

Indicates the order of a matrix multiplication.