# Basic Matrix / Vector Operations

## BASIC LINEAR ALGEBRA SUBPROGRAMS (BLAS)

### LEVEL 1 BLAS

ROUTINE | DESCRIPTION |
---|---|

SSET | Sets the components of a vector to a scalar. |

SCOPY | Copies a vector x to a vector y, both single precision. |

SSCAL | Multiplies a vector by a scalar,, both single precision. y ← α y |

SVCAL | Multiplies a vector by a scalar and stores the result in another vector, , all single precision.y ←α x |

SADD | Adds a scalar to each component of a vector, , all single precision.x ← x + a |

SSUB | Subtract each component of a vector from a scalar, all single precision. x ← a - x, |

SAXPY | Subtract each component of a vector plus a vector,, all singleprecision. x ← ax + x |

SSWAP | Interchange vectors and x, both single precision.y |

SDOT | Computes the single-precision dot product .x^{T}y |

DSDOT | Computes the single-precision dot product using a double precision accumulator. x^{T}y |

SDSDOT | Computes the sum of a single-precision scalar and a single precision dot product, , using a double-precision accumulator.a + x^{T}y |

SDDOTI | Computes the sum of a single-precision scalar plus a single precision dot product using a double-precision accumulator, which is set to the result .ACC ← a + x^{T}y |

SHPROD | Computes the Hadamard product of two single-precision vectors. |

SXYZ | Computes a single-precision product.xyz |

SSUM | Sums the values of a single-precision vector |

SASUM | Sums the absolute values of the components of a single-precision vector. |

SNRM2 | Computes the Euclidean length or norm of a single-precision vector.L_{2} |

SPRDCT | Multiplies the components of a single-precision vector. |

ISMIN | Finds the smallest index of the component of a single-precision vector having minimum value. |

ISMAX | Finds the smallest index of the component of a single-precision vector having maximum value. |

ISAMIN | Finds the smallest index of the component of a single-precision vector having minimum absolute value. |

ISAMAX | Finds the smallest index of the component of a single-precision vector having maximum absolute value. |

SROTG | Constructs a Givens plane rotation in single precision. |

SROT | Applies a Givens plane rotation in single precision. |

SROTM | Applies a modified Givens plane rotation in single precision. |

SROTMG | Constructs a modified Givens plane rotation in single precision. |

### LEVEL 2 BLAS

ROUTINE | DESCRIPTION |
---|---|

SGEMV | Computes one of the matrix-vector operations:, or y ← αAx + βy.y ← αA^{T}x + βy |

SGBMV | Computes one of the matrix-vector operations:, or y ← αAx + βy, where y ← αA^{T}x + βy is a matrix stored in band storage mode.A |

CHEMV | Compute the matrix-vector operation where y ← αAx + βy is a Hermitian matrix.A |

CHPMV | Compute the matrix-vector operation where y ← αAx + βy is a packed Hermitian matrix.A |

CHBMV | Computes the matrix-vector operation wherey ← αAx + βyis a Hermitian band matrix in band Hermitian storage. A |

CTPMV | Performs the matrix-vector operation in packed form. x ← A^{T} x |

CTPSV | Solves the systems of equationsin packed form. x ← (A^{T})^{-1} x ≡ (A^{H})^{-1 }x |

SSYMV | Computes the matrix-vector operation where y ← αAx + βy is a symmetric matrix.A |

SSBMV | Computes the matrix-vector operation where y ← αAx + βy is a symmetric matrix in band symmetric storage mode. A |

SSPMV | Performs the matrix-vector operation in packed form.y ← αAx + βy |

STRMV | Computes one of the matrix-vector operations: or x← Ax where x← A^{T}x is a triangular matrix.A |

STBMV | Computes one of the matrix-vector operations: or x← Ax where A is a triangular matrix in band storage mode. x← A^{T}x |

STRSV | Solves one of the triangular linear systems: or x← A^{-1}x where x← (A^{-1})^{T}x is a triangular matrix.A |

STBSV | Solves one of the triangular systems: or x← A^{-1}x where x← (A^{-1})^{T}x is a triangular matrix in band storage mode.A |

STPMV | Performs one of the matrix-vector operations: or x← Axwherex← A^{T}x is in packed form. A |

STPSV | Solves one of the systems of equations or x← A^{-1}xwherex← (A^{-1})^{T}x A^{T}x is in packed form. A |

SGER | Computes the rank-one update of a real general matrix:. A← A + αxy^{T} |

CGERU | Computes the rank-one update of a complex general matrix: .A← A + αxy^{T} |

CGERC | Computes the rank-one update of a complex general matrix:.A← A + αxy^{T} |

CHER | Computes the rank-one update of a Hermitian matrix: . with A← A + αxx^{T} complex and x real.α |

CHPR | Computes the rank-one update of a Hermitian matrix: . in packed form with A← A + αxx^{T} complex and α real.x |

CHER2 | Computes a rank-two update of a Hermitian matrix: :.A ← A + αxy^{T }+ αyx^{T} |

CHPR2 | Performs the hermitian rank 2 operation :. in packed form.A ← A + αxy^{T }+ αyx^{T} |

SSYR | Computes the rank-one update of a real symmetric matrix: .A← A + αxx^{T} |

SSPR | Performs the symmetric rank 1 operation in packed form. A← A + αxx^{T} |

SSYR2 | Computes the rank-two update of a real symmetric matrix: .A← A + αxy + αyx^{T} |

SSPR2 | Performs the symmetric rank 2 operation in packed form.A← A + αxy + αyx^{T} |

### LEVEL 3 BLAS

ROUTINE | DESCRIPTION |
---|---|

SGEMM | Computes one of the matrix-matrix operations:,or C← αAB + βC, C← αA^{T}B + βC, C← αAB^{T}+ βC.C← αA^{T}B^{T}+ βC |

SSYMM | Computes one of the matrix-matrix operations: C← αAB + βC or C← αBA + βC, where is a symmetric matrix and A and B are C by m matrices.n |

CHEMM | Computes one of the matrix-matrix operations: or C← αAB + βC, where C← αBA + βC is a Hermitian matrix and A and B are m byC matrices. n |

SSYRK | Computes one of the symmetric rank operations: korC← αAA ^{T} + βC, where C← αA^{T}A + βC is an C byn symmetric matrix and n is an A by n matrix in the first case and a k by k matrix in the second case.n |

CHERK | Computes one of the Hermitian rank operations: kC← αAA^{T} + βC or C← αA^{T }A + βC, where is an C by n Hermitian matrix and n is an A byn matrix in the first case and a k byk matrix in the second case. n |

SSYR2K | Computes one of the symmetric rank operations: 2kor C← αAB^{T} + αBA^{T} + βC , where C← αA^{T}B + αB^{T}A + βC is an n byC symmetric matrix and n and A are B by n matrices in the first case and k by k matrices in the second case.n |

CHER2K | Computes one of the Hermitian rank operations: 2kC← αAB^{T} + αBA^{T} + βC or C← αA^{T}B + αB^{T}A + βC, where is an n by C Hermitian matrix in the first case andn by k matrices in the second case.n |

STRMM | Computes one of the matrix-matrix operations: or B← αAB, B← αA^{T}B,B← αBA, where B← αBA^{T} is an B by mmatrix and n is a triangular matrix.A |

STRSM | Solves one of the matrix equations: , B← αA^{-1}B or B← αBA^{-1}, B← α(A^{-1})^{T} B, where B← αB(A^{-1})^{T} is anB by m matrix and n is a triangular matrix.A |

CTRSM | Solves one of the complex matrix equations:or B ← α(A^{T})^{-1}, where B ← αB(A^{T})^{-1} is a triangular matrix.A |

### BLAS FOR NVIDIA

ROUTINE | DESCRIPTION |
---|---|

CUBLAS_GET | Returns the switchover value for a positional array argument for a specified BLAS routine. |

CUBLAS_SET | Sets the switchover value for an array used by a specified BLAS routine. |

CHECK_BUFFER_ALLOCATION | Maintains buffer sizes on the NVIDIA device and performs one-time initialization. |

CUDA_ERROR_PRINT | Prints error messages generated through the use of the CUDABLAS Library using the IMSL error handler. |

## OTHER MATRIX/VECTOR OPERATIONS

### MATRIX COPY

ROUTINE | DESCRIPTION |
---|---|

CRGRG | Copies a real general matrix. |

CCGCG | Copies a complex general matrix. |

CRBRB | Copies a real band matrix stored in band storage mode. |

CCBCB | Copies a complex band matrix stored in complex band storage mode. |

CRGRB | Converts a real general matrix to a matrix in band storage mode. |

CRBRG | Converts a real matrix in band storage mode to a real general matrix. |

CCGCB | Converts a complex general matrix to a matrix in complex band storage mode. |

CCBCG | Converts a complex matrix in band storage mode to a complex matrix in full storage mode. |

CRGCG | Copies a real general matrix to a complex general matrix. |

CRRCR | Copies a real rectangular matrix to a complex rectangular matrix. |

CRBCB | Converts a real matrix in band storage mode to a complex matrix in band storage mode. |

CSFRG | Extends a real symmetric matrix defined in its upper triangle to its lower triangle. |

CHFCG | Extends a complex Hermitian matrix defined in its upper triangle to its lower triangle. |

CSBRB | Copies a real symmetric band matrix stored in band symmetric storage mode to a real band matrix stored in band storage mode. |

CHBCB | Copies a complex Hermitian band matrix stored in band Hermitian storage mode to a complex band matrix stored in band storage mode. |

TRNRR | Transposes a rectangular matrix. |

### MATRIX MULTIPLICATION

ROUTINE | DESCRIPTION |
---|---|

MXTXF | Computes the transpose product of a matrix, .A^{T}A |

MXTYF | Multiplies the transpose of matrix by matrix A, B.A^{T}B |

MXYTF | Multiplies the transpose of matrix by matrixA , B.A^{T}B |

MRRRR | Multiplies two real rectangular matrices, .AB |

MCRCR | Multiplies two complex rectangular matrices, .AB |

HRRRR | Computes the Hadamard product of two real rectangular matrices. |

BLINF | Computes the bilinear form .x^{T}Ay |

POLRG | Evaluates a real general matrix polynomial. |

### MATRIX-VECTOR MULTIPLICATION

ROUTINE | DESCRIPTION |
---|---|

MURRV | Multiplies a real rectangular matrix by a vector. |

MURBV | Multiplies a real band matrix in band storage mode by a real vector. |

MUCRV | Multiplies a complex rectangular matrix by a complex vector. |

MUCBV | Multiplies a complex band matrix in band storage mode by a complex vector. |

### MATRIX ADDITION

ROUTINE | DESCRIPTION |
---|---|

ARBRB | Adds two band matrices, both in band storage mode. |

ACBCB | Adds two complex band matrices, both in band storage mode. |

### MATRIX NORM

ROUTINE | DESCRIPTION |
---|---|

NRIRR | Computes the infinity norm of a real matrix. |

NR1RR | MComputes the 1-norm of a real matrix. |

NR2RR | Computes the Frobenius norm of a real rectangular matrix. |

NR1RB | Computes the 1-norm of a real band matrix in band storage mode. |

NR1CB | Computes the 1-norm of a complex band matrix in band storage mode. |

### DISTANCE BETWEEN TWO POINTS

ROUTINE | DESCRIPTION |
---|---|

DISL2 | Computes the Euclidean (2-norm) distance between two points. |

DISL1 | Computes the 1-norm distance between two points. |

DISLI | Computes the infinity norm distance between two points. |

### VECTOR CONVOLUTIONS

ROUTINE | DESCRIPTION |
---|---|

VCONR | Computes the convolution of two real vectors. |

VCONC | Computes the convolution of two complex vectors. |

### EXTENDED PRECISION ARITHMETIC

ROUTINE | DESCRIPTION |
---|---|

DQINI | Initializes an extended-precision accumulator with a double-precision scalar. |

DQSTO | Stores a double-precision approximation to an extended-precision scalar. |

DQADD | Adds a double-precision scalar to the accumulator in extended precision. |

DQMUL | Multiplies double-precision scalars in extended precision. |

ZQINI | Initializes an extended-precision complex accumulator to a double complex scalar. |

ZQSTO | Stores a double complex approximation to an extended-precision complex scalar. |

ZQADD | Adds a double complex scalar to the accumulator in extended precision. |

ZQMUL | Multiplies double complex scalars using extended precision. |